- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 / primary-100 and TallStackUI's dark labels, hints and checkbox labels are lightened so everything stays at 4.5:1. - Shared HexColor picks white or black text by the higher WCAG contrast; a native-dialog colour picker and a large work dialog component. - Customers get a header colour (customers.header_color), set on the customer page. - New job status Jatkuvat / Kausi (ongoing): open, never late, billed monthly like running jobs. - Kanban model: board columns and views, urgent threshold, per-user board preferences (density, column colours and sort), card positions, tasks of continuing jobs pinned to the board, MoveBoardCard and board queries with logged hours from TimeTracking. Co-Authored-By: Claude Opus 5.5 <[email protected]>
95 lines
2.6 KiB
PHP
95 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Fakes;
|
|
|
|
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
|
use App\Modules\Customers\Application\DTOs\BillingUnitSummary;
|
|
use App\Modules\Customers\Application\DTOs\ContactSummary;
|
|
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
|
use App\Modules\Customers\Domain\Enums\CustomerType;
|
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
|
use LogicException;
|
|
|
|
/**
|
|
* Customers for unit tests of other modules: names by id, contacts and
|
|
* billing units as [customerId, id, name].
|
|
*/
|
|
class FakeCustomerQueries implements CustomerQueries
|
|
{
|
|
/** @var array<int, string> */
|
|
public array $customers = [];
|
|
|
|
/** @var list<array{int, int, string}> */
|
|
public array $contacts = [];
|
|
|
|
/** @var list<array{int, int, string}> */
|
|
public array $billingUnits = [];
|
|
|
|
public function findSummary(int $id): ?CustomerSummary
|
|
{
|
|
return isset($this->customers[$id]) ? new CustomerSummary($id, $this->customers[$id], CustomerType::Company, null) : null;
|
|
}
|
|
|
|
public function namesByIds(array $ids): array
|
|
{
|
|
return array_intersect_key($this->customers, array_flip($ids));
|
|
}
|
|
|
|
public function headerColorsByIds(array $ids): array
|
|
{
|
|
return array_fill_keys(array_keys(array_intersect_key($this->customers, array_flip($ids))), null);
|
|
}
|
|
|
|
public function internalCustomerId(): ?int
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function personalIdentityCodeOf(int $customerId): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function paginate(?string $search, int $perPage = 25): LengthAwarePaginator
|
|
{
|
|
throw new LogicException('Not needed in unit tests.');
|
|
}
|
|
|
|
public function search(string $term, int $limit = 10): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function contactsOf(int $customerId): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function findContact(int $customerId, int $contactId): ?ContactSummary
|
|
{
|
|
foreach ($this->contacts as [$ownerId, $id, $name]) {
|
|
if ($ownerId === $customerId && $id === $contactId) {
|
|
return new ContactSummary($id, $ownerId, $name, null, null, null, null);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public function billingUnitsOf(int $customerId): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function findBillingUnit(int $customerId, int $billingUnitId): ?BillingUnitSummary
|
|
{
|
|
foreach ($this->billingUnits as [$ownerId, $id, $name]) {
|
|
if ($ownerId === $customerId && $id === $billingUnitId) {
|
|
return new BillingUnitSummary($id, $ownerId, $name, null, null, null, null);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|