495 Commits
1.0.0 ... v3.0

Author SHA1 Message Date
Darko Gjorgjijoski
5c11147e95 feat(settings): allow Danger Zone for any owner regardless of company count
Removes three layered gates that kept the Danger Zone completely hidden unless the current user had more than one company:

1. SettingsLayoutView's showDangerZone computed no longer checks companies.length > 1 — just is_owner. 2. DangerZoneView drops the v-if that wrapped the delete button with the same check. 3. Admin\\CompaniesController::destroy() drops the companies_count <= 1 early-return that was enforcing the rule server-side (translation key You_cannot_delete_all_companies was inline in the controller, not in lang files or tests, so nothing else needs cleanup).

The reasoning behind the old gate was that a user with zero companies would be stranded. That's a misread of how the app degrades: /admin/no-company already exists as a graceful fallback view, and the user can create a fresh company from there to recover. Hiding the entire delete flow just to avoid that fallback UX was overkill — the name-confirmation modal already prevents accidental deletion.
2026-04-11 08:00:00 +02:00
Darko Gjorgjijoski
31a2a66127 refactor(modules): move Modules into Company Settings as Module Configuration
The per-company Modules management page moves off its own top-level sidebar slot (which sat in the Admin group alongside Members/Reports/Settings) and into a new Module Configuration entry inside Company Settings, alongside Tax Types, Payment Modes, Mail Configuration, etc. That's where every other 'configure how the company behaves' surface lives — the Modules page is a configuration surface, not a primary working area.

The label is deliberately 'Module Configuration' rather than 'Module Settings' because the latter collides with the existing per-module ModuleSettingsModal concept (the modal that opens when a user clicks an installed module's gear icon). Keeping the two names distinct means 'Module Configuration' unambiguously refers to the list of installed modules, and 'Module Settings' continues to mean the per-module schema form.

CompanyModulesIndexView is stripped of its standalone BasePage / BasePageHeader / BaseBreadcrumb wrappers — as a child of SettingsLayoutView it would have rendered a double header — and re-wrapped in BaseSettingCard, matching TaxTypesView and every other settings-child view. The module grid tightens from lg:grid-cols-2 xl:grid-cols-3 down to lg:grid-cols-2 since the settings sidebar eats 240px of horizontal real estate.

Routes consolidate: features/company/modules/routes.ts is deleted; the new settings.modules child route lives inside the settings routes file directly, alongside the rest. Top-level redirects are kept for the legacy /admin/modules and /admin/modules/:slug/settings URLs so existing bookmarks still resolve. ModuleRoutesConfigTest is re-pointed at settings/routes.ts and asserts the settings.modules route is owner-only.

Module-contributed sidebar entries (those registered via Registry::registerMenu()) are NOT moved. Modules that want top-level navigation visibility keep it; only the meta management page moves. This mirrors WordPress/Discourse conventions where plugin pages stay in the main navigation but the 'Plugins' admin screen itself lives under Settings.
2026-04-11 06:30:00 +02:00
Darko Gjorgjijoski
e44657bf7e feat(exchange-rate): make providers extendible via module Registry
Exchange rate providers are now pluggable via the module Registry. The four built-in drivers (currency_converter, currency_freak, currency_layer, open_exchange_rate) move from a static config array into App\\Providers\\DriverRegistryProvider, which calls Registry::registerExchangeRateDriver() for each during app boot with metadata the frontend needs: label (i18n key), website (help-text URL), and config_fields (schema for driver-specific driver_config JSON).

The Currency Converter's server-type selector and dedicated URL field — previously hardcoded in ExchangeRateProviderModal.vue — are now just another config_fields entry with a visible_when rule that shows the URL input only when type=DEDICATED. Any module that wants to ship a custom driver gets the same treatment for free: declare config_fields in the registration, and the host app's modal renders them automatically.

ExchangeRateDriverFactory::make() falls back to Registry::driverMeta() when a name isn't in the local built-in map, and availableDrivers() merges both sources. ConfigController handles the exchange_rate_drivers key specially by mapping Registry::allDrivers('exchange_rate') to enriched option objects, so the config-file route still works for every other key. The static exchange_rate_drivers + currency_converter_servers arrays in config/invoiceshelf.php are deleted.

Unit tests cover the new Registry::register/flushDrivers, the factory merging built-ins with Registry-contributed drivers, and the factory rejecting unknown names. A feature test exercises the end-to-end /api/v1/config?key=exchange_rate_drivers response shape.

NOTE: this commit depends on invoiceshelf/modules package commit e44d951 which adds the Registry driver API. The package needs to be released and pinned in composer.json before a fresh composer install on this commit will work.
2026-04-11 04:00:00 +02:00
Darko Gjorgjijoski
112cc56922 chore(infra): default mail driver to sendmail and expose Vue runtime
Mail DEFAULT_DRIVER changes from smtp to sendmail; DRIVER_ORDER is reshuffled so sendmail is the head of the list on fresh installs. This matches what most self-hosted installs already have working out of the box — SMTP requires provider credentials the typical user doesn't have set up yet. The mail config description is rewritten to drop the 'Laravel' framework reference and to explicitly tell unsure users to leave it on sendmail.

SiteApi::get() now catches GuzzleException (the broader interface) and returns null on network failure instead of bubbling the exception object — callers were treating a non-array return as 'marketplace unavailable' anyway, so null is the correct shape.

main.ts exposes the Vue runtime on window.__invoiceshelf_vue so module JS (compiled against the host's Vue install) can call createApp / defineComponent without re-bundling Vue. invoiceshelf.css adds Tailwind source globs for Modules/**/*.{js,ts,vue,blade.php} so module-contributed classes are picked up by the host CSS pipeline.

Installation wizard PreferencesView was already in the tree waiting for the API field rename (date_formats, time_zones, fiscal_years, languages) that landed in setting.service.ts; this commit catches both sides up together.
2026-04-11 02:00:00 +02:00
Darko Gjorgjijoski
7885bf9d11 feat(menu): priority-sorted menu groups, user-menu items, sidebar appearance toggle
Every main_menu entry moves from numeric group (1/2/3) to string-based group + group_label + priority. Groups now carry their own i18n label and child entries are sorted by an explicit priority field instead of config-array order, so module-contributed menu items can slot into any existing group at any position.

BootstrapController merges module-registered menu items into main_menu (previously they lived in a separate module_menu response key) and introduces a user_menu response key for items modules want to place in the avatar dropdown. The global store follows suit: moduleMenu becomes userMenu, menuGroups is a computed that sorts by priority, and hasActiveModules drops out.

New admin Appearance setting page with a single toggle for whether sidebar group labels render — so instances that prefer a compact sidebar can hide the Documents/Administration/Modules headings without losing the grouping itself. CompanyLayout watches route meta and re-bootstraps when the admin-mode flag flips so the sidebar repaints with the right menu on navigation across the admin boundary.

Test suites updated: module menu merging is asserted against main_menu (name: 'module-{slug}') rather than the old module_menu response; HelloWorldIntegrationTest verifies the schema translation path; CompanyModulesIndexTest covers the display_name attachment.
2026-04-11 00:30:00 +02:00
Darko Gjorgjijoski
345bfde306 feat(modules): translated display names and inline settings modal
CompanyModulesController attaches a translated display_name to each module before returning the list. ModuleSettingsController gains a translateSchema() helper that resolves section titles and field labels against the host app's i18n store before sending the schema to the frontend, so module authors can keep their 'my_module::settings.field' keys and users still see localized strings.

Per-module settings now open in an inline ModuleSettingsModal rather than routing to a standalone page. The modal reuses BaseSchemaForm for rendering, so the whole interaction takes place in-context next to the module card the user clicked — no navigation, no loss of place.

CompanyModuleCard displays the translated display_name instead of the raw slug and emits open-settings with the module payload; the parent view hands that to the modal store.
2026-04-10 21:30:00 +02:00
Darko Gjorgjijoski
3d79fe1abc feat(modules): redesign admin marketplace cards and detail view
ModuleCard moves badges to the top-right, shows a cover placeholder when art is missing, and drops the rating/pricing chrome that was never populated by the marketplace. ModuleDetailView splits into a hero row (cover + module info, two-thirds width) plus a sticky action card on the right (one-third) so install/update/purchase buttons stay visible when scrolling long descriptions.

ModuleIndexView promotes the marketplace API token form to a persistent card at the top of the page and adds an authenticated/premium status pill so super-admins can see whether the current token unlocks premium listings. The tabs and empty state were reorganized so 'installed' and 'marketplace' feel like peers.

The admin modules store tracks marketplace auth status, adds checkApiToken() and setApiToken() methods, and unifies the install-request shape into ModuleInstallPayload so both the free and paid install buttons route through the same code path.
2026-04-10 19:00:00 +02:00
Darko Gjorgjijoski
23d1476870 refactor(modules): marketplace install flow with checksum validation
Rewires module installation to use slug + version + checksum_sha256 instead of the opaque module identifier. ModuleInstaller splits marketplace token handling out of install() into helpers, adopts structured error responses, and validates the downloaded archive's SHA-256 against the marketplace manifest before unpacking.

ModuleResource is simplified to accept an already-loaded installed-module instance rather than fetching it from state, exposes access_tier and checksum fields, and drops the auto-disable-on-unpurchased side effect that was bleeding write logic into a read resource. UnzipUpdateRequest accepts a nullable module with a conditional module_name field so the same endpoint serves both app and module updates.

ModulesPolicy::manageModules now short-circuits for super-admins so administration flows (token validation, store state) are not blocked on a company-scoped ability. Two new feature tests cover both the authorization bypass and ModuleResource serialization.
2026-04-10 17:30:00 +02:00
Darko Gjorgjijoski
2af31d0e5f Rename local_public disk back to public and store avatars/logos on public disk
The public disk was accidentally removed during the Laravel 11 upgrade
and re-added as local_public in the FileDisk refactor. Restoring the
standard Laravel name avoids breaking Spatie MediaLibrary expectations
and simplifies the v2-to-v3 upgrade path.

User avatars and company logos now explicitly use the public disk via
registerMediaCollections(), keeping them web-accessible while the default
media disk remains private for sensitive documents like PDFs and receipts.

The v3 upgrade migration renames the system disk entry and any alpha media
records from local_public back to public.
2026-04-10 15:56:31 +02:00
Darko Gjorgjijoski
42ce99eeba Show common currencies first in dropdowns and default to USD in install wizard
Currency dropdowns now display the most-traded currencies (USD, EUR, GBP,
JPY, CAD, AUD, CHF, CNY, INR, BRL) at the top, followed by the rest
alphabetically. The install wizard defaults to USD instead of EUR and
formats currency names as "USD - US Dollar" for consistency with the
rest of the app.
2026-04-10 15:55:46 +02:00
Darko Gjorgjijoski
9174254165 Refactor install wizard and mail configuration 2026-04-09 10:06:27 +02:00
Darko Gjorgjijoski
1d2cca5837 feat(marketplace): make base_url env-configurable for local testing
The marketplace client (App\Services\Module\ModuleInstaller) and the updater
(App\Services\Update\Updater) both build their Guzzle base URI from
config('invoiceshelf.base_url') via the App\Traits\SiteApi::getRemote()
helper. The value was hardcoded to 'https://invoiceshelf.com', which made
local development against a self-hosted invoiceshelf/website checkout
impossible without editing the config file by hand.

Wrap it in env('INVOICESHELF_BASE_URL', 'https://invoiceshelf.com') so a
.env entry can repoint both the marketplace and the updater at any host —
e.g. http://invoiceshelf-website.test, http://localhost:8000, or a staging
deployment. The default fallback stays https://invoiceshelf.com so
production behavior is unchanged.

Document the new variable in .env.example, commented out so it has no
effect unless explicitly enabled.

The marketplace and updater are tied to the same base URL by design — a
local dev instance pointed at a local marketplace probably also wants to
test against the local release-API, so they should move together.
2026-04-09 00:30:59 +02:00
Darko Gjorgjijoski
93b04a0c2a test(modules): integration tests for company surfaces and stub generator
End-to-end coverage for the new module APIs and the custom module:make
stubs shipped from invoiceshelf/modules. Each test file is hermetic — uses
\InvoiceShelf\Modules\Registry::flush() in setup/teardown to prevent
cross-test contamination, and ModuleMakeStubTest cleans up generated test
artifacts (the throwaway scaffold directory and the storage statuses entry).

- CompanyModulesIndexTest: 4 tests covering only-enabled-modules filter,
  has_settings flag computed against the real Registry, menu inclusion, and
  the empty-state response.

- ModuleSettingsControllerTest: 7 tests covering 404 for unregistered slug,
  show schema + defaults round-trip, persistence with the
  module.{slug}.{key} prefix, missing-required-field rejection, unknown-key
  silent-drop, update 404, and per-company isolation (the load-bearing
  multi-tenancy guarantee).

- BootstrapModuleMenuTest: 3 tests covering Registry-driven module_menu
  population on the company-context bootstrap branch, the empty default
  when nothing is registered, and the absence of module_menu on the
  super-admin-mode branch.

- ModuleMakeStubTest: 3 tests that actually run
  Artisan::call('module:make', ['name' => ['ScaffoldProbe']]) against a
  throwaway module name and assert the generated ServiceProvider contains
  use InvoiceShelf\Modules\Registry, the generated composer.json requires
  invoiceshelf/modules: ^3.0, and starter lang/en/{menu,settings}.php exist.
  Validates that the custom stubs shipped from the package are picked up
  via Stub::setBasePath().
2026-04-09 00:30:24 +02:00
Darko Gjorgjijoski
7743c2e126 feat(modules): dynamic sidebar group rendering active modules
The sidebar gains a new section that lists each currently-activated module
as a direct shortcut to its settings page. This is the always-visible
companion to the company-context Active Modules index — both surface the
same set of modules, but the index is the catalog landing page and the
sidebar group is the per-module quick access.

- BootstrapController returns module_menu populated from
  \InvoiceShelf\Modules\Registry::allMenu(), but only on the company-context
  branch — not on the super-admin branch (lines 53-69), since super admins
  don't see the dynamic group. Because nwidart only boots service providers
  for currently-activated modules, the registry naturally contains only
  active modules at request time, no extra filtering needed.

- bootstrap.service.ts BootstrapResponse type extended with
  module_menu?: ModuleMenuItem[]; new ModuleMenuItem interface
  (title/link/icon) — shaped distinctly from MenuItem because module entries
  use namespaced i18n keys and don't carry group/ability metadata.

- global.store.ts exposes a moduleMenu ref + a hasActiveModules computed.

- SiteSidebar.vue appends a new "Modules" section after the existing
  menuGroups output, in both the mobile (Dialog) and desktop branches. The
  section is hidden when hasActiveModules is false. Uses the
  modules.sidebar.section_title i18n key added in the previous commit.
2026-04-09 00:29:56 +02:00
Darko Gjorgjijoski
e6eeacb6d4 feat(modules): company-context module surfaces and schema-driven settings
Adds the read-only company "Active Modules" index page (lists every
instance-activated module with a Settings shortcut) and the schema-driven
settings framework (generic BaseSchemaForm.vue renderer + per-company
persistence in CompanySetting). Bundled because they share the same
routes/api.php edit and the index page's Settings button targets the
settings page.

Backend:

- CompanyModulesController::index() returns every Module::enabled = true row
  with a kebab-case slug (via Str::kebab()) and a has_settings flag computed
  from \InvoiceShelf\Modules\Registry::settingsFor(). nwidart stores module
  names in PascalCase ("HelloWorld") but URLs and registry keys use kebab
  ("hello-world") — the controller normalizes so module authors can call
  Registry::registerSettings('hello-world') naturally without thinking
  about the storage format.

- ModuleSettingsController::show(\$slug) returns the registered Schema +
  per-company values from CompanySetting (defaults flow through when nothing
  has been saved yet). update(\$slug) builds Laravel validator rules from
  the Schema's per-field rules arrays — with type-rule fallbacks for
  switch -> boolean, number -> numeric, multiselect -> array — silently
  drops unknown keys, and persists via CompanySetting::setSettings() under
  the module.{slug}.{key} prefix. Activation is instance-global, but
  settings are per-company: two companies on the same instance can
  configure the same activated module differently.

- routes/api.php mounts GET /api/v1/company-modules at the root of the
  company API group and GET/PUT /api/v1/modules/{slug}/settings inside the
  existing modules prefix.

Frontend:

- BaseSchemaForm.vue is the central new component — a generic schema-driven
  form renderer that maps schema fields to BaseInput / BaseTextarea /
  BaseSwitch / BaseMultiselect by type, and builds Vuelidate rules
  dynamically from each field's rules array (supports required, email, url,
  numeric, min:N, max:N). New fields are added by extending the type ->
  component map.

- CompanyModulesIndexView.vue fetches /company-modules and renders a card
  grid (with empty/loading states); CompanyModuleCard.vue is the per-row
  component with the Settings button. ModuleSettingsView.vue fetches
  /modules/{slug}/settings, hands {schema, values} to BaseSchemaForm, and
  posts back on submit.

- Company-context routes.ts is rebuilt after the previous commit relocated
  the marketplace browser away. It now declares modules.index +
  modules.settings, both gated by manage-module ability.

- New api/services/{companyModules,moduleSettings}.service.ts thin clients.

- lang/en.json adds modules.index.{description,empty_title,empty_description},
  modules.settings.{title,open,saved,not_found,none}, and
  modules.sidebar.section_title. The sidebar key is added here even though
  the dynamic sidebar rendering lands in the next commit — keeping all i18n
  additions in one file edit avoids hunk-splitting lang/en.json.
2026-04-09 00:29:36 +02:00
Darko Gjorgjijoski
84725b2dfa feat(modules): relocate marketplace browser to super-admin context
The module marketplace browser UI (ModuleIndexView, ModuleDetailView,
ModuleCard, the four-step installer store) was filed under
features/company/modules/ only by historical accident — it's authorized via
the manage modules ability (super-admin-only) and conceptually belongs in the
admin context, not the company context.

- Move features/company/modules/{store.ts, views/ModuleIndexView.vue,
  views/ModuleDetailView.vue, components/ModuleCard.vue} to
  features/admin/modules/.
- Update hardcoded /admin/modules/... paths in the moved files to
  /admin/administration/modules/... so the breadcrumbs and ModuleCard
  navigation target the new admin-context routes.
- Tighten the four-step installer's silent catch {} blocks in the moved
  store.ts: errors were being swallowed, now they dispatch through the
  global notification store instead.
- New features/admin/modules/routes.ts declares admin.modules.index +
  admin.modules.view as children of /admin/administration with
  meta.isSuperAdmin: true.
- features/admin/{index,routes}.ts re-export and mount the relocated routes.
- config/invoiceshelf.php gains a new AdminModules entry in admin_menu
  pointing at /admin/administration/modules with super_admin_only: true.
- The dev-gated navigation.modules entry in main_menu is replaced (not
  deleted) with a non-gated entry pointing at the new company-context
  Active Modules index page that lands in the next commit. The
  ability is set to manage modules so non-owners can't see it.

The new company-context Active Modules index, schema-driven settings page,
and dynamic sidebar group are introduced in subsequent commits.
2026-04-09 00:28:59 +02:00
Darko Gjorgjijoski
b2b7a07e0c refactor(modules): migrate asset registry from app/Services to invoiceshelf/modules package
The vestigial App\Services\Module\Module static class — with its unused
\$scripts / \$styles / \$settings registries — never had any of its helpers
wired up. The new InvoiceShelf\Modules\Registry shipped from the
invoiceshelf/modules package supersedes it cleanly: same static-array surface
(\$menu, \$settings, \$scripts, \$styles), but lives outside the host app so
third-party modules can depend on it without importing v3-app internals.

Three consumers in the host app are migrated to the new namespace:

- ScriptController and StyleController (the HTTP endpoints that serve
  module-registered JS/CSS assets at /modules/scripts/{name} and
  /modules/styles/{name}) now look up paths via Registry::scriptFor() and
  Registry::styleFor() instead of Arr::get(ModuleFacade::all*(), \$name).
  Also tightens type hints — Request import + Response return type.

- resources/views/app.blade.php iterates Registry::allStyles() /
  Registry::allScripts() to inject module-supplied <link>/<script> tags into
  the main layout. Same Akaunting-style asset injection mechanism, just
  reading from the new namespace.

Both Module and ModuleFacade are deleted — they had no remaining callers
after this migration.
2026-04-09 00:27:44 +02:00
Darko Gjorgjijoski
61e1efd81b chore(deps): upgrade nwidart/laravel-modules to v13 via invoiceshelf/modules ^3.0
Pulls invoiceshelf/modules ^3.0 from packagist — a thin extension package on
top of current upstream nwidart/laravel-modules ^13.0 — replacing the stale
2021-era invoiceshelf/modules ^1.0 fork that bundled its own copy of nwidart.

The host app's autoloader now resolves Nwidart\Modules\* from
vendor/nwidart/laravel-modules and InvoiceShelf\Modules\* from
vendor/invoiceshelf/modules. Existing imports of Nwidart\Modules\Facades\Module
keep working unchanged.

config/modules.php is republished from upstream v13 with two
InvoiceShelf-specific overrides:

- activators.file.statuses-file kept at storage/app/modules_statuses.json so
  existing installations don't lose track of which modules are enabled when
  the config is republished (upstream v13 defaults to base_path()).
- New lang/menu and lang/settings entries in stubs.files / stubs.replacements
  that pair with the custom module:make stubs shipped from the package.

Wires wikimedia/composer-merge-plugin (a transitive dependency of nwidart) so
each module's nested composer.json autoload mapping is merged into the host
autoloader at composer dump-autoload time. This is what makes a module
generated via php artisan module:make MyModule actually loadable. The plugin
is added to allow-plugins and configured via extra.merge-plugin.include.

Drops the stale Modules\\: Modules/ PSR-4 fallback root from autoload — it
didn't match nwidart's app/-prefixed module layout and was always broken for
generated modules.
2026-04-09 00:27:16 +02:00
Darko Gjorgjijoski
1fb5886d06 Sanitize PDF address fields against SSRF in getFormattedString chokepoint
Closes the residual surface from the three published SSRF advisories (GHSA-pc5v-8xwc-v9xq, GHSA-38hf-fq8x-q49r, GHSA-q9wx-ggwq-mcgh / CVE-2026-34365 to 34367) that the original 2.2.0 fix only covered for the Notes field. The same blade templates render company/billing/shipping address fields with {!! !!} via Invoice/Estimate/Payment::getCompanyAddress(), getCustomerBillingAddress(), getCustomerShippingAddress() — and those flow through GeneratesPdfTrait::getFormattedString() which did not call PdfHtmlSanitizer.

Customer-controlled fields (name, street, phone, custom-field values) are substituted into address templates via getFieldsArray() without HTML-escaping, so a malicious customer name like "Acme <img src='http://attacker/probe'>" reaches Dompdf as raw HTML through the address path. Today this is blocked only by the secondary defense of dompdf's enable_remote=false; if a self-hoster sets DOMPDF_ENABLE_REMOTE=true for legitimate remote logos, the address surface immediately re-opens.

Move PdfHtmlSanitizer::sanitize() into the chokepoint at GeneratesPdfTrait::getFormattedString() so all four sinks — notes plus the three address fields, on all three models — get the same treatment via a single call site. v3.0's models (Invoice, Estimate, Payment) already had the simpler getNotes() shape (no per-method PdfHtmlSanitizer wrapper), so the trait edit alone is sufficient — no model edits required on this branch. Verified getFormattedString() is only called from PDF code paths (no email body callers, which use strtr() directly).

This is the v3.0 counterpart to master's f387e751. Re-implemented directly on v3.0 instead of cherry-picked because the import-block divergence from the larger v3.0 refactor produced four merge conflicts that were noisier than just porting the chokepoint change manually.

Extends tests/Unit/PdfHtmlSanitizerTest.php with three new cases covering the address-template scenario, iframe/link tag stripping, and on* event handler removal. All 8 tests pass via vendor/bin/pest tests/Unit/PdfHtmlSanitizerTest.php.
2026-04-07 20:36:05 +02:00
Darko Gjorgjijoski
bd756f2365 Rewrite README with v3.0 roadmap
Polishes the intro wording, removes the Mobile Apps section (the source repo is referenced from invoiceshelf.com instead) and the Credits section, and rebuilds the Roadmap as a single flat checklist that mixes shipped items with in-flight v3.0 work.

Shipped v3.0 items added: decoupled system settings from company settings, proper multi-tenancy system, company member invitations with custom roles, dark mode, full TypeScript refactor of the frontend, improved backend architecture, security hardening.

In-flight v3.0 items (bold + (v3.0) marker so they jump out as the active milestone): reworked installation wizard, Module Directory, rewritten Payments module. The two longer-term items (Stripe integration, improved template system) stay at the bottom unchanged.
2026-04-07 20:14:02 +02:00
Darko Gjorgjijoski
999ff3e977 Auto-update invoice due date when invoice date changes
Port of master's 241ec092 (Feat: Automatically set due date when invoice date is changed). The original commit was a JavaScript Options-API watcher in the deleted v1 InvoiceCreate.vue; v3.0's equivalent is a Composition-API TypeScript view at resources/scripts/features/company/invoices/views/InvoiceCreateView.vue, so this is a re-implementation rather than a cherry-pick.

Behaviour: if the company setting invoice_set_due_date_automatically is 'YES', a watcher on invoiceStore.newInvoice.invoice_date recomputes the due date as invoice_date + invoice_due_date_days whenever the invoice date changes. A second watcher on due_date tracks whether the user has manually edited it; if the manual value is still valid (>= the new invoice date) it is left alone, otherwise the auto value takes over. An isAutoUpdatingDueDate guard avoids a feedback loop when the watcher writes back to the store.

Uses moment for the date math, matching the original master commit and several other v3.0 features (reports, CreateCustomFields) that already import moment. companyStore is newly imported in this view to read selectedCompanySettings.
2026-04-07 17:33:03 +02:00
Darko Gjorgjijoski
cb37de6da4 Auto-generate company slug server-side in CompanyRequest
CompanyRequest::getCompanyPayload() accepted 'slug' from the client but never generated it, so the installation wizard (which PUTs /api/v1/company) left the slug empty when setting up the first company. Match the sibling CompaniesRequest (which already does Str::slug($this->name)) and generate the slug from the name server-side; drop the now-unused 'slug' validation rule.

Fixes the same bug that master's ed7af3fc tried to fix client-side with a lodash deburr + regex workaround in Step7CompanyInfo.vue. v3.0's installation wizard is a rewrite under resources/scripts/features/installation/CompanyView.vue and doesn't carry that workaround, so the cleaner fix is to make the backend authoritative like CompaniesRequest already is.
2026-04-07 17:30:34 +02:00
Darko Gjorgjijoski
119a1712b0 Port expense report grouped itemized view + i18n + return types from master
Ports the net behaviour from three master commits into v3.0 as a single change, because v3.0 has already diverged structurally (controller moved from V1/Admin/Report to Company/Report, blade has its own CSS rework using the bundled fonts partial, and v3.0's App\Facades\Pdf replaces Barryvdh\DomPDF\Facade\Pdf). The three source commits are: 834b53ea (grouped itemized expenses), e22050bc (DomPDF facade + Pint — adapted to v3.0's App\Facades\Pdf), 0e9f18d4 (expenses.uncategorized + pdf_expense_group_total_label i18n keys + View|Response return type).

Controller: replaces the expenseCategories aggregate fetch with an itemized Expense query ordered by date, groups by category name with expenses.uncategorized fallback, and shares an expenseGroups collection of {name, expenses, total} plus the overall totalExpense. Adds expense_category_id to applyFilters. Updates the docblock return type from JsonResponse to View|Response. Keeps v3.0's App\Facades\Pdf.

Blade: replaces the single expenseCategories aggregate table with a per-group itemized table (date / note / amount columns + per-group total line using the new pdf_expense_group_total_label i18n key). Adds the item-table-* CSS classes and removes the old expense-total-table bottom block.

lang/en.json: adds expenses.uncategorized = "Uncategorized" and pdf_expense_group_total_label = "Group total:".
2026-04-07 17:28:34 +02:00
Darko Gjorgjijoski
f5e876122d New translations en.json (Hindi) 2026-04-07 17:12:41 +02:00
Darko Gjorgjijoski
66f7dce701 Document the design system in CLAUDE.md and clean up scripts-v2 leftovers
Updates CLAUDE.md to reflect the actual current state of the codebase: rewrites the Frontend section to point at main.ts / features-folder layout / @ alias (the previous text still pointed at the deleted v1 main.js / admin-router.js / admin/stores paths), expands Backend Patterns with the FileDisk + disk-assignments model and the per-user 'default' language sentinel, and adds two new sections — PDF Font System (the on-demand Font Packages mechanism plus the two non-obvious dompdf constraints around variable fonts and font-family fallback) and CSS Theme Tokens (the @theme inline registration model, all currently-defined token categories, the [data-theme=dark] attribute switch, the two-step ritual for adding a new token, and the no-hardcoded-values convention).

Cleans up two scripts-v2 leftovers from the rename refactor: resources/css/invoiceshelf.css had four @source directives — two pointing at the long-deleted scripts-v2/ directory and one pointing at scripts/**/*.js (the new directory has zero .js files, only .vue and .ts), collapsed down to the two correct ones. CONTRIBUTING.md still pointed contributors at 'patterns in resources/scripts-v2/' — fixed to resources/scripts/.
2026-04-07 14:18:49 +02:00
Darko Gjorgjijoski
6fdf10b2b1 Rebuild auth pages on the project design system
Rewrites resources/scripts/layouts/AuthLayout.vue from scratch using only the @theme tokens defined in themes.css and registered via @theme inline in invoiceshelf.css. The new layout is a centered card on the existing bg-glass-gradient utility, using the same visual vocabulary as BaseCard (bg-surface, rounded-xl, border-line-default, shadow-sm) so the auth pages read as a smaller, simpler version of the admin's existing card pattern. Both light and dark mode work automatically because every color references a theme token rather than a hardcoded hex/rgb.

Drops the previous attempt's hardcoded #0a0e1a / #fbbf24 / #f5efe5 palette, the imported Google Fonts (Fraunces / Manrope / JetBrains Mono — replaced with the project default Poppins via font-base), the local --ink / --brass / --cream CSS variables that ignored [data-theme=dark], and the :deep() overrides that forced BaseInput / BaseButton into a custom underline style. The form components now render in the auth card identically to how they render anywhere else in the admin — same components, same theme tokens, no overrides.

Removes four legacy SVG decorations from the original two-panel design: LoginPlanetCrater, LoginBackground, LoginBackgroundOverlay, LoginBottomVector. The page now has no decorative imagery — the bg-glass-gradient utility carries the visual mood.

Adds w-full justify-center to the four auth-form submit buttons (LoginView, ForgotPasswordView, ResetPasswordView, RegisterWithInvitationView) so they fill the auth card width with their labels centered. Done at the call site rather than via :deep() so BaseButton stays untouched and the rest of the admin keeps its inline button style. Route-aware heading/subheading copy is preserved for all four auth views, and the four window.* admin customization hooks (login_page_logo, login_page_heading, login_page_description, copyright_text) still work.
2026-04-07 14:18:34 +02:00
Darko Gjorgjijoski
71388ec6a5 Rename resources/scripts-v2 to resources/scripts and drop @v2 alias
Now that the legacy v1 frontend (commit 064bdf53) is gone, the v2 directory is the only frontend and the v2 suffix is just noise. Renames resources/scripts-v2 to resources/scripts via git mv (so git records the move as renames, preserving blame and log --follow), then bulk-rewrites the 152 files that imported via @v2/... to use @/scripts/... instead. The existing @ alias (resources/) covers the new path with no extra config needed.

Drops the now-unused @v2 alias from vite.config.js and points the laravel-vite-plugin entry at resources/scripts/main.ts. Updates the only blade reference (resources/views/app.blade.php) to match. The package.json test script (eslint ./resources/scripts) automatically targets the right place after the rename without any edit.

Verified: npm run build exits clean and the Vite warning lines now reference resources/scripts/plugins/i18n.ts, confirming every import resolved through the new path. git log --follow on any moved file walks back through its scripts-v2 history.
2026-04-07 12:50:16 +02:00
Darko Gjorgjijoski
064bdf5395 Delete legacy v1 frontend (resources/scripts)
The resources/scripts/ directory was the original Vue 2 / Pinia v1 admin and customer-portal SPA. It has been fully orphaned for some time — vite.config.js has zero entry points pointing at it and the only blade @vite() reference in resources/views/app.blade.php loads scripts-v2/main.ts. The directory was pure dead code.

Removes 424 .vue / .js / store / router / helper files (~2.7 MB) so that resources/scripts-v2/ can be renamed back to resources/scripts/ in a follow-up commit, dropping the v2 suffix now that there is no v1 left.
2026-04-07 12:48:15 +02:00
Darko Gjorgjijoski
f83ec6e78f Pluralize Macedonian status labels for filter tabs and column headers
Status labels in lang/mk.json shipped as neuter singular adjectives in commit 9345d3e5 (Платено, Активно, Повторливо, Прегледано, …) but in the actual UI these strings appear primarily as filter tab labels at the top of list views and as column headers — both contexts read more naturally in plural in Macedonian. Going plural also sidesteps the gender-mismatch problem we'd otherwise hit (Фактура fem., Плаќање neut., Корисник masc.) since Macedonian plural is gender-neutral.

Pluralizes 27 status keys across invoices, estimates, recurring_invoices and settings.preferences: paid → Платени, viewed → Прегледани, overdue → Задоцнети, completed → Завршени, accepted → Прифатени, rejected → Одбиени, expired → Истечени, active → Активни, recurring → Повторливи, one_time → Еднократни, partially_paid → Делумно платени, etc.

Deliberately preserved as singular: general.draft / general.sent and their estimates.* aliases (inherited by single-item header badges), recurring_invoices.on_hold / settings.preferences.on_hold (prepositional phrase, doesn't decline), and settings.exchange_rate.active (per-row is_active flag on a single provider entry).
2026-04-07 12:43:06 +02:00
Darko Gjorgjijoski
9345d3e525 Translate Macedonian (mk) locale to ~99% coverage
lang/mk.json was an empty Crowdin stub with only 16 of 1591 keys translated (~1%), and several of those were stale English variants from older en.json revisions ('Roles' instead of 'Company Roles', 'Notes' instead of 'Record Notes', 'Backup' instead of 'Backups', etc.) that survived as pseudo-translations. Replace the stub with a full Cyrillic translation covering 1578 of 1591 keys (~99%), with structural parity to en.json (zero missing keys, identical 1769-line shape, valid JSON).

The 13 deliberately untranslated entries are brand names and technical conventions that should not be localized: CC, BCC, 404, EXP-001, Slug, Placeholder, URL, dropbox, and the four exchange-rate provider proper nouns (Currency Freak, Currency Layer, Open Exchange Rate, Currency Converter). Industry-standard transliterations are used where Macedonian doesn't have a settled term (Драјвер for driver, S3 / AWS / Mailgun / Dropbox kept as proper nouns, ДДВ for VAT). Vue-i18n pluralization syntax preserved (e.g. 'Фактура | Фактури', 'Корисник | Корисници').

All sidebar menu titles, form labels, validation messages, settings pages, wizard flow, error states, PDF labels and email templates are translated. Re-rendering the SPA after a hard refresh shows the full admin UI in Cyrillic when the company language is set to Macedonian.
2026-04-07 12:35:18 +02:00
Darko Gjorgjijoski
fac9ad8cef Add Hebrew and Urdu to the company language dropdown
Both lang/he.json and lang/ur.json shipped as empty Crowdin stubs but never made it into config('invoiceshelf.languages'), so admins could not pick either locale even after the matching font packages (noto-sans-hebrew, noto-naskh-arabic) landed in commit 04952d91. Add the two entries with native names (עברית, اردو) following the existing Svenska / ไทย / Tiếng Việt convention for non-Latin scripts.

Inserted alphabetically by English name — he between Greek and Hindi, ur after Ukrainian. The first PDF render for either locale will trigger ensureFontsForLocale() and synchronously install the corresponding font package; the UI itself stays mostly English until the Crowdin translations catch up, which is the intended trade-off — these locales are useful primarily as language tags for PDF rendering of Hebrew / Arabic-script customer data.
2026-04-07 12:35:01 +02:00
Darko Gjorgjijoski
04952d91ed Add Hebrew/Arabic/Devanagari/Sarabun font packages and unify Noto Sans into the package array
Closes the audit gaps from the original font system commit. The bundled NotoSans only covered Latin/Greek/Cyrillic but the descriptions claimed Arabic, Thai and Hindi too — that was false. DejaVu Sans, the prior dompdf default, did cover Hebrew, Arabic, Armenian and Georgian, so swapping it for NotoSans had silently regressed those scripts. The Thai conditional include was also dropped from every PDF template in that commit, leaving th locales rendering boxes despite THSarabunNew still sitting in resources/static/fonts/.

Adds four on-demand Font Packages — Noto Sans Hebrew, Noto Naskh Arabic (covering Arabic, Persian, Urdu, Sorani Kurdish), Noto Sans Devanagari (Hindi, Marathi, Sanskrit, Nepali) and Sarabun (Thai) — sourced from openmaptiles/fonts and google/fonts as static TTF. Static is mandatory because dompdf's PHP-Font-Lib does not parse variable fonts. Sarabun replaces THSarabunNew as the Thai face: same designer, OFL-licensed, maintained on a stable upstream URL, and surfaces through the same install flow as every other non-Latin script. The bundled THSarabunNew TTF files and the dead app/pdf/locale/th.blade.php legacy partial are removed as part of the migration.

Unifies the bundled Noto Sans into FONT_PACKAGES as a noto-sans entry with bundled => true and files served from resources/static/fonts/ instead of storage/fonts/. FontService::isInstalled, downloadPackage, getInstalledFontFaces and getPackageStatuses honor the flag through a new packageDir() helper. The hardcoded @font-face block in the PDF partial is gone — fonts.blade.php collapses to a single getInstalledFontFaces() call so the package array is the only source of truth for every face, bundled or on-demand. Admin → Font Packages now lists Noto Sans at the top with a primary-colored Bundled pill (new settings.fonts.bundled string) alongside the existing Installed badge / Install button states.

Also fixes the misleading settings.fonts.description and settings.fonts.bundled_info copy to actually describe what ships out of the box vs. what's optional, and rebuilds the en locale chunk.
2026-04-07 11:50:34 +02:00
Darko Gjorgjijoski
27c60bb6f5 Allow modal dropdowns and tooltips to overflow their panel
Switch the BaseModal panel container from overflow-hidden to overflow-visible so multiselect dropdowns, autocompletes and tooltips can render outside the modal bounds. Same fix as the settings layout panel earlier — Headless UI's dialog still clips at the viewport, and the modal panel keeps its rounded-xl corners through its own bg-surface background, so removing the clip exposes no square-corner regression on existing modals.
2026-04-07 11:50:10 +02:00
Darko Gjorgjijoski
53932e9e16 Pluralize admin settings menu items and clarify Font Packages copy
Sidebar entries Backup and File Disk now read Backups and File Disks to match how the underlying pages actually behave (each one lists/manages multiple entries) and to align with the recently added Font Packages entry. The settings.{backup,disk}.title pluralization slots are collapsed to plural-only so the existing $t(..., 1) call sites in AdminBackupView, AdminFileDiskView and the legacy v1 BackupSetting view render the plural form on the page header without touching any Vue code.

Also finishes the Fonts → Font Packages rename: menu_title.fonts and fonts.title both read Font Packages, and fonts.description leads with 'used exclusively when generating PDF documents' so the PDF-only scope is unmissable.
2026-04-07 10:53:45 +02:00
Darko Gjorgjijoski
5ab9c5f736 Allow settings panel dropdowns to overflow their container
Switch the settings layout content wrapper from overflow-hidden to overflow-visible in SettingsLayoutView, UserSettingsLayoutView and AdminSettingsView so multiselect dropdowns and tooltips can render outside the panel without being clipped.
2026-04-07 07:55:00 +02:00
Darko Gjorgjijoski
78ed332d06 Add per-user language preference with company default fallback
Existing accounts inherited the company language at creation time and there was no way to change UI language per user. Add a 'Default (Company Language)' entry to the language selector in UserGeneralView, persist the choice through userStore.updateUserSettings and reload the i18n bundle via window.loadLanguage. The 'default' sentinel keeps the user opted in to the company-wide setting.

Bootstrap (global.store) now syncs userForm from current_user data and resolves the active UI language as user > company > 'en'. RegisterController, InvitationRegistrationController and MemberService seed new users with language=default instead of copying the current company setting, so promoting/inviting members no longer leaks the inviter's frozen language.
2026-04-07 04:41:00 +02:00
Darko Gjorgjijoski
c5c9677ffc Add Admin Fonts settings page to install CJK font packages
Adds AdminFontView with package list, install buttons, status indicators and toast notifications backed by /api/v1/fonts/status and /api/v1/fonts/{package}/install. Wires the new admin.settings.fonts lazy route and a Languages-icon menu entry under Admin → Settings.
2026-04-07 01:17:00 +02:00
Darko Gjorgjijoski
ba5c6c39ba Add multilingual PDF font system with Noto Sans and on-demand CJK packages
Bundle Noto Sans (Regular/Bold/Italic/BoldItalic) under resources/static/fonts/ as the default PDF face — it covers Latin, Cyrillic, Greek, Arabic, Thai and Hindi out of the box, replacing the limited DejaVu Sans fallback. Move all @font-face declarations into app.pdf.partials.fonts and include it from every invoice/estimate/payment/report template, dropping per-template font-family hardcodes and the conditional Thai locale include.

Introduce FontService + FontController to download static Noto Sans CJK packages (zh, zh_CN, ja, ko) from life888888/cjk-fonts-ttf on demand. GeneratesPdfTrait::ensureFontsForLocale primes the family before rendering and the partial emits @font-face rules for installed packages so dompdf resolves them through standard CSS — no separate registerFont() instance required. Static TTFs are mandatory because dompdf's PHP-Font-Lib does not parse variable fonts (fvar/gvar tables), which is why Google Fonts' NotoSansTC[wght].ttf rendered empty boxes.

Expose status/install via /api/v1/fonts/status and /api/v1/fonts/{package}/install with matching FONTS_STATUS / FONTS_INSTALL constants in scripts-v2/api/endpoints.ts. Flip DOMPDF_ENABLE_REMOTE default to true for remote asset loading.
2026-04-06 23:32:00 +02:00
Darko Gjorgjijoski
346e5df7ee Fix Thai font path with duplicated static/ segment in PDF locale partial
The @font-face URLs in resources/views/app/pdf/locale/th.blade.php pointed to resource_path('static/static/fonts/THSarabunNew*.ttf'), which does not exist on disk, so dompdf fell back to a default face when rendering Thai PDFs. Drop the duplicated segment so the bundled THSarabunNew TTFs resolve correctly.
2026-04-06 21:48:00 +02:00
Darko Gjorgjijoski
9c3013bb24 Add cache clearing and auto-migrate to Docker entrypoint
Clears config and application cache on every container start to
prevent stale provider references after image updates. Creates the
storage symlink and runs pending migrations if the app is already
installed.

Fixes #614
2026-04-07 02:17:18 +02:00
Darko Gjorgjijoski
5efd1054f4 Add v3.0 upgrade migration
Migrates media disk references from the old temp_{driver} naming to
the new disk_{id} scheme. System local disks map to 'local', remote
disks map to 'disk_{id}'. Structured as the single v3.0 upgrade
migration for future additions.
2026-04-07 02:12:38 +02:00
Darko Gjorgjijoski
20085cab5d Refactor FileDisk system with per-disk unique names and disk assignments UI
Major changes to the file disk subsystem:

- Each FileDisk now gets a unique Laravel disk name (disk_{id}) instead
  of temp_{driver}, fixing the bug where multiple local disks with
  different roots overwrote each other's config.

- Move disk registration logic from FileDisk model to FileDiskService
  (registerDisk, getDiskName). Model keeps only getDecodedCredentials
  and a deprecated setConfig() wrapper.

- Add Disk Assignments admin UI (File Disk tab) with three purpose
  dropdowns: Media Storage, PDF Storage, Backup Storage. Stored as
  settings (media_disk_id, pdf_disk_id, backup_disk_id).

- Backup tab now uses the assigned backup disk instead of a per-backup
  dropdown. BackupsController refactored to use BackupService which
  centralizes disk resolution. Removed stale 4-second cache.

- Add local_public disk to config/filesystems.php so system disks
  are properly defined.

- Local disk roots stored relative to storage/app/ with hint text
  in the admin modal explaining the convention.

- Fix BaseModal watchEffect -> watch to prevent infinite request
  loops on the File Disk page.

- Fix string/number comparison for disk purpose IDs from settings.

- Add safeguards: prevent deleting disks with files, warn on
  purpose change, prevent deleting system disks.
2026-04-07 02:04:57 +02:00
Darko Gjorgjijoski
ea1fc9b799 Consolidate media disk config into AppConfigProvider
Remove duplicate configureMediaDisk() from AppServiceProvider — all
FileDisk and media-library config is now in AppConfigProvider's
configureFileSystemFromDatabase().

Replace setConfig() calls with inline config registration everywhere
to avoid mutating filesystems.default, which caused infinite request
loops on the File Disk admin page.
2026-04-07 01:09:06 +02:00
Darko Gjorgjijoski
6dd9ed1232 Fix infinite request loop on File Disk admin page
configureMediaDisk() was calling FileDisk::setConfig() which mutates
the global filesystems.default config on every request. This caused
cascading requests on the File Disk admin page.

Now registers the media disk config directly without changing the
global default filesystem.
2026-04-07 01:05:08 +02:00
Darko Gjorgjijoski
67268ac2b7 Secure expense receipts by wiring Media Library to FileDisk
Spatie Media Library now uses the default FileDisk (local_private) for
new uploads instead of the public disk. Expense receipts are no longer
directly web-accessible.

- AppServiceProvider configures media-library disk from FileDisk on boot
- Change media-library fallback from 'public' to 'local'
- Expense receipt URL accessor returns authenticated route instead of
  direct file URL
- Add registerMediaCollections() to Expense model
- Prevent deleting FileDisk that contains files or is a system disk
- Add media:secure command to migrate existing receipts to private disk

Fixes #187
2026-04-07 01:01:59 +02:00
Darko Gjorgjijoski
39c9179888 Support internationalized domain names (IDN) in email validation
Add IdnEmail validation rule that converts IDN domains to Punycode
via idn_to_ascii() before validating with FILTER_VALIDATE_EMAIL.
Applied to all email fields: customers, members, profiles, admin
users, customer portal profiles, and mail configuration.

Includes unit tests for standard emails, IDN emails, and invalid
inputs.

Fixes #388
2026-04-06 23:55:29 +02:00
Darko Gjorgjijoski
631d838834 Fix recurring invoices using wrong date in non-UTC timezones
Pass the app's configured timezone to CronExpression::getNextRunDate()
so the next invoice date is calculated in the correct timezone instead
of defaulting to UTC.

Fixes #491
2026-04-06 23:38:55 +02:00
Darko Gjorgjijoski
9638e02eb8 Fix customer portal not reflecting company default currency
The customer portal bootstrap now returns current_company_currency
alongside the customer's own currency. The store falls back to the
company currency when the customer has no currency assigned.

Fixes #142
2026-04-06 23:37:56 +02:00
Darko Gjorgjijoski
c46118be3b Add Icelandic Króna (ISK) to currency seeder
ISK uses 0 decimal precision (no fractional units), dot thousand
separator, comma decimal separator, and symbol after the number.

Fixes #348
2026-04-06 23:27:15 +02:00
Darko Gjorgjijoski
0093bf4d53 Copy custom fields when converting estimate to invoice
Custom fields defined on an estimate are now carried over to the
invoice when using Convert to Invoice. Uses the same pattern as
the clone method.

Fixes #282
2026-04-06 23:24:11 +02:00
Darko Gjorgjijoski
25b61b73a0 Fix case-sensitive email login
Email comparison on login now uses LOWER() for case-insensitive
matching. Applied to both admin and customer portal login controllers.

Fixes #424
2026-04-06 23:22:16 +02:00
Darko Gjorgjijoski
8508e7e1b8 Show user role in company switcher
CompanyResource now includes user_role — the authenticated user's
Bouncer role title scoped to that company (e.g. "Owner"). Displayed
as a subtitle under each company name in the switcher dropdown.
2026-04-06 23:03:29 +02:00
Darko Gjorgjijoski
9ca998e64a Add Convert to Estimate feature for invoices
New backend endpoint POST /invoices/{id}/convert-to-estimate that
creates a draft estimate from an invoice, copying items, taxes,
custom fields, and financial data. Frontend wired with dropdown
action, store method, and API service call.
2026-04-06 22:57:03 +02:00
Darko Gjorgjijoski
c328d1cd10 Mount send modals on index views and dashboard, pass missing props
SendInvoiceModal and SendEstimateModal were only mounted on detail
views. Resend from table dropdowns did nothing because the modal
component was not in the DOM. Added to index views and dashboard.

Pass canCreatePayment and canCreateEstimate props to InvoiceDropdown
from detail view and dashboard.
2026-04-06 22:56:57 +02:00
Darko Gjorgjijoski
5c0e761dfa Fix copy PDF URL and dropdown action conditions
Copy PDF URL now checks window.isSecureContext before using
navigator.clipboard, falls back to textarea+execCommand on HTTP,
and shows a success notification.

Invoice dropdown: Mark as Sent uses its own condition instead of
reusing Send, Resend hidden in detail view.

Estimate dropdown: Mark as Accepted/Rejected hidden when already in
the other terminal state, Convert to Invoice hidden on rejected
estimates. Added Convert to Estimate action for invoices.
2026-04-06 22:56:49 +02:00
Darko Gjorgjijoski
6106ac8208 Fix send modals: from email and preview rendering
fetchBasicMailConfig() was calling the wrong endpoint (company-config
instead of default config). Also, the response has no .data wrapper so
from_mail was never extracted. Fixed in all three send modals.

Estimate and payment preview blob construction now falls back to the
raw response when .data is undefined, matching the invoice modal.
2026-04-06 22:56:41 +02:00
Darko Gjorgjijoski
45f347ebef Fix global tax recalculation and fractional cent totals
Global percentage taxes are now recalculated when items or discount
change, preventing stale tax amounts. Math.round() applied to
sub_total, total, and tax in invoice/estimate submit payloads to
ensure the backend always receives whole-cent integers.
2026-04-06 22:56:31 +02:00
Darko Gjorgjijoski
b07a252523 Fix default template not pre-selected on document create
Read default_invoice_template and default_estimate_template from
useUserStore().currentUserSettings instead of relying on a parameter
that was never passed from the create views.
2026-04-06 22:56:24 +02:00
Darko Gjorgjijoski
b0b7d40c73 Fix exchange rate parity across all document types
- Fix exchange-rate service types to match actual backend response shapes
  (exchangeRate array, activeProvider success/error, used currencies as strings)
- Add ExchangeRateConverter to payments, expenses, and recurring invoices
- Set currency_id from customer currency in invoice/estimate selectCustomer()
- Load globalStore.currencies in ExchangeRateConverter on mount
- Pass driver/key/driver_config params to getSupportedCurrencies in provider modal
- Fix OpenExchangeRateDriver validateConnection to use base=USD (free plan compat)
- Fix checkActiveCurrencies SQLite whereJsonContains with array values
- Remove broken currency/companyCurrency props from ExpenseCreateView, use stores
- Show base currency equivalent in document line items and totals when exchange
  rate is active
2026-04-06 21:07:50 +02:00
Darko Gjorgjijoski
e64529468c Replace deleted_files with manifest-based updater cleanup, add release workflow
- Add manifest.json generation script (scripts/generate-manifest.php)
- Add Updater::cleanStaleFiles() that removes files not in manifest
- Add /api/v1/update/clean endpoint with backward compatibility
- Add configurable update_protected_paths in config/invoiceshelf.php
- Update frontend to use clean step instead of delete step
- Add GitHub Actions release workflow triggered on version tags
- Add .github/release.yml for auto-generated changelog categories
- Update Makefile to include manifest generation and scripts directory
2026-04-06 19:27:33 +02:00
Darko Gjorgjijoski
2bdfb6a8b6 Add contributing documentation 2026-04-06 18:00:18 +02:00
Darko Gjorgjijoski
74b4b2df4e Finalize Typescript restructure 2026-04-06 17:59:15 +02:00
Darko Gjorgjijoski
cab785172e Add missing base components and global alias registrations
Create BaseCustomTag (dynamic tag render), BaseFormatMoney,
BaseHeading, BaseScrollPane, BaseDescriptionList/Item, BaseLabel,
BaseCustomerSelectInput, BaseSpinner, BaseRating, and status label
components. Register all renamed v2 components under their old
Base* names (BaseInputGroup->FormGroup, BasePage->Page,
BaseTable->DataTable, etc.) so templates resolve correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 10:45:00 +02:00
Darko Gjorgjijoski
97f88eaf2c Fix build warnings: add isImageFile util, exclude heavy components
from eager glob, clean up dynamic import conflicts

- Add missing isImageFile() to format-money utils
- Exclude BaseMultiselect, InvoicePublicPage, InvoiceInformationCard
  from eager glob in global-components.ts using negative patterns
- Short-circuit English locale in i18n to avoid redundant dynamic import
- Only en.json warning remains (intentional: English bundled inline)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 10:15:00 +02:00
Darko Gjorgjijoski
af92a361a5 Fix auth endpoints: LOGIN and LOGOUT are web routes, not API routes
LOGIN was posting to /api/v1/auth/login but the actual route is
POST /login (session-based web route). LOGOUT was /api/v1/auth/logout
but the actual is POST /auth/logout. All 76+ other endpoints verified
correct against routes/api.php.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 10:00:00 +02:00
Darko Gjorgjijoski
a46cca5cd8 Complete scripts-v2 TypeScript migration — all imports resolved,
build passes

Create all missing components (modals, dropdowns, icons, tabs, mail
drivers, customer partials), fix all @/scripts/ imports to @v2/,
wire up vite entry point and blade template. 382 files, 48883 lines.

- 27 settings components: modals (tax, payment, custom field, note,
  category, role, exchange rate, unit, mail test), dropdowns (6),
  customization tabs (4), mail driver forms (4)
- 22 icon components: 5 utility icons, 4 dashboard icons, 13 editor
  toolbar icons with typed barrel export
- 3 customer components: info, chart placeholder, custom fields single
- Fixed usePopper composable, client/format-money import patterns
- Zero remaining @/scripts/ imports in scripts-v2/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:30:00 +02:00
Darko Gjorgjijoski
812956abcc Phase 5-6: Router, plugins, entry points — scripts-v2 complete
13 files completing the TypeScript migration:
- router/ (3 files): typed guards, route meta augmentation,
  merged feature routes from all 16 modules
- plugins/ (4 files): i18n with dynamic locale loading, pinia,
  tooltip directive
- Entry points: main.ts, InvoiceShelf.ts bootstrap class,
  App.vue, global-components.ts with typed registration
- NoCompanyView and NotFoundView stubs

scripts-v2/ totals: 324 files, 42853 lines of strict TypeScript.
Zero any types. Complete feature-based architecture with typed
stores, API services, composables, and Vue components.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 08:00:00 +02:00
Darko Gjorgjijoski
d91f6ff2e3 Phase 4b: Remaining features — payments, expenses, recurring
invoices, members, reports, settings, customer portal, modules,
installation

82 files, 14293 lines. Completes all feature modules:
- payments: CRUD with send/preview, payment modes
- expenses: CRUD with receipt upload, categories
- recurring-invoices: full frequency logic, limit by date/count
- members: list with roles, invite modal, pending invitations
- reports: sales, profit/loss, expenses, tax with date ranges
- settings: 14 settings views, number customizer, mail config
- customer-portal: consolidated store, 8 views, portal layout
- modules: marketplace index, detail/install, module cards
- installation: 8-step wizard with requirements/db/mail/account

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 07:30:00 +02:00
Darko Gjorgjijoski
774b2614f0 Phase 4a: Feature modules — layouts, auth, admin, dashboard,
customers, items, invoices, estimates, shared document form

77 files, 14451 lines. Typed layouts (CompanyLayout, AuthLayout,
header, sidebar, company switcher), auth views (login, register,
forgot/reset password), admin feature (dashboard, companies, users,
settings with typed store), company features (dashboard with chart/
stats, customers CRUD, items CRUD, invoices CRUD with full store,
estimates CRUD with full store), and shared document form components
(items table, item row, totals, notes, tax popup, template select,
exchange rate converter, calculation composable).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 06:30:00 +02:00
Darko Gjorgjijoski
e43e515614 Phase 3: Typed Vue components in scripts-v2/
Migrate all shared components to TypeScript SFCs with script setup
lang=ts. 72 files, 7144 lines, zero any types.

- components/base/ (42 files): Button, Input, Textarea, Checkbox,
  Radio, Switch, Badge, Card, Modal, Dialog, Dropdown, DatePicker,
  TimePicker, Money, FileUploader, Select, Icon, Loader, Multiselect,
  TabGroup, Wizard, CustomerSelect, ItemSelect, CustomInput, alerts,
  status badges (Invoice/Estimate/Paid/RecurringInvoice), List/ListItem
- components/table/ (3 files): DataTable, TablePagination
- components/form/ (4 files): FormGroup, FormGrid, SwitchSection
- components/layout/ (11 files): Page, PageHeader, Breadcrumb,
  FilterWrapper, EmptyPlaceholder, ContentPlaceholders, SettingCard
- components/editor/ (2 files): RichEditor with Tiptap
- components/charts/ (2 files): LineChart with Chart.js
- components/notifications/ (3 files): NotificationRoot, NotificationItem
- components/icons/ (2 files): MainLogo

All use defineProps<Props>(), defineEmits<Emits>(), typed refs,
and import domain types from types/domain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 05:45:00 +02:00
Darko Gjorgjijoski
2b996d30bf Phase 2: Typed global Pinia stores in scripts-v2/
Rewrite all 7 global stores from JS options API to TypeScript
composition API. 8 files, 1005 lines, zero any types.

- auth.store.ts: login/logout with authService
- global.store.ts: bootstrap, menus, sidebar, config fetching
- company.store.ts: company selection, admin mode, settings
- user.store.ts: current user, abilities, settings
- notification.store.ts: typed toast notifications
- dialog.store.ts: confirm dialog returning Promise<boolean>
- modal.store.ts: modal state with isEdit getter

All use async/await, typed API services, localStore utility,
and explicit ref<T> generics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 05:15:00 +02:00
Darko Gjorgjijoski
991b716b33 Phase 1: TypeScript foundation in scripts-v2/
Create the complete TypeScript foundation for the Vue 3 migration
in a parallel scripts-v2/ directory. 72 files, 5430 lines, zero
any types, strict mode.

- types/ (21 files): Domain interfaces for all 17 entities derived
  from actual Laravel models and API resources. Enums for all
  statuses. Generic API response wrappers.
- api/ (29 files): Typed axios client with interceptors, endpoint
  constants from routes/api.php, 25 typed service classes covering
  every API endpoint.
- composables/ (14 files): Vue 3 composition functions for auth,
  notifications, dialogs, modals, pagination, filters, currency,
  dates, theme, sidebar, company context, and permissions.
- utils/ (5 files): Pure typed utilities for money formatting,
  date formatting (date-fns), localStorage, and error handling.
- config/ (3 files): Typed ability constants, app constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 05:00:00 +02:00
Darko Gjorgjijoski
53a0e1491d Refine sidebar collapse toggle to bottom toolbar
Move collapse button from header into a sticky bottom toolbar in
the sidebar. Chevron double-left/right icon aligned to sidebar edge.
Toolbar area uses mt-auto with border-t separator and glass backdrop,
ready for additional action buttons in the future.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 04:00:00 +02:00
Darko Gjorgjijoski
827c5c8938 Add collapsible sidebar with icon-only mode and tooltips
Desktop sidebar can be toggled between full width (w-56/w-64) and
collapsed icon-only mode (w-16). Collapsed state persists in
localStorage. Icons enlarge to w-6 h-6 when collapsed, labels
hidden, v-tooltip shows item names on hover. Group labels replaced
with thin dividers when collapsed. Toggle button pinned at bottom
with ChevronLeft/Right icon. Content area padding animates smoothly
with transition-all duration-300.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:45:00 +02:00
Darko Gjorgjijoski
9c8e4ae558 Add glass UI with backdrop blur and fix primary button colors
Apply glassmorphism to sidebar, cards, tables, modals, dropdowns,
and dialogs with semi-transparent backgrounds, backdrop-blur, and
white/15 borders. Add subtle gradient body background for the blur
to work against. Add dedicated btn-primary color tokens so primary
buttons stay bold in dark mode instead of using the brightened text
palette. Use shadow-sm to avoid heavy halos in light mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:30:00 +02:00
Darko Gjorgjijoski
7e15eb7c7a Make settings sidebar sticky and consistent across all settings pages
Add gap-8 to user settings (was missing), and sticky top-20
self-start to all three settings sidebars (company, admin, user
profile) so the menu stays fixed while the content area scrolls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:22:00 +02:00
Darko Gjorgjijoski
a10d4d2de9 Theme scrollbars for dark mode
Add global webkit and Firefox scrollbar styling using semantic
color tokens. Fix component scrollbar classes in GlobalSearchBar
and CompanySwitcher from hardcoded gray to theme-aware colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:15:00 +02:00
Darko Gjorgjijoski
249b2759b6 Fix header gradient too light in dark mode
Add dedicated header-from/header-to color tokens that are independent
of the primary palette dark mode overrides. Dark mode header uses a
deeper indigo gradient instead of the brightened primary colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:08:00 +02:00
Darko Gjorgjijoski
d7f88d3103 Fix + button icon color in header to white
The bulk sed migration changed the PlusIcon from text-gray-600 to
text-body, but it sits on the gradient header and should be white.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:00:00 +02:00
Darko Gjorgjijoski
960e6d3517 Polish header search bar with frosted glass styling
Replace solid bg-surface background with bg-white/20 translucent
style matching the + button and company switcher. Use white text
and placeholder with opacity for consistency on the gradient header.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:55:00 +02:00
Darko Gjorgjijoski
7a1e2cd2c3 Rename Notes to Record Notes in company settings menu
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:48:00 +02:00
Darko Gjorgjijoski
d36fbbbf27 Add green status indicator for global mail configuration
Show a green check icon with tinted background when company is
using the global mail configuration, replacing the plain gray text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:42:00 +02:00
Darko Gjorgjijoski
2a3774f437 Soften divider lines across settings pages
Change BaseDivider from text-subtle (which left the hr with a dark
default border) to border-line-light for a gentle themed separator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:35:00 +02:00
Darko Gjorgjijoski
dabdd2b417 Fix status badge colors: SENT to green, PAID more visible
Change SENT status from yellow to green in both invoice and estimate
badges. Make PAID badge more noticeable with stronger green background
(40% opacity) and semibold text. Use consistent text-status-green
token for PAID across all badge components.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:30:00 +02:00
Darko Gjorgjijoski
350068706c Unify form styling across invoice, estimate, and recurring invoice pages
Apply consistent rounded-xl shadow border-line-light to customer
selector, date/number fields card, items table, totals card, editor,
tax popup, and view page sidebars. Wrap right-side basic fields in
card container matching the customer card.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:18:00 +02:00
Darko Gjorgjijoski
88adfe0e50 Add dark mode with CSS custom property theme system
Define 13 semantic color tokens (surface, text, border, hover) with
light/dark values in themes.css. Register with Tailwind via @theme inline.
Migrate all 335 Vue files from hardcoded gray/white classes to semantic
tokens. Add theme toggle (sun/moon/system) in user avatar dropdown.
Replace @tailwindcss/forms with custom form reset using theme vars.
Add status badge and alert tokens for dark mode. Theme-aware chart
grid/labels, skeleton placeholders, and editor. Inline script in
<head> prevents flash of wrong theme on load.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 02:05:00 +02:00
Darko Gjorgjijoski
7fbe3d85a3 UI: Facelift for v3 2026-04-04 01:52:03 +02:00
Darko Gjorgjijoski
eb0a588164 Refactor Administration entrypoint
We moved the administration item to the company switcher in the header
2026-04-04 01:36:28 +02:00
Darko Gjorgjijoski
29b3abd317 Add role column to members table and reorder admin settings menu
Display the Bouncer role title in the members list table. Move
Update App to the last position in administration settings menu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 01:00:00 +02:00
Darko Gjorgjijoski
c85051161b Improve NoCompanyView design and fix header for no-company state
Personalize welcome heading with user name, add descriptive subtitle,
improve invitation card styling, remove redundant logout button. Fix
hasCreateAbilities check in header to actually call the function.
Widen company switcher dropdown and improve invitation row layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:48:00 +02:00
Darko Gjorgjijoski
c3a59a46db Add frontend handling for users without a company
Make setSelectedCompany null-safe and clear stale localStorage.
Conditionally initialize company store state in bootstrap. Add
router guard to redirect no-company users to NoCompanyView while
allowing super admins through. Hide sidebar when no company.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:36:00 +02:00
Darko Gjorgjijoski
fae59221d3 Generate admin menus for super admins without a company
Super admin users with no company associations now receive their
administration menu items in the bootstrap response instead of
empty arrays.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:24:00 +02:00
Darko Gjorgjijoski
afbc6c1db3 Handle no-company user in ScopeBouncer middleware and User model
Skip bouncer scoping when user has no companies instead of crashing
on null. Fall back to Y-m-d date format in getFormattedCreatedAtAttribute
when no company settings are available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:12:00 +02:00
Darko Gjorgjijoski
c49c130e9e Remove Add Member button and Create page — members are added via invitation only 2026-04-04 00:00:53 +02:00
Darko Gjorgjijoski
51f0e6285b Fix session not invalidated on logout causing CSRF mismatch on re-login
The web logout route called Auth::guard('web')->logout() but didn't
invalidate the session or regenerate the CSRF token. The browser kept
sending the old session cookie, causing CSRF token mismatch errors
when logging in as a different user.
2026-04-03 23:52:07 +02:00
Darko Gjorgjijoski
03afb98452 Fix logout not clearing auth token and company from localStorage
After logout, the old auth.token and selectedCompany stayed in
localStorage. On next login, the http interceptor sent the stale
token in the Authorization header, causing all API calls to fail
with 401/419 even though the new session was valid.
2026-04-03 23:49:47 +02:00
Darko Gjorgjijoski
acce67f514 Fix CSRF token mismatch after logout by refreshing cookie
After logout invalidates the session, the SPA still holds the old CSRF
cookie. Subsequent login attempts succeed but bootstrap/API calls fail
with CSRF mismatch, causing redirect back to login. Fix: fetch a fresh
CSRF cookie via /sanctum/csrf-cookie after logout completes.
2026-04-03 23:46:07 +02:00
Darko Gjorgjijoski
8e966965f5 Add logo to invitation registration page 2026-04-03 23:41:27 +02:00
Darko Gjorgjijoski
e0e302e1cf Add /register web route to serve SPA for invitation registration
The SPA catch-all only handles /admin/{vue?}. The /register route needs
its own web route to serve the app view so Vue router can handle it.
2026-04-03 23:39:14 +02:00
Darko Gjorgjijoski
8d3029c877 Fix invitation email: load relationships and handle mail failures gracefully
The CompanyInvitationMail accesses company, role, and invitedBy
relationships which weren't loaded before sending. Also wrap mail
send in try-catch so the invitation is still created even if the
mailer is misconfigured (logs a warning instead of crashing).
2026-04-03 23:30:13 +02:00
Darko Gjorgjijoski
c1994887ef Support invitations for unregistered users
When inviting an email without an InvoiceShelf account, the email now
links to a registration page (/register?invitation={token}) instead of
login. After registering, the invitation is auto-accepted.

Backend:
- InvitationRegistrationController: public details() and register()
  endpoints. Registration validates token + email match, creates account,
  auto-accepts invitation, returns Sanctum token.
- AuthController: login now accepts optional invitation_token param to
  auto-accept invitation for existing users clicking the email link.
- CompanyInvitationMail: conditional URL based on user existence.
- Web route for /invitations/{token}/decline (email decline link).

Frontend:
- RegisterWithInvitation.vue: fetches invitation details, shows company
  name + role, registration form with pre-filled email.
- Router: /register route added.

Tests: 3 new tests (invitation details, register + accept, email mismatch).
2026-04-03 23:26:58 +02:00
Darko Gjorgjijoski
6343b4a17f Add invitation frontend: invite modal, pending invitations, no-company view
Members Index:
- "Invite Member" button opens InviteMemberModal (email + role dropdown)
- Pending invitations section shows below members table with cancel buttons
- Members store gains inviteMember, fetchPendingInvitations, cancelInvitation

CompanySwitcher:
- Shows pending invitations greyed out below active companies
- Each with Accept/Decline mini-buttons
- Accepting refreshes bootstrap and switches to new company

NoCompanyView:
- Standalone page for users with zero accepted companies
- Shows pending invitations with Accept/Decline or "no companies" message
- Route: /admin/no-company

Invitation Pinia store:
- Manages user's own pending invitations (fetchPending, accept, decline)
- Bootstrap populates invitations from API response

Global store:
- Bootstrap action stores pending_invitations from response
2026-04-03 23:20:41 +02:00
Darko Gjorgjijoski
8a6c085288 Rename company-scoped Users to Members throughout
Complete rename across backend and frontend:
- Controller: Company/Users/UsersController -> Company/Members/MembersController
- Service: UserService -> MemberService
- Requests: UserRequest -> MemberRequest, DeleteUserRequest -> DeleteMemberRequest
- API routes: /api/v1/users -> /api/v1/members (company-scoped only)
- Sidebar menu: "Users" -> "Members"
- Frontend: views/users -> views/members, stores/users -> stores/members
- Router: users.index -> members.index, /admin/users -> /admin/members
- i18n: new "members" section with invitation-related keys
- Tests: UserTest -> MemberTest

Admin/super-admin Users (system-wide user management) remains unchanged.
2026-04-03 23:12:30 +02:00
Darko Gjorgjijoski
92a1baced4 Add company invitation system (backend)
New feature allowing company owners/admins to invite users by email with
a specific company-scoped role.

Database:
- New company_invitations table (company_id, email, role_id, token,
  status, invited_by, expires_at)

Backend:
- CompanyInvitation model with pending/forUser scopes
- InvitationService: invite, accept, decline, getPendingForUser
- CompanyInvitationMail with markdown email template
- InvitationController (company-scoped): list, send, cancel invitations
- InvitationResponseController (user-scoped): pending, accept, decline
- BootstrapController returns pending_invitations in response
- CompanyMiddleware handles zero-company users gracefully

Tests: 9 feature tests covering invite, accept, decline, cancel, expire,
duplicate prevention, and bootstrap integration.
2026-04-03 22:58:55 +02:00
Darko Gjorgjijoski
4318c59976 Add Star History chart to README 2026-04-03 22:41:15 +02:00
Darko Gjorgjijoski
c3ad718799 Document Service pattern and TDD requirements in CLAUDE.md and AGENTS.md
Add mandatory Service pattern guidelines: all business logic in Services,
thin controllers, clean models. Document TDD approach with feature tests
for routes and unit tests for services. Add role definitions (super admin
vs owner) to AGENTS.md.
2026-04-03 22:38:53 +02:00
Darko Gjorgjijoski
dee17a1da8 Rename Roles to Company Roles in settings menu 2026-04-03 22:35:50 +02:00
Darko Gjorgjijoski
00d5abae5f Eliminate Company\CompaniesController, introduce owner role
Redistribute methods:
- show() -> BootstrapController::currentCompany()
- store(), destroy(), userCompanies() -> Admin\CompaniesController
- transferOwnership() -> CompanySettingsController

Security fix: introduce 'owner' role for company-level admin, distinct
from 'super admin' which is now global platform admin only.
- CompanyService::setupRoles() creates 'owner' role per company
- Company creation assigns scoped 'owner' role instead of global 'super admin'
- Seeders updated to assign 'owner'

Migration renames all existing company-scoped 'super admin' roles to
'owner' and ensures every company owner has the role assigned.
2026-04-03 22:33:56 +02:00
Darko Gjorgjijoski
5912995164 Move CompaniesController from Company/Company/ to Company/ to eliminate namespace stutter 2026-04-03 22:20:04 +02:00
Darko Gjorgjijoski
6f095210d6 Consolidate Pdf controllers: 6 -> 1 DocumentPdfController
Merge InvoicePdfController, EstimatePdfController, PaymentPdfController
into DocumentPdfController with invoice(), estimate(), payment() methods.

Delete DownloadInvoicePdfController and DownloadPaymentPdfController
(dead code — not mapped in any routes).

Move DownloadReceiptController logic to ExpensesController::downloadReceipt()
(expense receipts, not PDF documents).
2026-04-03 22:16:20 +02:00
Darko Gjorgjijoski
b9e34ff25c Consolidate Company/Settings: 7 controllers -> 5
Merge CompanyCurrencyCheckTransactionsController into
CompanySettingsController as checkTransactions() method.

Merge UserSettingsController into UserProfileController as
showSettings() and updateSettings() methods — both operate on
the authenticated user (/me routes).
2026-04-03 22:11:16 +02:00
Darko Gjorgjijoski
8e7c48f532 Move BackupsController and UpdateController to Admin/ namespace directly
Remove single-file Backup/ and Update/ subdirectories. These controllers
now sit alongside CompaniesController, UsersController, etc. in Admin/.
2026-04-03 21:49:30 +02:00
Darko Gjorgjijoski
20ace694fe Fix UpdateController auth: use Bouncer ability instead of company owner check
ensureOwner() checked isOwner() which only verifies company ownership,
not super admin status. Replace with authorize('manage update app')
which uses the proper Bouncer ability gate for platform administration.
2026-04-03 21:45:40 +02:00
Darko Gjorgjijoski
3f5accc0f0 Consolidate Admin/Update: 8 controllers into 1 UpdateController
Merge 7 single-action pipeline controllers (checkVersion, download,
unzip, copy, delete, migrate, finish) into UpdateController with named
methods. Remove dead UpdateController that duplicated the same logic
but wasn't referenced in routes. Extract shared owner check into
private ensureOwner() helper. Route URLs unchanged.
2026-04-03 21:42:45 +02:00
Darko Gjorgjijoski
7bb6d9bcc3 Consolidate Admin/Settings: merge GetSettingsController + UpdateSettingsController into SettingsController 2026-04-03 21:21:13 +02:00
Darko Gjorgjijoski
142899cfd7 Consolidate Admin/Backup: merge ApiController and DownloadBackupController into BackupsController
Inline the respondSuccess() helper, add download() method. Remove the
unnecessary ApiController base class and DownloadBackupController.
2026-04-03 21:18:45 +02:00
Darko Gjorgjijoski
d505677a74 Consolidate Admin/Modules: 10 single-action controllers into 2
ModulesController: index, show, checkToken, enable, disable
ModuleInstallationController: download, upload, unzip, copy, complete
2026-04-03 21:16:18 +02:00
Darko Gjorgjijoski
e9ee74cd01 Add return types and typed parameters to remaining 10 models
Complete the type modernization across all models. Adds Builder-typed
$query parameters and return types to all scope methods, typed parameters
on accessors, and PHPDoc on scopePaginateData/scopeApplyFilters.

Models updated: Address, EstimateItem, Expense, ExpenseCategory,
InvoiceItem, Item, Note, Tax, TaxType, Unit.

5 models needed no changes (Country, Currency, ImpersonationLog,
Module, UserSetting) as they had no untyped public methods.
2026-04-03 20:53:41 +02:00
Darko Gjorgjijoski
0fa1aac748 Add return types, typed parameters, and PHPDoc to all model methods
Modernize all 16 models with missing type declarations:
- Return types on ~87 methods (string, bool, void, array, mixed, etc.)
- Typed parameters where missing
- PHPDoc blocks on non-obvious methods explaining their purpose

Models updated: Invoice, Estimate, Payment, User, Company, Customer,
RecurringInvoice, Setting, CompanySetting, FileDisk, Transaction,
EmailLog, ExchangeRateLog, PaymentMethod, CustomField, CustomFieldValue.
2026-04-03 20:46:26 +02:00
Darko Gjorgjijoski
c794f92932 Remove unused model constants
- Company: COMPANY_LEVEL, CUSTOMER_LEVEL (never referenced)
- Payment: all 5 PAYMENT_MODE_* constants (never referenced)
- Transaction: PENDING (never referenced)

RecurringInvoice constants (ACTIVE, ON_HOLD, NONE, COUNT, DATE) are kept
as they are used via hardcoded strings in services, factories, and migrations.
2026-04-03 20:39:21 +02:00
Darko Gjorgjijoski
c90dd1f2ac Remove dead model methods now handled by services
Remove createItem/updateItem from Item, createTransaction/
completeTransaction/failedTransaction from Transaction,
createCustomField/updateCustomField from CustomField, all business
methods from ExchangeRateProvider (CRUD + API checks + URL helpers),
and validateCredentials/createDisk/updateDisk/updateDefaultDisks/
setAsDefaultDisk from FileDisk.

All logic now lives in their respective service classes.
2026-04-03 20:32:02 +02:00
Darko Gjorgjijoski
85b62dfdf8 Refactor exchange rate providers into driver-based architecture
Replace duplicated switch/case blocks across 4 methods with a clean
abstract driver pattern:

- ExchangeRateDriver (abstract): defines getExchangeRate(),
  getSupportedCurrencies(), validateConnection()
- CurrencyFreakDriver, CurrencyLayerDriver, OpenExchangeRateDriver,
  CurrencyConverterDriver: concrete implementations
- ExchangeRateDriverFactory: resolves driver name to class, with
  register() method for module extensibility

Delete ExchangeRateProvidersTrait — all logic now lives in driver
classes and ExchangeRateProviderService. Adding a new exchange rate
provider only requires implementing ExchangeRateDriver and calling
ExchangeRateDriverFactory::register() in a module service provider.
2026-04-03 20:24:03 +02:00
Darko Gjorgjijoski
8f29e8f5de Extract business logic from remaining models to services
New services:
- ExchangeRateProviderService: CRUD, API status checks, currency converter
  URL resolution (extracted 122 lines from ExchangeRateProvider model)
- FileDiskService: create, update, setAsDefault, validateCredentials
  (extracted 97 lines from FileDisk model)
- ItemService: create/update with tax handling (extracted from Item model)
- TransactionService: create/complete/fail (extracted from Transaction model)
- CustomFieldService: create/update with slug generation (extracted from
  CustomField model)

Controllers updated to use constructor-injected services:
ExchangeRateProviderController, DiskController, ItemsController,
CustomFieldsController.
2026-04-03 19:32:37 +02:00
Darko Gjorgjijoski
ece6ce737b Rename Services/Installation to Services/Setup to match controllers 2026-04-03 19:23:32 +02:00
Darko Gjorgjijoski
00599b6943 Move Bouncer DefaultScope from app/Bouncer to app/Support/BouncerDefaultScope 2026-04-03 19:21:56 +02:00
Darko Gjorgjijoski
4f47db9258 Move Mobile/AuthController to Company/Auth and remove Mobile namespace
The Mobile namespace only contained an API auth controller (Sanctum token
login/logout/check) that is not mobile-specific. Relocated to
Company/Auth/AuthController alongside the other auth controllers.
2026-04-03 19:19:09 +02:00
Darko Gjorgjijoski
64c481e963 Rename controller namespaces: drop V1 prefix, clarify roles
V1/Admin     -> Company       (company-scoped controllers)
V1/SuperAdmin -> Admin        (platform-wide admin controllers)
V1/Customer  -> CustomerPortal (customer-facing portal)
V1/Installation -> Setup      (installation wizard)
V1/PDF       -> Pdf           (consistent casing)
V1/Modules   -> Modules       (drop V1 prefix)
V1/Webhook   -> Webhook       (drop V1 prefix)

The V1 prefix served no purpose - API versioning is in the route prefix
(/api/v1/), not the controller namespace. "Admin" was misleading for
company-scoped controllers. "SuperAdmin" is now simply "Admin" for
platform administration.
2026-04-03 19:15:20 +02:00
Darko Gjorgjijoski
0aaf0419c3 Reorganize Admin/General: 14 controllers down to 6
Move global reference data to SuperAdmin:
- CountriesController, CurrenciesController (not company-scoped)

Merge exchange rate operations into ExchangeRateProviderController:
- GetAllUsedCurrenciesController -> usedCurrenciesWithoutRate()
- BulkExchangeRateController -> bulkUpdate()

Consolidate single-action controllers:
- DateFormatsController + TimeFormatsController + TimezonesController -> FormatsController
- NextNumberController + NumberPlaceholdersController -> SerialNumberController
- SearchUsersController merged into SearchController::users()
2026-04-03 19:03:57 +02:00
Darko Gjorgjijoski
c0454613a8 Move customer stats logic from CustomerStatsController to CustomerService 2026-04-03 18:10:59 +02:00
Darko Gjorgjijoski
92872e7e1c Merge ShowReceiptController and UploadReceiptController into ExpensesController 2026-04-03 18:07:07 +02:00
Darko Gjorgjijoski
2191417151 Consolidate ExchangeRate single-action controllers into ExchangeRateProviderController
Merge 4 invocable controllers (GetActiveProvider, GetExchangeRate,
GetSupportedCurrencies, GetUsedCurrencies) as methods on the existing
resource controller: activeProvider(), getRate(), supportedCurrencies(),
usedCurrencies().
2026-04-03 18:03:24 +02:00
Darko Gjorgjijoski
5f389ea3b0 Consolidate single-action controllers into resource controllers
Merge 11 single-action controllers into their parent resource controllers:
- Invoice: send, sendPreview, clone, changeStatus -> InvoicesController
- Estimate: send, sendPreview, clone, convertToInvoice, changeStatus -> EstimatesController
- Payment: send, sendPreview -> PaymentsController

Extract clone and convert business logic from controllers into services:
- InvoiceService: add clone(), changeStatus()
- EstimateService: add clone(), convertToInvoice(), changeStatus()

Previously this logic was inlined in controllers (~80-90 lines each).
2026-04-03 17:55:46 +02:00
Darko Gjorgjijoski
f76f351244 Merge CompanyController into CompaniesController as show() method 2026-04-03 17:45:20 +02:00
Darko Gjorgjijoski
735eef6e9b Fix password update sending name and email to satisfy ProfileRequest validation 2026-04-03 17:42:14 +02:00
Darko Gjorgjijoski
4bfec37a53 Switch User Settings from horizontal tabs to sidebar layout
Match the Company Settings design pattern: sidebar navigation on desktop
with dropdown on mobile, child routes rendered via RouterView. Each tab
(General, Profile Photo, Security) is now a BaseSettingCard with its own
route under /admin/user-settings/{general,profile-photo,security}.
2026-04-03 17:41:18 +02:00
Darko Gjorgjijoski
1ca915a0a3 Split CompanyController and introduce standalone User Settings page
Backend:
- Extract user profile methods (show, update, uploadAvatar) from
  CompanyController into new UserProfileController
- CompanyController now only handles company concerns (updateCompany,
  uploadCompanyLogo)
- Remove Account Settings from setting_menu config

Frontend:
- New /admin/user-settings page with 3 tabs: General, Profile Photo,
  Security (password change)
- User dropdown now links to /admin/user-settings instead of
  /admin/settings/account-settings
- Settings sidebar defaults to Company Information as first item
- Remove old monolithic AccountSetting.vue
2026-04-03 17:35:41 +02:00
Darko Gjorgjijoski
6b5e4878fb Consolidate Admin Settings controllers: merge Get/Update pairs
Merge GetCompanySettingsController + UpdateCompanySettingsController into
CompanySettingsController with show() and update() methods.

Merge GetUserSettingsController + UpdateUserSettingsController into
UserSettingsController with show() and update() methods.

Absorb GetCompanyMailConfigurationController into
CompanyMailConfigurationController as getDefaultConfig() method.

Removes 5 single-action controllers, down to 4 Settings controllers.
2026-04-03 17:18:48 +02:00
Darko Gjorgjijoski
bbf46577dc Move global admin controllers from Admin to SuperAdmin namespace
Backup, Update, Modules, and global Settings controllers (mail config,
PDF config, disk management, global settings) are application-wide features
not scoped to a company. Move them from Admin/ to SuperAdmin/ to match the
v3.0 UI structure where these live under Administration.

Company-scoped settings controllers remain in Admin/Settings/.
2026-04-03 16:52:18 +02:00
Darko Gjorgjijoski
de06c335ac Remove dead code from app/Http: unused middleware, requests, and resources
Delete 23 unused files:
- AdminMiddleware (never registered, SuperAdminMiddleware used instead)
- 4 form requests with no controller references
- AbilityResource/Collection and ExchangeRateLogResource/Collection (zero usage)
- Customer/RecurringInvoiceResource and Collection (no controller or nested reference)
- 10 Customer Collection classes whose Resources are only used via new, never ::collection()
2026-04-03 16:41:33 +02:00
Darko Gjorgjijoski
62f31960ab Move CustomPathGenerator from app/Generators to app/Support 2026-04-03 16:21:36 +02:00
Darko Gjorgjijoski
129028518d Consolidate PDF classes under app/Services/Pdf with consistent naming
Split PDFService.php (3 classes + 2 interfaces in one file) into separate
files. Move GotenbergPDFDriver from app/Services/PDFDrivers/ into
app/Services/Pdf/. Normalize casing from ALL-CAPS PDF to Pdf throughout:
facade, provider, service, driver factory, and Gotenberg driver.

Fix PaymentService using Barryvdh DomPDF facade directly instead of the
app's PDF facade (bypassed the driver factory). Report controllers also
updated to use the app facade.
2026-04-03 16:18:25 +02:00
Darko Gjorgjijoski
e0b8b86e06 Rename SerialNumberFormatter to SerialNumberService for consistency 2026-04-03 16:09:22 +02:00
Darko Gjorgjijoski
e208e3ba56 Move Hashids classes from app/Hashids to app/Services/Hashids 2026-04-03 15:41:05 +02:00
Darko Gjorgjijoski
0ce88ab817 Remove app/Space folder and extract model business logic into services
Relocate all 14 files from the catch-all app/Space namespace into proper
locations: data providers to Support/Formatters, installation utilities to
Services/Installation, PDF utils to Services/Pdf, module/update classes to
Services/Module and Services/Update, SiteApi trait to Traits, and helpers
to Support.

Extract ~1,400 lines of business logic from 8 fat models (Invoice, Payment,
Estimate, RecurringInvoice, Company, Customer, Expense, User) into 9 new
service classes with constructor injection. Controllers now depend on
services instead of calling static model methods. Shared item/tax creation
logic consolidated into DocumentItemService.
2026-04-03 15:37:22 +02:00
Darko Gjorgjijoski
23ff69026e Merge branch 'master' into v3.0 2026-04-03 14:36:24 +02:00
Darko Gjorgjijoski
7d9fdb79cc Scope users listing and search to current company (#607)
Add scopeWhereCompany() to User model using whereHas through the
user_company pivot table. Apply it in UsersController::index() and
SearchController so users only see members of their current company.

Previously, the users page showed ALL users across all companies.

Ref #574
2026-04-03 14:34:33 +02:00
Darko Gjorgjijoski
3d871604ae Add company ownership check to clone endpoints (#606)
Verify the source record belongs to the current company before cloning.
Previously, users could clone invoices/estimates from other companies,
leaking sensitive data (amounts, customer details, items, taxes, notes).

The view policy already includes hasCompany() check, so authorizing
view on the source record gates both ability and company ownership.

Ref #574
2026-04-03 14:32:12 +02:00
Darko Gjorgjijoski
1adebe85b9 Scope all bulk deletes to current company and fix inverted ownership transfer (#605)
Bulk delete: filter IDs through whereCompany() before deleting in all
controllers (Invoices, Payments, Items, Expenses, Estimates, Recurring
Invoices). Previously, any user could delete records from other companies
by providing cross-company IDs.

Transfer ownership: fix inverted hasCompany() check that allowed
transferring company ownership to users who do NOT belong to the company,
while blocking users who DO belong.

Ref #567
2026-04-03 14:16:42 +02:00
Darko Gjorgjijoski
defbfc6406 Fix CustomerPolicy missing hasCompany() check (IDOR) (#604)
* Fix CustomerPolicy missing hasCompany() check (cross-company IDOR)

Add $user->hasCompany($customer->company_id) check to view, update,
delete, restore, and forceDelete methods in CustomerPolicy, matching
the pattern used by all other policies (InvoicePolicy, PaymentPolicy,
EstimatePolicy, etc.).

Without this check, a user in Company A with view-customer ability
could access customers belonging to Company B by providing the target
customer's ID.

Add cross-company authorization tests to verify the fix.

Closes #565

* Scope bulk delete to current company to prevent cross-company deletion

Filter customer IDs through whereCompany() before passing to
deleteCustomers(), ensuring users cannot delete customers belonging
to other companies via the bulk delete endpoint.
2026-04-03 13:56:34 +02:00
Darko Gjorgjijoski
55416bc633 Improve copyright handling 2026-04-03 13:34:33 +02:00
Darko Gjorgjijoski
c469f64c79 Remove unused CompanySetting defaults from company setup
Remove invoice_auto_generate, payment_auto_generate, estimate_auto_generate
(defined but never read anywhere in the codebase) and duplicate save_pdf_to_disk
entries (now a global Setting, not per-company).
2026-04-03 10:36:48 +02:00
Darko Gjorgjijoski
9432da467e Add super-admin Administration section and restructure global vs company settings
- Add Administration sidebar section (super-admin only) with Companies, Users, and Global Settings pages
- Add super-admin middleware, controllers, and API routes under /api/v1/super-admin/
- Allow super-admins to manage all companies and users across tenants
- Add user impersonation with short-lived tokens, audit logging, and UI banner
- Move system-level settings (Mail, PDF, Backup, Update, File Disk) from per-company to Administration > Global Settings
- Convert save_pdf_to_disk from CompanySetting to global Setting
- Add per-company mail configuration overrides (optional, falls back to global)
- Add CompanyMailConfigService to apply company mail config before sending emails
2026-04-03 10:35:40 +02:00
Darko Gjorgjijoski
25986b7bd5 Update IDE helpers, Tailwind skill to v4, and refresh dependencies 2026-04-02 21:03:55 +02:00
Darko Gjorgjijoski
751bd4a1c8 Upgrade ChartJS from v2 to v4 (#603) 2026-04-02 20:02:49 +02:00
Darko Gjorgjijoski
0e313b80ca Upgrade @vueuse/core from v12 to v14 (#602) 2026-04-02 18:09:43 +02:00
Darko Gjorgjijoski
5014a75fbc Upgrade eslint tooling to v10 and fix linting bugs (#601)
- Upgrade eslint 9→10, eslint-config-prettier 9→10, eslint-plugin-vue 9→10
- Upgrade @types/node 20→24
- Migrate from legacy .eslintrc.mjs to flat config eslint.config.mjs
- Remove --ext flag from npm test script (dropped in eslint 10)
- Fix vue/no-ref-as-operand: add missing .value to ref assignments (5 files)
- Fix vue/return-in-computed-property: add default returns (2 files)
- Fix vue/no-side-effects-in-computed-properties: move mutation to watcher
- Fix vue/no-dupe-keys: remove ref shadowing prop in DomPDFDriver
- Fix vue/no-deprecated-slot-attribute: migrate to v-slot syntax (3 files)
- Fix vue/require-valid-default-prop: use factory function for array default
- Fix vue/no-unused-vars: remove unused slot destructure
- Disable vue/no-mutating-props (false positive for Pinia store props)
2026-04-02 17:33:18 +02:00
Darko Gjorgjijoski
9e5b9fdaad Upgrade vue-flatpickr-component from v11 to v12 (#600) 2026-04-02 17:17:17 +02:00
Darko Gjorgjijoski
08dfe62312 Standardize Node.js version to 24 (#599)
Update Node.js from 20 to 24 across CI workflows, Dockerfiles,
package.json engines field, and add .node-version file for consistent
local development.
2026-04-02 17:08:39 +02:00
Darko Gjorgjijoski
f623cd0179 Upgrade vue-router from v4 to v5 (#598)
- Migrate beforeEach navigation guard from next() callback to return-based
  API, preparing for vue-router v6 where next() is removed
2026-04-02 16:47:16 +02:00
Darko Gjorgjijoski
414531524c Remove unused cross-env dependency 2026-04-02 16:39:10 +02:00
Darko Gjorgjijoski
d75a957183 Upgrade Tiptap from v2 to v3 (#597)
- Upgrade @tiptap/core, starter-kit, vue-3, pm, extension-text-align to v3
- Remove @tiptap/extension-link (now bundled in StarterKit v3)
- Move Link config into StarterKit.configure()
2026-04-02 16:35:43 +02:00
Darko Gjorgjijoski
63d3a7fc8e Skip PHP CI jobs when only non-PHP files change
Replace workflow-level paths-ignore with per-job filtering using
dorny/paths-filter. PHP lint and test jobs now only run when PHP-related
files (app/, config/, database/, routes/, tests/, composer.*, phpunit.xml)
are modified.
2026-04-02 16:35:07 +02:00
Darko Gjorgjijoski
0be747a483 Pin axios to 1.14.0
Avoid possible supply chain attacks in future caused by compromised
author account or even rogue author.
2026-04-02 16:14:47 +02:00
Darko Gjorgjijoski
3ceb08bc31 Upgrade Pinia from v2 to v3 (#596)
Migrate all 37 store definitions from the deprecated object-with-id
signature to the string-id-first signature required by Pinia 3:

  defineStore({ id: 'name', ... }) → defineStore('name', { ... })
2026-04-02 16:12:11 +02:00
Darko Gjorgjijoski
ad5a7e51b9 Upgrade to Vite 8 and Tailwind CSS 4 (#595)
- Vite 6 → 8 (Rolldown bundler), laravel-vite-plugin 1 → 3, @vitejs/plugin-vue 5 → 6
- Tailwind CSS 3 → 4 with CSS-based config (@theme, @plugin, @utility)
- Add @tailwindcss/vite plugin, remove postcss/autoprefixer/sass
- Convert SCSS files to plain CSS (resources/sass → resources/css)
- Migrate tailwind.config.js to CSS @theme directives
- Rename deprecated utility classes (shadow-sm→shadow-xs, outline-none→outline-hidden,
  rounded-sm→rounded-xs, bg-gradient-to→bg-linear-to, ring→ring-3)
- Migrate opacity utilities to color modifiers (bg-opacity, text-opacity,
  border-opacity, ring-opacity → color/N syntax)
- Update primary color CSS vars to full rgb() values for TW4 color-mix()
- Fix border-l color specificity for sidebar navigation (TW4 default border
  color changed from gray-200 to currentColor)
- Fix invalid border color classes (border-grey-light, border-modal-bg, border--200)
- Add @reference directive for @apply in Vue component style blocks
- Convert Vue component <style lang="scss"> blocks to plain CSS
2026-04-02 15:59:15 +02:00
Darko Gjorgjijoski
691178857f Add HTTP client wrapper and upgrade Axios to v1 (#594)
* refactor: add HTTP client wrapper and upgrade axios to v1

Introduce a thin HTTP wrapper (resources/scripts/http) that centralizes
axios configuration, interceptors, and auth header injection. All 43
files now import from the wrapper instead of axios directly, making
future library swaps a single-file change. Upgrade axios from 0.30.0
to 1.14.0.

* fix: restore window.Ls assignment removed during axios refactor

company.js uses window.Ls.set() to persist selected company,
which broke after the axios plugin (that set window.Ls) was deleted.
2026-04-02 15:08:23 +02:00
Darko Gjorgjijoski
a38f09cf7b Installer reliability improvements (#593)
* docs: add CLAUDE.md for Claude Code guidance

* fix: handle missing settings table in installation middlewares

RedirectIfInstalled crashed with "no such table: settings" when the
database_created marker file existed but the database was empty.
Changed to use isDbCreated() which verifies actual tables, and added
try-catch around Setting queries in both middlewares.

* feat: pre-select database driver from env in installation wizard

The database step now reads DB_CONNECTION from the environment and
pre-selects the matching driver on load, including correct defaults
for hostname and port.

* feat: pre-select mail driver and config from env in installation wizard

The email step now fetches the current mail configuration on load
instead of hardcoding the driver to 'mail'. SMTP fields fall back
to Laravel config values from the environment.

* refactor: remove file-based DB marker in favor of direct DB checks

The database_created marker file was a second source of truth that
could drift out of sync with the actual database. InstallUtils now
checks the database directly via Schema::hasTable which is cached
per-request and handles all error cases gracefully.
2026-04-02 14:48:08 +02:00
mchev
375cfc6b18 Merge pull request #591 from mchev/588
Fix PDF notes line breaks
2026-04-01 21:38:14 +02:00
mchev
aa88dc340d Closes #588 2026-04-01 21:30:32 +02:00
mchev
7004bf375e Merge pull request #587 from rihards-simanovics/rihards-simanovics/issue586
Fix docker containers failing to create SQL backups due to missing OS dependencies
2026-03-27 08:15:43 +01:00
mchev
80889293bf Merge pull request #508 from alexdev01012020/email-backup
Overrite the email notification for backup
2026-03-27 08:04:02 +01:00
Rihards Simanovics
d754c4d29e fix: return missing development docker sql dependencies
Fixes #586
2026-03-27 00:18:15 +00:00
Rihards Simanovics
8de32e27d3 fix: return missing production docker sql dependencies
Fixes #586
2026-03-27 00:17:56 +00:00
mchev
3bae2c282c Merge pull request #576 from csalzano/fix/remote-disk-backup-listing
Fix remote disk backups never appear in backup listing
2026-03-26 09:16:13 +01:00
Corey Salzano
14b5aaa0c9 Runs pint 2026-03-25 09:09:33 -04:00
Corey Salzano
aafcf147cf Updates the "create backup" test to handle the disk prefix. 2026-03-24 23:00:47 -04:00
mchev
7e8f9e65fb Merge pull request #580 from InvoiceShelf/translations
New Crowdin updates
2026-03-24 12:27:36 +01:00
mchev
67739750ca Merge pull request #582 from mchev/master
Hot fix  #280
2026-03-24 12:26:27 +01:00
mchev
5f6a7b92bf Merge pull request #581 from swiffer/master
Import File facade in UpdateCommand
2026-03-24 12:26:00 +01:00
mchev
ff3cab570a Hot fix #280 2026-03-24 12:13:40 +01:00
Darko Gjorgjijoski
11024ddc38 Update source file en.json 2026-03-24 09:30:45 +01:00
Matthias Wirtz
71303a1050 Import File facade in UpdateCommand
Added use statement for File facade.
2026-03-24 08:03:53 +01:00
Darko Gjorgjijoski
3af0e83d26 New translations en.json (Serbian (Latin)) 2026-03-24 07:44:53 +01:00
Darko Gjorgjijoski
a866a26e9f New translations en.json (Swahili) 2026-03-24 07:44:52 +01:00
Darko Gjorgjijoski
154a4dc076 New translations en.json (Malay) 2026-03-24 07:44:51 +01:00
Darko Gjorgjijoski
7900e020f5 New translations en.json (Hindi) 2026-03-24 07:44:50 +01:00
Darko Gjorgjijoski
974efb36da New translations en.json (Latvian) 2026-03-24 07:44:49 +01:00
Darko Gjorgjijoski
45d84b8b3c New translations en.json (Estonian) 2026-03-24 07:44:48 +01:00
Darko Gjorgjijoski
fdfb46ed79 New translations en.json (Croatian) 2026-03-24 07:44:46 +01:00
Darko Gjorgjijoski
ddcef0fb2c New translations en.json (Thai) 2026-03-24 07:44:45 +01:00
Darko Gjorgjijoski
0254b16556 New translations en.json (Bengali) 2026-03-24 07:44:44 +01:00
Darko Gjorgjijoski
a9a52ca85f New translations en.json (Persian) 2026-03-24 07:44:43 +01:00
Darko Gjorgjijoski
708d880b52 New translations en.json (Indonesian) 2026-03-24 07:44:42 +01:00
Darko Gjorgjijoski
57406989d4 New translations en.json (Portuguese, Brazilian) 2026-03-24 07:44:41 +01:00
Darko Gjorgjijoski
5d7e46b026 New translations en.json (Vietnamese) 2026-03-24 07:44:39 +01:00
Darko Gjorgjijoski
8e034e59f8 New translations en.json (Urdu (Pakistan)) 2026-03-24 07:44:38 +01:00
Darko Gjorgjijoski
43951d4542 New translations en.json (Chinese Traditional) 2026-03-24 07:44:37 +01:00
Darko Gjorgjijoski
3cc0f41d8c New translations en.json (Chinese Simplified) 2026-03-24 07:44:36 +01:00
Darko Gjorgjijoski
5f34ae558c New translations en.json (Ukrainian) 2026-03-24 07:44:35 +01:00
Darko Gjorgjijoski
70d51d580d New translations en.json (Turkish) 2026-03-24 07:44:34 +01:00
Darko Gjorgjijoski
b7929672fb New translations en.json (Swedish) 2026-03-24 07:44:32 +01:00
Darko Gjorgjijoski
bd28849a9f New translations en.json (Albanian) 2026-03-24 07:44:31 +01:00
Darko Gjorgjijoski
4d21aadcd4 New translations en.json (Slovenian) 2026-03-24 07:44:30 +01:00
Darko Gjorgjijoski
373a824fdb New translations en.json (Slovak) 2026-03-24 07:44:29 +01:00
Darko Gjorgjijoski
a5d9a60d5c New translations en.json (Russian) 2026-03-24 07:44:28 +01:00
Darko Gjorgjijoski
2537b53506 New translations en.json (Portuguese) 2026-03-24 07:44:27 +01:00
Darko Gjorgjijoski
bbc2d2088a New translations en.json (Polish) 2026-03-24 07:44:25 +01:00
Darko Gjorgjijoski
5734a06ab3 New translations en.json (Norwegian) 2026-03-24 07:44:24 +01:00
Darko Gjorgjijoski
75a1038245 New translations en.json (Dutch) 2026-03-24 07:44:23 +01:00
Darko Gjorgjijoski
017691b7b1 New translations en.json (Macedonian) 2026-03-24 07:44:22 +01:00
Darko Gjorgjijoski
d4f8a40982 New translations en.json (Lithuanian) 2026-03-24 07:44:21 +01:00
Darko Gjorgjijoski
ebdee1e3f0 New translations en.json (Georgian) 2026-03-24 07:44:20 +01:00
Darko Gjorgjijoski
ce97a474f9 New translations en.json (Japanese) 2026-03-24 07:44:18 +01:00
Darko Gjorgjijoski
4ee3d0d129 New translations en.json (Italian) 2026-03-24 07:44:17 +01:00
Darko Gjorgjijoski
bd5abdec0e New translations en.json (Hungarian) 2026-03-24 07:44:16 +01:00
Darko Gjorgjijoski
995533974e New translations en.json (Hebrew) 2026-03-24 07:44:15 +01:00
Darko Gjorgjijoski
156e94f931 New translations en.json (Finnish) 2026-03-24 07:44:14 +01:00
Darko Gjorgjijoski
e38c4963ef New translations en.json (Greek) 2026-03-24 07:44:13 +01:00
Darko Gjorgjijoski
d7efbb5c47 New translations en.json (German) 2026-03-24 07:44:11 +01:00
Darko Gjorgjijoski
3cd219e7b3 New translations en.json (Danish) 2026-03-24 07:44:10 +01:00
Darko Gjorgjijoski
3d65a09038 New translations en.json (Czech) 2026-03-24 07:44:09 +01:00
Darko Gjorgjijoski
f52c376a49 New translations en.json (Catalan) 2026-03-24 07:44:08 +01:00
Darko Gjorgjijoski
5a7c1363ee New translations en.json (Bulgarian) 2026-03-24 07:44:07 +01:00
Darko Gjorgjijoski
2c40c2ef06 New translations en.json (Arabic) 2026-03-24 07:44:06 +01:00
Darko Gjorgjijoski
b5ff16c318 New translations en.json (Spanish) 2026-03-24 07:44:04 +01:00
Darko Gjorgjijoski
4d7b818d23 New translations en.json (French) 2026-03-24 07:44:03 +01:00
Darko Gjorgjijoski
b314ebc07f New translations en.json (Romanian) 2026-03-24 07:44:02 +01:00
mchev
254ed5ade0 Merge pull request #579 from mchev/upgrade_requirements
PHP8.4 requirement
2026-03-24 07:15:33 +01:00
mchev
40e4ea931e PHP8.4 requirement 2026-03-24 07:07:41 +01:00
mchev
030c13b67a Merge pull request #578 from mchev/updates
Laravel 13 upgrade, security updates and fixes
2026-03-24 06:36:47 +01:00
mchev
28fedead6c Merge pull request #566 from InvoiceShelf/translations
New Crowdin updates
2026-03-24 06:14:11 +01:00
mchev
14ccce1934 Merge pull request #572 from klittle81/payment-pdf-invoice-details
Update receipt PDF to include Invoice Total, Balance Due, and Invoice Status
2026-03-24 06:13:15 +01:00
mchev
2d808f17bb Merge pull request #573 from csalzano/fix/dropbox-file-disk-creation
Bug fix in Dropbox file disk creation. Applies disk path.
2026-03-24 05:32:44 +01:00
mchev
6d227fa368 Merge pull request #554 from csalzano/fix/paginated-table-stale-response
Fix wrong customer names on invoice list page 2+
2026-03-23 20:18:26 +01:00
mchev
07757e747e Addresses SSRF risk 2026-03-21 19:14:51 +01:00
mchev
d4e19646ee fix(ci): install deps on PHP 8.4 (Symfony 8 requires >=8.4) 2026-03-21 19:03:37 +01:00
mchev
c901114fc0 Pint 2026-03-21 18:59:53 +01:00
mchev
186ab35fd4 Laravel 13 upgrade, updates and fixes 2026-03-21 18:53:33 +01:00
Corey Salzano
3c31baf20d fix(backup): remote disk backups never appear in backup listing
Three bugs prevented backups stored on remote disks (Dropbox, S3, etc.)
from ever appearing in the Settings > Backup listing:

1. Typo in BackupSetting.vue: `filed_disk_id` was sent to the API
   instead of `file_disk_id`, so the backend never received the selected
   disk ID and always fell back to the local filesystem.

2. Wrong default disk selection in loadDisksData(): `set_as_default == 0`
   selected the first disk that is NOT default (local_public), instead of
   the disk that IS default. Changed to `set_as_default == 1` with a
   fallback to the first disk.

3. BackupsController::index() did not call setConfig() on the FileDisk
   before querying backups, so even when the correct file_disk_id arrived
   it still read from the default local filesystem. Added the same disk
   bootstrap logic already present in CreateBackupJob and destroy().

Made-with: Cursor
2026-03-17 19:32:40 -04:00
Darko Gjorgjijoski
c7485930a8 New translations en.json (Romanian) 2026-03-15 18:17:11 +01:00
Darko Gjorgjijoski
c7d06671d6 New translations en.json (Romanian) 2026-03-15 17:11:09 +01:00
Corey Salzano
b35bd0880a Bug fix in Dropbox file disk creation. Applies disk path. 2026-03-03 11:47:55 -05:00
klittle81
c70e2abf8a Apply suggestion from @klittle81
remove the <br> at end as its not needed
2026-02-27 22:43:40 -05:00
klittle81
fc05cf61fa Patch to update reciept PDF generated by payment.blade.php to include Invoice Total, Balance Due, and Invoice Status 2026-02-27 22:06:27 -05:00
Rihards Simanovičs
48abd9020d docs(SECURITY.md): revise security vulnerability reporting instructions
Updated contact information to include GWS security email and added Discord outreach option for reporting vulnerabilities.
2026-02-27 16:35:06 +00:00
Darko Gjorgjijoski
9afd4011a6 New translations en.json (Hindi) 2026-02-25 12:16:09 +01:00
Corey Salzano
01528d9ebe Fix wrong customer names on invoice list page 2+
On the invoices list, when viewing page 2 or later, customer names in the
table could be wrong—opening an invoice showed a different customer than
the one displayed in that row.

Ensure we only apply API responses that match the currently requested page.
This prevents stale or out-of-order responses from overwriting the displayed
data. Also use row id as v-for key for correct Vue reconciliation.
2026-02-16 11:57:36 -05:00
Alex
a386fd19fc Merge remote-tracking branch 'upstream/master' into email-backup 2026-02-15 12:37:13 +02:00
Darko Gjorgjijoski
d20f1aa105 New Crowdin updates (#539)
* Update source file en.json

* New translations en.json (Slovak)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (Danish)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Georgian)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Norwegian)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Russian)

* New translations en.json (Slovenian)

* New translations en.json (Albanian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Urdu (Pakistan))

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Bengali)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Estonian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Malay)

* New translations en.json (Swahili)

* New translations en.json (Serbian (Latin))

* Update source file en.json
2026-02-08 17:34:06 +01:00
Alex
e5f6984078 Apply review feedback 2026-02-06 16:17:57 +02:00
Abdulrazzaq Alhendi
65d1fdd3f0 feat(mail): add CC and BCC fields to email requests and forms (#466)
* feat(mail): add CC and BCC fields to email requests and forms

* chore: fmt
2026-02-06 01:59:38 +01:00
Darko Gjorgjijoski
796f6f364a New Crowdin updates (#481)
* New translations en.json (Norwegian)

* New translations en.json (Croatian)

* New translations en.json (French)

* New translations en.json (Arabic)

* New translations en.json (Dutch)

* New translations en.json (Dutch)

* New translations en.json (Dutch)

* New translations en.json (Chinese Simplified)

* New translations en.json (Dutch)

* New translations en.json (Spanish)

* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (Romanian)

* New translations en.json (Dutch)

* New translations en.json (Romanian)

* New translations en.json (Romanian)

* New translations en.json (Swedish)

* New translations en.json (Bulgarian)

* New translations en.json (Bulgarian)

* New translations en.json (Bulgarian)

* New translations en.json (Bulgarian)

* New translations en.json (Slovenian)

* New translations en.json (Slovenian)

* New translations en.json (Italian)

* New translations en.json (Bengali)

* New translations en.json (Slovak)
2026-02-06 01:53:49 +01:00
Radoš
61b345d473 chore: lang - cs.json (#490)
Wrong translation for tax_id
2026-02-06 01:44:03 +01:00
Darko Gjorgjijoski
a30b2e751b Pin PHP version to 8.4 in development Dockerfile 2026-02-06 00:57:13 +01:00
Devstack
af205acb75 Fix aggregates for customers using withSum() (SQL-portable, no DB mode tweaks) (#486)
* Update CustomersController.php

Fix: replace GROUP BY + SUM join with withSum() to avoid ONLY_FULL_GROUP_BY; no API changes (same aliases)

* Update CustomersController.php

style: apply Laravel Pint formatting
2026-01-01 22:43:52 +01:00
Ahmed Ashraf
24546aea3c New currency: Qatari Riyal (#476)
* add qatari riyal currency to migration and seeder

* run pint
2026-01-01 17:50:31 +01:00
Alex
d2953e9409 Overrite the email notification for backup 2025-11-05 19:14:55 +02:00
Darko
935fe06f9e Bump version 2025-09-19 15:50:54 +02:00
Darko Gjorgjijoski
18d63a3375 Configurations cleanup & database configurations for mail and pdfs (#479)
* Move Mail, PDF configuration to Database, standardize configurations

* Set default currency to USD on install

* Pint code
2025-09-19 15:42:53 +02:00
Darko Gjorgjijoski
3da86965e1 New Crowdin updates (#454)
* New translations en.json (French)

* New translations en.json (Norwegian)

* New translations en.json (Norwegian)

* New translations en.json (Norwegian)

* New translations en.json (Norwegian)

* New translations en.json (Norwegian)

* New translations en.json (Norwegian)

* New translations en.json (Italian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Norwegian)

* New translations en.json (Danish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Georgian)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Urdu (Pakistan))

* New translations en.json (Bengali)

* New translations en.json (Estonian)

* New translations en.json (Malay)

* New translations en.json (Swahili)

* New translations en.json (Portuguese)

* New translations en.json (Albanian)

* Update source file en.json
2025-09-13 16:42:20 +02:00
Darko Gjorgjijoski
5aa54dbd86 Fix docker asset url (#472) 2025-09-08 17:52:33 +02:00
Darko Gjorgjijoski
58b262fe32 Fix path to sqlite.empty.db in setup script 2025-09-08 14:19:59 +02:00
lupus
f8c4e63b3f Fix: broken file links for development files (#469)
* FIx broken file links for development files

* Fix: Compose Files Context / Paths / Networks
2025-09-07 14:16:39 +02:00
Darko Gjorgjijoski
78dfdbe162 Devenv subcommands for test / format (#462)
* Add devenv subcommands for test / format

* Rename dev-env-config to devenvconfig for consitency sake
2025-09-02 03:32:21 +02:00
Darko Gjorgjijoski
770da45dbf Production docker improvements (#463)
* Update production dockerfiles for testing

* Add bash, nano and remove unecessary sqlite3 alpine package
2025-09-02 03:27:26 +02:00
Christos Yiakoumettis
3e96297699 Add expense number at Expenses (#406)
* add expense number at expenses

* Re-order expense fields

* Rename expense_number migration

* Add expense_number to tests

---------

Co-authored-by: Darko Gjorgjijoski <dg@darkog.com>
2025-09-02 03:20:27 +02:00
Rihards Simanovičs
f3e49d3044 Temperately hide modules tab while Module Management is developed (#443)
* fix(navigation): temperately hide modules tab while Module Management is developed

* chore run pint
2025-09-02 01:30:53 +02:00
Darko Gjorgjijoski
05ab78942c Update JS dependencies 2025-09-01 20:58:43 +02:00
Rihards Simanovičs
827436af15 chore: Ignore devcontainer dir (#460) 2025-09-01 13:00:38 +02:00
Darko Gjorgjijoski
233d3cb989 Update readme.md 2025-09-01 12:07:15 +02:00
Darko Gjorgjijoski
8842d6a626 Development Environment (#459)
* Fix SQLite docker build related issues

* Add devenv for development
2025-09-01 11:47:58 +02:00
Darko Gjorgjijoski
f1635bcef8 Fix SQLite docker build related issues (#458) 2025-09-01 02:42:07 +02:00
Darko Gjorgjijoski
3d327a1735 Add SQLite command line utility to docker images 2025-08-31 21:35:15 +02:00
Darko Gjorgjijoski
a6ce294497 Update sqlite path 2025-08-31 20:57:45 +02:00
Darko Gjorgjijoski
1998d15b25 Fix repository name 2025-08-31 16:18:29 +02:00
Darko Gjorgjijoski
f47b6d51f2 GitHub Actions Tweaks (#457)
* Remove PHP 8.2 from tests

* Fix docker hub repository name

* Improve action labels

* Ignore .github folder from check CI
2025-08-31 16:13:18 +02:00
Darko Gjorgjijoski
23f6b1877f 🚢 Simplified docker builds (#456)
* Simplify docker builds

* Ignore docker and frontend scripts from PHP related checks

* Update docker development setup
2025-08-31 15:07:22 +02:00
Darko Gjorgjijoski
3ed91545d1 Bump version 2025-08-31 03:27:33 +02:00
Calcen
c035c834d4 Fix: Weird gap in invoice items description (#439)
- Ensure invoice item display is block for better layout. 
- Gets rid of the weird extra gap between last line and the line above it.
2025-08-31 03:23:58 +02:00
lupus
4f34ca783b Fix: Actually display company currency symbol / total receipts for customer charts (#453)
* Fix: Actually display company currency symbol for customer charts

Related to draft #403.
The mentioned pull request was incomplete, the current state would show amounts in base currency but not use the base/company currency symbols/notation. This change addresses the issue.

* Fix: Use totalReceipts for "Receipts" value
2025-08-31 03:13:16 +02:00
Darko Gjorgjijoski
bae8dbe083 Upgrade mail configuration (#455)
* Upgrade the mail configuration

* Update mail configuration to match Laravel 12

* Update mail configuration to properly set none or null

* Pint code

* Upgrade Symfony Mailers
2025-08-31 03:04:31 +02:00
Tim van Osch
d1bca362de chore: Improve .dev dockerfile for development and production (#183)
* chore: update dockerfile and dev env

* chore(dockerfile): fix user/group id args

* chore(docker): use php-fpm w/ separate nginx

* chore(docker): add nginx image w/ static files

* chore(docker): build vite resources only once, bump vite minor version,
add watch yarn command.
By using --buildplatform tag in the dockerfile we can have the vite step
be built only on the host platform, which significantly speeds it up.
This is possible since the build assets aren't platform dependant.

* Move dockerfiles to .dev
2025-08-31 00:46:56 +02:00
lupus
d5137e393d Fix: Use amounts in base currency for customer charts (#403)
Previously, the customer chart used the total/amount fields to calculate net profits/expenses/etc.
If the currency the expense (for example) was created in differed from the base currency of the company, the chart would display wrong amounts.
This change addresses the issue by always using the base currency field.
2025-08-30 12:30:49 +02:00
Darko Gjorgjijoski
20caf7ef5b Add missing mailgun-mailer package for Mailgun email driver (#452) 2025-08-30 12:14:20 +02:00
Fabio Ribeiro
e8e01a706e Fix: Create item with tax (ItemModal) (#385)
The issue was found during an Item creation inside the Invoice,
Estimates or Recurring Invoice, the same fix that was applied into the
Item creation view, now is needed into ItemModal. The root cause is that
price + tax returns an amount as float making the database fail.

Relates #377
2025-08-30 11:38:04 +02:00
Darko Gjorgjijoski
2f8c98003d Fix language file conflicts (#451) 2025-08-30 01:36:13 +02:00
Darko Gjorgjijoski
02701db815 New Crowdin updates (#368)
* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Turkish)

* New translations en.json (Indonesian)

* New translations en.json (Russian)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Indonesian)

* New translations en.json (Catalan)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Simplified)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (German)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Slovak)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (German)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Arabic)

* New translations en.json (German)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Slovenian)

* New translations en.json (Italian)

* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (Italian)

* New translations en.json (Italian)

* New translations en.json (Italian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Norwegian)

* New translations en.json (Croatian)

* New translations en.json (Danish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Georgian)

* New translations en.json (Urdu (Pakistan))

* New translations en.json (Bengali)

* New translations en.json (Estonian)

* New translations en.json (Malay)

* New translations en.json (Swahili)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Portuguese)

* New translations en.json (Albanian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Portuguese)

* New translations en.json (Chinese Simplified)
2025-08-30 01:24:36 +02:00
Darko Gjorgjijoski
b7f17f2d14 Add common languages (#448)
* Update languages

* Update language list
2025-08-28 15:35:10 +02:00
Honza Raclavský
cf1d5e7324 Fix deprecated i18n api (#398) 2025-08-28 15:28:42 +02:00
Darko Gjorgjijoski
a40bf5840d Dynamically load language files (#446) 2025-08-28 15:19:51 +02:00
Darko Gjorgjijoski
32f7bc053a New currencies: Paraguayan Guaraní, Algerian Dinar (#447)
* feat(currency): add Algerian Dinar (DZD) support (#395)

* Add Paraguayan Guarany (PYG) currency  (#434)

* Adding Paraguayan currency, closes #404

* Adding the currency to the seeder too

* If the data was already seeded, don't add the entry

* Pint

---------

Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>

* Add DZD currency to the currencies seeder

---------

Co-authored-by: Polat İnceler <inceler.polat@gmail.com>
Co-authored-by: mchev <martin.chevignard@gmail.com>
2025-08-28 14:13:03 +02:00
Honza Raclavský
a006b07be5 fixed czech translates (#399) 2025-08-28 13:10:48 +02:00
Yes-Sebastian
a44303a370 Update de.json (#414)
Grammar in the German language is a bit tricky. The past tense has been corrected here.
2025-08-28 13:10:02 +02:00
Fabio Ribeiro
d69a56e2d5 feat: Tax included (#370)
* feat: Tax included

* Added a toggle switch in tax settings to enable the feature.
* Database migration adding tax_included field into estimates, invoices
  and recurring invoices table.
* Toggle switch to enable and store the tax_included by estimates,
  invoices and recurring invoices.
* In case of tax included enabled, total taxes will be recalculated and
  the invoices, estimates and recurring invoices total won't be sum with
  taxes.
* Apply tax included when discount_per_item/tax_per_item item is enabled.
* Custom component to show the net total when tax included is enabled.
* Update invoice and estimates pdfs with net total.

* chore: Tax included by default

A switch button inside the tax settings to enable the tax included by
default in invoices, estimates and recurring invoices.
2025-08-28 10:28:24 +02:00
Darko Gjorgjijoski
08e1bb2e22 Exclude .git directory from backups (#445)
* Exclude .git directory from backups

* Fix formatting
2025-08-28 10:02:06 +02:00
Darko Gjorgjijoski
29c15116bc Fix Adminer docker build (#444) 2025-08-28 10:01:50 +02:00
Loduis Madariaga Barrios
8e96d3e972 fix(csrf-token): add leading dot to session domain cookie. (#224)
* fix(csrf-token): add leading dot to session domain cookie.

* refactor: remove generate key, upgrade axios and keep session domain in null.

* refactor: fix PSR-12 code styles for PHP 8.2 compatibility.

---------

Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>
2025-08-28 09:44:34 +02:00
Fabio Ribeiro
bf0d98c69c fix: Backup Job (#375)
Since `laravel-backup` major version was updated 8 to 9, the backup
ability was compromised, the main reason is the change on the method
contract from `BackupFactory` that now the `createFromArray` no longer
exists.
2025-06-11 23:23:19 +02:00
Fabio Ribeiro
73d4ac1eb1 fix: Payment confirmation error (#376)
Error caused when using Payments module, when try Stripe redirects back
to InvoiceShelf, and the module calls the InvoiceShelf `generatePayment`.

Relates #369
2025-06-11 22:56:56 +02:00
Leo
e832c7661a Fix: Heroicons v1 leftovers (#374)
Change the getOrderBy's button. 
Using Heroicons v2

Change the SortAscendingIcon to BarsArrowUpIcon
Change the SortDescendingIcon to BarsArrowDownIcon
2025-06-11 22:48:01 +02:00
Fabio Ribeiro
b962bc9227 fix: Create item with tax (#377)
When the `tax-per-item` is enabled and also has a tax added, during the
item creation, the price + tax returns an amount as float making the
database fail. To fix this was necessary to round the result.
2025-05-22 10:48:34 +02:00
mchev
6d14dce668 Improving github workflow (#278)
* Improving workflow, updating dependencies and test pint with PHP 8.3, adding php 8.4 on tests

* Fix cache issue

* Not caching since it is not working
2025-05-04 15:22:43 +02:00
mchev
1ff220f0d8 Upgrading to Laravel 12 (#346)
* Upgrading to Laravel 12

* Upgrade lockfile

* Keep the old local filesystem driver base path

---------

Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>
Co-authored-by: Darko Gjorgjijoski <dg@darkog.com>
2025-05-04 11:04:01 +02:00
Darko Gjorgjijoski
2e77a76c7b New Crowdin updates (#345)
* New translations en.json (Portuguese, Brazilian)

* Update source file en.json

* New translations en.json (Czech)

* New translations en.json (Indonesian)

* New translations en.json (Lithuanian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Serbian (Latin))

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Turkish)

* New translations en.json (Romanian)

* New translations en.json (Indonesian)

* New translations en.json (Russian)

* New translations en.json (Turkish)

* New translations en.json (Romanian)

* New translations en.json (Indonesian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (Turkish)

* New translations en.json (Romanian)

* New translations en.json (Indonesian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))
2025-05-04 02:50:56 +02:00
mchev
bf5b544ca3 Adding Flat Tax support with fixed amount (#253)
* Possibility to set a fixed amount on tax types settings

* Pint and manage flat taxes on items

* Fix display errors and handle global taxes

* Tests

* Pint with PHP 8.2 cause with PHP 8.3 version it cause workflow error

* Merging percent and fixed amount into one column

* Now display the currency on SelectTaxPopup on fixed taxes
2025-05-04 02:24:56 +02:00
Darko Gjorgjijoski
546f75d3a6 Pint updated files (#367) 2025-05-04 02:23:51 +02:00
Tim van Osch
bf40f792c2 Feat(Gotenberg): Opt-in alternative pdf generation for modern CSS (#184)
* WIP(gotenberg): add pdf generation abstraction and UI

* feat(pdf): settings validate(clien+server) & save

* fix(gotenberg): Use correct default papersize
chore(gotengberg): Remove unused GOTENBERG_MARGINS env from .env

* style(gotenberg): fix linter/styling issues

* fix(pdf): use pdf config policy

* fix: revert accidental capitalization in mail config vue

* Update composer, remove whitespace typo

* Fix small typos

* fix cookie/env issue

* Add gotenberg to .dev, move admin menu item up
2025-05-04 02:10:15 +02:00
Fabio Ribeiro
8a9392e400 Fix: AWS SES Mailer (#365)
As reported on issue #357, the aws ses configuration was not able to
store because of the missing `ses` service config. Additionally was
added a `AWS Region` field to be used by the `ses`.

closes #357
2025-05-02 11:16:31 +02:00
mchev
14bfaff30b Fix security alert on axios 0.29 (#347) 2025-05-02 10:49:16 +02:00
Yannic Inselmann
b32c334a71 feat: default notes (#263)
* feat: default notes

* feat: include default invoice note in recurring invoice

* feat: use default export in tw config

* fix: test and naming

* fix: consistent ui for switch in note modal

* feat: little text improvements
2025-04-05 12:01:06 +02:00
mchev
2aa17513e1 Check version number on version.md file (#280) 2025-04-05 10:16:23 +02:00
mchev
ba243b28a9 Upgrade to Heroicons v2 (#281) 2025-04-05 02:11:12 +02:00
mchev
1bb65f420c Fix negative values on item price (#335)
* Fix negative values on item price

* Remove console log
2025-04-05 00:43:34 +02:00
Darko Gjorgjijoski
23a99758d2 New Crowdin updates (#308)
* New translations en.json (Chinese Traditional)

* New translations en.json (Czech)

* New translations en.json (Slovak)

* New translations en.json (Czech)

* New translations en.json (Czech)

* New translations en.json (French)

* New translations en.json (Czech)

* New translations en.json (Romanian)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Slovak)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (Spanish)

* New translations en.json (Japanese)

* New translations en.json (Polish)

* New translations en.json (Romanian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Traditional)

* New translations en.json (Macedonian)

* New translations en.json (Indonesian)

* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Russian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Swedish)

* New translations en.json (Arabic)

* New translations en.json (Czech)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Lithuanian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Czech)

* New translations en.json (Indonesian)

* New translations en.json (Lithuanian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (Spanish)
2025-04-05 00:42:24 +02:00
Rihards Simanovičs
139f8e2d13 Update Github issuepr templates (#341)
* chore(github): update bug report template

* chore(github): update feature request template

* chore(github): update code quality template

* chore(github): update issue selection menu config

* chore(github): update PR template

* chore(github): update PR template typo

* chore(github): remove one checklist item from PR template

* chore(github): update bug report to add a Docker check

* chore(github): update template formatting and links

* chore(github): final spell and grammar check of all issues and PR templates
2025-04-04 11:57:07 +02:00
Vid Čufar
ac1a582ecf fix: capitalise 'date' in PDF invoice due date label (#320) 2025-04-04 11:42:24 +02:00
mchev
6b168f36ec [HOTFIX] Customers names on table list issue #210 (#310)
* Fix customer dropdown

* Fix #250
2025-02-17 12:11:10 +01:00
Rihards Simanovičs
50b647e26e Merge pull request #318 from Pureball/translation
fix: en translation spelling
2025-02-17 10:45:46 +00:00
Pureball
57776b7c7d fix: en translation spelling 2025-02-17 10:40:38 +01:00
Darko Gjorgjijoski
8c343b4b92 New Crowdin updates (#304)
* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)
2025-02-05 11:10:06 +01:00
Darko Gjorgjijoski
a60cac3e66 Update version.md 2025-02-05 11:04:44 +01:00
mchev
6a0d3a3bcc Fix customer dropdown (#307) 2025-02-05 11:04:17 +01:00
Darko Gjorgjijoski
3e52b84fa8 New Crowdin updates (#279)
* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Spanish)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (German)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Japanese)
2025-02-01 10:41:49 +01:00
Darko Gjorgjijoski
d1f45a790b Bump version 2025-02-01 10:41:19 +01:00
Darko Gjorgjijoski
bec0c058a8 Bump version 2025-01-13 02:14:23 +01:00
Darko Gjorgjijoski
d862ee05e9 Refactor Custom Invoice/Estimate PDF Templates (#277)
* Add utility class for managing templates

* Register custom pdf template views location

* Update the make:template command to make use of PdfTemplateUtils

* Update PDF invoice/estimate template controllers

* Register pdf_templates filesystem disk

* Remove unused leftovers

* Reformat with pint
2025-01-13 01:20:13 +01:00
Darko Gjorgjijoski
12d9d6c801 Regenerate IDE Helper Assets (#274)
* Add back laravel/ui package

* Fix wrong Closure import

* Regenerate ide-helper files
2025-01-12 20:48:06 +01:00
Darko Gjorgjijoski
e9e52c60a7 Reformat with pint 2025-01-12 18:37:08 +01:00
Darko Gjorgjijoski
34b9f52af7 Upgrade Laravel and other third-party packages 2025-01-12 18:22:51 +01:00
Darko Gjorgjijoski
fcf64c0b26 Upgrade Vite, Vue and other thrid-party packages 2025-01-12 17:38:54 +01:00
Darko Gjorgjijoski
7e2d257f7d Update caniuse-lite package 2025-01-12 17:11:50 +01:00
Darko Gjorgjijoski
c617f7d169 Fix: PDF Template command (#272)
* Fix `make:template` command

* Fix issue related to Vite assets

* Reformat code

---------

Co-authored-by: Steven Rombauts <steven@kotuha.be>
2025-01-12 16:19:54 +01:00
Darko Gjorgjijoski
1804481fc6 New Crowdin updates (#262)
* New translations en.json (Indonesian)

* New translations en.json (Turkish)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Persian)

* New translations en.json (Chinese Traditional)

* Update source file en.json

* New translations en.json (Dutch)

* New translations en.json (Czech)

* New translations en.json (Indonesian)

* New translations en.json (Turkish)

* New translations en.json (Hindi)

* New translations en.json (Persian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Ukrainian)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Serbian (Latin))

* New translations en.json (Dutch)

* New translations en.json (Czech)

* New translations en.json (Indonesian)

* New translations en.json (Turkish)

* New translations en.json (Hindi)

* New translations en.json (Persian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Ukrainian)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Serbian (Latin))

* Update source file en.json
2025-01-12 15:09:28 +01:00
mchev
9bed81fe8f Handle demo version of the app (#256) 2025-01-12 13:56:52 +01:00
Darko Gjorgjijoski
f52b73f517 Invoice time support (#269)
* Changed invoice date to datetime

* Fixed code style errors

* Update TimeFormatsController.php

* Update TimeFormatter.php

* Update TimeFormatsController namespace

* Fix missing comma in language file

* Fix formatting

---------

Co-authored-by: troky <troky2001@yahoo.com>
2025-01-12 13:32:47 +01:00
Mohamed Safouan Besrour
32e03b98a3 Update CurrenciesTableSeeder.php (#258) 2025-01-12 11:42:12 +01:00
mchev
3f560a1de2 Add Amount Paid and Amount Due to Invoice PDF (#248)
* Display payment status on invoices

* Update en.json
2025-01-12 11:36:36 +01:00
mchev
ef9adbd6c9 Adding sent and viewed field to payload (#247) 2025-01-12 11:27:29 +01:00
Loduis Madariaga Barrios
969cbe9ad8 fix: update company info on array of companies. (#227) 2025-01-12 11:02:58 +01:00
Darko Gjorgjijoski
6031f0dbdd Module paths (#268)
* refactor: Update file paths for stub files for module creation (#144)

---------

Co-authored-by: Dominik Hendrix <dominik.hendrix@g-fittings.com>

* Revert unrelated change

---------

Co-authored-by: Dominik Hendrix <all@dhendrix.de>
Co-authored-by: Dominik Hendrix <dominik.hendrix@g-fittings.com>
2025-01-12 10:49:04 +01:00
Loduis Madariaga Barrios
06a71fc7b3 fix: Corrects and simplifies password visibility icon logic. (#222) 2025-01-12 10:48:34 +01:00
Darko Gjorgjijoski
fd1c7be1f8 New Crowdin updates (#241)
* New translations en.json (Slovak)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Indonesian)

* New translations en.json (German)

* New translations en.json (Arabic)

* New translations en.json (Arabic)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Dutch)

* New translations en.json (Czech)

* New translations en.json (Czech)
2025-01-05 12:06:14 +01:00
Darko Gjorgjijoski
c466d51fe0 New Crowdin updates (#235)
* New translations en.json (Swedish)

* New translations en.json (Croatian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Ukrainian)

* New translations en.json (Slovak)

* New translations en.json (Romanian)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Slovenian)

* New translations en.json (Turkish)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))
2024-12-03 18:39:00 +01:00
OniriCorpe
e8dccb178b Specifying that a custom frequency should be in the cron format (#231) 2024-12-03 15:27:21 +01:00
Darko Gjorgjijoski
f5b36d7e6c New Crowdin updates (#232)
* New translations en.json (French)

* New translations en.json (Croatian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Ukrainian)

* New translations en.json (Slovak)
2024-12-03 15:27:09 +01:00
OniriCorpe
a32bbb6268 Fixes receipt view (#234)
The #185 modifications were also necessary here
2024-12-03 15:26:05 +01:00
Darko Gjorgjijoski
9599814ae5 New Crowdin updates (#225)
* New translations en.json (Swedish)

* New translations en.json (Croatian)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Croatian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (French)
2024-11-29 21:29:22 +01:00
Darko Gjorgjijoski
0d14da93d0 New Crowdin updates (#221)
* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Greek)

* New translations en.json (Greek)
2024-11-18 01:21:13 +01:00
Loduis Madariaga Barrios
298c170867 feat(infrastructure): improve htaccess configuration. (#214) 2024-11-17 00:18:35 +01:00
Rihards Simanovičs
b49228eabf chore: Update Issue Template (#215)
* chore: update issue template

Signed-off-by: Rihards Simanovics <rihards.s@griffin-web.studio>

* chore: correct spelling in issue template

Signed-off-by: Rihards Simanovics <rihards.s@griffin-web.studio>

* fix: adjust render for some textarea fields and add a reproduction step

* fix: remove render from markdown fields

looks like github gets confused as all textarea fields are markdown by the default

* style: add comments and correct labels

* feat(github): add code quality issue template

* refactor: remove direct references to Files

From template fields, descriptions, and placeholders

* refactor(github): convert feature request template to issue form

---------

Signed-off-by: Rihards Simanovics <rihards.s@griffin-web.studio>
2024-11-17 00:18:18 +01:00
Darko Gjorgjijoski
99ada6fbcc New Crowdin updates (#217)
* New translations en.json (Japanese)

* New translations en.json (Japanese)
2024-11-17 00:17:37 +01:00
Darko Gjorgjijoski
ed4a59574c Customer tax id validation (#220)
* Remove tax_id validation

* Remove validation leftovers
2024-11-17 00:17:25 +01:00
Darko Gjorgjijoski
be2e1df442 Add 'Database Overwrtie' during install for SQLite type (#219) 2024-11-17 00:07:44 +01:00
Darko Gjorgjijoski
ddca5a7b6d New translations en.json (Dutch) (#211) 2024-11-11 12:24:48 +01:00
Darko Gjorgjijoski
51d001aa0f New Crowdin updates (#209)
* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Turkish)
2024-11-09 21:39:07 +01:00
Darko Gjorgjijoski
5d817b5c45 Ignore the translations branch from CI 2024-11-09 15:22:23 +01:00
Ali Çömez | Slaweally
ac2c73829c Update tr.json (#205) 2024-11-09 15:01:57 +01:00
Loduis Madariaga Barrios
317f763a85 chore(wizard): add missing translations for Spanish version in setup wizard (#207) 2024-11-09 14:38:20 +01:00
Joël Kuijper
e112ed5875 Add missing dutch translations (#208) 2024-11-09 14:38:02 +01:00
Darko Gjorgjijoski
84c10264ed Add missing strings lost in merge (#200)
Issue #199
2024-11-02 21:47:22 +01:00
Darko Gjorgjijoski
b143642056 New Crowdin updates (#188)
* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Croatian)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Spanish)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (German)

* New translations en.json (Japanese)

* New translations en.json (Spanish)

* New translations en.json (Croatian)

* New translations en.json (Spanish)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (German)

* New translations en.json (Croatian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json
2024-11-02 12:49:04 +01:00
mchev
967c225df9 Merge pull request #198 from mchev/invoice_cancellation
Support for Zero and Negative Item Quantities on Invoices
2024-11-02 12:20:55 +01:00
mchev
e1a0a2d8e4 Merge pull request #138 from IDerr/develop
Add VAT and Tax into PDF Trait
2024-11-02 12:19:43 +01:00
mchev
748168ffa5 Merge pull request #189 from loduis/master
enhance(wizard): update translations, refine icons, and add automated…
2024-11-02 10:36:52 +01:00
mchev
4db243e136 Merge branch 'master' into master 2024-11-02 10:31:53 +01:00
mchev
bc0c8d5348 Merge pull request #166 from mchev/customer_tax_id
Include a Tax ID field in both customer creation and invoices
2024-11-02 10:28:49 +01:00
mchev
6583569b1c Merge pull request #190 from mchev/issue_71
Refactor editor and allow links
2024-11-02 10:28:30 +01:00
mchev
134c99369e Merge pull request #186 from mchev/issue_181
Fix table data not refreshing properly (keys)
2024-11-02 10:28:12 +01:00
Loduis Madariaga
f2ae4e17c8 enhance(wizard): update translations, refine icons, and add automated requirement verification 2024-10-17 07:24:17 -05:00
Martin Chevignard
4ff62c0adf Refactor editor and allow links 2024-10-17 11:16:11 +02:00
Darko Gjorgjijoski
2604db32ce New Crowdin updates (#154)
* New translations en.json (Spanish)

* New translations en.json (Finnish)

* New translations en.json (French)

* New translations en.json (German)

* New translations en.json (Romanian)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (Greek)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Russian)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Japanese)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Spanish)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Slovak)

* New translations en.json (Swedish)

* New translations en.json (Vietnamese)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovenian)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (Japanese)

* New translations en.json (Japanese)
2024-10-16 15:18:26 +02:00
Darko Gjorgjijoski
01d32d50b5 Exclude crowdin branch from workflows 2024-10-16 00:54:02 +02:00
SalvaGR
0c86563375 fix: missing values in en.json translation (#179) 2024-10-15 20:53:08 +02:00
mchev
33c2949a7b Fix carbon int val (#185) 2024-10-15 20:51:17 +02:00
mchev
547a2be0a3 Update readme.md 2024-10-15 19:14:55 +02:00
Martin Chevignard
59b43fa258 Public Invoice View fix 2024-10-15 17:55:56 +02:00
Martin Chevignard
168b741936 Upadate filters with laravel best practices 2024-10-15 16:20:04 +02:00
SpeedX
022769ba38 Fix Logo render in Payment PDF (#162)
* Fix logo render in Payment PDF

* Fix CSS to make it consistent with other templates
2024-10-14 11:47:10 +02:00
mchev
068f48568e Fix carbon dates on custom fields value (#178) 2024-10-11 13:17:01 +02:00
Martin Chevignard
03b9defeb1 Customers tax id field 2024-10-04 12:07:29 +02:00
mchev
dd98df1c77 Fix long text on dropdown items (#157) 2024-09-30 20:15:56 +02:00
Darko Gjorgjijoski
c8c75a6aa7 New Crowdin updates (#85)
* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Dutch)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Swedish)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Dutch)

* New translations en.json (Swedish)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Vietnamese)

* New translations en.json (Slovak)

* New translations en.json (Vietnamese)

* New translations en.json (Slovak)

* New translations en.json (Slovak)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (German)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Finnish)

* New translations en.json (French)

* New translations en.json (German)

* Update source file en.json

* New translations en.json (Spanish)

* New translations en.json (Finnish)

* New translations en.json (French)

* New translations en.json (German)

* New translations en.json (Romanian)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Czech)

* New translations en.json (Greek)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Lithuanian)

* New translations en.json (Macedonian)

* New translations en.json (Dutch)

* New translations en.json (Polish)

* New translations en.json (Russian)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Thai)

* New translations en.json (Croatian)

* New translations en.json (Latvian)

* New translations en.json (Hindi)

* New translations en.json (Serbian (Latin))
2024-09-24 19:51:47 +02:00
Darko Gjorgjijoski
5ece0f43c0 Bump version 2024-09-24 19:05:06 +02:00
Darko Gjorgjijoski
91962f43b2 Add additional language and bump sqlite version 2024-08-04 21:40:15 +02:00
Darko Gjorgjijoski
50613fcff0 Remove unecessary debug calls 2024-08-04 19:50:14 +02:00
Darko Gjorgjijoski
468aec6bc1 Fix partially paid status appearing after invoice update 2024-08-04 19:45:08 +02:00
Darko Gjorgjijoski
c799149d2d Improved logo display in Invoice/Estimate PDFs 2024-08-04 16:08:22 +02:00
Darko Gjorgjijoski
c9e85f18da Merge branch 'develop' into pdf-templates-logo 2024-08-04 15:17:09 +02:00
Darko Gjorgjijoski
9a46f892ab Add support for release channels (insider release channel) in Updater 2024-08-04 03:04:10 +02:00
Darko Gjorgjijoski
bcb89bc9ae Ignore .dev/docker-compose.yml to allow devs to customize one of those 2024-08-04 02:39:20 +02:00
Darko Gjorgjijoski
fbac9abbc5 Expose port 5173 for the Dev environment 2024-08-04 02:38:02 +02:00
Darko Gjorgjijoski
f16b4df44a Remove extensions from composer 2024-08-01 20:48:12 +02:00
Darko Gjorgjijoski
f82937e85e Set app version on install and updates 2024-08-01 19:39:47 +02:00
jacobi petrucciani
f10154539e fix logo rendering in pdf output for invoices 2024-07-31 14:22:48 -04:00
Darko Gjorgjijoski
a64701bda5 Set SESSION_DRIVER to file by default 2024-07-29 14:24:48 +02:00
Darko Gjorgjijoski
da600d0144 Add database overwrite checkbox on Install wizard
Allows overwriting the existing database when installing InvoiceShelf
2024-07-29 14:21:34 +02:00
Darko Gjorgjijoski
56a555bc4a Fix installer wizard step highlighting 2024-07-29 14:06:21 +02:00
Darko Gjorgjijoski
6422da193b Improve .dev/php/entrypoint permissions setting 2024-07-29 13:01:43 +02:00
Darko Gjorgjijoski
cc39f37b12 Update axios and vite 2024-07-29 13:00:54 +02:00
Darko Gjorgjijoski
f95d03f281 Fix "declarations that appear after nested rules" deprecation warning 2024-07-29 12:55:29 +02:00
Darko Gjorgjijoski
4b9052079f Update docker context for the php image 2024-07-28 17:45:06 -07:00
Darko Gjorgjijoski
bf5f95d29d Update file line ending format 2024-07-28 17:44:22 -07:00
Darko Gjorgjijoski
53343c64eb Update migrations formatting & namespace 2024-07-28 23:14:34 +02:00
Darko Gjorgjijoski
dfc4b1982e Update namespace on 1.x migration 2024-07-28 23:13:53 +02:00
Darko Gjorgjijoski
8dd9d0c414 Consolidate migrations v2.0 should go after v1.x 2024-07-28 22:46:45 +02:00
Darko Gjorgjijoski
84a6181240 Merge master 2024-07-28 22:43:02 +02:00
Darko Gjorgjijoski
25fb260cd7 Update local links 2024-07-28 21:07:48 +02:00
Darko Gjorgjijoski
17082ea8c8 Improvements to SQLite dev setup 2024-07-28 21:02:49 +02:00
Darko Gjorgjijoski
c4ade42a8f Update dev readme 2024-07-28 21:02:00 +02:00
Darko Gjorgjijoski
314abe4cc6 Add node and exif & update entrypoint 2024-07-28 19:54:07 +02:00
Darko Gjorgjijoski
45ff9c89a8 Add development environment 2024-07-28 17:25:32 +02:00
Darko Gjorgjijoski
9df5b306a2 Make artisan file executable 2024-07-28 17:24:57 +02:00
Darko Gjorgjijoski
310d05eab1 Set backup to point to the default database connection 2024-07-28 17:24:44 +02:00
Darko Gjorgjijoski
f986454084 Set backup to point to the default database connection 2024-07-28 17:22:40 +02:00
mchev
0c0de64549 Updated download link 2024-07-27 09:49:57 +02:00
Darko Gjorgjijoski
19bf467068 Add "none" as choice for MAIL_ENCRYPTION settings/install that translates to =NULL 2024-07-21 10:42:00 +02:00
Darko Gjorgjijoski
532a044bb9 Add APP_NAME in .env.example 2024-07-18 09:00:00 +02:00
mchev
948e9ea814 Delete CONTRIBUTING.md 2024-07-17 15:55:34 +02:00
mchev
1bd33b8b1b Create CONTRIBUTING.md 2024-07-17 15:50:22 +02:00
mchev
b06cc46eaf Create CONTRIBUTING.md 2024-07-17 12:37:33 +02:00
mchev
c8439d859d Add cache and queue tables migrations (#121)
* Add cache and queue tables migrations
2024-07-17 12:06:04 +02:00
Darko Gjorgjijoski
a866187f71 Add default cache and queue configs 2024-07-17 11:32:42 +02:00
Darko Gjorgjijoski
e212714c63 Pint 2024-07-13 15:19:00 +02:00
Darko Gjorgjijoski
429a8ae826 Add sqlite3 into the php requirements 2024-07-13 15:18:30 +02:00
Darko Gjorgjijoski
94cfe55555 Add sqlite3 validation 2024-07-13 15:18:10 +02:00
Darko Gjorgjijoski
ad9d08c43c Create empty SQLite database if it doesn't exist 2024-07-13 15:12:54 +02:00
Darko Gjorgjijoski
27a511bc09 Update version
[ci-skip]
2024-07-13 03:11:14 +02:00
Darko Gjorgjijoski
1317d57ef8 Update readme.md 2024-07-13 03:07:18 +02:00
Darko Gjorgjijoski
ba85f407d6 Revert "Add version.md file"
This reverts commit 75b0c264dc.
2024-07-13 02:49:02 +02:00
Darko Gjorgjijoski
b37019f845 Set the default database to SQLite 2024-07-13 02:29:20 +02:00
Darko Gjorgjijoski
75b0c264dc Add version.md file 2024-07-13 02:14:41 +02:00
Darko Gjorgjijoski
98852686c7 Add doctrine/dbal and run pint 2024-07-13 02:03:22 +02:00
Darko Gjorgjijoski
a907f8c932 Set the default database to be SQLite 2024-07-12 17:13:54 +02:00
Darko Gjorgjijoski
53866f721c Require dbal as dependency for migrations that changing columns 2024-07-12 12:37:04 +02:00
Darko Gjorgjijoski
9c0d79bf59 Add app version 2024-07-12 03:08:07 +02:00
Darko Gjorgjijoski
33076dc240 Update makefile 2024-07-11 14:10:40 +02:00
Darko Gjorgjijoski
de126465a8 Update code style (pint) 2024-07-11 13:42:43 +02:00
Darko Gjorgjijoski
9317751de9 Remove duplicate SESSION_DOMAIN 2024-07-11 13:37:31 +02:00
Darko Gjorgjijoski
24ba33fd02 Update /installation/languages controller namespace 2024-07-11 13:36:57 +02:00
mchev
9fcf3792c7 Translate recurring invoice subject (#110)
* Translate recurring invoice subject
2024-06-25 19:44:23 +02:00
mchev
2c9f81c571 Merge pull request #109 from mchev/customer-portal
Fix CompanySetting not being imported in BootstrapController
2024-06-20 14:56:56 +02:00
mchev
0af379909d Merge pull request #108 from mchev/updating_other_stored_namespaces
Adding new field to update #107
2024-06-20 14:56:45 +02:00
mchev
680e105f1b Fix CompanySetting not imported in BootstrapController 2024-06-16 21:58:16 +02:00
mchev
210f735e40 Adding new field to update #107 2024-06-16 21:35:55 +02:00
mchev
a0bf6f7f59 Replacing model_type in database (#100)
* Replacing model_type in database

* Also update old Crater namespace
2024-06-07 12:10:57 +02:00
mchev
bb8258036a Clone estimates (#97)
* Clone estimates

* Clone estimate test feature

* Resolve namespace

* Fix string to int for Carbon

* Fix homes routes and default queue key

* Move dropdown item below View and use the propper translation key
2024-06-06 12:16:41 +02:00
mchev
14c599ed4f Allow decimals on items quantities (#94)
* Allow decimals on items quantities #80

* Updating all requests validation

* Revert discount_val
2024-06-05 15:10:36 +02:00
mchev
592a537379 Replace fixed text length with css line-clamp (#96) 2024-06-05 14:36:32 +02:00
mchev
bf5a8cdb28 Increasing base total validation limit for IDR currency (#98) 2024-06-05 12:16:09 +02:00
Darko Gjorgjijoski
96e2f6cf0f Run pint 2024-06-05 12:09:04 +02:00
agencetwogether
3b61440e1f Complete dashboard translations & small UI improvements (#69)
* fix dropdown action Estimate Dashboard and fix translating full Dasboard page

* Update app.php

* fix locale in app.php config

* Wizard install with translation, customer portal with translation, and fixing hardcoding strings to get translation

* fixes asked to review

* fixes pint

---------

Co-authored-by: Max <contact@agencetwogether.fr>
Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>
2024-06-05 12:07:46 +02:00
mchev
3259173066 Laravel 11 (#84)
* Convert string references to `::class`

PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.

* Use Faker methods

Accessing Faker properties was deprecated in Faker 1.14.

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Adopt class based routes

* Remove default `app` files

* Shift core files

* Streamline config files

* Set new `ENV` variables

* Default new `bootstrap/app.php`

* Re-register HTTP middleware

* Consolidate service providers

* Re-register service providers

* Re-register routes

* Re-register scheduled commands

* Bump Composer dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Adopt anonymous migrations

* Rename `password_resets` table

* Convert `$casts` property to method

* Adopt Laravel type hints

* Mark base controller as `abstract`

* Remove `CreatesApplication` testing trait

* Shift cleanup

* Fix shift first issues

* Updating Rules for laravel 11, sanctum config and pint

* Fix Carbon issue on dashboard

* Temporary fix for tests while migration is issue fixed on laravel side

* Carbon needs numerical values, not strings

* Minimum php version

* Fix domain installation step not fetching the correct company_id

* Fix Role Policy wasn't properly registered

---------
2024-06-05 11:33:52 +02:00
Jay Muntz
72311db1bd Fix SES configuration process to set correct SES_KEY and SES_SECRET (#74)
* Fix SES configuration process to set correct SES_KEY and SES_SECRET

* Fixed SES from name

---------

Co-authored-by: Jay Muntz <jaymuntz@jaymuntz.com>
2024-05-31 12:46:06 +02:00
Darko Gjorgjijoski
1e530e0387 Include lang directory in the dist build (#65)
* Include lang/ dir in the build

* Bump version
2024-05-04 15:27:40 +02:00
Darko Gjorgjijoski
fa777d673f Update release migration rollback to point to 1.2.0 2024-05-04 13:48:42 +02:00
Darko Gjorgjijoski
8570252db5 Add missing migration 2024-05-04 13:35:51 +02:00
Darko Gjorgjijoski
ecb029758b Add Libyan Dinar (LD) (#63)
* Add Libyan Dinar (LD)

* Fix code style
2024-05-04 12:06:07 +02:00
Timo
6ea112c04f fix EnvironmentManager updateEnv (#60)
* fix EnvironmentManager updateEnv

* fix EnvironmentManager encode method

* fix code style
2024-05-04 10:35:35 +02:00
Timo
2784318ebf Migrate polymorphic relationships (#58)
* add crater media model type migration

* migrate all morph type fields

* fix code style

* migrate custom_field_values
2024-04-21 00:03:34 +02:00
Darko Gjorgjijoski
bb580f4b88 Restore open-direction top in Account language picker
Follow up to #55
2024-04-20 23:26:10 +02:00
Timo
8c83df558c Add Company VAT-ID and Tax-ID (#54)
* add company vat_id & tax_id field

* add tax & vat id field in company settings

* fix vat & tax id validation

* add german vat & tax id translation

* add translations for pdf

* add vat_id and tax_id field before timestamps

* make fields nullable and fix code style
2024-04-20 23:08:32 +02:00
Timo
dc8a85538f Support S3 compatible storage services (#56)
* add s3compat filesystem driver

* add s3compat ui modal

* fix code style
2024-04-16 17:24:56 +02:00
Darko Gjorgjijoski
093b2acc24 Merge branch 'master' of github.com:InvoiceShelf/InvoiceShelf 2024-04-16 03:02:27 +02:00
Timo
df85fd6a0a Fix base multi select open direction top (#55) 2024-04-16 03:01:53 +02:00
Darko Gjorgjijoski
db4396f160 Remove duplicate noLabel in dialog store 2024-04-16 03:01:14 +02:00
Darko Gjorgjijoski
1831560a62 Fix language switching. It now switches instantly 2024-04-16 02:58:44 +02:00
mchev
223678e5bd Fix locales issue #43 (#46)
* Fix locales issue #43

* Adding open-direction bottom to the language multiselect
2024-03-27 11:00:36 +01:00
Darko Gjorgjijoski
9bb4963e8a Fixes/backup issues (#51)
* Fix: Error related to undefined Backup::size()

* Fix: Disable signals if PCNTL isn't loaded to avoid fatal error (Fixes SIGINT is not defined on environments that are missing the PCNTL library)
2024-03-27 01:15:49 +01:00
Darko Gjorgjijoski
8788f3d504 Tax calculation issue (#38)
* fix initial tax per item issue

* remove commit in estimate storage

* add changes in tax per item calculation

* add validation on requests

* fix minimum total issue

* fix table pagination filter issue

* minor fix

* remove compound interest and remove unused code

---------

Co-authored-by: yashkanakiya <yashkanakiya281297@gmail.com>
Co-authored-by: dhruvbhattt <dhruvbhatt7790@gmail.com>
Co-authored-by: gdarko <dg@darkog.com>
2024-02-18 10:54:12 +01:00
Darko Gjorgjijoski
0d006846d5 Merge pull request #37 from InvoiceShelf/bouncer-hotfix
Bouncer hotfix
2024-02-18 01:25:47 +01:00
gdarko
d2559c8773 Fix formatting 2024-02-18 00:49:15 +01:00
Darko Gjorgjijoski
20a489e52d Merge pull request #35 from dariuszz123/bugfix/missing-access-token-table-column
Added expires_at column to personal_access_tokens table
2024-02-18 00:27:13 +01:00
gdarko
e73ab3d4ee Override the default bouncer scope class with a temporary hotfix to the roles issue 2024-02-18 00:13:42 +01:00
gdarko
1c7274287d Lock silber/bouncer to 1.0.1 for now 2024-02-18 00:12:33 +01:00
Darius Kristapavicius
5ba8639ac8 Added expires_at column to personal_access_tokens table 2024-02-17 23:51:21 +02:00
gdarko
44153c2993 Improve 110 migration rollback 2024-02-11 20:43:03 +01:00
gdarko
b9d5b8247c Fix: Wrong migration name 2024-02-11 20:42:01 +01:00
Darko Gjorgjijoski
39879cb4b4 Merge pull request #29 from InvoiceShelf/database/old-leftovers
Release migration and improvements to the database
2024-02-11 20:25:49 +01:00
Darko Gjorgjijoski
7d7b48a5b7 Merge pull request #28 from InvoiceShelf/installer-improvements-phase1
Installer improvements
2024-02-11 20:25:32 +01:00
gdarko
e0176139c2 Remove unecessary db install flag delete call 2024-02-11 20:07:59 +01:00
gdarko
29ed7f437a Fix code style 2024-02-11 13:58:38 +01:00
gdarko
020a0741de Add error logging to install process :: db marker utilities 2024-02-11 13:55:32 +01:00
gdarko
d2ad2222be Fix code style 2024-02-11 09:41:23 +01:00
gdarko
2358969050 Add release migration and fix some old database leftovers 2024-02-11 09:38:21 +01:00
gdarko
c7c70dd3ef Encoide .env value in case of spaces or special characters 2024-02-11 02:41:14 +01:00
gdarko
b806efd66d Refactor EnvironmentManager to fix weird installation issues 2024-02-11 01:44:05 +01:00
gdarko
b85538dbc0 Fix code style 2024-02-10 01:36:53 +01:00
gdarko
8918ea5124 Fix image extension validation
Issue #21
2024-02-10 01:31:44 +01:00
Darko Gjorgjijoski
91d37673aa Merge pull request #25 from danybmx/18-allow-negative-taxes
feat: Allow negative taxes
2024-02-10 00:49:09 +01:00
Daniel Rodríguez
b819440e76 feat: allow negative taxes 2024-02-08 19:19:32 +01:00
Darko Gjorgjijoski
36424bbf05 Update code style 2024-02-08 03:37:17 +01:00
Darko Gjorgjijoski
e14a248f24 Fix: Status set incorrectly after updating invoice
Issue: https://github.com/crater-invoice/crater/issues/955, #23
2024-02-08 03:09:56 +01:00
Darko Gjorgjijoski
acf3ca2c26 Fix Discord link 2024-02-08 02:33:27 +01:00
Darko Gjorgjijoski
e7e9c57552 Improvements to the menu generation, add safety checks 2024-02-08 01:54:05 +01:00
Darko Gjorgjijoski
49a11f08e9 Improvements to the Install Utilities 2024-02-08 01:53:32 +01:00
1700 changed files with 150637 additions and 81032 deletions

5
.claude/settings.json Normal file
View File

@@ -0,0 +1,5 @@
{
"enabledPlugins": {
"frontend-design@claude-plugins-official": true
}
}

11
.cursor/mcp.json Normal file
View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"laravel-boost": {
"command": "php",
"args": [
"artisan",
"boost:mcp"
]
}
}
}

View File

@@ -0,0 +1,106 @@
---
name: medialibrary-development
description: Build and work with spatie/laravel-medialibrary features including associating files with Eloquent models, defining media collections and conversions, generating responsive images, and retrieving media URLs and paths.
license: MIT
metadata:
author: Spatie
---
# Media Library Development
## Overview
Use spatie/laravel-medialibrary to associate files with Eloquent models. Supports image/video conversions, responsive images, multiple collections, and various storage disks.
## When to Activate
- Activate when working with file uploads, media attachments, or image processing in Laravel.
- Activate when code references `HasMedia`, `InteractsWithMedia`, the `Media` model, or media collections/conversions.
- Activate when the user wants to add, retrieve, convert, or manage files attached to Eloquent models.
## Scope
- In scope: media uploads, collections, conversions, responsive images, custom properties, file retrieval, path/URL generation.
- Out of scope: general file storage without Eloquent association, non-Laravel frameworks.
## Workflow
1. Identify the task (model setup, adding media, defining conversions, retrieving files, etc.).
2. Read `references/medialibrary-guide.md` and focus on the relevant section.
3. Apply the patterns from the reference, keeping code minimal and Laravel-native.
## Core Concepts
### Model Setup
Every model that should have media must implement `HasMedia` and use the `InteractsWithMedia` trait:
```php
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class BlogPost extends Model implements HasMedia
{
use InteractsWithMedia;
}
```
### Adding Media
```php
$blogPost->addMedia($file)->toMediaCollection('images');
$blogPost->addMediaFromUrl($url)->toMediaCollection('images');
$blogPost->addMediaFromRequest('file')->toMediaCollection('images');
```
### Defining Collections
```php
public function registerMediaCollections(): void
{
$this->addMediaCollection('avatar')->singleFile();
$this->addMediaCollection('downloads')->useDisk('s3');
}
```
### Defining Conversions
```php
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\Image\Enums\Fit;
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')
->fit(Fit::Contain, 300, 300)
->nonQueued();
}
```
### Retrieving Media
```php
$url = $model->getFirstMediaUrl('images');
$thumbUrl = $model->getFirstMediaUrl('images', 'thumb');
$allMedia = $model->getMedia('images');
```
## Do and Don't
Do:
- Always implement the `HasMedia` interface alongside the `InteractsWithMedia` trait.
- Use `?Media $media = null` as the parameter for `registerMediaConversions()`.
- Call `->toMediaCollection()` to finalize adding media.
- Use `->nonQueued()` for conversions that should run synchronously.
- Use `->singleFile()` on collections that should only hold one file.
- Use `Spatie\Image\Enums\Fit` enum values for fit methods.
Don't:
- Don't forget to run `php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"` before migrating.
- Don't use `env()` for disk configuration; use `config()` or set it in `config/media-library.php`.
- Don't call `addMedia()` without calling `toMediaCollection()` — the media won't be saved.
- Don't reference conversion names that aren't registered in `registerMediaConversions()`.
## References
- `references/medialibrary-guide.md`

View File

@@ -0,0 +1,577 @@
# Laravel Media Library Reference
Complete reference for `spatie/laravel-medialibrary`. Full documentation: https://spatie.be/docs/laravel-medialibrary
## Model Setup
Implement `HasMedia` and use `InteractsWithMedia`:
```php
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class BlogPost extends Model implements HasMedia
{
use InteractsWithMedia;
public function registerMediaCollections(): void
{
$this->addMediaCollection('images');
}
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')
->fit(Fit::Contain, 300, 300);
}
}
```
## Adding Media
### From uploaded file
```php
$model->addMedia($request->file('image'))->toMediaCollection('images');
```
### From request (shorthand)
```php
$model->addMediaFromRequest('image')->toMediaCollection('images');
```
### From URL
```php
$model->addMediaFromUrl('https://example.com/image.jpg')->toMediaCollection('images');
```
### From string content
```php
$model->addMediaFromString('raw content')->usingFileName('file.txt')->toMediaCollection('files');
```
### From base64
```php
$model->addMediaFromBase64($base64Data)->usingFileName('photo.jpg')->toMediaCollection('images');
```
### From stream
```php
$model->addMediaFromStream($stream)->usingFileName('file.pdf')->toMediaCollection('files');
```
### From existing disk
```php
$model->addMediaFromDisk('path/to/file.jpg', 's3')->toMediaCollection('images');
```
### Multiple files from request
```php
$model->addMultipleMediaFromRequest(['images'])->each(function ($fileAdder) {
$fileAdder->toMediaCollection('images');
});
$model->addAllMediaFromRequest()->each(function ($fileAdder) {
$fileAdder->toMediaCollection('images');
});
```
### Copy instead of move
```php
$model->copyMedia($pathToFile)->toMediaCollection('images');
// or
$model->addMedia($pathToFile)->preservingOriginal()->toMediaCollection('images');
```
## FileAdder Options
All methods are chainable before calling `toMediaCollection()`:
```php
$model->addMedia($file)
->usingName('Custom Name') // display name
->usingFileName('custom-name.jpg') // filename on disk
->setOrder(3) // order within collection
->withCustomProperties(['alt' => 'A landscape photo'])
->withManipulations(['thumb' => ['filter' => 'greyscale']])
->withResponsiveImages() // generate responsive variants
->storingConversionsOnDisk('s3') // put conversions on different disk
->addCustomHeaders(['CacheControl' => 'max-age=31536000'])
->toMediaCollection('images');
```
### Store on cloud disk
```php
$model->addMedia($file)->toMediaCollectionOnCloudDisk('images');
```
## Media Collections
Define in `registerMediaCollections()`:
```php
public function registerMediaCollections(): void
{
// Basic collection
$this->addMediaCollection('images');
// Single file (replacing previous on new upload)
$this->addMediaCollection('avatar')
->singleFile();
// Keep only latest N items
$this->addMediaCollection('recent_photos')
->onlyKeepLatest(5);
// Specific disk
$this->addMediaCollection('downloads')
->useDisk('s3');
// With conversions disk
$this->addMediaCollection('photos')
->useDisk('s3')
->storeConversionsOnDisk('s3-thumbnails');
// MIME type restriction
$this->addMediaCollection('documents')
->acceptsMimeTypes(['application/pdf', 'application/zip']);
// Custom validation
$this->addMediaCollection('images')
->acceptsFile(function ($file) {
return $file->mimeType === 'image/jpeg';
});
// Fallback URL/path when collection is empty
$this->addMediaCollection('avatar')
->singleFile()
->useFallbackUrl('/images/default-avatar.jpg')
->useFallbackPath(public_path('/images/default-avatar.jpg'));
// Enable responsive images for entire collection
$this->addMediaCollection('hero_images')
->withResponsiveImages();
// Collection-specific conversions
$this->addMediaCollection('photos')
->registerMediaConversions(function () {
$this->addMediaConversion('card')
->fit(Fit::Crop, 400, 400);
});
}
```
## Media Conversions
Define in `registerMediaConversions()`:
```php
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\Image\Enums\Fit;
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')
->fit(Fit::Contain, 300, 300)
->nonQueued();
$this->addMediaConversion('preview')
->fit(Fit::Crop, 500, 500)
->withResponsiveImages()
->queued();
$this->addMediaConversion('banner')
->fit(Fit::Max, 1200, 630)
->performOnCollections('images', 'headers')
->nonQueued()
->sharpen(10);
// Conditional conversion based on media properties
if ($media?->mime_type === 'image/png') {
$this->addMediaConversion('png-thumb')
->fit(Fit::Contain, 150, 150);
}
// Keep original format instead of converting to jpg
$this->addMediaConversion('web')
->fit(Fit::Max, 800, 800)
->keepOriginalImageFormat();
// PDF page rendering
$this->addMediaConversion('pdf-preview')
->pdfPageNumber(1)
->fit(Fit::Contain, 400, 400);
// Video frame extraction
$this->addMediaConversion('video-thumb')
->extractVideoFrameAtSecond(5)
->fit(Fit::Crop, 300, 300);
}
```
### Image Manipulation Methods (via spatie/image)
Resizing and fitting:
- `width(int)`, `height(int)` — constrain dimensions
- `fit(Fit, int, int)` — fit within bounds using `Fit::Contain`, `Fit::Max`, `Fit::Fill`, `Fit::Stretch`, `Fit::Crop`
- `crop(int, int)` — crop to exact dimensions
Effects:
- `sharpen(int)`, `blur(int)`, `pixelate(int)`
- `greyscale()`, `sepia()`
- `brightness(int)`, `contrast(int)`, `colorize(int, int, int)`
Orientation:
- `orientation(int)`, `flip(string)`, `rotate(int)`
Format:
- `format(string)``'jpg'`, `'png'`, `'webp'`, `'avif'`
- `quality(int)` — 1-100
Other:
- `border(int, string, string)`, `watermark(string)`
- `optimize()`, `nonOptimized()`
### Conversion Configuration
- `performOnCollections('col1', 'col2')` — limit to specific collections
- `queued()` / `nonQueued()` — run async or sync
- `withResponsiveImages()` — also generate responsive variants for this conversion
- `keepOriginalImageFormat()` — preserve png/webp/gif instead of converting to jpg
- `pdfPageNumber(int)` — which PDF page to render
- `extractVideoFrameAtSecond(int)` — video thumbnail timing
## Retrieving Media
### Getting media items
```php
$media = $model->getMedia('images'); // all in collection
$first = $model->getFirstMedia('images'); // first item
$last = $model->getLastMedia('images'); // last item
$has = $model->hasMedia('images'); // boolean check
```
### Getting URLs
```php
$url = $model->getFirstMediaUrl('images'); // original URL
$thumbUrl = $model->getFirstMediaUrl('images', 'thumb'); // conversion URL
$lastUrl = $model->getLastMediaUrl('images', 'thumb');
```
### Getting paths
```php
$path = $model->getFirstMediaPath('images');
$thumbPath = $model->getFirstMediaPath('images', 'thumb');
```
### Temporary URLs (S3)
```php
$tempUrl = $model->getFirstTemporaryUrl(
now()->addMinutes(30),
'images',
'thumb'
);
```
### Fallback URLs
```php
$url = $model->getFallbackMediaUrl('avatar');
```
### From the Media model
```php
$media = $model->getFirstMedia('images');
$media->getUrl(); // original URL
$media->getUrl('thumb'); // conversion URL
$media->getPath(); // disk path
$media->getFullUrl(); // full URL with domain
$media->getTemporaryUrl(now()->addMinutes(30));
$media->hasGeneratedConversion('thumb'); // check if conversion exists
```
### Filtering media
```php
$media = $model->getMedia('images', function (Media $media) {
return $media->getCustomProperty('featured') === true;
});
$media = $model->getMedia('images', ['mime_type' => 'image/jpeg']);
```
## Custom Properties
Store arbitrary metadata on media items:
```php
// When adding
$model->addMedia($file)
->withCustomProperties([
'alt' => 'Descriptive text',
'credits' => 'Photographer Name',
])
->toMediaCollection('images');
// Get/set on existing media
$media->setCustomProperty('alt', 'Updated text');
$media->save();
$alt = $media->getCustomProperty('alt');
$has = $media->hasCustomProperty('alt');
$media->forgetCustomProperty('alt');
$media->save();
```
## Responsive Images
Generate multiple sizes for optimal loading:
```php
// On the FileAdder
$model->addMedia($file)
->withResponsiveImages()
->toMediaCollection('images');
// On a conversion
$this->addMediaConversion('hero')
->fit(Fit::Max, 1200, 800)
->withResponsiveImages();
// On a collection
$this->addMediaCollection('photos')
->withResponsiveImages();
```
### Using in Blade
```blade
{{-- Renders img tag with srcset --}}
{{ $media->toHtml() }}
{{-- With attributes --}}
{{ $media->img()->attributes(['class' => 'w-full', 'alt' => 'Photo']) }}
{{-- Get srcset string --}}
<img src="{{ $media->getUrl() }}" srcset="{{ $media->getSrcset() }}" />
{{-- Responsive conversion --}}
<img src="{{ $media->getUrl('hero') }}" srcset="{{ $media->getSrcset('hero') }}" />
```
### Placeholder SVG
```php
$svg = $media->responsiveImages()->getPlaceholderSvg(); // tiny blurred base64 placeholder
```
## Managing Media
### Clear a collection
```php
$model->clearMediaCollection('images');
```
### Clear except specific items
```php
$model->clearMediaCollectionExcept('images', $mediaToKeep);
```
### Delete specific media
```php
$model->deleteMedia($mediaId);
```
### Delete all media
```php
$model->deleteAllMedia();
```
### Delete model but keep media files
```php
$model->deletePreservingMedia();
```
### Reorder media
```php
Media::setNewOrder([3, 1, 2]); // media IDs in desired order
```
### Move/copy media between models
```php
$media->move($otherModel, 'images');
$media->copy($otherModel, 'images');
```
## Events
```php
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
use Spatie\MediaLibrary\Conversions\Events\ConversionWillStartEvent;
use Spatie\MediaLibrary\Conversions\Events\ConversionHasBeenCompletedEvent;
use Spatie\MediaLibrary\MediaCollections\Events\CollectionHasBeenClearedEvent;
```
Listen to these events to hook into the media lifecycle:
```php
Event::listen(MediaHasBeenAddedEvent::class, function ($event) {
$event->media; // the added Media model
});
Event::listen(ConversionHasBeenCompletedEvent::class, function ($event) {
$event->media;
$event->conversion;
});
```
## Configuration
Key `config/media-library.php` options:
```php
return [
'disk_name' => 'public', // default disk
'max_file_size' => 1024 * 1024 * 10, // 10MB
'queue_connection_name' => '', // queue connection
'queue_name' => '', // queue name
'queue_conversions_by_default' => true, // queue conversions
'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,
'file_namer' => Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer::class,
'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,
'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
'image_driver' => 'gd', // 'gd', 'imagick', or 'vips'
'image_optimizers' => [/* optimizer config */],
'version_urls' => true, // cache busting
'default_loading_attribute_value' => null, // 'lazy' for lazy loading
];
```
### Custom Path Generator
```php
use Spatie\MediaLibrary\Support\PathGenerator\PathGenerator;
class CustomPathGenerator implements PathGenerator
{
public function getPath(Media $media): string
{
return md5($media->id) . '/';
}
public function getPathForConversions(Media $media): string
{
return $this->getPath($media) . 'conversions/';
}
public function getPathForResponsiveImages(Media $media): string
{
return $this->getPath($media) . 'responsive/';
}
}
```
### Custom File Namer
```php
use Spatie\MediaLibrary\Support\FileNamer\FileNamer;
class CustomFileNamer extends FileNamer
{
public function originalFileName(string $fileName): string
{
return Str::slug(pathinfo($fileName, PATHINFO_FILENAME));
}
public function conversionFileName(string $fileName, Conversion $conversion): string
{
return $this->originalFileName($fileName) . '-' . $conversion->getName();
}
public function responsiveFileName(string $fileName): string
{
return pathinfo($fileName, PATHINFO_FILENAME);
}
}
```
### Custom Media Model
```php
use Spatie\MediaLibrary\MediaCollections\Models\Media as BaseMedia;
class Media extends BaseMedia
{
// Add custom methods, scopes, or override behavior
}
```
Register in config: `'media_model' => App\Models\Media::class`
## Downloading Media
### Single file
```php
return $media->toResponse($request); // download
return $media->toInlineResponse($request); // display inline
return $media->stream(); // stream
```
### ZIP download of collection
```php
use Spatie\MediaLibrary\Support\MediaStream;
return MediaStream::create('photos.zip')
->addMedia($model->getMedia('images'));
```
## Using with API Resources
```php
class PostResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => $this->id,
'title' => $this->title,
'image' => $this->getFirstMediaUrl('images'),
'thumb' => $this->getFirstMediaUrl('images', 'thumb'),
'media' => $this->getMedia('images')->map(function ($media) {
return [
'id' => $media->id,
'url' => $media->getUrl(),
'thumb' => $media->getUrl('thumb'),
'name' => $media->name,
'size' => $media->size,
'type' => $media->mime_type,
];
}),
];
}
}
```

View File

@@ -0,0 +1,157 @@
---
name: pest-testing
description: "Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code."
license: MIT
metadata:
author: laravel
---
# Pest Testing 4
## Documentation
Use `search-docs` for detailed Pest 4 patterns and documentation.
## Basic Usage
### Creating Tests
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
### Test Organization
- Unit/Feature tests: `tests/Feature` and `tests/Unit` directories.
- Browser tests: `tests/Browser/` directory.
- Do NOT remove tests without approval - these are core application code.
### Basic Test Structure
<!-- Basic Pest Test Example -->
```php
it('is true', function () {
expect(true)->toBeTrue();
});
```
### Running Tests
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
- Run all tests: `php artisan test --compact`.
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
## Assertions
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
<!-- Pest Response Assertion -->
```php
it('returns all', function () {
$this->postJson('/api/docs', [])->assertSuccessful();
});
```
| Use | Instead of |
|-----|------------|
| `assertSuccessful()` | `assertStatus(200)` |
| `assertNotFound()` | `assertStatus(404)` |
| `assertForbidden()` | `assertStatus(403)` |
## Mocking
Import mock function before use: `use function Pest\Laravel\mock;`
## Datasets
Use datasets for repetitive tests (validation rules, etc.):
<!-- Pest Dataset Example -->
```php
it('has emails', function (string $email) {
expect($email)->not->toBeEmpty();
})->with([
'james' => 'james@laravel.com',
'taylor' => 'taylor@laravel.com',
]);
```
## Pest 4 Features
| Feature | Purpose |
|---------|---------|
| Browser Testing | Full integration tests in real browsers |
| Smoke Testing | Validate multiple pages quickly |
| Visual Regression | Compare screenshots for visual changes |
| Test Sharding | Parallel CI runs |
| Architecture Testing | Enforce code conventions |
### Browser Test Example
Browser tests run in real browsers for full integration testing:
- Browser tests live in `tests/Browser/`.
- Use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories.
- Use `RefreshDatabase` for clean state per test.
- Interact with page: click, type, scroll, select, submit, drag-and-drop, touch gestures.
- Test on multiple browsers (Chrome, Firefox, Safari) if requested.
- Test on different devices/viewports (iPhone 14 Pro, tablets) if requested.
- Switch color schemes (light/dark mode) when appropriate.
- Take screenshots or pause tests for debugging.
<!-- Pest Browser Test Example -->
```php
it('may reset the password', function () {
Notification::fake();
$this->actingAs(User::factory()->create());
$page = visit('/sign-in');
$page->assertSee('Sign In')
->assertNoJavaScriptErrors()
->click('Forgot Password?')
->fill('email', 'nuno@laravel.com')
->click('Send Reset Link')
->assertSee('We have emailed your password reset link!');
Notification::assertSent(ResetPassword::class);
});
```
### Smoke Testing
Quickly validate multiple pages have no JavaScript errors:
<!-- Pest Smoke Testing Example -->
```php
$pages = visit(['/', '/about', '/contact']);
$pages->assertNoJavaScriptErrors()->assertNoConsoleLogs();
```
### Visual Regression Testing
Capture and compare screenshots to detect visual changes.
### Test Sharding
Split tests across parallel processes for faster CI runs.
### Architecture Testing
Pest 4 includes architecture testing (from Pest 3):
<!-- Architecture Test Example -->
```php
arch('controllers')
->expect('App\Http\Controllers')
->toExtendNothing()
->toHaveSuffix('Controller');
```
## Common Pitfalls
- Not importing `use function Pest\Laravel\mock;` before using mock
- Using `assertStatus(200)` instead of `assertSuccessful()`
- Forgetting datasets for repetitive validation tests
- Deleting tests without approval
- Forgetting `assertNoJavaScriptErrors()` in browser tests

View File

@@ -0,0 +1,119 @@
---
name: tailwindcss-development
description: "Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS."
license: MIT
metadata:
author: laravel
---
# Tailwind CSS Development
## Documentation
Use `search-docs` for detailed Tailwind CSS v4 patterns and documentation.
## Basic Usage
- Use Tailwind CSS classes to style HTML. Check and follow existing Tailwind conventions in the project before introducing new patterns.
- Offer to extract repeated patterns into components that match the project's conventions (e.g., Blade, JSX, Vue).
- Consider class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child elements carefully to reduce repetition, and group elements logically.
## Tailwind CSS v4 Specifics
- Always use Tailwind CSS v4 and avoid deprecated utilities.
- `corePlugins` is not supported in Tailwind v4.
### CSS-First Configuration
In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed:
<!-- CSS-First Config -->
```css
@theme {
--color-brand: oklch(0.72 0.11 178);
}
```
### Import Syntax
In Tailwind v4, import Tailwind with a regular CSS `@import` statement instead of the `@tailwind` directives used in v3:
<!-- v4 Import Syntax -->
```diff
- @tailwind base;
- @tailwind components;
- @tailwind utilities;
+ @import "tailwindcss";
```
### Replaced Utilities
Tailwind v4 removed deprecated utilities. Use the replacements shown below. Opacity values remain numeric.
| Deprecated | Replacement |
|------------|-------------|
| bg-opacity-* | bg-black/* |
| text-opacity-* | text-black/* |
| border-opacity-* | border-black/* |
| divide-opacity-* | divide-black/* |
| ring-opacity-* | ring-black/* |
| placeholder-opacity-* | placeholder-black/* |
| flex-shrink-* | shrink-* |
| flex-grow-* | grow-* |
| overflow-ellipsis | text-ellipsis |
| decoration-slice | box-decoration-slice |
| decoration-clone | box-decoration-clone |
## Spacing
Use `gap` utilities instead of margins for spacing between siblings:
<!-- Gap Utilities -->
```html
<div class="flex gap-8">
<div>Item 1</div>
<div>Item 2</div>
</div>
```
## Dark Mode
If existing pages and components support dark mode, new pages and components must support it the same way, typically using the `dark:` variant:
<!-- Dark Mode -->
```html
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
Content adapts to color scheme
</div>
```
## Common Patterns
### Flexbox Layout
<!-- Flexbox Layout -->
```html
<div class="flex items-center justify-between gap-4">
<div>Left content</div>
<div>Right content</div>
</div>
```
### Grid Layout
<!-- Grid Layout -->
```html
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div>Card 1</div>
<div>Card 2</div>
<div>Card 3</div>
</div>
```
## Common Pitfalls
- Using deprecated v3 utilities (bg-opacity-*, flex-shrink-*, etc.)
- Using `@tailwind` directives instead of `@import "tailwindcss"`
- Trying to use `tailwind.config.js` instead of CSS `@theme` directive
- Using margins for spacing between siblings instead of gap utilities
- Forgetting to add dark mode variants when the project uses dark mode

45
.dockerignore Normal file
View File

@@ -0,0 +1,45 @@
.idea/
.git/
.github/
docker/
!docker/production/entrypoint.d
!docker/production/inject.sh
node_modules/
database/*.sqlite
storage/app/*
!storage/app/templates*
storage/fonts/*
storage/framework/cache/data/*
storage/framework/sessions/*
storage/framework/views/*
storage/logs/*
tests/
vendor/
.dockerignore
.devenvconfig
.editorconfig
.env
.env.testing
.eslintrc.mjs
.gitattributes
.gitignore
.prettierrc.json
devenv
CODE_OF_CONDUCT.md
Dockerfile
*.Dockerfile
LICENSE
Makefile
SECURITY.md
_ide_helper.php
crowdin.yml
invoiceshelf.code-workspace
package-lock.json
phpunit.xml
readme.md

View File

@@ -1,40 +1,28 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:kgk/4DW1vEVy7aEvet5FPp5un6PIGe/so8H0mvoUtW0=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://invoiceshelf.test
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=invoiceshelf
DB_USERNAME=invoiceshelf
DB_PASSWORD="invoiceshelf"
APP_NAME="InvoiceShelf"
APP_TIMEZONE=UTC
APP_URL=
APP_LOCALE=en
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_DRIVER=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=1440
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
SANCTUM_STATEFUL_DOMAINS=invoiceshelf.test
SESSION_DOMAIN=invoiceshelf.test
DB_CONNECTION=sqlite
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
SESSION_DOMAIN=null
SANCTUM_STATEFUL_DOMAIN=
TRUSTED_PROXIES="*"
CRON_JOB_AUTH_TOKEN=""
# Dompdf: keep false so untrusted HTML in PDF notes cannot trigger outbound requests (SSRF).
# Set true only if you fully trust all PDF HTML and need remote images/CSS.
DOMPDF_ENABLE_REMOTE=false
# InvoiceShelf marketplace and updater base URL.
# Defaults to https://invoiceshelf.com. Override to point at a local website
# checkout for development:
# INVOICESHELF_BASE_URL=http://invoiceshelf-website.test

View File

@@ -3,7 +3,7 @@ APP_DEBUG=true
APP_KEY=base64:IdDlpLmYyWA9z4Ruj5st1FSYrhCR7lPOscLGCz2Jf4I=
DB_CONNECTION=sqlite
MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=ff538f0e1037f4

View File

@@ -1,14 +0,0 @@
// .eslintrc.js
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
"plugin:vue/vue3-recommended",
"prettier",
],
rules: {
// override/add rules settings here, such as:
// 'vue/no-unused-vars': 'error'
},
};

24
.gitattributes vendored
View File

@@ -1,3 +1,25 @@
* text=auto
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.otf binary
*.eot binary
*.svg binary
*.ttf binary
*.woff binary
*.woff2 binary
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored

65
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,65 @@
# Welcome to InvoiceShelf contributing guide <!-- omit in toc -->
Thank you for investing your time in contributing to our project! :sparkles:.
Read our [Code of Conduct](../CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
## New contributor guide
To get an overview of the project, read the [README](../README.md) file. Here are some resources to help you get started with open source contributions:
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
- [Set up Git](https://docs.github.com/en/get-started/getting-started-with-git/set-up-git)
- [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow)
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
## Getting started
### Issues
#### Create a new issue
If you spot a problem, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/InvoiceShelf/InvoiceShelf/issues/new/choose).
#### Solve an issue
Scan through our [existing issues](https://github.com/InvoiceShelf/InvoiceShelf/issues) to find one that interests you. You can narrow down the search using `labels` as filters. See "[Label reference](https://docs.github.com/en/contributing/collaborating-on-github-docs/label-reference)" for more information. As a general rule, we dont assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
### Make Changes
#### Make changes locally
1. Fork the repository.
- Using GitHub Desktop:
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
- Using the command line:
- [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo) so that you can make your changes without affecting the original project until you're ready to merge them.
2. Install or update to **Node.js**, at the version specified in `.node-version`. For more information, see [the development guide](../docker/development/README.md).
3. Create a working branch and start with your changes!
### Commit your update
Commit the changes once you are happy with them. Don't forget to use the "[Self review checklist](https://docs.github.com/en/contributing/collaborating-on-github-docs/self-review-checklist)" to speed up the review process :zap:.
### Pull Request
When you're finished with the changes, create a pull request, also known as a PR.
- Fill the "Ready for review" template so that we can review your PR. This template helps reviewers understand your changes as well as the purpose of your pull request.
- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
Once you submit your PR, a project maintainer will review your proposal. We may ask questions or request additional information.
- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
- If you run into any merge issues, check out this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.
### Your PR is merged!
Congratulations :tada::tada: The InvoiceShelf team thanks you :sparkles:.
Once your PR is merged, your contributions will be publicly visible on the [InvoiceShelf repository](https://github.com/InvoiceShelf/InvoiceShelf).

View File

@@ -1,26 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Please complete the following information:**
- InvoiceShelf version:
- PHP version:
- Database type and version:
**Optional info**
- OS: [e.g. Ubuntu]
- Browser: [e.g. chrome, safari]

237
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,237 @@
name: Bug report
description: Template for bug reports
labels: ['bug', 'triage']
type: Bug
projects: ['InvoiceShelf/2']
assignees:
- rihards-simanovics
body:
# Ask user to confirm they've tried to fix or research the issue before
# posting a bug report.
- type: checkboxes
id: confirm-read-documentation
attributes:
label: Issue filing prerequisites
description: 'Prior to filing an issue please confirm that:'
options:
- label: I've checked the [documentation](https://docs.invoiceshelf.com/).
required: true
- label: I've looked for similar issues both Open and Closed.
required: true
- label: >-
I've tried clearing both cache and cookies in my browser or tried
opening the app in the Incognito/InPrivate window.
required: true
# Thank users for taking time to submit a bug report
- type: markdown
attributes:
value: >-
If you did all of the above, we would first like to thank you for taking
the time to fill out this bug report. It will help us tremendously to
find and fix the issue sooner!
# Description of the bug
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: >-
When doing `x`, `y`, and `z` in that order, an error occurs, but when `x`,
`z` and then `y` is done, the error does not occur.
validations:
required: true
# Reproduction steps
- type: textarea
id: reproduce
attributes:
label: Steps to Reproduce the issue
description: A clear step-by-step explanation of how to reproduce your issue
placeholder: >-
## Produces an error:
1. Do X;
2. Do Y;
3. Do Z;
## Works fine:
4. Do X;
5. Do Z;
6. Do Y.
validations:
required: true
# Expected Behaviour
- type: textarea
id: expected-behaviour
attributes:
label: Expected behaviour
description: A clear and concise description of what you expected to happen.
placeholder: Doing `x`, `y`, and `z` in that order should not generate an error.
validations:
required: true
# Actual Behaviour
- type: textarea
id: actual-behaviour
attributes:
label: Actual behaviour
description: A clear and concise description of what actually happens.
placeholder: Doing `x`, `y`, and `z` in that order generates an error.
validations:
required: true
# Section break
- type: markdown
attributes:
value: |-
## Environment
Now let's collect some information about your environment.
# Use Docker?
- type: checkboxes
id: confirm-docker-install
attributes:
label: Docker
description: 'Please note that unless the issue is with the app itself, you should file a bug report under the [docker](https://github.com/InvoiceShelf/docker) repository.'
options:
- label: App running in Docker Container.
- label: Docker container running behind Reverse proxy.
# App Version
- type: input
id: invoiceshelf-version
attributes:
label: InvoiceShelf version
placeholder: v0.0.0
validations:
required: true
# PHP Version
- type: input
id: php-version
attributes:
label: PHP version
placeholder: v0.0.0
validations:
required: true
# DB Type
- type: input
id: database-type
attributes:
label: Database type
placeholder: MariaDB / MySQL / PostgreSQL / SQLite
validations:
required: true
# DB Version
- type: input
id: db-version
attributes:
label: Database version
placeholder: v0.0.0
validations:
required: true
# Web Browser
- type: input
id: web-browser
attributes:
label: Web Browser
placeholder: 'Firefox / Safari / or any other (Chromium-based browser)'
# OS Version
- type: input
id: server-os
attributes:
label: Server OS
description: If Linux, please make sure to provide both the distro name and its version
placeholder: Windows / Linux (e.g. Ubuntu 24.04)
# Associated Logs
- type: markdown
attributes:
value: >-
## Logs
Last but not least, could you please take some time to get us the logs
for:
# Log Reverse proxy
- type: textarea
id: log-rev-proxy
attributes:
label: Reverse-proxy logs
description: >-
Please provide logs from your Apache, Nginx, Traefik, or any other
reverse proxy application.
placeholder: >-
2023-04-12 10:15:32 [NGINX] 172.16.0.5 - - [12/Apr/2023:10:15:32 +0000] "GET /index.html HTTP/1.1" 200 1024 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
2023-04-12 10:15:33 [NGINX] 172.16.0.7 - - [12/Apr/2023:10:15:33 +0000] "POST /login HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
2023-04-12 10:15:34 [NGINX] 172.16.0.9 - - [12/Apr/2023:10:15:34 +0000] "GET /about HTTP/1.1" 200 2048 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
2023-04-12 10:15:35 [NGINX] 172.16.0.11 - - [12/Apr/2023:10:15:35 +0000] "PUT /api/v1/users/123 HTTP/1.1" 200 - "https://example.com/profile" "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1"
2023-04-12 10:15:36 [NGINX] 172.16.0.13 - - [12/Apr/2023:10:15:36 +0000] "DELETE /api/v1/products/456 HTTP/1.1" 204 - "-" "Dalvik/2.1.0 (Linux; U; Android 10; Pixel 4 Build/QD1A.190821.014.C2)"
2023-04-12 10:15:37 [NGINX] 172.16.0.15 - - [12/Apr/2023:10:15:37 +0000] "GET /easter-egg HTTP/1.1" 200 42 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.3"
render: irc logs
# PHP/Laravel Logs
- type: textarea
id: log-laravel
attributes:
label: Laravel/PHP logs
description: Please provide logs from either PHP or Laravel or both.
placeholder: >-
[2015-02-04 10:00:00] production.INFO: Laravel 5.0 released. The world rejoices.
[2015-12-03 12:00:00] production.INFO: PHP 7.0 introduced scalar type declarations. Minds blown.
[2016-05-15 14:00:00] production.INFO: Composer installed new dependencies. Dependency hell avoided.
[2017-08-20 16:00:00] production.INFO: Artisan command executed: migrate. Smooth sailing.
[2018-01-10 09:00:00] production.INFO: User login successful.
[2018-01-10 09:05:00] production.ERROR: Database connection failed. Did you try turning it off and on again?
[2018-01-10 09:10:00] production.WARNING: Deprecated function used in UserController.php. Time to refactor, again.
[2018-01-10 09:15:00] production.ERROR: Uncaught Exception: Division by zero. Oops, maths is hard.
[2018-01-10 09:20:00] production.INFO: User logout successful. See you later, alligator.
[2019-03-25 11:00:00] production.INFO: Cache cleared. Fresh start!
[2019-06-30 13:00:00] production.ERROR: Syntax error. Missing semicolon strikes again.
[2020-09-10 15:00:00] production.INFO: User registered. Welcome aboard!
[2021-11-05 17:00:00] production.WARNING: Low disk space. Time to clean up.
[2022-12-20 19:00:00] production.INFO: Server rebooted. All systems go.
[2024-11-14 18:56:20] production.INFO: Unexpected item in the bagging area. Please wait for assistance.
render: irc logs
# Special thanks
- type: markdown
attributes:
value: >-
This template was generated with [Issue Forms
Creator](https://issue-forms-creator.netlify.app)

View File

@@ -0,0 +1,94 @@
# Big thanks to https://github.com/files-community/Files/ for a template of the code_quality_issue
name: Code Quality Issue
description: Create a code quality issue to help InvoiceShelf keep a clean codebase
labels:
- code quality
- triage
projects: ['InvoiceShelf/2']
assignees:
- rihards-simanovics
body:
# Tip to warn of checking for existing issues
- type: markdown
attributes:
value: >
> [!TIP]
> Have you checked for similar code quality issues? There's a
possibility your suggestion is already being tracked. Please do a
thorough search before creating a new issue.
# Ask user to confirm they've tried to fix or research the issue before
# posting a bug report.
- type: checkboxes
id: confirm-read-documentation
attributes:
label: Issue filing prerequisites
description: 'Prior to filing an issue please confirm that:'
options:
- label: I've checked the [documentation](https://docs.invoiceshelf.com/).
required: true
- label: I've looked for similar issues both Open and Closed.
required: true
- label: >-
I've tried clearing both cache and cookies in my browser or tried
opening the app in the Incognito/InPrivate window.
required: true
# Issue body
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of what the code quality issue is.
validations:
required: true
# Related code
- type: textarea
id: code-in-question
attributes:
label: The code in question
description: >-
A list of the different InvoiceShelf and/or areas of the code concerned by the issue.
validations:
required: true
# Gains
- type: textarea
id: gains
attributes:
label: Gains
description: What would fixing this code quality issue bring to the source code?
placeholder: >-
- e.g. Better readability.
- e.g. Uncoupling concepts X and Y.
- e.g. Clarifying the responsibility of class C.
validations:
required: true
# Requirements
- type: textarea
id: requirements
attributes:
label: Requirements
description: Describe all the requirements to solve the code quality issue.
placeholder: >-
- e.g. Using a specific design pattern.
- e.g. Separating Interface I into three new interfaces I1, I2 and I3.
- e.g. Regrouping the duplicated process into a new helper.
# Remarks
- type: textarea
id: comments
attributes:
label: Comments
description: >-
Additional information, comments or screenshots about the code quality
issue.

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://docs.invoiceshelf.com/
about: App documentation.
- name: Translation issue
url: https://crowdin.com/project/invoiceshelf
about: Help improve translations on Crowdin.
- name: Support, Question & Discussion - Official Discord Server
url: https://discord.gg/hwg2FtwWHW
about: Post your questions and join the discussion. You can participate in chats on every channel.

View File

@@ -1,17 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

View File

@@ -0,0 +1,96 @@
# Big thanks to https://github.com/files-community/Files/ for a template of the feature_request
name: Feature Request
labels:
- feature request
- triage
type: Feature
projects: ['InvoiceShelf/2']
assignees:
- rihards-simanovics
description: >-
This project thrives from differentiation from competing apps. Suggest an idea
for InvoiceShelf.
body:
# Tip to warn of checking for existing issues
- type: markdown
attributes:
value: >
> [!TIP]
>Have you checked for similar feature requests? There's a possibility
your suggestion is already being tracked. Please do a thorough search
before creating a new issue.
# Ask user to confirm they've tried to fix or research the issue before
# posting a bug report.
- type: checkboxes
id: confirm-read-documentation
attributes:
label: Issue filing prerequisites
description: 'Prior to filing an issue please confirm that:'
options:
- label: I've checked the [documentation](https://docs.invoiceshelf.com/).
required: true
- label: I've looked for similar issues with feature requests both Open and Closed.
required: true
- label: >-
I've tried clearing both cache and cookies in my browser or tried
opening the app in the Incognito/InPrivate window.
required: true
# Description
- type: textarea
id: what-feature
attributes:
label: What feature or improvement do you think would benefit InvoiceShelf?
description: Please include your use case
placeholder: >-
I propose that feature J be implemented as I believe it will greatly benefit the application.
validations:
required: true
# Tooltip about Requirements
- type: markdown
attributes:
value: >
---
Please include a list of changes required to make this improvement. A good
rule of thumb is to start your proposal with no more than 7 high-level
requirements.
# Requirements
- type: textarea
id: requirements
attributes:
label: Requirements
description: Describe all the requirements to make your idea happen.
placeholder: >-
- This proposal will accomplish X
- This proposal will accomplish Y
- This proposal will accomplish Z
validations:
required: true
# InvoiceShelf Version
- type: input
id: invoiceshelf_version
attributes:
label: App Version
description: Which version of InvoiceShelf are you currently using?
placeholder: v0.0.0
validations:
required: true
# Additional Comments
- type: textarea
id: comments
attributes:
label: Comments
description: >-
Additional information, comments or screenshots about the feature
request.

View File

@@ -0,0 +1,17 @@
## Pre-review request checklist
- [ ] (\*) I have listed all changes in the `Changes` section.
- [ ] (opt) I have listed all issues this PR addresses in the `Issues` section [with the issue/discussion IDs](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue).
- [ ] (\*) I have tested my changes.
- [ ] (\*) I have considered backwards compatibility.
## Changes
- Added feature X
- Removed Code Y
- Refactored code Z
## Issues
- fixes #
- closes #

18
.github/release.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
changelog:
categories:
- title: New Features
labels:
- enhancement
- feature
- title: Bug Fixes
labels:
- bug
- fix
- title: Maintenance
labels:
- chore
- dependencies
- ci
- title: Other Changes
labels:
- "*"

View File

@@ -3,19 +3,41 @@ name: Check
# Run this workflow every time a new commit pushed to your repository
on:
push:
paths-ignore:
- '**/*.md'
- 'public/build/*.js'
- 'public/build/**/*.js'
tags-ignore:
- "*"
branches-ignore:
- 'translations'
pull_request:
paths-ignore:
- '**/*.md'
- 'public/build/*.js'
- 'public/build/**/*.js'
branches-ignore:
- 'translations'
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
changes:
name: 🔍 Detect changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
php:
- 'app/**'
- 'config/**'
- 'database/**'
- 'routes/**'
- 'tests/**'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
kill_previous:
name: 0⃣ Kill previous runs
runs-on: ubuntu-latest
@@ -32,11 +54,13 @@ jobs:
runs-on: ubuntu-latest
needs:
- kill_previous
- changes
if: needs.changes.outputs.php == 'true'
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
- name: Checkout code
uses: actions/checkout@v4
@@ -51,18 +75,19 @@ jobs:
name: 2⃣ PHP ${{ matrix.php-version }} Tests
needs:
- php_syntax_errors
- changes
if: needs.changes.outputs.php == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.2
- 8.3
- 8.4
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
@@ -75,10 +100,10 @@ jobs:
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Use Node.js 20
uses: actions/setup-node@v3
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
- name: Install
run: npm install
@@ -88,52 +113,3 @@ jobs:
- name: Apply tests ${{ matrix.php-version }}
run: php artisan test
createReleaseFile:
name: 3⃣ Build / Upload - Release File
if: github.ref_type == 'tag'
needs:
- tests
runs-on: ubuntu-latest
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: ${{ env.extensions }}
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install
run: npm install
- name: Compile Front-end
run: npm run build
- name: Build Dist
run: |
make clean dist
- name: Upload package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file: InvoiceShelf.zip
asset_name: InvoiceShelf.zip
tag: ${{ github.ref }}
overwrite: true

259
.github/workflows/docker.yaml vendored Normal file
View File

@@ -0,0 +1,259 @@
name: Docker Build and Push
on:
release:
types: [published]
schedule:
# Run nightly at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
tag:
description: 'Docker tag'
required: true
default: 'latest'
jobs:
php_syntax_errors:
name: 1⃣ PHP Code Style errors
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
uses: ramsey/composer-install@v2
- name: Check source code for syntax errors
run: ./vendor/bin/pint --test
tests:
name: 2⃣ PHP Tests
if: github.event_name == 'release'
needs:
- php_syntax_errors
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.4
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
tools: pecl, composer
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install
run: npm install
- name: Compile Front-end
run: npm run build
- name: Apply tests ${{ matrix.php-version }}
run: php artisan test
release_artifact_build:
name: 🏗️ Build / Upload - Release File
if: github.event_name == 'release'
needs:
- tests
runs-on: ubuntu-latest
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: ${{ env.extensions }}
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install
run: npm install
- name: Compile Front-end
run: npm run build
- name: Build Dist
run: |
make clean dist
- name: Upload package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file: InvoiceShelf.zip
asset_name: InvoiceShelf.zip
tag: ${{ github.ref }}
overwrite: true
release_docker_build:
name: 🐳 Release Docker Build
if: github.event_name == 'release'
needs:
- tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: invoiceshelf/invoiceshelf
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/production/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
manual_docker_build:
name: 🛠️ Manual Docker Build
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/production/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: invoiceshelf/invoiceshelf:${{ github.event.inputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
nightly_build:
name: 🌙 Nightly Docker Build
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
branch: [master, develop]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
fetch-depth: 2
- name: Check for recent changes
id: changes
run: |
# Check if there are commits in the last 24 hours
RECENT_COMMITS=$(git log --since="24 hours ago" --oneline | wc -l)
echo "recent_commits=$RECENT_COMMITS" >> $GITHUB_OUTPUT
if [ "$RECENT_COMMITS" -gt 0 ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
if: steps.changes.outputs.has_changes == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: steps.changes.outputs.has_changes == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set Docker tag
if: steps.changes.outputs.has_changes == 'true'
id: tag
run: |
if [ "${{ matrix.branch }}" = "master" ]; then
echo "tag=nightly" >> $GITHUB_OUTPUT
elif [ "${{ matrix.branch }}" = "develop" ]; then
echo "tag=alpha" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
if: steps.changes.outputs.has_changes == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: docker/production/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: invoiceshelf/invoiceshelf:${{ steps.tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: No changes detected
if: steps.changes.outputs.has_changes == 'false'
run: |
echo "No commits found in the last 24 hours for ${{ matrix.branch }} branch. Skipping build."

96
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,96 @@
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
name: Build & Release
runs-on: ubuntu-latest
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: ${{ env.extensions }}
tools: composer
- name: Install Composer dependencies
run: composer install --no-dev --optimize-autoloader --no-interaction
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install npm dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Prepare release directory
run: |
mkdir -p /tmp/InvoiceShelf/public
cp -r app /tmp/InvoiceShelf/
cp -r bootstrap /tmp/InvoiceShelf/
cp -r config /tmp/InvoiceShelf/
cp -r database /tmp/InvoiceShelf/
cp -r public/build /tmp/InvoiceShelf/public/
cp -r public/favicons /tmp/InvoiceShelf/public/
cp public/.htaccess /tmp/InvoiceShelf/public/
cp public/index.php /tmp/InvoiceShelf/public/
cp public/robots.txt /tmp/InvoiceShelf/public/
cp public/web.config /tmp/InvoiceShelf/public/
cp -r resources /tmp/InvoiceShelf/
cp -r lang /tmp/InvoiceShelf/
cp -r routes /tmp/InvoiceShelf/
cp -r storage /tmp/InvoiceShelf/
cp -r vendor /tmp/InvoiceShelf/ 2>/dev/null || true
cp -r scripts /tmp/InvoiceShelf/
cp version.md /tmp/InvoiceShelf/
cp .env.example /tmp/InvoiceShelf/
cp artisan /tmp/InvoiceShelf/
cp composer.json /tmp/InvoiceShelf/
cp composer.lock /tmp/InvoiceShelf/
cp LICENSE /tmp/InvoiceShelf/
cp readme.md /tmp/InvoiceShelf/
cp SECURITY.md /tmp/InvoiceShelf/
cp server.php /tmp/InvoiceShelf/
# Clean up runtime artifacts
find /tmp/InvoiceShelf -wholename '*/[Tt]ests/*' -delete
find /tmp/InvoiceShelf -wholename '*/[Tt]est/*' -delete
rm -rf /tmp/InvoiceShelf/storage/framework/cache/data/* 2>/dev/null || true
rm -f /tmp/InvoiceShelf/storage/framework/sessions/* 2>/dev/null || true
rm -f /tmp/InvoiceShelf/storage/framework/views/* 2>/dev/null || true
rm -f /tmp/InvoiceShelf/storage/logs/* 2>/dev/null || true
touch /tmp/InvoiceShelf/storage/logs/laravel.log
- name: Generate manifest
run: php scripts/generate-manifest.php /tmp/InvoiceShelf
- name: Create zip
working-directory: /tmp
run: zip -r InvoiceShelf.zip InvoiceShelf/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: /tmp/InvoiceShelf.zip
generate_release_notes: true
make_latest: true

6
.gitignore vendored
View File

@@ -14,10 +14,16 @@ Homestead.yaml
.rnd
/.expo
/.vscode
/.devcontainer
.gitkeep
/public/docs
/.scribe
!storage/fonts/.gitkeep
.DS_Store
.php-cs-fixer.cache
.devenvconfig
/storage/fonts*
package-lock.json
/docker/development/docker-compose.yml
/docker/production/docker-compose.yml
/docker-compose.yaml

1
.node-version Normal file
View File

@@ -0,0 +1 @@
24

5909
.phpstorm.meta.php Normal file

File diff suppressed because it is too large Load Diff

255
AGENTS.md Normal file
View File

@@ -0,0 +1,255 @@
<laravel-boost-guidelines>
=== foundation rules ===
# Laravel Boost Guidelines
The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to ensure the best experience when building Laravel applications.
## Foundational Context
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
- php - 8.4
- laravel/framework (LARAVEL) - v13
- laravel/prompts (PROMPTS) - v0
- laravel/sanctum (SANCTUM) - v4
- phpunit/phpunit (PHPUNIT) - v12
- laravel/boost (BOOST) - v2
- laravel/mcp (MCP) - v0
- laravel/pint (PINT) - v1
- laravel/sail (SAIL) - v1
- pestphp/pest (PEST) - v4
- vue (VUE) - v3
- eslint (ESLINT) - v9
- prettier (PRETTIER) - v3
- tailwindcss (TAILWINDCSS) - v3
## Skills Activation
This project has domain-specific skills available. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.
- `pest-testing` — Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code.
- `tailwindcss-development` — Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS.
- `medialibrary-development` — Build and work with spatie/laravel-medialibrary features including associating files with Eloquent models, defining media collections and conversions, generating responsive images, and retrieving media URLs and paths.
## Conventions
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
- Check for existing components to reuse before writing a new one.
## Verification Scripts
- Do not create verification scripts or tinker when tests cover that functionality and prove they work. Unit and feature tests are more important.
## Application Structure & Architecture
- Stick to existing directory structure; don't create new base folders without approval.
- Do not change the application's dependencies without approval.
## Frontend Bundling
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.
## Documentation Files
- You must only create documentation files if explicitly requested by the user.
## Replies
- Be concise in your explanations - focus on what's important rather than explaining obvious details.
=== invoiceshelf rules ===
# InvoiceShelf Architecture
## Service Pattern (Required)
All business logic must live in Service classes (`app/Services/`). This is mandatory — do not put business logic in Models or Controllers.
- **Controllers** are thin: authorize, call the service, return a response.
- **Models** only contain relationships, scopes, accessors, mutators, and constants.
- **Services** are injected into controllers via constructor injection.
- Check existing services in `app/Services/` for patterns before creating new ones.
## Testing (TDD)
InvoiceShelf follows TDD development style. Every new feature or bug fix must have tests.
- **Feature tests** (`tests/Feature/`) — test API routes end-to-end (HTTP requests, responses, database assertions). These are the primary test type.
- **Unit tests** (`tests/Unit/`) — test service classes and business logic in isolation.
- Write tests before or alongside implementation, not after.
## Roles
- **`super admin`** — global platform admin role (unscoped, manages all companies)
- **`owner`** — company-level admin role (scoped to a specific company via Bouncer, full access to that company)
=== boost rules ===
# Laravel Boost
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
## Artisan Commands
- Run Artisan commands directly via the command line (e.g., `php artisan route:list`, `php artisan tinker --execute "..."`).
- Use `php artisan list` to discover available commands and `php artisan [command] --help` to check parameters.
## URLs
- Whenever you share a project URL with the user, you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain/IP, and port.
## Debugging
- Use the `database-query` tool when you only need to read from the database.
- Use the `database-schema` tool to inspect table structure before writing migrations or models.
- To execute PHP code for debugging, run `php artisan tinker --execute "your code here"` directly.
- To read configuration values, read the config files directly or run `php artisan config:show [key]`.
- To inspect routes, run `php artisan route:list` directly.
- To check environment variables, read the `.env` file directly.
## Reading Browser Logs With the `browser-logs` Tool
- You can read browser logs, errors, and exceptions using the `browser-logs` tool from Boost.
- Only recent browser logs will be useful - ignore old logs.
## Searching Documentation (Critically Important)
- Boost comes with a powerful `search-docs` tool you should use before trying other approaches when working with Laravel or Laravel ecosystem packages. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
- Search the documentation before making code changes to ensure we are taking the correct approach.
- Use multiple, broad, simple, topic-based queries at once. For example: `['rate limiting', 'routing rate limiting', 'routing']`. The most relevant results will be returned first.
- Do not add package names to queries; package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
### Available Search Syntax
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'.
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit".
3. Quoted Phrases (Exact Position) - query="infinite scroll" - words must be adjacent and in that order.
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit".
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms.
=== php rules ===
# PHP
- Always use curly braces for control structures, even for single-line bodies.
## Constructors
- Use PHP 8 constructor property promotion in `__construct()`.
- `public function __construct(public GitHub $github) { }`
- Do not allow empty `__construct()` methods with zero parameters unless the constructor is private.
## Type Declarations
- Always use explicit return type declarations for methods and functions.
- Use appropriate PHP type hints for method parameters.
<!-- Explicit Return Types and Method Params -->
```php
protected function isAccessible(User $user, ?string $path = null): bool
{
...
}
```
## Enums
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
## Comments
- Prefer PHPDoc blocks over inline comments. Never use comments within the code itself unless the logic is exceptionally complex.
## PHPDoc Blocks
- Add useful array shape type definitions when appropriate.
=== herd rules ===
# Laravel Herd
- The application is served by Laravel Herd and will be available at: `https?://[kebab-case-project-dir].test`. Use the `get-absolute-url` tool to generate valid URLs for the user.
- You must not run any commands to make the site available via HTTP(S). It is always available through Laravel Herd.
=== tests rules ===
# Test Enforcement
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.
=== laravel/core rules ===
# Do Things the Laravel Way
- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using `php artisan list` and check their parameters with `php artisan [command] --help`.
- If you're creating a generic PHP class, use `php artisan make:class`.
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.
## Database
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
- Use Eloquent models and relationships before suggesting raw database queries.
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
- Generate code that prevents N+1 query problems by using eager loading.
- Use Laravel's query builder for very complex database operations.
### Model Creation
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `php artisan make:model --help` to check the available options.
### APIs & Eloquent Resources
- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.
## Controllers & Validation
- Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.
- Check sibling Form Requests to see if the application uses array or string based validation rules.
## Authentication & Authorization
- Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
## URL Generation
- When generating links to other pages, prefer named routes and the `route()` function.
## Queues
- Use queued jobs for time-consuming operations with the `ShouldQueue` interface.
## Configuration
- Use environment variables only in configuration files - never use the `env()` function directly outside of config files. Always use `config('app.name')`, not `env('APP_NAME')`.
## Testing
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
- When creating tests, make use of `php artisan make:test [options] {name}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
## Vite Error
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
=== pint/core rules ===
# Laravel Pint Code Formatter
- If you have modified any PHP files, you must run `vendor/bin/pint --dirty --format agent` before finalizing changes to ensure your code matches the project's expected style.
- Do not run `vendor/bin/pint --test --format agent`, simply run `vendor/bin/pint --format agent` to fix any formatting issues.
=== pest/core rules ===
## Pest
- This project uses Pest for testing. Create tests: `php artisan make:test --pest {name}`.
- Run tests: `php artisan test --compact` or filter: `php artisan test --compact --filter=testName`.
- Do NOT delete tests without approval.
=== spatie/laravel-medialibrary rules ===
## Media Library
- `spatie/laravel-medialibrary` associates files with Eloquent models, with support for collections, conversions, and responsive images.
- Always activate the `medialibrary-development` skill when working with media uploads, conversions, collections, responsive images, or any code that uses the `HasMedia` interface or `InteractsWithMedia` trait.
</laravel-boost-guidelines>

129
CLAUDE.md Normal file
View File

@@ -0,0 +1,129 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
InvoiceShelf is an open-source invoicing and expense tracking application built with Laravel 13 (PHP 8.4) and Vue 3. It supports multi-company tenancy, customer portals, recurring invoices, and PDF generation.
## Common Commands
### Development
```bash
composer run dev # Starts PHP server, queue listener, log tail, and Vite dev server concurrently
npm run dev # Vite dev server only
npm run build # Production frontend build
```
### Testing
```bash
php artisan test --compact # Run all tests
php artisan test --compact --filter=testName # Run specific test
./vendor/bin/pest --stop-on-failure # Run via Pest directly
make test # Makefile shortcut
```
Tests use SQLite in-memory DB, configured in `phpunit.xml`. Tests seed via `DatabaseSeeder` + `DemoSeeder` in `beforeEach`. Authenticate with `Sanctum::actingAs()` and set the `company` header.
### Code Style
```bash
vendor/bin/pint --dirty --format agent # Fix style on modified PHP files
vendor/bin/pint --test # Check style without fixing (CI uses this)
```
### Artisan Generators
Always use `php artisan make:*` with `--no-interaction` to create new files (models, controllers, migrations, tests, etc.).
## Architecture
### Multi-Tenancy
Every major model has a `company_id` foreign key. The `CompanyMiddleware` sets the active company from the `company` request header. Bouncer authorization is scoped to the company level via `DefaultScope` (`app/Bouncer/Scopes/DefaultScope.php`).
### Authentication
Three guards: `web` (session), `api` (Sanctum tokens for `/api/v1/`), `customer` (session for customer portal). API routes use `auth:sanctum` middleware; customer portal uses `auth:customer`.
### Routing
- **API**: All endpoints under `/api/v1/` in `routes/api.php`, grouped with `auth:sanctum`, `company`, and `bouncer` middleware
- **Web**: `routes/web.php` serves PDF endpoints, auth pages, and catch-all SPA routes (`/admin/{vue?}`, `/{company:slug}/customer/{vue?}`)
### Frontend
- Vue 3 + TypeScript + Pinia + vue-router + Tailwind v4 (`@tailwindcss/vite`)
- Entry point: `resources/scripts/main.ts` (single Vite input)
- Feature-folder layout under `resources/scripts/features/{admin,auth,company,customer-portal,...}` — each feature owns its own `routes.ts`, `views/`, `components/`
- Shared layers: `resources/scripts/{api,stores,components,composables,layouts,plugins,utils,types,config}`
- Path aliases: `@``resources/` (so most imports look like `@/scripts/api/client`, `@/scripts/stores/global.store`); `$fonts``resources/static/fonts`; `$images``resources/static/img`. There is no `@v2` alias — that was retired when the legacy v1 SPA was deleted.
- i18n: `lang/*.json` are dynamically imported by `resources/scripts/plugins/i18n.ts`. Locale-code → filename mismatches (e.g. `pt_BR``pt-br.json`) live in `LOCALE_FILE_MAP`. English is statically bundled; other locales lazy-load. Only edit `lang/en.json` directly — other locales are Crowdin-sourced.
- Vite dev server expects the `invoiceshelf.test` hostname (configured in `vite.config.js`)
### CSS Theme Tokens
The styling system uses **Tailwind v4 with CSS custom properties as the source of truth** — colors are not configured in JS, they live in CSS and are exposed to Tailwind via the `@theme` directive. Two files own this:
1. **`resources/css/themes.css`** — defines every color as a CSS custom property on `:root` (light) and `[data-theme="dark"]` (dark). This is where you change actual values.
2. **`resources/css/invoiceshelf.css`** — has an `@theme inline { ... }` block that **registers** each custom property as a Tailwind theme token (e.g. `--color-heading: var(--color-heading);`), making it available as utility classes (`bg-heading`, `text-heading`, `border-heading`, etc.). The block also uses the legacy `@theme { --spacing-88: 22rem; --font-base: Poppins, sans-serif; }` for non-color tokens.
**Token categories defined today:**
- `primary-{50…950}` — brand color scale
- `surface`, `surface-secondary`, `surface-tertiary`, `surface-muted` — background depth tiers
- `heading`, `body`, `muted`, `subtle` — text emphasis tiers
- `line-{light,default,strong}` — borders
- `hover`, `hover-strong` — hover backgrounds
- `header-from`, `header-to` — fixed header gradient stops (not dark-mode-aware)
- `btn-primary`, `btn-primary-hover` — button colors (fixed, always bold)
- `status-{yellow,green,blue,red,purple}` — status badge text colors
- `alert-{warning,error,success}-{bg,text}` — alert variants
**Dark mode** is toggled via the `[data-theme="dark"]` attribute on the `<html>` element. The same custom-property names get redefined under that selector — components do **not** need `dark:` variants or conditional logic, they just reference the semantic tokens and the right value is picked up automatically.
**Adding a new color token is a two-step ritual:**
1. Add the custom property to **both** `:root` and `[data-theme="dark"]` in `themes.css`
2. Add a matching `--color-X: var(--color-X);` line inside the `@theme inline` block in `invoiceshelf.css`
After that the token is usable as `bg-X` / `text-X` / `border-X` in Vue templates and as `var(--color-X)` in raw CSS. Skip step 2 and the value exists at the CSS level but Tailwind utility classes won't be generated.
**Convention — never hardcode hex/rgb values in components.** Use the semantic tokens: `text-heading` not `text-gray-900`, `bg-surface` not `bg-white`, `border-line-default` not `border-gray-300`. Hardcoded values won't follow dark-mode flips and will diverge from the rest of the app over time. There are **no exceptions** in the project — even the auth pages (which sit outside the admin chrome) use the same `bg-surface` / `text-heading` / `border-line-default` vocabulary as `BaseCard`, just composed differently.
### Backend Patterns
- **Authorization**: Silber/Bouncer with policies in `app/Policies/`. Controllers use `$this->authorize()`.
- **Validation**: Form Request classes, never inline validation
- **API responses**: Eloquent API Resources in `app/Http/Resources/`
- **PDF generation**: Pluggable driver — `dompdf` (default, via `GeneratesPdfTrait`) or `gotenberg` (headless Chromium). Driver chosen per company through the **PDF Generation** admin settings page.
- **Email**: Mailable classes with `EmailLog` tracking. Mail driver is configurable globally and may be overridden per-company.
- **File storage**: Spatie MediaLibrary backed by the **FileDisk** model — admins create named disk entries (local / S3 / Dropbox / DigitalOcean Spaces) and assign them to purposes (`media_storage`, `pdf_storage`, `backup_storage`) in **Admin → File Disks → Disk Assignments**. New uploads go to the assigned disk; existing files stay where they were and require `php artisan media:secure` to migrate.
- **Serial numbers**: `SerialNumberService`
- **Company settings**: `CompanySetting` model (key-value per company)
- **User settings**: User-level preferences (notably `language`) stored as JSON via `setSettings()`. The sentinel value `'default'` means "inherit the company-level setting" — used for the per-user language preference so promoting/inviting members doesn't freeze a copy of the inviter's language.
### PDF Font System
PDFs ship with bundled **Noto Sans** (Latin / Greek / Cyrillic) as the default face. Non-Latin scripts come from on-demand **Font Packages** managed in **Admin → Font Packages** and defined in `FontService::FONT_PACKAGES` (`app/Services/FontService.php`). Currently shipped packages: `noto-sans` (bundled, marker only), `noto-sans-{sc,tc,jp,kr}` (CJK), `noto-sans-hebrew`, `noto-naskh-arabic` (covers `ar`/`fa`/`ur`), `noto-sans-devanagari` (`hi`), `sarabun` (Thai). `GeneratesPdfTrait::ensureFontsForLocale()` synchronously installs the matching package on the first PDF render for a given company language.
Two non-obvious constraints when extending the font system:
1. **dompdf's PHP-Font-Lib does not parse variable fonts** (`fvar`/`gvar` tables). Any new package must source **static TTF** files — Google Fonts' main repo ships variable fonts and produces empty boxes. Reliable static-TTF sources used today: `openmaptiles/fonts` for non-CJK Noto scripts, `life888888/cjk-fonts-ttf` for the CJK packages, `google/fonts/ofl/sarabun` for Thai.
2. **dompdf does not glyph-fall-back through the `font-family` chain** — it uses the *first* font for ALL characters. So locale-specific packages must be the **primary** font for that locale, not a fallback. Selection happens in `FontService::getFontFamilyForLocale()`. This is also why a Latin-locale company with a Hebrew customer name will still render boxes for the Hebrew text — solving that needs Gotenberg or a custom mid-render font-switching pass.
The bundled NotoSans is also surfaced as a `bundled: true` package entry (no download URL, files served from `resources/static/fonts/` instead of `storage/fonts/`) so it appears alongside the on-demand packages in the admin UI with a "Bundled" pill instead of an Install button.
### Database
Supports MySQL, PostgreSQL, and SQLite. Prefer Eloquent over raw queries. Use `Model::query()` instead of `DB::`. Use eager loading to prevent N+1 queries.
### Service Pattern
All business logic must live in Service classes (`app/Services/`), not in Models or Controllers. Controllers are thin — they authorize, call the service, and return a response. Models only contain relationships, scopes, accessors, mutators, and constants. Services are injected via constructor injection.
### Testing (TDD)
InvoiceShelf follows TDD development style:
- **Feature tests** (`tests/Feature/`) — test API routes end-to-end (HTTP requests, responses, database assertions)
- **Unit tests** (`tests/Unit/`) — test service classes and business logic in isolation
- Write tests before or alongside implementation. Every new feature or bug fix must have tests.
## Code Conventions
- PHP: snake_case, constructor property promotion, explicit return types, PHPDoc blocks over inline comments
- TS / Vue: camelCase, `<script setup lang="ts">`, prefer Composition API + Pinia stores over component-local state for anything cross-cutting
- Always check sibling files for patterns before creating new ones
- Use `config()` helper, never `env()` outside config files
- Every change must have tests
- Run `vendor/bin/pint --dirty --format agent` after modifying PHP files
- After editing `lang/en.json` or any file under `resources/scripts/`, rebuild via `npm run build` — the bundled chunks (including locale chunks) are content-hashed by Vite, so the browser will pick them up on hard refresh
## CI Pipeline
GitHub Actions (`check.yaml`): runs Pint style check, then builds frontend and runs Pest tests on PHP 8.4.

68
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,68 @@
# Contributing to InvoiceShelf
Thank you for your interest in contributing to InvoiceShelf! We welcome contributions from the community and appreciate your effort to improve this project.
## How to Contribute
1. **Fork the repository** and create a new branch from `master`
2. **Make your changes** — follow the existing code style and conventions
3. **Write tests** if applicable
4. **Run the test suite** to ensure nothing is broken
5. **Submit a Pull Request** with a clear description of the changes
## Development Setup
Please refer to the [README](README.md) for instructions on setting up the development environment.
## Code Style
- **PHP**: Follow PSR-12 standards. Run `vendor/bin/pint --dirty` before committing
- **TypeScript/Vue**: Follow the existing patterns in `resources/scripts/`
- **Tests**: Every new feature or bug fix should include tests
## Contributor License Agreement (CLA)
By submitting a pull request, patch, commit, or any other contribution (collectively, "Contribution") to this repository, you agree to the following terms:
### Grant of Rights
You hereby grant to **Ideologix Media Dooel** (the maintainer and owner of InvoiceShelf), and to recipients of software distributed by Ideologix Media Dooel, a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to:
- Reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your Contribution and any derivative works thereof
- Use your Contribution for any purpose, including but not limited to incorporating it into InvoiceShelf or any other product or service
- Relicense your Contribution under any license, including proprietary licenses
### Copyright Assignment
You agree that your Contribution, once merged, becomes part of the InvoiceShelf project and that **Ideologix Media Dooel** retains full rights to the combined work, including the right to:
- Offer the software under dual licensing (open-source and commercial)
- Enforce the license terms against third parties
- Make licensing decisions without requiring additional permission from contributors
### Representations
By submitting a Contribution, you represent that:
1. You have the legal right to grant the above license
2. Your Contribution is your original work, or you have sufficient rights to submit it
3. Your Contribution does not violate any third-party intellectual property rights
4. You understand that your Contribution is provided voluntarily and is not confidential
### Scope
This agreement applies to all Contributions made to any repository owned by InvoiceShelf / Ideologix Media Dooel, including but not limited to code, documentation, translations, and design assets.
## Reporting Issues
- Use [GitHub Issues](https://github.com/InvoiceShelf/InvoiceShelf/issues) for bug reports and feature requests
- Include steps to reproduce for bug reports
- Check existing issues before creating a new one
## Questions?
If you have questions about contributing, feel free to open a discussion on GitHub.
---
*InvoiceShelf is maintained by [Ideologix Media Dooel](https://ideologix.com/) and licensed under the [AGPL-3.0 License](LICENSE).*

View File

@@ -25,17 +25,20 @@ dist-gen: clean composer npm-build
@cp -r public/robots.txt InvoiceShelf/public
@cp -r public/web.config InvoiceShelf/public
@cp -r resources InvoiceShelf
@cp -r lang InvoiceShelf
@cp -r routes InvoiceShelf
@cp -r storage InvoiceShelf
@cp -r vendor InvoiceShelf 2> /dev/null || true
@cp -r scripts InvoiceShelf
@cp -r version.md InvoiceShelf
@cp -r .env.example InvoiceShelf
@cp -r artisan InvoiceShelf
@cp -r composer.json InvoiceShelf
@cp -r composer.lock InvoiceShelf
@cp -r server.php InvoiceShelf
@cp -r LICENSE InvoiceShelf
@cp -r readme.md InvoiceShelf
@cp -r SECURITY.md InvoiceShelf
@cp -r server.php InvoiceShelf
@touch InvoiceShelf/storage/logs/laravel.log
dist-clean: dist-gen
@@ -45,6 +48,7 @@ dist-clean: dist-gen
@rm InvoiceShelf/storage/framework/sessions/* 2> /dev/null || true
@rm InvoiceShelf/storage/framework/views/* 2> /dev/null || true
@rm InvoiceShelf/storage/logs/* 2> /dev/null || true
@php scripts/generate-manifest.php InvoiceShelf
dist: dist-clean
@zip -r InvoiceShelf.zip InvoiceShelf

View File

@@ -2,4 +2,6 @@
## Reporting a Vulnerability
Please email security@invoiceshelf.com to report any security vulnerabilities. We will acknowledge receipt of your vulnerability and strive to send you regular updates about our progress. If you're curious about the status of your disclosure please feel free to email us again.
Please email **security@invoiceshelf.com** and cc **security@griffin-web.studio** to report any security vulnerabilities. In the unlikely event that you havent heard back, try reaching out on Discord to one of our moderators.
We will acknowledge receipt of your report and strive to provide regular updates on our progress. If you're curious about the status of your disclosure, please feel free to email us again.

File diff suppressed because it is too large Load Diff

1629
_ide_helper_models.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use App\Models\Estimate;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvoiceShelf\Models\Estimate;
class CheckEstimateStatus extends Command
{
@@ -37,7 +37,7 @@ class CheckEstimateStatus extends Command
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$date = Carbon::now();
$status = [Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED];

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use App\Models\Invoice;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvoiceShelf\Models\Invoice;
class CheckInvoiceStatus extends Command
{
@@ -37,7 +37,7 @@ class CheckInvoiceStatus extends Command
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$date = Carbon::now();
$invoices = Invoice::whereNotIn('status', [Invoice::STATUS_COMPLETED, Invoice::STATUS_DRAFT])

View File

@@ -1,9 +1,12 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use App\Services\Pdf\PdfTemplateUtils;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class CreateTemplateCommand extends Command
{
@@ -33,32 +36,57 @@ class CreateTemplateCommand extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle()
public function handle(): int
{
$templateName = $this->argument('name');
$type = $this->option('type');
$templateType = $this->option('type');
if (! $type) {
$type = $this->choice('Create a template for?', ['invoice', 'estimate']);
if (! $templateType) {
$templateType = $this->choice('Create a template for?', ['invoice', 'estimate']);
}
if (Storage::disk('views')->exists("/app/pdf/{$type}/{$templateName}.blade.php")) {
if (PdfTemplateUtils::customTemplateFileExists($templateType, sprintf('%s.blade.php', $templateName))) {
$this->info('Template with given name already exists.');
return 0;
return self::INVALID;
}
Storage::disk('views')->copy("/app/pdf/{$type}/{$type}1.blade.php", "/app/pdf/{$type}/{$templateName}.blade.php");
copy(public_path("/build/img/PDF/{$type}1.png"), public_path("/build/img/PDF/{$templateName}.png"));
copy(resource_path("/static/img/PDF/{$type}1.png"), resource_path("/static/img/PDF/{$templateName}.png"));
if (! PdfTemplateUtils::toCustomTemplateMarkupFile(
Str::replace(
sprintf('app.pdf.%s', $templateType),
sprintf('pdf_templates::%s', $templateType),
Storage::disk('views')->get("/app/pdf/{$templateType}/{$templateType}1.blade.php"),
),
$templateType,
$templateName
)) {
$this->error(sprintf('Unable to create %s template.', ucfirst($templateType)));
$path = resource_path("views/app/pdf/{$type}/{$templateName}.blade.php");
$type = ucfirst($type);
$this->info("{$type} Template created successfully at ".$path);
return self::FAILURE;
}
return 0;
PdfTemplateUtils::toCustomTemplateImageFile(
File::get(resource_path("static/img/PDF/{$templateType}1.png")),
$templateType,
$templateName,
);
if (! PdfTemplateUtils::customTemplateFileExists($templateType, 'partials/table.blade.php')) {
PdfTemplateUtils::toCustomTemplateFile(
Storage::disk('views')->get("/app/pdf/{$templateType}/partials/table.blade.php"),
$templateType,
'partials/table.blade.php'
);
}
$this->info(
sprintf('%s Template created successfully at %s',
ucfirst($templateType),
PdfTemplateUtils::getCustomTemplateFilePath($templateType, sprintf('%s.blade.php', $templateName))
)
);
return self::SUCCESS;
}
}

View File

@@ -1,9 +1,9 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use App\Services\Module\ModuleInstaller;
use Illuminate\Console\Command;
use InvoiceShelf\Space\ModuleInstaller;
class InstallModuleCommand extends Command
{
@@ -33,10 +33,8 @@ class InstallModuleCommand extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle()
public function handle(): int
{
ModuleInstaller::complete($this->argument('module'), $this->argument('version'));

View File

@@ -0,0 +1,132 @@
<?php
namespace App\Console\Commands;
use App\Models\FileDisk;
use App\Models\Setting;
use App\Services\FileDiskService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class MigrateMediaToPrivateDisk extends Command
{
protected $signature = 'media:secure {--dry-run : Show what would be moved without moving}';
protected $description = 'Move sensitive media files (receipts) from the public disk to the private disk';
public function handle(): int
{
$targetDisk = $this->resolveTargetDisk();
if (! $targetDisk) {
$this->error('No target disk found. Set a default FileDisk or configure media_disk_id setting.');
return self::FAILURE;
}
$targetDiskName = app(FileDiskService::class)->registerDisk($targetDisk);
$targetRoot = config('filesystems.disks.'.$targetDiskName.'.root');
if (! $targetRoot) {
$this->error('Could not resolve target disk root path.');
return self::FAILURE;
}
$records = DB::table('media')
->where('disk', 'public')
->where(function ($query) {
$query->where('collection_name', 'receipts');
})
->get();
if ($records->isEmpty()) {
$this->info('No media files to migrate.');
return self::SUCCESS;
}
$this->info('Found '.$records->count().' file(s) to migrate.');
if ($this->option('dry-run')) {
foreach ($records as $record) {
$this->line(" Would move: media/{$record->id}/{$record->file_name}");
}
return self::SUCCESS;
}
$moved = 0;
$skipped = 0;
$publicMediaRoot = public_path('media');
$bar = $this->output->createProgressBar($records->count());
$bar->start();
foreach ($records as $record) {
$relativePath = $record->id.DIRECTORY_SEPARATOR.$record->file_name;
$sourcePath = $publicMediaRoot.DIRECTORY_SEPARATOR.$relativePath;
$destPath = $targetRoot.DIRECTORY_SEPARATOR.$relativePath;
if (! file_exists($sourcePath)) {
$skipped++;
$bar->advance();
continue;
}
$destDir = dirname($destPath);
if (! File::isDirectory($destDir)) {
File::makeDirectory($destDir, 0755, true);
}
File::move($sourcePath, $destPath);
DB::table('media')
->where('id', $record->id)
->update(['disk' => $targetDiskName]);
$moved++;
$bar->advance();
}
$bar->finish();
$this->newLine(2);
$this->info("Done. Moved: {$moved}, Skipped (missing): {$skipped}");
// Clean up empty directories in public/media
$this->cleanEmptyDirectories($publicMediaRoot);
return self::SUCCESS;
}
private function resolveTargetDisk(): ?FileDisk
{
$mediaDiskId = Setting::getSetting('media_disk_id');
if ($mediaDiskId) {
return FileDisk::find($mediaDiskId);
}
return FileDisk::where('set_as_default', true)->first();
}
private function cleanEmptyDirectories(string $path): void
{
if (! File::isDirectory($path)) {
return;
}
$directories = File::directories($path);
foreach ($directories as $dir) {
$this->cleanEmptyDirectories($dir);
if (count(File::allFiles($dir)) === 0 && count(File::directories($dir)) === 0) {
File::deleteDirectory($dir);
}
}
}
}

View File

@@ -1,11 +1,13 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Support\Facades\Artisan;
use function Laravel\Prompts\confirm;
class ResetApp extends Command
{
use ConfirmableTrait;
@@ -22,7 +24,7 @@ class ResetApp extends Command
*
* @var string
*/
protected $description = 'Clean database, database_created and public/storage folder';
protected $description = 'Clean database and public/storage folder';
/**
* Create a new command instance.
@@ -39,30 +41,49 @@ class ResetApp extends Command
*
* @return mixed
*/
public function handle()
/**
* Execute the console command to reset the application.
*
* This will:
* 1. Enable maintenance mode to prevent access during reset
* 2. Fresh migrate the database with initial seeds
* 3. Seed demo data using DemoSeeder
* 4. Clear all application caches
* 5. Disable maintenance mode
*
* The --force flag can be used to skip confirmation prompt.
*/
public function handle(): void
{
if (! $this->confirmToProceed()) {
return;
if (! $this->option('force')) {
if (! confirm('Are you sure you want to reset the application?')) {
$this->components->error('Reset cancelled');
return;
}
}
$this->info('Running migrate:fresh');
// Enable maintenance mode to prevent access during reset
$this->info('Activating maintenance mode...');
Artisan::call('down');
// Fresh migrate database and run initial seeds
$this->info('Running migrate:fresh');
Artisan::call('migrate:fresh --seed --force');
// Seed demo data
$this->info('Seeding database');
Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]);
$path = base_path('.env');
// Clear all application caches
$this->info('Clearing cache...');
Artisan::call('optimize:clear');
if (file_exists($path)) {
file_put_contents($path, str_replace(
'APP_DEBUG=true',
'APP_DEBUG=false',
file_get_contents($path)
));
}
// Disable maintenance mode
$this->info('Deactivating maintenance mode...');
Artisan::call('up');
$this->info('App has been reset successfully');
$this->info('App reset completed successfully!');
}
}

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Console\Commands;
namespace App\Console\Commands;
use App\Services\Update\Updater;
use Illuminate\Console\Command;
use InvoiceShelf\Models\Setting;
use InvoiceShelf\Space\Updater;
use Illuminate\Support\Facades\File;
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
class UpdateCommand extends Command
@@ -42,7 +42,7 @@ class UpdateCommand extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
set_time_limit(3600); // 1 hour
@@ -98,7 +98,7 @@ class UpdateCommand extends Command
public function getInstalledVersion()
{
return Setting::getSetting('version');
return preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
}
public function getLatestVersionResponse()

View File

@@ -1,60 +0,0 @@
<?php
namespace InvoiceShelf\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use InvoiceShelf\Models\CompanySetting;
use InvoiceShelf\Models\RecurringInvoice;
use InvoiceShelf\Space\InstallUtils;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\ResetApp::class,
Commands\UpdateCommand::class,
Commands\CreateTemplateCommand::class,
Commands\InstallModuleCommand::class,
];
/**
* Define the application's command schedule.
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
if (InstallUtils::isDbCreated()) {
$schedule->command('check:invoices:status')
->daily();
$schedule->command('check:estimates:status')
->daily();
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$timeZone = CompanySetting::getSetting('time_zone', $recurringInvoice->company_id);
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency)->timezone($timeZone);
}
}
}
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@@ -1,6 +1,6 @@
<?php
namespace InvoiceShelf\Events;
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;

View File

@@ -1,6 +1,6 @@
<?php
namespace InvoiceShelf\Events;
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;

View File

@@ -1,6 +1,6 @@
<?php
namespace InvoiceShelf\Events;
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;

View File

@@ -1,6 +1,6 @@
<?php
namespace InvoiceShelf\Events;
namespace App\Events;
use Illuminate\Foundation\Events\Dispatchable;

View File

@@ -1,51 +0,0 @@
<?php
namespace InvoiceShelf\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @return void
*/
public function report(Throwable $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}

22
app/Facades/Hashids.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static string encode(mixed ...$numbers)
* @method static array decode(string $hash)
* @method static string encodeHex(string $str)
* @method static string decodeHex(string $hash)
* @method static \Hashids\Hashids connection(string|null $name = null)
*/
class Hashids extends Facade
{
protected static function getFacadeAccessor(): string
{
return 'hashids';
}
}

16
app/Facades/Pdf.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static \Psr\Http\Message\ResponseInterface loadView(string $template)
*/
class Pdf extends Facade
{
protected static function getFacadeAccessor()
{
return 'pdf.driver';
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Company;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class AdminDashboardController extends Controller
{
public function index(): JsonResponse
{
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
$dbDriver = config('database.default');
$dbVersion = $this->getDatabaseVersion($dbDriver);
return response()->json([
'app_version' => $version,
'php_version' => phpversion(),
'database' => [
'driver' => $dbDriver,
'version' => $dbVersion,
],
'counts' => [
'companies' => Company::count(),
'users' => User::count(),
],
]);
}
private function getDatabaseVersion(string $driver): ?string
{
try {
return match ($driver) {
'mysql' => DB::selectOne('SELECT VERSION() as version')?->version,
'pgsql' => DB::selectOne('SHOW server_version')?->server_version,
'sqlite' => DB::selectOne('SELECT sqlite_version() as version')?->version,
default => null,
};
} catch (\Throwable) {
return null;
}
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Jobs\CreateBackupJob;
use App\Rules\Backup\PathToZip;
use App\Services\Backup\BackupService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Spatie\Backup\BackupDestination\Backup;
use Spatie\Backup\Helpers\Format;
use Symfony\Component\HttpFoundation\StreamedResponse;
class BackupsController extends Controller
{
public function __construct(
private readonly BackupService $backupService,
) {}
public function index(Request $request): JsonResponse
{
$this->authorize('manage backups');
try {
$destination = $this->backupService->getDestination($request->file_disk_id);
$backups = $destination
->backups()
->map(function (Backup $backup) {
return [
'path' => $backup->path(),
'created_at' => $backup->date()->format('Y-m-d H:i:s'),
'size' => Format::humanReadableSize($backup->sizeInBytes()),
];
})
->toArray();
return response()->json([
'backups' => $backups,
]);
} catch (\Exception $e) {
return response()->json([
'backups' => [],
'error' => 'invalid_disk_credentials',
'error_message' => $e->getMessage(),
]);
}
}
public function store(Request $request): JsonResponse
{
$this->authorize('manage backups');
$data = $request->all();
dispatch(new CreateBackupJob($data))->onQueue(config('backup.queue.name'));
return response()->json(['success' => true]);
}
public function destroy($disk, Request $request): JsonResponse
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip],
]);
$destination = $this->backupService->getDestination($request->file_disk_id);
$destination
->backups()
->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
})
->delete();
return response()->json(['success' => true]);
}
public function download(Request $request): Response|StreamedResponse
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip],
]);
$destination = $this->backupService->getDestination($request->file_disk_id);
$backup = $destination->backups()->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
});
if (! $backup) {
return response('Backup not found', 422);
}
$fileName = pathinfo($backup->path(), PATHINFO_BASENAME);
return response()->stream(function () use ($backup) {
$stream = $backup->stream();
fpassthru($stream);
if (is_resource($stream)) {
fclose($stream);
}
}, 200, [
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Content-Type' => 'application/zip',
'Content-Length' => $backup->sizeInBytes(),
'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
'Pragma' => 'public',
]);
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Facades\Hashids;
use App\Http\Controllers\Controller;
use App\Http\Requests\AdminCompanyUpdateRequest;
use App\Http\Requests\CompaniesRequest;
use App\Http\Resources\CompanyResource;
use App\Models\Company;
use App\Services\CompanyService;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class CompaniesController extends Controller
{
public function __construct(
private readonly CompanyService $companyService,
) {}
public function index(Request $request)
{
$companies = Company::query()
->with(['owner', 'address'])
->when($request->has('search'), function ($query) use ($request) {
$query->where('name', 'like', '%'.$request->search.'%');
})
->when($request->has('orderByField') && $request->has('orderBy'), function ($query) use ($request) {
$query->orderBy($request->orderByField, $request->orderBy);
}, function ($query) {
$query->orderBy('name', 'asc');
})
->paginate($request->input('limit', 10));
return CompanyResource::collection($companies);
}
public function show(Company $company)
{
$company->load(['owner', 'address']);
return new CompanyResource($company);
}
public function update(AdminCompanyUpdateRequest $request, Company $company)
{
$company->update([
'name' => $request->name,
'vat_id' => $request->vat_id,
'tax_id' => $request->tax_id,
'owner_id' => $request->owner_id,
]);
if ($request->has('address')) {
$company->address()->updateOrCreate(
['company_id' => $company->id],
$request->address,
);
}
$company->load(['owner', 'address']);
return new CompanyResource($company);
}
public function store(CompaniesRequest $request)
{
$this->authorize('create company');
$user = $request->user();
$company = Company::create($request->getCompanyPayload());
$company->unique_hash = Hashids::connection(Company::class)->encode($company->id);
$company->save();
$this->companyService->setupDefaults($company);
$user->companies()->attach($company->id);
BouncerFacade::scope()->to($company->id);
$user->assign('owner');
if ($request->address) {
$company->address()->create($request->address);
}
return new CompanyResource($company);
}
public function destroy(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('delete company', $company);
$user = $request->user();
if ($request->name !== $company->name) {
return respondJson('company_name_must_match_with_given_name', 'Company name must match with given name');
}
$this->companyService->delete($company, $user);
return response()->json([
'success' => true,
]);
}
public function userCompanies(Request $request)
{
$companies = $request->user()->companies;
return CompanyResource::collection($companies);
}
}

View File

@@ -1,18 +1,19 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\General;
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Resources\CountryResource;
use App\Models\Country;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Resources\CountryResource;
use InvoiceShelf\Models\Country;
class CountriesController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function __invoke(Request $request)
{

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Resources\CurrencyResource;
use App\Services\CurrencyService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
class CurrenciesController extends Controller
{
public function __construct(
private readonly CurrencyService $currencyService,
) {}
public function __invoke(Request $request): AnonymousResourceCollection
{
$currencies = $this->currencyService->getAllWithCommonFirst();
return CurrencyResource::collection($currencies);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Services\FontService;
use Illuminate\Http\JsonResponse;
class FontController extends Controller
{
public function __construct(
private readonly FontService $fontService,
) {}
public function status(): JsonResponse
{
$this->authorize('manage settings');
return response()->json([
'packages' => $this->fontService->getPackageStatuses(),
]);
}
public function install(string $package): JsonResponse
{
$this->authorize('manage settings');
if (! isset(FontService::FONT_PACKAGES[$package])) {
return response()->json(['error' => 'Unknown font package'], 404);
}
$pkg = FontService::FONT_PACKAGES[$package];
if ($this->fontService->isInstalled($pkg)) {
return response()->json(['success' => true, 'message' => 'Already installed']);
}
try {
$this->fontService->downloadPackage($pkg);
return response()->json([
'success' => true,
'installed' => true,
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => $e->getMessage(),
], 500);
}
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\Admin\Modules;
use App\Http\Controllers\Controller;
use App\Http\Requests\UnzipUpdateRequest;
use App\Http\Requests\UploadModuleRequest;
use App\Services\Module\ModuleInstaller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ModuleInstallationController extends Controller
{
public function download(Request $request): JsonResponse
{
$this->authorize('manage modules');
$response = ModuleInstaller::download(
(string) $request->slug,
(string) $request->version,
$request->checksum_sha256 ? (string) $request->checksum_sha256 : null,
);
return response()->json($response);
}
public function upload(UploadModuleRequest $request): JsonResponse
{
$this->authorize('manage modules');
$response = ModuleInstaller::upload($request);
return response()->json($response);
}
public function unzip(UnzipUpdateRequest $request): JsonResponse
{
$this->authorize('manage modules');
$path = ModuleInstaller::unzip($request->module_name ?? $request->module, $request->path);
return response()->json([
'success' => true,
'path' => $path,
]);
}
public function copy(Request $request): JsonResponse
{
$this->authorize('manage modules');
$response = ModuleInstaller::copyFiles($request->module_name ?? $request->module, $request->path);
return response()->json([
'success' => $response,
]);
}
public function complete(Request $request): JsonResponse
{
$this->authorize('manage modules');
$response = ModuleInstaller::complete($request->module_name ?? $request->module, $request->version);
return response()->json([
'success' => $response,
]);
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Http\Controllers\Admin\Modules;
use App\Events\ModuleDisabledEvent;
use App\Events\ModuleEnabledEvent;
use App\Http\Controllers\Controller;
use App\Http\Resources\ModuleResource;
use App\Models\Module as ModelsModule;
use App\Services\Module\ModuleInstaller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Nwidart\Modules\Facades\Module;
class ModulesController extends Controller
{
public function index(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::getModules();
if (($response['status'] ?? 0) !== 200 || ! isset($response['body']->modules)) {
return response()->json(['error' => 'marketplace_unavailable'], 503);
}
return ModuleResource::collection(collect($response['body']->modules));
}
public function show(Request $request, string $module)
{
$this->authorize('manage modules');
$response = ModuleInstaller::getModule($module);
if (($response['status'] ?? 0) === 404) {
return response()->json(['error' => 'not_found'], 404);
}
if (($response['status'] ?? 0) !== 200 || ! isset($response['body']->data)) {
return response()->json(['error' => 'marketplace_unavailable'], 503);
}
return (new ModuleResource($response['body']->data))
->additional(['meta' => [
'modules' => ModuleResource::collection(
collect($response['body']->meta->modules ?? [])
),
]]);
}
public function checkToken(Request $request): JsonResponse
{
$this->authorize('manage modules');
return ModuleInstaller::checkToken($request->api_token);
}
public function enable(Request $request, string $module): JsonResponse
{
$this->authorize('manage modules');
$module = ModelsModule::where('name', $module)->first();
$module->update(['enabled' => true]);
$installedModule = Module::find($module->name);
$installedModule->enable();
ModuleEnabledEvent::dispatch($module);
return response()->json(['success' => true]);
}
public function disable(Request $request, string $module): JsonResponse
{
$this->authorize('manage modules');
$module = ModelsModule::where('name', $module)->first();
$module->update(['enabled' => false]);
$installedModule = Module::find($module->name);
$installedModule->disable();
ModuleDisabledEvent::dispatch($module);
return response()->json(['success' => true]);
}
}

View File

@@ -0,0 +1,268 @@
<?php
namespace App\Http\Controllers\Admin\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\DiskEnvironmentRequest;
use App\Http\Resources\FileDiskResource;
use App\Models\FileDisk;
use App\Models\Setting;
use App\Services\FileDiskService;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Support\Facades\DB;
class DiskController extends Controller
{
public function __construct(
private readonly FileDiskService $fileDiskService,
) {}
/**
* @throws AuthorizationException
* @throws AuthorizationException
*/
public function index(Request $request): AnonymousResourceCollection
{
$this->authorize('manage file disk');
$limit = $request->has('limit') ? $request->limit : 5;
$disks = FileDisk::applyFilters($request->all())
->latest()
->paginateData($limit);
return FileDiskResource::collection($disks);
}
/**
* @return JsonResponse
*
* @throws AuthorizationException
* @throws AuthorizationException
*/
public function store(DiskEnvironmentRequest $request): JsonResponse|FileDiskResource
{
$this->authorize('manage file disk');
if (! $this->fileDiskService->validateCredentials($request->credentials, $request->driver)) {
return respondJson('invalid_credentials', 'Invalid Credentials.');
}
$disk = $this->fileDiskService->create($request);
return new FileDiskResource($disk);
}
/**
* @throws AuthorizationException
*/
public function update(FileDisk $disk, Request $request): JsonResponse|FileDiskResource
{
$this->authorize('manage file disk');
$credentials = $request->credentials;
$driver = $request->driver;
if ($credentials && $driver && $disk->type !== 'SYSTEM') {
if (! $this->fileDiskService->validateCredentials($credentials, $driver)) {
return respondJson('invalid_credentials', 'Invalid Credentials.');
}
$this->fileDiskService->update($disk, $request);
} elseif ($request->set_as_default) {
$this->fileDiskService->setAsDefault($disk);
}
return new FileDiskResource($disk);
}
/**
* @param Request $request
*
* @throws AuthorizationException
* @throws AuthorizationException
*/
public function show($disk): JsonResponse
{
$this->authorize('manage file disk');
$diskData = [];
switch ($disk) {
case 'local':
// Path is relative to storage/app/.
// e.g., "backups" resolves to storage/app/backups/ at runtime.
$diskData = [
'root' => '',
];
break;
case 's3':
$diskData = [
'key' => '',
'secret' => '',
'region' => '',
'bucket' => '',
'root' => '',
];
break;
case 's3compat':
$diskData = [
'endpoint' => '',
'key' => '',
'secret' => '',
'region' => '',
'bucket' => '',
'root' => '',
];
case 'doSpaces':
$diskData = [
'key' => '',
'secret' => '',
'region' => '',
'bucket' => '',
'endpoint' => '',
'root' => '',
];
break;
case 'dropbox':
$diskData = [
'token' => '',
'key' => '',
'secret' => '',
'app' => '',
'root' => '',
];
break;
}
$data = array_merge($diskData);
return response()->json($data);
}
/**
* Remove the specified resource from storage.
*
* @param FileDisk $taxType
*
* @throws AuthorizationException
* @throws AuthorizationException
*/
public function destroy(FileDisk $disk): JsonResponse
{
$this->authorize('manage file disk');
if ($disk->type === 'SYSTEM') {
return respondJson('not_allowed', 'System disks cannot be deleted.');
}
if ($disk->setAsDefault()) {
return respondJson('not_allowed', 'The default disk cannot be deleted.');
}
$prefix = env('DYNAMIC_DISK_PREFIX', 'temp_');
$diskName = $prefix.$disk->driver;
$mediaCount = DB::table('media')
->where('disk', $diskName)
->orWhere('disk', $disk->driver)
->count();
if ($mediaCount > 0) {
return respondJson('disk_has_files', 'Cannot delete this disk — it contains '.$mediaCount.' file(s). Migrate files first.');
}
$disk->delete();
return response()->json([
'success' => true,
]);
}
/**
* @throws AuthorizationException
* @throws AuthorizationException
*/
public function getDiskDrivers(): JsonResponse
{
$this->authorize('manage file disk');
$drivers = [
[
'name' => 'Local',
'value' => 'local',
],
[
'name' => 'Amazon S3',
'value' => 's3',
],
[
'name' => 'S3 Compatible Storage',
'value' => 's3compat',
],
[
'name' => 'Digital Ocean Spaces',
'value' => 'doSpaces',
],
[
'name' => 'Dropbox',
'value' => 'dropbox',
],
];
$defaultDisk = FileDisk::where('set_as_default', true)->first();
return response()->json([
'drivers' => $drivers,
'default' => $defaultDisk?->driver ?? 'local',
]);
}
public function getDiskPurposes(): JsonResponse
{
$this->authorize('manage file disk');
$defaultDisk = FileDisk::where('set_as_default', true)->first();
$defaultId = $defaultDisk?->id;
return response()->json([
'media_disk_id' => Setting::getSetting('media_disk_id') ?? $defaultId,
'pdf_disk_id' => Setting::getSetting('pdf_disk_id') ?? $defaultId,
'backup_disk_id' => Setting::getSetting('backup_disk_id') ?? $defaultId,
]);
}
public function updateDiskPurposes(Request $request): JsonResponse
{
$this->authorize('manage file disk');
$request->validate([
'media_disk_id' => 'nullable|exists:file_disks,id',
'pdf_disk_id' => 'nullable|exists:file_disks,id',
'backup_disk_id' => 'nullable|exists:file_disks,id',
]);
if ($request->has('media_disk_id')) {
Setting::setSetting('media_disk_id', $request->media_disk_id);
}
if ($request->has('pdf_disk_id')) {
Setting::setSetting('pdf_disk_id', $request->pdf_disk_id);
}
if ($request->has('backup_disk_id')) {
Setting::setSetting('backup_disk_id', $request->backup_disk_id);
}
return response()->json(['success' => true]);
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace App\Http\Controllers\Admin\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\MailEnvironmentRequest;
use App\Mail\TestMail;
use App\Models\Setting;
use App\Services\MailConfigurationService;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Illuminate\Validation\ValidationException;
class MailConfigurationController extends Controller
{
public function __construct(private readonly MailConfigurationService $mailConfigurationService) {}
/**
* Save the mail environment variables
*
*
*
* @throws AuthorizationException
*/
public function saveMailEnvironment(MailEnvironmentRequest $request): JsonResponse
{
$this->authorize('manage email config');
$setting = Setting::getSetting('profile_complete');
$this->mailConfigurationService->saveGlobalConfig($request->validated());
if ($setting !== 'COMPLETED') {
Setting::setSetting('profile_complete', 4);
}
return response()->json([
'success' => 'mail_variables_save_successfully',
]);
}
/**
* Return the mail environment variables
*
*
* @throws AuthorizationException
*/
public function getMailEnvironment(): JsonResponse
{
$this->authorize('manage email config');
return response()->json($this->mailConfigurationService->getGlobalConfig());
}
/**
* Return the available mail drivers
*
*
* @throws AuthorizationException
*/
public function getMailDrivers(): JsonResponse
{
$this->authorize('manage email config');
return response()->json($this->mailConfigurationService->getAvailableDrivers());
}
/**
* Test the email configuration
*
*
*
* @throws AuthorizationException
* @throws ValidationException
*/
public function testEmailConfig(Request $request): JsonResponse
{
$this->authorize('manage email config');
$this->validate($request, [
'to' => 'required|email',
'subject' => 'required',
'message' => 'required',
]);
Mail::to($request->to)->send(new TestMail($request->subject, $request->message));
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Http\Controllers\Admin\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\PDFConfigurationRequest;
use App\Models\Setting;
use App\Services\Setup\EnvironmentManager;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\JsonResponse;
class PDFConfigurationController extends Controller
{
protected EnvironmentManager $environmentManager;
/**
* Constructor
*/
public function __construct(EnvironmentManager $environmentManager)
{
$this->environmentManager = $environmentManager;
}
/**
* Returns the available drivers
*
* @throws AuthorizationException
*/
public function getDrivers(): JsonResponse
{
$this->authorize('manage pdf config');
$drivers = [
'dompdf',
'gotenberg',
];
return response()->json($drivers);
}
/**
* Return the PDF settings
*
* @throws AuthorizationException
*/
public function getEnvironment(): JsonResponse
{
$this->authorize('manage pdf config');
// Get PDF settings from database
$pdfSettings = Setting::getSettings([
'pdf_driver',
'gotenberg_host',
'gotenberg_papersize',
'gotenberg_margins',
]);
$config = [
'pdf_driver' => $pdfSettings['pdf_driver'] ?? config('pdf.driver'),
'gotenberg_host' => $pdfSettings['gotenberg_host'] ?? config('pdf.connections.gotenberg.host'),
'gotenberg_margins' => $pdfSettings['gotenberg_margins'] ?? config('pdf.connections.gotenberg.margins'),
'gotenberg_papersize' => $pdfSettings['gotenberg_papersize'] ?? config('pdf.connections.gotenberg.papersize'),
];
return response()->json($config);
}
/**
* Saves the settings
*
* @throws AuthorizationException
*/
public function saveEnvironment(PDFConfigurationRequest $request): JsonResponse
{
$this->authorize('manage pdf config');
// Prepare PDF settings for database storage
$pdfSettings = $this->preparePDFSettingsForDatabase($request);
// Save PDF settings to database
Setting::setSettings($pdfSettings);
return response()->json([
'success' => 'pdf_variables_save_successfully',
]);
}
/**
* Prepare PDF settings for database storage
*/
private function preparePDFSettingsForDatabase(PDFConfigurationRequest $request): array
{
$driver = $request->get('pdf_driver');
// Base settings that are always saved
$settings = [
'pdf_driver' => $driver,
];
// Driver-specific settings
switch ($driver) {
case 'gotenberg':
$settings = array_merge($settings, [
'gotenberg_host' => $request->get('gotenberg_host'),
'gotenberg_papersize' => $request->get('gotenberg_papersize'),
'gotenberg_margins' => $request->get('gotenberg_margins'),
]);
break;
case 'dompdf':
// dompdf doesn't have additional configuration in the current setup
break;
}
return $settings;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers\Admin\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\GetSettingRequest;
use App\Http\Requests\SettingRequest;
use App\Models\Setting;
use Illuminate\Http\JsonResponse;
class SettingsController extends Controller
{
public function show(GetSettingRequest $request): JsonResponse
{
$this->authorize('manage settings');
$setting = Setting::getSetting($request->key);
return response()->json([
$request->key => $setting,
]);
}
public function update(SettingRequest $request): JsonResponse
{
$this->authorize('manage settings');
Setting::setSettings($request->settings);
return response()->json([
'success' => true,
$request->settings,
]);
}
}

View File

@@ -0,0 +1,116 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Services\Update\Updater;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
class UpdateController extends Controller
{
public function checkVersion(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
set_time_limit(600);
$channel = $request->get('channel', 'stable');
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
return response()->json(Updater::checkForUpdate($version, $channel));
}
public function download(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
$request->validate(['version' => 'required']);
return response()->json([
'success' => true,
'path' => Updater::download($request->version),
]);
}
public function unzip(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
$request->validate(['path' => 'required']);
try {
return response()->json([
'success' => true,
'path' => Updater::unzip($request->path),
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => $e->getMessage(),
], 500);
}
}
public function copy(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
$request->validate(['path' => 'required']);
return response()->json([
'success' => true,
'path' => Updater::copyFiles($request->path),
]);
}
public function delete(Request $request): JsonResponse
{
return $this->clean($request);
}
public function clean(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
// Backward compatibility: use deleted_files when no manifest exists
if (! File::exists(base_path('manifest.json'))
&& isset($request->deleted_files)
&& ! empty($request->deleted_files)) {
Updater::deleteFiles($request->deleted_files);
return response()->json(['success' => true, 'cleaned' => 0]);
}
$result = Updater::cleanStaleFiles();
return response()->json($result);
}
public function migrate(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
Updater::migrateUpdate();
return response()->json(['success' => true]);
}
public function finish(Request $request): JsonResponse
{
$this->ensureSuperAdmin();
$request->validate([
'installed' => 'required',
'version' => 'required',
]);
return response()->json(Updater::finishUpdate($request->installed, $request->version));
}
private function ensureSuperAdmin(): void
{
$this->authorize('manage update app');
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\AdminUserUpdateRequest;
use App\Http\Resources\UserResource;
use App\Models\ImpersonationLog;
use App\Models\User;
use Illuminate\Http\Request;
use Laravel\Sanctum\PersonalAccessToken;
class UsersController extends Controller
{
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$users = User::with('companies')
->applyFilters($request->all())
->latest()
->paginate($limit);
return UserResource::collection($users);
}
public function show(User $user)
{
$user->load('companies');
return new UserResource($user);
}
public function update(AdminUserUpdateRequest $request, User $user)
{
$data = $request->only(['name', 'email', 'phone']);
if ($request->filled('password')) {
$data['password'] = $request->password;
}
$user->update($data);
return new UserResource($user);
}
public function impersonate(Request $request, User $user)
{
$admin = $request->user();
if ($admin->id === $user->id) {
return response()->json([
'error' => 'cannot_impersonate_self',
'message' => 'You cannot impersonate yourself.',
], 422);
}
$token = $user->createToken(
'impersonation-by-'.$admin->id,
['*'],
now()->addHours(2),
);
$log = ImpersonationLog::create([
'admin_id' => $admin->id,
'user_id' => $user->id,
'ip_address' => $request->ip(),
'token_id' => $token->accessToken->id,
]);
return response()->json([
'token' => $token->plainTextToken,
'impersonation_log_id' => $log->id,
'user' => new UserResource($user),
]);
}
public function stopImpersonating(Request $request)
{
$token = $request->user()->currentAccessToken();
if ($token instanceof PersonalAccessToken && str_starts_with($token->name, 'impersonation-by-')) {
$log = ImpersonationLog::where('token_id', $token->id)
->whereNull('stopped_at')
->first();
if ($log) {
$log->update(['stopped_at' => now()]);
}
$token->delete();
return response()->json(['success' => true]);
}
return response()->json([
'error' => 'not_impersonating',
'message' => 'No active impersonation session.',
], 422);
}
}

View File

@@ -1,23 +1,32 @@
<?php
namespace InvoiceShelf\Http\Controllers;
namespace App\Http\Controllers;
use App\Models\Setting;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Models\Setting;
use Illuminate\Support\Facades\File;
class AppVersionController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return JsonResponse
*/
public function __invoke(Request $request)
{
$version = Setting::getSetting('version');
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
$channel = Setting::getSetting('updater_channel');
if (is_null($channel)) {
$channel = 'stable';
Setting::setSetting('updater_channel', 'stable'); // default.
}
return response()->json([
'version' => $version,
'channel' => $channel,
]);
}
}

View File

@@ -1,20 +1,22 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Mobile;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\LoginRequest;
use App\Models\CompanyInvitation;
use App\Models\User;
use App\Services\InvitationService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\LoginRequest;
use InvoiceShelf\Models\User;
class AuthController extends Controller
{
public function login(LoginRequest $request)
{
$user = User::where('email', $request->username)->first();
$user = User::whereRaw('LOWER(email) = ?', [strtolower($request->username)])->first();
if (! $user || ! Hash::check($request->password, $user->password)) {
throw ValidationException::withMessages([
@@ -22,6 +24,17 @@ class AuthController extends Controller
]);
}
// Auto-accept invitation if token is provided
if ($request->has('invitation_token') && $request->invitation_token) {
$invitation = CompanyInvitation::where('token', $request->invitation_token)
->pending()
->first();
if ($invitation) {
app(InvitationService::class)->accept($invitation, $user);
}
}
return response()->json([
'type' => 'Bearer',
'token' => $user->createToken($request->device_name)->plainTextToken,

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Providers\RouteServiceProvider;
class ConfirmPasswordController extends Controller
{
@@ -26,7 +26,7 @@ class ConfirmPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = AppServiceProvider::HOME;
/**
* Create a new controller instance.

View File

@@ -1,10 +1,12 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
class ForgotPasswordController extends Controller
{
@@ -25,7 +27,7 @@ class ForgotPasswordController extends Controller
* Get the response for a successful password reset link.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
* @return RedirectResponse|JsonResponse
*/
protected function sendResetLinkResponse(Request $request, $response)
{
@@ -39,7 +41,7 @@ class ForgotPasswordController extends Controller
* Get the response for a failed password reset link.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
* @return RedirectResponse|JsonResponse
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Models\CompanyInvitation;
use App\Models\User;
use App\Services\InvitationService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
class InvitationRegistrationController extends Controller
{
public function __construct(
private readonly InvitationService $invitationService,
) {}
/**
* Get invitation details by token (public endpoint for registration page).
*/
public function details(string $token): JsonResponse
{
$invitation = CompanyInvitation::where('token', $token)
->pending()
->with(['company', 'role'])
->first();
if (! $invitation) {
return response()->json([
'error' => 'Invitation not found or expired.',
], 404);
}
return response()->json([
'email' => $invitation->email,
'company_name' => $invitation->company->name,
'role_name' => $invitation->role->title,
]);
}
/**
* Register a new user and auto-accept the invitation.
*/
public function register(Request $request): JsonResponse
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:8|confirmed',
'invitation_token' => 'required|string',
]);
$invitation = CompanyInvitation::where('token', $request->invitation_token)
->pending()
->first();
if (! $invitation) {
throw ValidationException::withMessages([
'invitation_token' => ['Invitation not found or expired.'],
]);
}
if ($invitation->email !== $request->email) {
throw ValidationException::withMessages([
'email' => ['Email does not match the invitation.'],
]);
}
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => $request->password,
]);
$user->setSettings(['language' => 'default']);
$this->invitationService->accept($invitation, $user);
return response()->json([
'type' => 'Bearer',
'token' => $user->createToken('web')->plainTextToken,
]);
}
}

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Providers\RouteServiceProvider;
class LoginController extends Controller
{
@@ -26,7 +26,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = AppServiceProvider::HOME;
/**
* Create a new controller instance.

View File

@@ -1,12 +1,12 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Models\User;
use InvoiceShelf\Providers\RouteServiceProvider;
class RegisterController extends Controller
{
@@ -28,7 +28,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = AppServiceProvider::HOME;
/**
* Create a new controller instance.
@@ -61,10 +61,14 @@ class RegisterController extends Controller
*/
protected function create(array $data)
{
return User::create([
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => $data['password'],
]);
$user->setSettings(['language' => 'default']);
return $user;
}
}

View File

@@ -1,13 +1,16 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Providers\AppServiceProvider;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Contracts\Auth\CanResetPassword;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Providers\RouteServiceProvider;
class ResetPasswordController extends Controller
{
@@ -29,13 +32,13 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = AppServiceProvider::HOME;
/**
* Get the response for a successful password reset.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
* @return RedirectResponse|JsonResponse
*/
protected function sendResetResponse(Request $request, $response)
{
@@ -47,7 +50,7 @@ class ResetPasswordController extends Controller
/**
* Reset the given user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param CanResetPassword $user
* @param string $password
* @return void
*/
@@ -66,7 +69,7 @@ class ResetPasswordController extends Controller
* Get the response for a failed password reset.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
* @return RedirectResponse|JsonResponse
*/
protected function sendResetFailedResponse(Request $request, $response)
{

View File

@@ -1,10 +1,10 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Auth;
namespace App\Http\Controllers\Company\Auth;
use App\Http\Controllers\Controller;
use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Providers\RouteServiceProvider;
class VerificationController extends Controller
{
@@ -26,7 +26,7 @@ class VerificationController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = AppServiceProvider::HOME;
/**
* Create a new controller instance.

View File

@@ -1,16 +1,17 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Config;
namespace App\Http\Controllers\Company\Config;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use Illuminate\Http\Response;
class FiscalYearsController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request)
{

View File

@@ -1,16 +1,17 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Config;
namespace App\Http\Controllers\Company\Config;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use Illuminate\Http\Response;
class LanguagesController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request)
{

View File

@@ -1,16 +1,17 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Config;
namespace App\Http\Controllers\Company\Config;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use Illuminate\Http\Response;
class RetrospectiveEditsController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request)
{

View File

@@ -1,19 +1,25 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\CustomField;
namespace App\Http\Controllers\Company\CustomField;
use App\Http\Controllers\Controller;
use App\Http\Requests\CustomFieldRequest;
use App\Http\Resources\CustomFieldResource;
use App\Models\CustomField;
use App\Services\CustomFieldService;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\CustomFieldRequest;
use InvoiceShelf\Http\Resources\CustomFieldResource;
use InvoiceShelf\Models\CustomField;
use Illuminate\Http\Response;
class CustomFieldsController extends Controller
{
public function __construct(
private readonly CustomFieldService $customFieldService,
) {}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -33,13 +39,13 @@ class CustomFieldsController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\CustomFieldRequest $request
* @return \Illuminate\Http\Response
* @return Response
*/
public function store(CustomFieldRequest $request)
{
$this->authorize('create', CustomField::class);
$customField = CustomField::createCustomField($request);
$customField = $this->customFieldService->create($request);
return new CustomFieldResource($customField);
}
@@ -48,7 +54,7 @@ class CustomFieldsController extends Controller
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(CustomField $customField)
{
@@ -60,15 +66,15 @@ class CustomFieldsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Request $request
* @param int $id
* @return \Illuminate\Http\Response
* @return Response
*/
public function update(CustomFieldRequest $request, CustomField $customField)
{
$this->authorize('update', $customField);
$customField->updateCustomField($request);
$this->customFieldService->update($customField, $request);
return new CustomFieldResource($customField);
}
@@ -77,7 +83,7 @@ class CustomFieldsController extends Controller
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
* @return Response
*/
public function destroy(CustomField $customField)
{

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers\Company\Customer;
use App\Http\Controllers\Controller;
use App\Http\Resources\CustomerResource;
use App\Models\Customer;
use App\Services\CustomerService;
use Illuminate\Http\Request;
class CustomerStatsController extends Controller
{
public function __construct(
private readonly CustomerService $customerService,
) {}
public function __invoke(Request $request, Customer $customer)
{
$this->authorize('view', $customer);
$chartData = $this->customerService->getStats(
$customer,
$request->header('company'),
$request->has('previous_year')
);
$customer = Customer::find($customer->id);
return (new CustomerResource($customer))
->additional(['meta' => [
'chartData' => $chartData,
]]);
}
}

View File

@@ -1,21 +1,26 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Customer;
namespace App\Http\Controllers\Company\Customer;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Http\Requests\DeleteCustomersRequest;
use App\Http\Resources\CustomerResource;
use App\Models\Customer;
use App\Services\CustomerService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests;
use InvoiceShelf\Http\Requests\DeleteCustomersRequest;
use InvoiceShelf\Http\Resources\CustomerResource;
use InvoiceShelf\Models\Customer;
class CustomersController extends Controller
{
public function __construct(
private readonly CustomerService $customerService,
) {}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function index(Request $request)
{
@@ -26,13 +31,8 @@ class CustomersController extends Controller
$customers = Customer::with('creator')
->whereCompany()
->applyFilters($request->all())
->select(
'customers.*',
DB::raw('sum(invoices.base_due_amount) as base_due_amount'),
DB::raw('sum(invoices.due_amount) as due_amount'),
)
->groupBy('customers.id')
->leftJoin('invoices', 'customers.id', '=', 'invoices.customer_id')
->withSum('invoices as base_due_amount', 'base_due_amount')
->withSum('invoices as due_amount', 'due_amount')
->paginateData($limit);
return CustomerResource::collection($customers)
@@ -44,14 +44,14 @@ class CustomersController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
* @param Request $request
* @return JsonResponse
*/
public function store(Requests\CustomerRequest $request)
{
$this->authorize('create', Customer::class);
$customer = Customer::createCustomer($request);
$customer = $this->customerService->create($request);
return new CustomerResource($customer);
}
@@ -59,7 +59,7 @@ class CustomersController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function show(Customer $customer)
{
@@ -71,18 +71,14 @@ class CustomersController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
* @param Request $request
* @return JsonResponse
*/
public function update(Requests\CustomerRequest $request, Customer $customer)
{
$this->authorize('update', $customer);
$customer = Customer::updateCustomer($request, $customer);
if (is_string($customer)) {
return respondJson('you_cannot_edit_currency', 'Cannot change currency once transactions created');
}
$customer = $this->customerService->update($request, $customer);
return new CustomerResource($customer);
}
@@ -90,14 +86,18 @@ class CustomersController extends Controller
/**
* Remove a list of Customers along side all their resources (ie. Estimates, Invoices, Payments and Addresses)
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
* @param Request $request
* @return JsonResponse
*/
public function delete(DeleteCustomersRequest $request)
{
$this->authorize('delete multiple customers');
Customer::deleteCustomers($request->ids);
$ids = Customer::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
$this->customerService->delete($ids);
return response()->json([
'success' => true,

View File

@@ -1,17 +1,18 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Dashboard;
namespace App\Http\Controllers\Company\Dashboard;
use App\Http\Controllers\Controller;
use App\Models\Company;
use App\Models\CompanySetting;
use App\Models\Customer;
use App\Models\Estimate;
use App\Models\Expense;
use App\Models\Invoice;
use App\Models\Payment;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Models\Company;
use InvoiceShelf\Models\CompanySetting;
use InvoiceShelf\Models\Customer;
use InvoiceShelf\Models\Estimate;
use InvoiceShelf\Models\Expense;
use InvoiceShelf\Models\Invoice;
use InvoiceShelf\Models\Payment;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller
@@ -19,7 +20,7 @@ class DashboardController extends Controller
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function __invoke(Request $request)
{
@@ -40,15 +41,16 @@ class DashboardController extends Controller
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
$companyStartMonth = intval($terms[0]);
if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
if ($companyStartMonth <= $start->month) {
$startDate->month($companyStartMonth)->startOfMonth();
$start->month($companyStartMonth)->startOfMonth();
$end->month($companyStartMonth)->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
$startDate->subYear()->month($companyStartMonth)->startOfMonth();
$start->subYear()->month($companyStartMonth)->startOfMonth();
$end->subYear()->month($companyStartMonth)->endOfMonth();
}
if ($request->has('previous_year')) {
@@ -58,39 +60,27 @@ class DashboardController extends Controller
}
while ($monthCounter < 12) {
array_push(
$invoice_totals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_total')
);
array_push(
$expense_totals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$receipt_totals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$net_income_totals,
($receipt_totals[$i] - $expense_totals[$i])
);
$invoice_totals[] = Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_total');
$expense_totals[] = Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$receipt_totals[] = Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$net_income_totals[] = ($receipt_totals[$i] - $expense_totals[$i]);
$i++;
array_push($months, $start->format('M'));
$months[] = $start->translatedFormat('M');
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();

View File

@@ -1,23 +1,25 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Estimate;
namespace App\Http\Controllers\Company\Estimate;
use App\Http\Controllers\Controller;
use App\Models\Estimate;
use App\Services\Pdf\PdfTemplateUtils;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Models\Estimate;
class EstimateTemplatesController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return JsonResponse
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$estimateTemplates = Estimate::estimateTemplates();
$estimateTemplates = PdfTemplateUtils::getFormattedTemplates('estimate');
return response()->json([
'estimateTemplates' => $estimateTemplates,

View File

@@ -0,0 +1,141 @@
<?php
namespace App\Http\Controllers\Company\Estimate;
use App\Http\Controllers\Controller;
use App\Http\Requests\DeleteEstimatesRequest;
use App\Http\Requests\EstimatesRequest;
use App\Http\Requests\SendEstimatesRequest;
use App\Http\Resources\EstimateResource;
use App\Http\Resources\InvoiceResource;
use App\Jobs\GenerateEstimatePdfJob;
use App\Models\Estimate;
use App\Models\Invoice;
use App\Services\EstimateService;
use Illuminate\Http\Request;
use Illuminate\Mail\Markdown;
class EstimatesController extends Controller
{
public function __construct(
private readonly EstimateService $estimateService,
) {}
public function index(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$limit = $request->has('limit') ? $request->limit : 10;
$estimates = Estimate::whereCompany()
->join('customers', 'customers.id', '=', 'estimates.customer_id')
->applyFilters($request->all())
->select('estimates.*', 'customers.name')
->latest()
->paginateData($limit);
return EstimateResource::collection($estimates)
->additional(['meta' => [
'estimate_total_count' => Estimate::whereCompany()->count(),
]]);
}
public function store(EstimatesRequest $request)
{
$this->authorize('create', Estimate::class);
$estimate = $this->estimateService->create($request);
if ($request->has('estimateSend')) {
$this->estimateService->send($estimate, $request->only(['title', 'body']));
}
GenerateEstimatePdfJob::dispatch($estimate);
return new EstimateResource($estimate);
}
public function show(Request $request, Estimate $estimate)
{
$this->authorize('view', $estimate);
return new EstimateResource($estimate);
}
public function update(EstimatesRequest $request, Estimate $estimate)
{
$this->authorize('update', $estimate);
$estimate = $this->estimateService->update($estimate, $request);
GenerateEstimatePdfJob::dispatch($estimate, true);
return new EstimateResource($estimate);
}
public function delete(DeleteEstimatesRequest $request)
{
$this->authorize('delete multiple estimates');
$ids = Estimate::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
Estimate::destroy($ids);
return response()->json([
'success' => true,
]);
}
public function send(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$response = $this->estimateService->send($estimate, $request->all());
return response()->json($response);
}
public function sendPreview(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$markdown = new Markdown(view(), config('mail.markdown'));
$data = $this->estimateService->sendEstimateData($estimate, $request->all());
$data['url'] = $estimate->estimatePdfUrl;
return $markdown->render('emails.send.estimate', ['data' => $data]);
}
public function clone(Request $request, Estimate $estimate)
{
$this->authorize('view', $estimate);
$this->authorize('create', Estimate::class);
$newEstimate = $this->estimateService->clone($estimate);
return new EstimateResource($newEstimate);
}
public function convertToInvoice(Request $request, Estimate $estimate)
{
$this->authorize('create', Invoice::class);
$invoice = $this->estimateService->convertToInvoice($estimate);
return new InvoiceResource($invoice);
}
public function changeStatus(Request $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$this->estimateService->changeStatus($estimate, $request->status);
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,359 @@
<?php
namespace App\Http\Controllers\Company\ExchangeRate;
use App\Http\Controllers\Controller;
use App\Http\Requests\BulkExchangeRateRequest;
use App\Http\Requests\ExchangeRateProviderRequest;
use App\Http\Resources\ExchangeRateProviderResource;
use App\Models\CompanySetting;
use App\Models\Currency;
use App\Models\Estimate;
use App\Models\ExchangeRateLog;
use App\Models\ExchangeRateProvider;
use App\Models\Invoice;
use App\Models\Payment;
use App\Models\Tax;
use App\Services\ExchangeRateProviderService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Arr;
class ExchangeRateProviderController extends Controller
{
public function __construct(
private readonly ExchangeRateProviderService $exchangeRateProviderService,
) {}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
$limit = $request->has('limit') ? $request->limit : 5;
$exchangeRateProviders = ExchangeRateProvider::whereCompany()->paginate($limit);
return ExchangeRateProviderResource::collection($exchangeRateProviders);
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(ExchangeRateProviderRequest $request)
{
$this->authorize('create', ExchangeRateProvider::class);
$query = $this->exchangeRateProviderService->checkActiveCurrencies($request);
if (count($query) !== 0) {
return respondJson('currency_used', 'Currency used.');
}
$checkConverterApi = $this->exchangeRateProviderService->checkProviderStatus($request);
if ($checkConverterApi->status() == 200) {
$exchangeRateProvider = $this->exchangeRateProviderService->create($request);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
return $checkConverterApi;
}
/**
* Display the specified resource.
*
* @return Response
*/
public function show(ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('view', $exchangeRateProvider);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @return Response
*/
public function update(ExchangeRateProviderRequest $request, ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('update', $exchangeRateProvider);
$query = $this->exchangeRateProviderService->checkUpdateActiveCurrencies($exchangeRateProvider, $request);
if (count($query) !== 0) {
return respondJson('currency_used', 'Currency used.');
}
$checkConverterApi = $this->exchangeRateProviderService->checkProviderStatus($request);
if ($checkConverterApi->status() == 200) {
$this->exchangeRateProviderService->update($exchangeRateProvider, $request);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
return $checkConverterApi;
}
/**
* Remove the specified resource from storage.
*
* @return Response
*/
public function destroy(ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('delete', $exchangeRateProvider);
if ($exchangeRateProvider->active == true) {
return respondJson('provider_active', 'Provider Active.');
}
$exchangeRateProvider->delete();
return response()->json([
'success' => true,
]);
}
public function activeProvider(Request $request, Currency $currency)
{
$query = ExchangeRateProvider::whereCompany()->whereJsonContains('currencies', $currency->code)
->where('active', true)
->get();
if (count($query) !== 0) {
return response()->json([
'success' => true,
'message' => 'provider_active',
], 200);
}
return response()->json([
'error' => 'no_active_provider',
], 200);
}
public function getRate(Request $request, Currency $currency)
{
$settings = CompanySetting::getSettings(['currency'], $request->header('company'));
$baseCurrency = Currency::findOrFail($settings['currency']);
$query = ExchangeRateProvider::whereJsonContains('currencies', $currency->code)
->where('active', true)
->get()
->toArray();
$exchangeRate = ExchangeRateLog::where('base_currency_id', $currency->id)
->where('currency_id', $baseCurrency->id)
->orderBy('created_at', 'desc')
->value('exchange_rate');
if ($query) {
$filter = Arr::only($query[0], ['key', 'driver', 'driver_config']);
$result = $this->exchangeRateProviderService->getExchangeRate(
$filter['driver'],
$filter['key'],
$filter['driver_config'] ?? [],
$currency->code,
$baseCurrency->code
);
if ($result->status() == 200) {
return $result;
}
}
if ($exchangeRate) {
return response()->json([
'exchangeRate' => [$exchangeRate],
], 200);
}
return response()->json([
'error' => 'no_exchange_rate_available',
], 200);
}
public function supportedCurrencies(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
return $this->exchangeRateProviderService->getSupportedCurrencies(
$request->driver,
$request->key,
$request->driver_config ?? []
);
}
public function usedCurrencies(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
$providerId = $request->provider_id;
$activeExchangeRateProviders = ExchangeRateProvider::where('active', true)
->whereCompany()
->when($providerId, function ($query) use ($providerId) {
return $query->where('id', '<>', $providerId);
})
->pluck('currencies');
$activeExchangeRateProvider = [];
foreach ($activeExchangeRateProviders as $data) {
if (is_array($data)) {
for ($limit = 0; $limit < count($data); $limit++) {
$activeExchangeRateProvider[] = $data[$limit];
}
}
}
$allExchangeRateProviders = ExchangeRateProvider::whereCompany()->pluck('currencies');
$allExchangeRateProvider = [];
foreach ($allExchangeRateProviders as $data) {
if (is_array($data)) {
for ($limit = 0; $limit < count($data); $limit++) {
$allExchangeRateProvider[] = $data[$limit];
}
}
}
return response()->json([
'allUsedCurrencies' => $allExchangeRateProvider ? $allExchangeRateProvider : [],
'activeUsedCurrencies' => $activeExchangeRateProvider ? $activeExchangeRateProvider : [],
]);
}
public function usedCurrenciesWithoutRate(Request $request)
{
$invoices = Invoice::where('exchange_rate', null)->pluck('currency_id')->toArray();
$taxes = Tax::where('exchange_rate', null)->pluck('currency_id')->toArray();
$estimates = Estimate::where('exchange_rate', null)->pluck('currency_id')->toArray();
$payments = Payment::where('exchange_rate', null)->pluck('currency_id')->toArray();
$currencies = array_merge($invoices, $taxes, $estimates, $payments);
return response()->json([
'currencies' => Currency::whereIn('id', $currencies)->get(),
]);
}
public function bulkUpdate(BulkExchangeRateRequest $request)
{
$bulkExchangeRate = CompanySetting::getSetting('bulk_exchange_rate_configured', $request->header('company'));
if ($bulkExchangeRate == 'NO') {
if ($request->currencies) {
foreach ($request->currencies as $currency) {
$currency['exchange_rate'] = $currency['exchange_rate'] ?? 1;
$invoices = Invoice::where('currency_id', $currency['id'])->get();
if ($invoices) {
foreach ($invoices as $invoice) {
$invoice->update([
'exchange_rate' => $currency['exchange_rate'],
'base_discount_val' => $invoice->sub_total * $currency['exchange_rate'],
'base_sub_total' => $invoice->sub_total * $currency['exchange_rate'],
'base_total' => $invoice->total * $currency['exchange_rate'],
'base_tax' => $invoice->tax * $currency['exchange_rate'],
'base_due_amount' => $invoice->due_amount * $currency['exchange_rate'],
]);
$this->updateItemsExchangeRate($invoice);
}
}
$estimates = Estimate::where('currency_id', $currency['id'])->get();
if ($estimates) {
foreach ($estimates as $estimate) {
$estimate->update([
'exchange_rate' => $currency['exchange_rate'],
'base_discount_val' => $estimate->sub_total * $currency['exchange_rate'],
'base_sub_total' => $estimate->sub_total * $currency['exchange_rate'],
'base_total' => $estimate->total * $currency['exchange_rate'],
'base_tax' => $estimate->tax * $currency['exchange_rate'],
]);
$this->updateItemsExchangeRate($estimate);
}
}
$taxes = Tax::where('currency_id', $currency['id'])->get();
if ($taxes) {
foreach ($taxes as $tax) {
$tax->base_amount = $tax->base_amount * $currency['exchange_rate'];
$tax->save();
}
}
$payments = Payment::where('currency_id', $currency['id'])->get();
if ($payments) {
foreach ($payments as $payment) {
$payment->exchange_rate = $currency['exchange_rate'];
$payment->base_amount = $payment->amount * $currency['exchange_rate'];
$payment->save();
}
}
}
}
$settings = [
'bulk_exchange_rate_configured' => 'YES',
];
CompanySetting::setSettings($settings, $request->header('company'));
return response()->json([
'success' => true,
]);
}
return response()->json([
'error' => false,
]);
}
private function updateItemsExchangeRate($model): void
{
foreach ($model->items as $item) {
$item->update([
'exchange_rate' => $model->exchange_rate,
'base_discount_val' => $item->discount_val * $model->exchange_rate,
'base_price' => $item->price * $model->exchange_rate,
'base_tax' => $item->tax * $model->exchange_rate,
'base_total' => $item->total * $model->exchange_rate,
]);
$this->updateTaxesExchangeRate($item);
}
$this->updateTaxesExchangeRate($model);
}
private function updateTaxesExchangeRate($model): void
{
if ($model->taxes()->exists()) {
$model->taxes->map(function ($tax) use ($model) {
$tax->update([
'exchange_rate' => $model->exchange_rate,
'base_amount' => $tax->amount * $model->exchange_rate,
]);
});
}
}
}

View File

@@ -1,19 +1,21 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Expense;
namespace App\Http\Controllers\Company\Expense;
use App\ExpensesCategory;
use App\Http\Controllers\Controller;
use App\Http\Requests\ExpenseCategoryRequest;
use App\Http\Resources\ExpenseCategoryResource;
use App\Models\ExpenseCategory;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\ExpenseCategoryRequest;
use InvoiceShelf\Http\Resources\ExpenseCategoryResource;
use InvoiceShelf\Models\ExpenseCategory;
use Illuminate\Http\Response;
class ExpenseCategoriesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -32,8 +34,8 @@ class ExpenseCategoriesController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(ExpenseCategoryRequest $request)
{
@@ -47,7 +49,7 @@ class ExpenseCategoriesController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(ExpenseCategory $category)
{
@@ -59,9 +61,9 @@ class ExpenseCategoriesController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \InvoiceShelf\Models\ExpenseCategory $ExpenseCategory
* @return \Illuminate\Http\Response
* @param Request $request
* @param ExpenseCategory $ExpenseCategory
* @return Response
*/
public function update(ExpenseCategoryRequest $request, ExpenseCategory $category)
{
@@ -75,8 +77,8 @@ class ExpenseCategoriesController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \InvoiceShelf\ExpensesCategory $category
* @return \Illuminate\Http\Response
* @param ExpensesCategory $category
* @return Response
*/
public function destroy(ExpenseCategory $category)
{

View File

@@ -0,0 +1,158 @@
<?php
namespace App\Http\Controllers\Company\Expense;
use App\Http\Controllers\Controller;
use App\Http\Requests\DeleteExpensesRequest;
use App\Http\Requests\ExpenseRequest;
use App\Http\Requests\UploadExpenseReceiptRequest;
use App\Http\Resources\ExpenseResource;
use App\Models\Expense;
use App\Services\ExpenseService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ExpensesController extends Controller
{
public function __construct(
private readonly ExpenseService $expenseService,
) {}
/**
* Display a listing of the resource.
*
* @return JsonResponse
*/
public function index(Request $request)
{
$this->authorize('viewAny', Expense::class);
$limit = $request->has('limit') ? $request->limit : 10;
$expenses = Expense::with('category', 'creator', 'fields')
->whereCompany()
->leftJoin('customers', 'customers.id', '=', 'expenses.customer_id')
->join('expense_categories', 'expense_categories.id', '=', 'expenses.expense_category_id')
->applyFilters($request->all())
->select('expenses.*', 'expense_categories.name', 'customers.name as user_name')
->paginateData($limit);
return ExpenseResource::collection($expenses)
->additional(['meta' => [
'expense_total_count' => Expense::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @return JsonResponse
*/
public function store(ExpenseRequest $request)
{
$this->authorize('create', Expense::class);
$expense = $this->expenseService->create($request);
return new ExpenseResource($expense);
}
/**
* Display the specified resource.
*
* @return JsonResponse
*/
public function show(Expense $expense)
{
$this->authorize('view', $expense);
return new ExpenseResource($expense);
}
/**
* Update the specified resource in storage.
*
* @return JsonResponse
*/
public function update(ExpenseRequest $request, Expense $expense)
{
$this->authorize('update', $expense);
$this->expenseService->update($expense, $request);
return new ExpenseResource($expense);
}
public function delete(DeleteExpensesRequest $request)
{
$this->authorize('delete multiple expenses');
$ids = Expense::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
Expense::destroy($ids);
return response()->json([
'success' => true,
]);
}
public function showReceipt(Expense $expense)
{
$this->authorize('view', $expense);
if ($expense) {
$media = $expense->getFirstMedia('receipts');
if ($media) {
return response()->file($media->getPath());
}
return respondJson('receipt_does_not_exist', 'Receipt does not exist.');
}
}
public function uploadReceipt(UploadExpenseReceiptRequest $request, Expense $expense)
{
$this->authorize('update', $expense);
$data = json_decode($request->attachment_receipt);
if ($data) {
if ($request->type === 'edit') {
$expense->clearMediaCollection('receipts');
}
$expense->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('receipts');
}
return response()->json([
'success' => 'Expense receipts uploaded successfully',
], 200);
}
public function downloadReceipt(Expense $expense)
{
$this->authorize('view', $expense);
if ($expense) {
$media = $expense->getFirstMedia('receipts');
if ($media) {
$imagePath = $media->getPath();
$response = \Response::download($imagePath, $media->file_name);
if (ob_get_contents()) {
ob_end_clean();
}
return $response;
}
}
return response()->json([
'error' => 'receipt_not_found',
]);
}
}

View File

@@ -0,0 +1,156 @@
<?php
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Http\Resources\CompanyInvitationResource;
use App\Http\Resources\CompanyResource;
use App\Http\Resources\UserResource;
use App\Models\Company;
use App\Models\CompanyInvitation;
use App\Models\CompanySetting;
use App\Models\Currency;
use App\Models\Module;
use App\Models\Setting;
use App\Traits\GeneratesMenuTrait;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Modules\Registry as ModuleRegistry;
use Silber\Bouncer\BouncerFacade;
class BootstrapController extends Controller
{
use GeneratesMenuTrait;
/**
* Handle the incoming request.
*
* @return JsonResponse
*/
public function __invoke(Request $request)
{
$current_user = $request->user();
$current_user_settings = $current_user->getAllSettings();
$companies = $current_user->companies;
$pendingInvitations = CompanyInvitation::forUser($current_user)
->pending()
->with(['company', 'role', 'invitedBy'])
->get();
$global_settings = Setting::getSettings([
'api_token',
'admin_portal_theme',
'admin_portal_logo',
'login_page_logo',
'login_page_heading',
'login_page_description',
'admin_page_title',
'copyright_text',
'save_pdf_to_disk',
'show_sidebar_group_labels',
]);
// Super admin mode — return admin-only menu with all companies listed
if ($current_user->isSuperAdmin() && $request->has('admin_mode')) {
return response()->json([
'current_user' => new UserResource($current_user),
'current_user_settings' => $current_user_settings,
'current_user_abilities' => [],
'companies' => CompanyResource::collection($companies),
'current_company' => null,
'current_company_settings' => [],
'current_company_currency' => Currency::first(),
'config' => config('invoiceshelf'),
'global_settings' => $global_settings,
'main_menu' => $this->generateMenu('admin_menu', $current_user),
'setting_menu' => [],
'modules' => [],
'admin_mode' => true,
'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations),
]);
}
// User has no companies — return minimal bootstrap
if ($companies->isEmpty()) {
return response()->json([
'current_user' => new UserResource($current_user),
'current_user_settings' => $current_user_settings,
'current_user_abilities' => [],
'companies' => [],
'current_company' => null,
'current_company_settings' => [],
'current_company_currency' => Currency::first(),
'config' => config('invoiceshelf'),
'global_settings' => $global_settings,
'main_menu' => [],
'setting_menu' => [],
'modules' => [],
'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations),
]);
}
$main_menu = $this->generateMenu('main_menu', $current_user);
$setting_menu = $this->generateMenu('setting_menu', $current_user);
// Merge module-registered menu items into the main menu so they
// participate in the unified group + priority ordering.
foreach (ModuleRegistry::allMenu() as $slug => $item) {
$main_menu[] = [
'title' => __($item['title']),
'link' => $item['link'],
'icon' => $item['icon'],
'name' => 'module-'.$slug,
'group' => $item['group'] ?? 'modules',
'group_label' => $item['group_label'] ?? 'navigation.modules',
'priority' => $item['priority'] ?? 100,
];
}
$current_company = Company::find($request->header('company'));
if ((! $current_company) || ($current_company && ! $current_user->hasCompany($current_company->id))) {
$current_company = $current_user->companies()->first();
}
$current_company_settings = CompanySetting::getAllSettings($current_company->id);
$current_company_currency = $current_company_settings->has('currency')
? Currency::find($current_company_settings->get('currency'))
: Currency::first();
BouncerFacade::refreshFor($current_user);
return response()->json([
'current_user' => new UserResource($current_user),
'current_user_settings' => $current_user_settings,
'current_user_abilities' => $current_user->getAbilities(),
'companies' => CompanyResource::collection($companies),
'current_company' => new CompanyResource($current_company),
'current_company_settings' => $current_company_settings,
'current_company_currency' => $current_company_currency,
'config' => config('invoiceshelf'),
'global_settings' => $global_settings,
'main_menu' => $main_menu,
'setting_menu' => $setting_menu,
'modules' => Module::where('enabled', true)->pluck('name'),
'user_menu' => collect(ModuleRegistry::allUserMenu())
->map(fn (array $item, string $slug) => [
...$item,
'title' => __($item['title']),
'name' => 'module-'.$slug,
])
->sortBy('priority')
->values()
->all(),
'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations),
]);
}
public function currentCompany(Request $request)
{
$company = Company::find($request->header('company'));
return new CompanyResource($company);
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Modules\Registry;
class ConfigController extends Controller
{
/**
* Handle the incoming request.
*/
public function __invoke(Request $request): JsonResponse
{
if ($request->key === 'exchange_rate_drivers') {
return response()->json([
'exchange_rate_drivers' => $this->exchangeRateDrivers(),
]);
}
return response()->json([
$request->key => config('invoiceshelf.'.$request->key),
]);
}
/**
* Build the exchange rate driver list from the module Registry.
*
* Returns enriched objects (with label, website, and config_fields) so the
* frontend can render driver-specific configuration forms without hardcoding
* any per-driver UI.
*
* @return array<int, array<string, mixed>>
*/
protected function exchangeRateDrivers(): array
{
return collect(Registry::allDrivers('exchange_rate'))
->map(fn (array $meta, string $name) => [
'value' => $name,
'label' => $meta['label'] ?? $name,
'website' => $meta['website'] ?? '',
'config_fields' => $meta['config_fields'] ?? [],
])
->values()
->all();
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Support\Formatters\DateFormatter;
use App\Support\Formatters\TimeFormatter;
use App\Support\Formatters\TimeZones;
use Illuminate\Http\JsonResponse;
class FormatsController extends Controller
{
public function dateFormats(): JsonResponse
{
return response()->json([
'date_formats' => DateFormatter::get_list(),
]);
}
public function timeFormats(): JsonResponse
{
return response()->json([
'time_formats' => TimeFormatter::get_list(),
]);
}
public function timezones(): JsonResponse
{
return response()->json([
'time_zones' => TimeZones::get_list(),
]);
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Http\Resources\CompanyInvitationResource;
use App\Models\CompanyInvitation;
use App\Services\InvitationService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class InvitationResponseController extends Controller
{
public function __construct(
private readonly InvitationService $invitationService,
) {}
/**
* Get pending invitations for the authenticated user.
*/
public function pending(Request $request): JsonResponse
{
$invitations = $this->invitationService->getPendingForUser($request->user());
return response()->json([
'invitations' => CompanyInvitationResource::collection($invitations),
]);
}
/**
* Accept a company invitation.
*/
public function accept(Request $request, CompanyInvitation $invitation): JsonResponse
{
$this->invitationService->accept($invitation, $request->user());
return response()->json(['success' => true]);
}
/**
* Decline a company invitation.
*/
public function decline(Request $request, CompanyInvitation $invitation): JsonResponse
{
$this->invitationService->decline($invitation, $request->user());
return response()->json(['success' => true]);
}
}

View File

@@ -1,19 +1,20 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\General;
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Http\Requests\NotesRequest;
use App\Http\Resources\NoteResource;
use App\Models\Note;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\NotesRequest;
use InvoiceShelf\Http\Resources\NoteResource;
use InvoiceShelf\Models\Note;
use Illuminate\Http\Response;
class NotesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -32,8 +33,8 @@ class NotesController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(NotesRequest $request)
{
@@ -41,13 +42,22 @@ class NotesController extends Controller
$note = Note::create($request->getNotesPayload());
if ($note->is_default) {
Note::where('id', '!=', $note->id)
->where('type', $note->type)
->where('is_default', true)
->update([
'is_default' => false,
]);
}
return new NoteResource($note);
}
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(Note $note)
{
@@ -59,8 +69,8 @@ class NotesController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function update(NotesRequest $request, Note $note)
{
@@ -68,13 +78,22 @@ class NotesController extends Controller
$note->update($request->getNotesPayload());
if ($note->is_default) {
Note::where('id', '!=', $note->id)
->where('type', $note->type)
->where('is_default', true)
->update([
'is_default' => false,
]);
}
return new NoteResource($note);
}
/**
* Remove the specified resource from storage.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function destroy(Note $note)
{

View File

@@ -1,18 +1,19 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\General;
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Models\Customer;
use App\Models\User;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Models\Customer;
use InvoiceShelf\Models\User;
use Illuminate\Http\Response;
class SearchController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request)
{
@@ -24,7 +25,8 @@ class SearchController extends Controller
->paginate(10);
if ($user->isOwner()) {
$users = User::applyFilters($request->only(['search']))
$users = User::whereCompany()
->applyFilters($request->only(['search']))
->latest()
->paginate(10);
}
@@ -34,4 +36,15 @@ class SearchController extends Controller
'users' => $users ?? [],
]);
}
public function users(Request $request)
{
$this->authorize('create', User::class);
$users = User::whereEmail($request->email)
->latest()
->paginate(10);
return response()->json(['users' => $users]);
}
}

View File

@@ -1,26 +1,22 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\General;
namespace App\Http\Controllers\Company\General;
use App\Http\Controllers\Controller;
use App\Models\Estimate;
use App\Models\Invoice;
use App\Models\Payment;
use App\Services\SerialNumberService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Models\Estimate;
use InvoiceShelf\Models\Invoice;
use InvoiceShelf\Models\Payment;
use InvoiceShelf\Services\SerialNumberFormatter;
class NextNumberController extends Controller
class SerialNumberController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Invoice $invoice, Estimate $estimate, Payment $payment)
public function nextNumber(Request $request, Invoice $invoice, Estimate $estimate, Payment $payment): JsonResponse
{
$key = $request->key;
$nextNumber = null;
$serial = (new SerialNumberFormatter())
$serial = (new SerialNumberService)
->setCompany($request->header('company'))
->setCustomer($request->userId);
@@ -48,7 +44,9 @@ class NextNumberController extends Controller
break;
default:
return;
return response()->json([
'success' => false,
]);
}
} catch (\Exception $exception) {
return response()->json([
@@ -62,4 +60,18 @@ class NextNumberController extends Controller
'nextNumber' => $nextNumber,
]);
}
public function placeholders(Request $request): JsonResponse
{
if ($request->input('format')) {
$placeholders = SerialNumberService::getPlaceholders($request->input('format'));
} else {
$placeholders = [];
}
return response()->json([
'success' => true,
'placeholders' => $placeholders,
]);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Company\Invoice;
use App\Http\Controllers\Controller;
use App\Models\Invoice;
use App\Services\Pdf\PdfTemplateUtils;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class InvoiceTemplatesController extends Controller
{
/**
* Handle the incoming request.
*
*
* @return JsonResponse
*
* @throws AuthorizationException
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', Invoice::class);
$invoiceTemplates = PdfTemplateUtils::getFormattedTemplates('invoice');
return response()->json([
'invoiceTemplates' => $invoiceTemplates,
]);
}
}

View File

@@ -0,0 +1,171 @@
<?php
namespace App\Http\Controllers\Company\Invoice;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Http\Requests\DeleteInvoiceRequest;
use App\Http\Requests\SendInvoiceRequest;
use App\Http\Resources\EstimateResource;
use App\Http\Resources\InvoiceResource;
use App\Jobs\GenerateInvoicePdfJob;
use App\Models\Estimate;
use App\Models\Invoice;
use App\Services\InvoiceService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Mail\Markdown;
class InvoicesController extends Controller
{
public function __construct(
private readonly InvoiceService $invoiceService,
) {}
/**
* Display a listing of the resource.
*
* @return JsonResponse
*/
public function index(Request $request)
{
$this->authorize('viewAny', Invoice::class);
$limit = $request->input('limit', 10);
$invoices = Invoice::whereCompany()
->applyFilters($request->all())
->with('customer')
->latest()
->paginateData($limit);
return InvoiceResource::collection($invoices)
->additional(['meta' => [
'invoice_total_count' => Invoice::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return JsonResponse
*/
public function store(Requests\InvoicesRequest $request)
{
$this->authorize('create', Invoice::class);
$invoice = $this->invoiceService->create($request);
if ($request->has('invoiceSend')) {
$this->invoiceService->send($invoice, $request->only(['subject', 'body']));
}
GenerateInvoicePdfJob::dispatch($invoice);
return new InvoiceResource($invoice);
}
/**
* Display the specified resource.
*
* @return JsonResponse
*/
public function show(Request $request, Invoice $invoice)
{
$this->authorize('view', $invoice);
return new InvoiceResource($invoice);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @return JsonResponse
*/
public function update(Requests\InvoicesRequest $request, Invoice $invoice)
{
$this->authorize('update', $invoice);
$invoice = $this->invoiceService->update($invoice, $request);
GenerateInvoicePdfJob::dispatch($invoice, true);
return new InvoiceResource($invoice);
}
/**
* delete the specified resources in storage.
*
* @param Request $request
* @return JsonResponse
*/
public function delete(DeleteInvoiceRequest $request)
{
$this->authorize('delete multiple invoices');
$ids = Invoice::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
$this->invoiceService->delete($ids);
return response()->json([
'success' => true,
]);
}
public function send(SendInvoiceRequest $request, Invoice $invoice)
{
$this->authorize('send invoice', $invoice);
$this->invoiceService->send($invoice, $request->all());
return response()->json([
'success' => true,
]);
}
public function sendPreview(SendInvoiceRequest $request, Invoice $invoice)
{
$this->authorize('send invoice', $invoice);
$markdown = new Markdown(view(), config('mail.markdown'));
$data = $this->invoiceService->sendInvoiceData($invoice, $request->all());
$data['url'] = $invoice->invoicePdfUrl;
return $markdown->render('emails.send.invoice', ['data' => $data]);
}
public function clone(Request $request, Invoice $invoice)
{
$this->authorize('view', $invoice);
$this->authorize('create', Invoice::class);
$newInvoice = $this->invoiceService->clone($invoice);
return new InvoiceResource($newInvoice);
}
public function convertToEstimate(Request $request, Invoice $invoice)
{
$this->authorize('create', Estimate::class);
$estimate = $this->invoiceService->convertToEstimate($invoice);
return new EstimateResource($estimate);
}
public function changeStatus(Request $request, Invoice $invoice)
{
$this->authorize('send invoice', $invoice);
$this->invoiceService->changeStatus($invoice, $request->status);
return response()->json([
'success' => true,
]);
}
}

View File

@@ -1,21 +1,27 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Item;
namespace App\Http\Controllers\Company\Item;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Http\Requests\DeleteItemsRequest;
use App\Http\Resources\ItemResource;
use App\Models\Item;
use App\Models\TaxType;
use App\Services\ItemService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests;
use InvoiceShelf\Http\Requests\DeleteItemsRequest;
use InvoiceShelf\Http\Resources\ItemResource;
use InvoiceShelf\Models\Item;
use InvoiceShelf\Models\TaxType;
class ItemsController extends Controller
{
public function __construct(
private readonly ItemService $itemService,
) {}
/**
* Retrieve a list of existing Items.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function index(Request $request)
{
@@ -40,14 +46,14 @@ class ItemsController extends Controller
/**
* Create Item.
*
* @param InvoiceShelf\Http\Requests\ItemsRequest $request
* @return \Illuminate\Http\JsonResponse
* @param App\Http\Requests\ItemsRequest $request
* @return JsonResponse
*/
public function store(Requests\ItemsRequest $request)
{
$this->authorize('create', Item::class);
$item = Item::createItem($request);
$item = $this->itemService->create($request);
return new ItemResource($item);
}
@@ -55,7 +61,7 @@ class ItemsController extends Controller
/**
* get an existing Item.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function show(Item $item)
{
@@ -67,14 +73,14 @@ class ItemsController extends Controller
/**
* Update an existing Item.
*
* @param InvoiceShelf\Http\Requests\ItemsRequest $request
* @return \Illuminate\Http\JsonResponse
* @param App\Http\Requests\ItemsRequest $request
* @return JsonResponse
*/
public function update(Requests\ItemsRequest $request, Item $item)
{
$this->authorize('update', $item);
$item = $item->updateItem($request);
$item = $this->itemService->update($item, $request);
return new ItemResource($item);
}
@@ -82,14 +88,18 @@ class ItemsController extends Controller
/**
* Delete a list of existing Items.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
* @param Request $request
* @return JsonResponse
*/
public function delete(DeleteItemsRequest $request)
{
$this->authorize('delete multiple items');
Item::destroy($request->ids);
$ids = Item::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
Item::destroy($ids);
return response()->json([
'success' => true,

View File

@@ -1,19 +1,20 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Item;
namespace App\Http\Controllers\Company\Item;
use App\Http\Controllers\Controller;
use App\Http\Requests\UnitRequest;
use App\Http\Resources\UnitResource;
use App\Models\Unit;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\UnitRequest;
use InvoiceShelf\Http\Resources\UnitResource;
use InvoiceShelf\Models\Unit;
use Illuminate\Http\Response;
class UnitsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -32,8 +33,8 @@ class UnitsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(UnitRequest $request)
{
@@ -47,7 +48,7 @@ class UnitsController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(Unit $unit)
{
@@ -59,8 +60,8 @@ class UnitsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function update(UnitRequest $request, Unit $unit)
{
@@ -74,7 +75,7 @@ class UnitsController extends Controller
/**
* Remove the specified resource from storage.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function destroy(Unit $unit)
{

View File

@@ -1,20 +1,26 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Users;
namespace App\Http\Controllers\Company\Members;
use App\Http\Controllers\Controller;
use App\Http\Requests\DeleteMemberRequest;
use App\Http\Requests\MemberRequest;
use App\Http\Resources\UserResource;
use App\Models\User;
use App\Services\MemberService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\DeleteUserRequest;
use InvoiceShelf\Http\Requests\UserRequest;
use InvoiceShelf\Http\Resources\UserResource;
use InvoiceShelf\Models\User;
class UsersController extends Controller
class MembersController extends Controller
{
public function __construct(
private readonly MemberService $memberService,
) {}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function index(Request $request)
{
@@ -24,28 +30,28 @@ class UsersController extends Controller
$user = $request->user();
$users = User::applyFilters($request->all())
$users = User::whereCompany()
->applyFilters($request->all())
->where('id', '<>', $user->id)
->latest()
->paginate($limit);
return UserResource::collection($users)
->additional(['meta' => [
'user_total_count' => User::count(),
'user_total_count' => User::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\UserRequest $request
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function store(UserRequest $request)
public function store(MemberRequest $request)
{
$this->authorize('create', User::class);
$user = User::createFromRequest($request);
$user = $this->memberService->create($request);
return new UserResource($user);
}
@@ -53,7 +59,7 @@ class UsersController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function show(User $user)
{
@@ -65,14 +71,13 @@ class UsersController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\UserRequest $request
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function update(UserRequest $request, User $user)
public function update(MemberRequest $request, User $user)
{
$this->authorize('update', $user);
$user->updateFromRequest($request);
$this->memberService->update($user, $request);
return new UserResource($user);
}
@@ -80,15 +85,15 @@ class UsersController extends Controller
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
* @param Request $request
* @return JsonResponse
*/
public function delete(DeleteUserRequest $request)
public function delete(DeleteMemberRequest $request)
{
$this->authorize('delete multiple users', User::class);
if ($request->users) {
User::deleteUsers($request->users);
$this->memberService->delete($request->users);
}
return response()->json([

View File

@@ -0,0 +1,76 @@
<?php
namespace App\Http\Controllers\Company\Modules;
use App\Http\Controllers\Controller;
use App\Models\Module;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Str;
use InvoiceShelf\Modules\Registry as ModuleRegistry;
/**
* Read-only company-context Active Modules index.
*
* Lists every module the super admin has activated on this instance
* (Module::enabled = true) and reports whether each one has registered a
* settings schema. The frontend uses this to render the company-context
* "Modules" landing page with a Settings button per active module.
*
* Activation is instance-global; per-company customization happens through
* settings (per CompanySetting under the module.{slug}.* prefix).
*
* Slug convention: nwidart stores the module's PascalCase class name in
* `modules.name` (e.g. "HelloWorld"), but URLs and registry keys use the
* kebab-case form ("hello-world") for readability. We normalize via
* Str::kebab() so module authors can call Registry::registerMenu('hello-world')
* naturally without thinking about the storage format.
*/
class CompanyModulesController extends Controller
{
public function index(): JsonResponse
{
$this->authorize('manage modules');
$modules = Module::query()
->where('enabled', true)
->get()
->map(function (Module $module) {
$slug = Str::kebab($module->name);
$menu = ModuleRegistry::menuFor($slug);
$translatedMenuTitle = $this->translateMenuTitle($menu['title'] ?? null);
$displayName = $translatedMenuTitle ?? Str::headline($module->name);
return [
'slug' => $slug,
'name' => $module->name,
'display_name' => $displayName,
'version' => $module->version,
'has_settings' => ModuleRegistry::settingsFor($slug) !== null,
'menu' => $menu === null
? null
: [
...$menu,
'title' => $translatedMenuTitle ?? $menu['title'],
],
];
})
->values();
return response()->json(['data' => $modules]);
}
private function translateMenuTitle(?string $title): ?string
{
if ($title === null) {
return null;
}
$translatedTitle = __($title);
if (! is_string($translatedTitle) || $translatedTitle === $title) {
return null;
}
return $translatedTitle;
}
}

View File

@@ -0,0 +1,176 @@
<?php
namespace App\Http\Controllers\Company\Modules;
use App\Http\Controllers\Controller;
use App\Models\CompanySetting;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use InvoiceShelf\Modules\Registry as ModuleRegistry;
use InvoiceShelf\Modules\Settings\Schema;
/**
* Schema-driven module settings backend.
*
* Each active module's ServiceProvider::boot() calls
* Registry::registerSettings($slug, $schema) once at app boot. This controller
* exposes that schema to the frontend, validates submitted values against the
* schema's per-field rules, and persists per-company values into CompanySetting
* under the key prefix `module.{slug}.{field_key}`.
*
* Activation is instance-global, but settings are per-company — two companies
* on the same instance can configure the same activated module differently.
*/
class ModuleSettingsController extends Controller
{
public function show(Request $request, string $slug): JsonResponse
{
$this->authorize('manage modules');
$schema = ModuleRegistry::settingsFor($slug);
if ($schema === null) {
abort(404, "Module '{$slug}' has not registered a settings schema.");
}
$values = collect($schema->fields())
->mapWithKeys(fn (array $field) => [
$field['key'] => CompanySetting::getSetting(
"module.{$slug}.{$field['key']}",
$request->header('company')
) ?? $field['default'],
])
->all();
return response()->json([
'schema' => $this->translateSchema($schema->toArray()),
'values' => $values,
]);
}
public function update(Request $request, string $slug): JsonResponse
{
$this->authorize('manage modules');
$schema = ModuleRegistry::settingsFor($slug);
if ($schema === null) {
abort(404, "Module '{$slug}' has not registered a settings schema.");
}
$rules = $this->buildRules($schema);
$allowedKeys = array_keys($rules);
$validated = $request->validate($rules);
$companyId = $request->header('company');
// Only persist keys the schema knows about — silently drop unknown keys
// rather than letting modules write arbitrary settings.
$settingsToWrite = [];
foreach ($allowedKeys as $key) {
if (array_key_exists($key, $validated)) {
$settingsToWrite["module.{$slug}.{$key}"] = $this->normalizeForStorage($validated[$key]);
}
}
if ($settingsToWrite !== []) {
CompanySetting::setSettings($settingsToWrite, $companyId);
}
return response()->json(['success' => true]);
}
/**
* Convert a Schema's field rule arrays into a flat Laravel validator rules array.
*
* Field rules are passed through verbatim — a field declared as
* `'rules' => ['required', 'string', 'max:255']` becomes
* `['my_field' => ['required', 'string', 'max:255']]`. The frontend's
* BaseSchemaForm.vue understands a subset of these for client-side validation;
* the backend validator is the source of truth.
*
* @return array<string, array<int, string>>
*/
private function buildRules(Schema $schema): array
{
$rules = [];
foreach ($schema->fields() as $field) {
$rules[$field['key']] = $this->withTypeRule($field);
}
return $rules;
}
/**
* Prepend a sensible per-type validation rule so booleans must be booleans,
* numbers must be numeric, etc., even if the module didn't declare it.
*
* @param array<string, mixed> $field
* @return array<int, string>
*/
private function withTypeRule(array $field): array
{
/** @var array<int, string> $declared */
$declared = $field['rules'] ?? [];
$typeRule = match ($field['type']) {
'switch' => 'boolean',
'number' => 'numeric',
'multiselect' => 'array',
default => 'nullable',
};
// Avoid duplicating the type rule if the module already declared it
if (in_array($typeRule, $declared, true)) {
return $declared;
}
return array_merge([$typeRule], $declared);
}
/**
* CompanySetting stores everything as strings. Cast booleans, ints, and
* arrays to a representation that round-trips through getSetting/setSetting
* without losing information. Reads happen in show() above and naturally
* return strings; the frontend handles re-coercion in BaseSchemaForm.vue.
*/
/**
* Translate section titles and field labels in the schema so the
* frontend receives ready-to-display strings instead of Laravel
* translation keys it cannot resolve (e.g. `helloworld::settings.greeting`).
*
* @param array{sections: list<array<string, mixed>>} $schema
* @return array{sections: list<array<string, mixed>>}
*/
private function translateSchema(array $schema): array
{
foreach ($schema['sections'] as &$section) {
if (isset($section['title'])) {
$section['title'] = __($section['title']);
}
foreach ($section['fields'] as &$field) {
if (isset($field['label'])) {
$field['label'] = __($field['label']);
}
}
}
return $schema;
}
private function normalizeForStorage(mixed $value): string
{
if (is_bool($value)) {
return $value ? '1' : '0';
}
if (is_array($value)) {
return json_encode($value, JSON_UNESCAPED_SLASHES) ?: '[]';
}
return (string) ($value ?? '');
}
}

View File

@@ -1,19 +1,20 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Payment;
namespace App\Http\Controllers\Company\Payment;
use App\Http\Controllers\Controller;
use App\Http\Requests\PaymentMethodRequest;
use App\Http\Resources\PaymentMethodResource;
use App\Models\PaymentMethod;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\PaymentMethodRequest;
use InvoiceShelf\Http\Resources\PaymentMethodResource;
use InvoiceShelf\Models\PaymentMethod;
use Illuminate\Http\Response;
class PaymentMethodsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -33,8 +34,8 @@ class PaymentMethodsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(PaymentMethodRequest $request)
{
@@ -48,7 +49,7 @@ class PaymentMethodsController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(PaymentMethod $paymentMethod)
{
@@ -60,8 +61,8 @@ class PaymentMethodsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function update(PaymentMethodRequest $request, PaymentMethod $paymentMethod)
{
@@ -75,7 +76,7 @@ class PaymentMethodsController extends Controller
/**
* Remove the specified resource from storage.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function destroy(PaymentMethod $paymentMethod)
{

View File

@@ -1,20 +1,28 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\Payment;
namespace App\Http\Controllers\Company\Payment;
use App\Http\Controllers\Controller;
use App\Http\Requests\DeletePaymentsRequest;
use App\Http\Requests\PaymentRequest;
use App\Http\Requests\SendPaymentRequest;
use App\Http\Resources\PaymentResource;
use App\Models\Payment;
use App\Services\PaymentService;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\DeletePaymentsRequest;
use InvoiceShelf\Http\Requests\PaymentRequest;
use InvoiceShelf\Http\Resources\PaymentResource;
use InvoiceShelf\Models\Payment;
use Illuminate\Http\Response;
use Illuminate\Mail\Markdown;
class PaymentsController extends Controller
{
public function __construct(
private readonly PaymentService $paymentService,
) {}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -40,14 +48,14 @@ class PaymentsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(PaymentRequest $request)
{
$this->authorize('create', Payment::class);
$payment = Payment::createPayment($request);
$payment = $this->paymentService->create($request);
return new PaymentResource($payment);
}
@@ -63,7 +71,7 @@ class PaymentsController extends Controller
{
$this->authorize('update', $payment);
$payment = $payment->updatePayment($request);
$payment = $this->paymentService->update($payment, $request);
return new PaymentResource($payment);
}
@@ -72,10 +80,35 @@ class PaymentsController extends Controller
{
$this->authorize('delete multiple payments');
Payment::deletePayments($request->ids);
$ids = Payment::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
$this->paymentService->delete($ids);
return response()->json([
'success' => true,
]);
}
public function send(SendPaymentRequest $request, Payment $payment)
{
$this->authorize('send payment', $payment);
$response = $this->paymentService->send($payment, $request->all());
return response()->json($response);
}
public function sendPreview(Request $request, Payment $payment)
{
$this->authorize('send payment', $payment);
$markdown = new Markdown(view(), config('mail.markdown'));
$data = $this->paymentService->sendPaymentData($payment, $request->all());
$data['url'] = $payment->paymentPdfUrl;
return $markdown->render('emails.send.payment', ['data' => $data]);
}
}

View File

@@ -1,19 +1,25 @@
<?php
namespace InvoiceShelf\Http\Controllers\V1\Admin\RecurringInvoice;
namespace App\Http\Controllers\Company\RecurringInvoice;
use App\Http\Controllers\Controller;
use App\Http\Requests\RecurringInvoiceRequest;
use App\Http\Resources\RecurringInvoiceResource;
use App\Models\RecurringInvoice;
use App\Services\RecurringInvoiceService;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Requests\RecurringInvoiceRequest;
use InvoiceShelf\Http\Resources\RecurringInvoiceResource;
use InvoiceShelf\Models\RecurringInvoice;
use Illuminate\Http\Response;
class RecurringInvoiceController extends Controller
{
public function __construct(
private readonly RecurringInvoiceService $recurringInvoiceService,
) {}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
@@ -34,14 +40,14 @@ class RecurringInvoiceController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(RecurringInvoiceRequest $request)
{
$this->authorize('create', RecurringInvoice::class);
$recurringInvoice = RecurringInvoice::createFromRequest($request);
$recurringInvoice = $this->recurringInvoiceService->create($request);
return new RecurringInvoiceResource($recurringInvoice);
}
@@ -49,7 +55,7 @@ class RecurringInvoiceController extends Controller
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(RecurringInvoice $recurringInvoice)
{
@@ -61,14 +67,14 @@ class RecurringInvoiceController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function update(RecurringInvoiceRequest $request, RecurringInvoice $recurringInvoice)
{
$this->authorize('update', $recurringInvoice);
$recurringInvoice->updateFromRequest($request);
$this->recurringInvoiceService->update($recurringInvoice, $request);
return new RecurringInvoiceResource($recurringInvoice);
}
@@ -76,14 +82,18 @@ class RecurringInvoiceController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \InvoiceShelf\Models\RecurringInvoice $recurringInvoice
* @return \Illuminate\Http\Response
* @param RecurringInvoice $recurringInvoice
* @return Response
*/
public function delete(Request $request)
{
$this->authorize('delete multiple recurring invoices');
RecurringInvoice::deleteRecurringInvoice($request->ids);
$ids = RecurringInvoice::whereCompany()
->whereIn('id', $request->ids)
->pluck('id');
$this->recurringInvoiceService->delete($ids);
return response()->json([
'success' => true,

Some files were not shown because too many files have changed in this diff Show More