feat: implement sales management module with product and order handling

- Introduced a new Sales module, consolidating routes for managing sales requests and orders.
- Added a Products module for handling product details, including creation, editing, and viewing functionalities.
- Implemented UI components for product forms and detail views, with validation schemas for product data.
- Integrated language support for English and Indonesian in the new modules.
- Developed unit tests for sales and product remote data services and transformers to ensure functionality and reliability.

These changes enhance the application by providing a structured approach to sales management, improving user experience and data handling.
This commit is contained in:
shancheas
2026-08-26 15:29:46 +07:00
parent ee6c3273d9
commit 4d9c83ee83
90 changed files with 3331 additions and 22 deletions
@@ -0,0 +1,20 @@
import { z } from 'zod';
const DECIMAL_PATTERN = /^\d+(\.\d{1,4})?$/;
function emptyToUndefined(value: unknown) {
if (value === '' || value === null || value === undefined) {
return undefined;
}
return value;
}
export function decimalStringSchema(t: (key: string) => string, fieldKey = 'common:fields.price') {
return z.string().regex(DECIMAL_PATTERN, {
message: JSON.stringify({ key: 'validation:invalid_format', values: { field: t(fieldKey) } }),
});
}
export function optionalDecimalStringSchema(t: (key: string) => string, fieldKey = 'common:fields.price') {
return z.preprocess(emptyToUndefined, decimalStringSchema(t, fieldKey).optional());
}