- Implemented CuttingIndex component for listing and managing cuttings. - Added routes for cutting management in web.php. - Created CuttingTest for testing cutting-related features including authorization, validation, and stock management. - Updated roles create and edit pages to include necessary imports. - Refactored settings and profile pages to streamline imports. - Enhanced permissions checks for cutting management actions.
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { createDraftStore } from '@/lib/draft-store';
|
|
|
|
export type CuttingDraftData = {
|
|
productName: string;
|
|
sample: number;
|
|
originalOutsideSample: number;
|
|
notes: string;
|
|
materials: Array<{
|
|
raw_material_price_id: number;
|
|
material_usage: number;
|
|
material_result: number | null;
|
|
combination_index: number | null;
|
|
variant: string;
|
|
material_name: string;
|
|
unit: string;
|
|
photo_url: string | null;
|
|
}>;
|
|
combinations: Array<{
|
|
material_result: number | null;
|
|
}>;
|
|
selectedMaterialName?: string;
|
|
photo?: string;
|
|
};
|
|
|
|
export const cuttingDraftStore =
|
|
createDraftStore<CuttingDraftData>('cutting-draft');
|
|
|
|
export function saveCuttingDraft(
|
|
type: 'create' | 'edit',
|
|
data: CuttingDraftData,
|
|
userId?: number,
|
|
): boolean {
|
|
return cuttingDraftStore.save(type, data, userId);
|
|
}
|
|
|
|
export function loadCuttingDraft(
|
|
type: 'create' | 'edit',
|
|
userId?: number,
|
|
): CuttingDraftData | null {
|
|
return cuttingDraftStore.load(type, userId);
|
|
}
|
|
|
|
export function clearCuttingDraft(
|
|
type: 'create' | 'edit',
|
|
userId?: number,
|
|
): void {
|
|
cuttingDraftStore.clear(type, userId);
|
|
}
|