Add the price list: hourly rates, products and mileage rate

- Work types get an hourly rate (VAT 0), set on the work type form or in
  the hourly rate grid of the new Hinnasto page (/catalog/prices), which
  saves a cell when focus leaves it.
- Fixed-price products with a unit from a list, consumer product flag and
  automatic hours, which need a work type. Products are moved and
  deactivated, never deleted.
- The mileage rate is stored in a new settings table through the shared
  Settings contract.
- Shared Money value object keeps amounts in cents, parses "85,50" and
  formats "85,50 €".
- Prices are read only through PriceListQueries, not CatalogQueries, so
  personal money permissions can be added in one place next.
- Only admins and management can open the pages for now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 07:30:49 +02:00
co-authored by Claude Opus 5.5
parent 1acdaa5b19
commit dc2612cf46
58 changed files with 2577 additions and 32 deletions
@@ -4,10 +4,14 @@ namespace App\Modules\Catalog\Infrastructure\Providers;
use App\Models\User;
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
use App\Modules\Catalog\Application\Contracts\PriceListQueries;
use App\Modules\Catalog\Domain\Contracts\ProductRepository;
use App\Modules\Catalog\Domain\Contracts\ServiceRepository;
use App\Modules\Catalog\Domain\Contracts\ServiceUnitRepository;
use App\Modules\Catalog\Domain\Contracts\WorkTypeRepository;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentCatalogQueries;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentPriceListQueries;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentProductRepository;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentServiceRepository;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentServiceUnitRepository;
use App\Modules\Catalog\Infrastructure\Persistence\Repositories\EloquentWorkTypeRepository;
@@ -17,7 +21,7 @@ use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
/**
* Wires the Catalog module (service units, services, work types) into
* Wires the Catalog module (service units, services, work types, price list) into
* Laravel: bindings, routes, the `catalog::` Livewire namespace and the
* `catalog.manage` ability.
*/
@@ -31,6 +35,8 @@ class CatalogServiceProvider extends ServiceProvider
ServiceRepository::class => EloquentServiceRepository::class,
WorkTypeRepository::class => EloquentWorkTypeRepository::class,
CatalogQueries::class => EloquentCatalogQueries::class,
ProductRepository::class => EloquentProductRepository::class,
PriceListQueries::class => EloquentPriceListQueries::class,
];
public function boot(): void
@@ -43,7 +49,7 @@ class CatalogServiceProvider extends ServiceProvider
$this->loadRoutesFrom($presentationPath.'/Routes/web.php');
}
// Catalog data (pohjatiedot) is managed by admins and management.
// Catalog data (pohjatiedot) and the price list are managed by admins and management.
Gate::define('catalog.manage', fn (User $user): bool => in_array($user->role, [Role::Admin, Role::Management], true));
}
}