mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 12:19:35 +01:00
feat(shared): Länderauswahl mit ISO 3166-1 Mapping und CountryPicker
Backend: Country-Record (Shared Kernel), InMemoryCountryRepository mit ~249 Ländern und DACH-Priorisierung, ListCountries-UseCase, GET /api/countries?q= Endpoint. Frontend: CountryPicker-Komponente mit Fuzzy-Suche, DACH-Favoriten bei leerem Query. SupplierCreate-, CustomerCreate- und AddDeliveryAddress- Screens verwenden jetzt den CountryPicker statt Freitext. Detail-Screens zeigen den Ländercode in der Adressanzeige. Closes #71
This commit is contained in:
parent
2811836039
commit
a77f0ec5df
20 changed files with 1136 additions and 63 deletions
|
|
@ -27,6 +27,7 @@ export { createRecipesResource } from './resources/recipes.js';
|
|||
export { createBatchesResource } from './resources/batches.js';
|
||||
export { createProductionOrdersResource } from './resources/production-orders.js';
|
||||
export { createStocksResource } from './resources/stocks.js';
|
||||
export { createCountriesResource } from './resources/countries.js';
|
||||
export {
|
||||
ApiError,
|
||||
AuthenticationError,
|
||||
|
|
@ -111,6 +112,7 @@ export type {
|
|||
ReservationDTO,
|
||||
StockBatchAllocationDTO,
|
||||
ReserveStockRequest,
|
||||
CountryDTO,
|
||||
} from '@effigenix/types';
|
||||
|
||||
// Resource types (runtime, stay in resource files)
|
||||
|
|
@ -141,6 +143,7 @@ export { BATCH_STATUS_LABELS } from './resources/batches.js';
|
|||
export type { ProductionOrdersResource, Priority } from './resources/production-orders.js';
|
||||
export { PRIORITY_LABELS } from './resources/production-orders.js';
|
||||
export type { StocksResource, BatchType, StockBatchStatus, StockFilter, ReferenceType, ReservationPriority } from './resources/stocks.js';
|
||||
export type { CountriesResource } from './resources/countries.js';
|
||||
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS, REFERENCE_TYPE_LABELS, RESERVATION_PRIORITY_LABELS } from './resources/stocks.js';
|
||||
|
||||
import { createApiClient } from './client.js';
|
||||
|
|
@ -156,6 +159,7 @@ import { createRecipesResource } from './resources/recipes.js';
|
|||
import { createBatchesResource } from './resources/batches.js';
|
||||
import { createProductionOrdersResource } from './resources/production-orders.js';
|
||||
import { createStocksResource } from './resources/stocks.js';
|
||||
import { createCountriesResource } from './resources/countries.js';
|
||||
import type { TokenProvider } from './token-provider.js';
|
||||
import type { ApiConfig } from '@effigenix/config';
|
||||
|
||||
|
|
@ -182,6 +186,7 @@ export function createEffigenixClient(
|
|||
batches: createBatchesResource(axiosClient),
|
||||
productionOrders: createProductionOrdersResource(axiosClient),
|
||||
stocks: createStocksResource(axiosClient),
|
||||
countries: createCountriesResource(axiosClient),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
17
frontend/packages/api-client/src/resources/countries.ts
Normal file
17
frontend/packages/api-client/src/resources/countries.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AxiosInstance } from 'axios';
|
||||
import type { CountryDTO } from '@effigenix/types';
|
||||
|
||||
export type { CountryDTO };
|
||||
|
||||
export function createCountriesResource(client: AxiosInstance) {
|
||||
return {
|
||||
async search(query?: string): Promise<CountryDTO[]> {
|
||||
const res = await client.get<CountryDTO[]>('/api/countries', {
|
||||
params: query ? { q: query } : {},
|
||||
});
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CountriesResource = ReturnType<typeof createCountriesResource>;
|
||||
4
frontend/packages/types/src/country.ts
Normal file
4
frontend/packages/types/src/country.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export interface CountryDTO {
|
||||
code: string;
|
||||
name: string;
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ export * from './article';
|
|||
export * from './customer';
|
||||
export * from './inventory';
|
||||
export * from './production';
|
||||
export * from './country';
|
||||
|
||||
// Re-export generated types for advanced usage
|
||||
export type { components, paths } from './generated/api';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue