ldc-boutique-cnc-sable/app/Http/Controllers/Bo/PickupExceptionsController.php
Jérémy Munsch 3b3997d547
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-27 09:58:44 +01:00

106 lines
3.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Controllers\Bo;
use App\Actions\PickupExceptions\CreatePickupException;
use App\Actions\PickupExceptions\DeletePickupException;
use App\Actions\PickupExceptions\DeletePickupExceptionInput;
use App\Actions\PickupExceptions\UpdatePickupException;
use App\Contracts\Executor;
use App\Dto\PickupExceptionDto;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\PickupExceptions\StorePickupExceptionRequest;
use App\Http\Requests\Bo\PickupExceptions\UpdatePickupExceptionRequest;
use App\Lib\Helpers\RequestHelper;
use App\Models\PickupException;
use App\Queries\PickupExceptions\GetPaginatedPickupExceptionsQuery;
use App\Queries\PickupExceptions\GetPaginatedPickupExceptionsQueryInput;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class PickupExceptionsController extends Controller
{
public function __construct(
private readonly Executor $executor,
) {
}
public function index(Request $request, GetPaginatedPickupExceptionsQuery $query): View
{
$this->authorize('viewAny', PickupException::class);
$pickupExceptions = $this->executor->execute(
$query,
new GetPaginatedPickupExceptionsQueryInput(
pagination: RequestHelper::pagination($request),
),
);
return view('bo.pickup-exceptions.index', compact('pickupExceptions'));
}
public function create(): View
{
$this->authorize('create', PickupException::class);
return view('bo.pickup-exceptions.create');
}
public function store(StorePickupExceptionRequest $request, CreatePickupException $action): RedirectResponse
{
$this->authorize('create', PickupException::class);
$pickupException = $this->executor->execute(
$action,
$request->toCreatePickupExceptionInput(),
);
return to_route('bo.pickup-exceptions.edit', $pickupException)
->with('success', trans('crud.messages.has_been_created', [
'model' => Str::ucfirst(trans_choice('models.classes.pickup-exceptions', 1)),
]));
}
public function edit(PickupException $pickupException): View
{
$this->authorize('update', $pickupException);
$pickupException = PickupExceptionDto::fromModel($pickupException);
return view('bo.pickup-exceptions.edit', compact('pickupException'));
}
public function update(UpdatePickupExceptionRequest $request, PickupException $pickupException, UpdatePickupException $action): RedirectResponse
{
$this->authorize('update', $pickupException);
$this->executor->execute(
$action,
$request->toUpdatePickupExceptionInput($pickupException),
);
return to_route('bo.pickup-exceptions.edit', $pickupException)
->with('success', trans('crud.messages.has_been_updated', [
'model' => Str::ucfirst(trans_choice('models.classes.pickup-exceptions', 1)),
]));
}
public function destroy(PickupException $pickupException, DeletePickupException $action): RedirectResponse
{
$this->authorize('delete', $pickupException);
$this->executor->execute(
$action,
new DeletePickupExceptionInput(pickupException: $pickupException),
);
return to_route('bo.pickup-exceptions.index')
->with('warning', trans('crud.messages.has_been_deleted', [
'model' => Str::ucfirst(trans_choice('models.classes.pickup-exceptions', 1)),
]));
}
}