2026-06-14 21:32:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
|
|
2026-10-29 20:21:32 +01:00
|
|
|
use Domain\Models\Entities\Shopper;
|
|
|
|
|
|
2026-06-14 21:32:07 +02:00
|
|
|
final readonly class OrderEmployee
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
public readonly Matricule $matricule,
|
|
|
|
|
public readonly string $firstname,
|
|
|
|
|
public readonly string $lastname,
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
public readonly ShopperEstablishmentCode $facility,
|
|
|
|
|
public readonly ShopperSiteCode $site,
|
|
|
|
|
public readonly ShopperServiceCode $service,
|
2026-06-14 21:32:07 +02:00
|
|
|
) {
|
|
|
|
|
$this->assertNotEmpty('firstname', $firstname);
|
|
|
|
|
$this->assertNotEmpty('lastname', $lastname);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-29 20:21:32 +01:00
|
|
|
public static function fromShopper(Shopper $shopper): self
|
|
|
|
|
{
|
|
|
|
|
return new self(
|
|
|
|
|
matricule: clone $shopper->matricule,
|
|
|
|
|
firstname: $shopper->prenom,
|
|
|
|
|
lastname: $shopper->nom,
|
|
|
|
|
facility: $shopper->etablissement,
|
|
|
|
|
site: $shopper->site,
|
|
|
|
|
service: $shopper->service
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-14 21:32:07 +02:00
|
|
|
private function assertNotEmpty(string $attribute, string $value): void
|
|
|
|
|
{
|
|
|
|
|
if (empty(trim($value))) {
|
|
|
|
|
throw new \DomainException("{$attribute} cannot be empty");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|