refactor: rename 'sampel' to 'sample' across models, requests, and UI components for consistency in cutting results management
This commit is contained in:
parent
b4e93fa329
commit
4e3e935f43
@ -25,7 +25,7 @@ public function rules(): array
|
||||
Rule::exists('product_variants', 'id')->whereNull('deleted_at'),
|
||||
],
|
||||
'cutting_result' => ['required', 'integer', 'min:1'],
|
||||
'sampel' => ['required', 'integer', 'min:0'],
|
||||
'sample' => ['required', 'integer', 'min:0'],
|
||||
'original_outside_sample' => ['required', 'integer', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public function rules(): array
|
||||
Rule::exists('product_variants', 'id')->whereNull('deleted_at'),
|
||||
];
|
||||
$rules['results.*.cutting_result'] = ['required', 'integer', 'min:1'];
|
||||
$rules['results.*.sampel'] = ['required', 'integer', 'min:0'];
|
||||
$rules['results.*.sample'] = ['required', 'integer', 'min:0'];
|
||||
$rules['results.*.original_outside_sample'] = ['required', 'integer', 'min:0'];
|
||||
}
|
||||
|
||||
@ -69,8 +69,8 @@ public function attributes(): array
|
||||
'results' => 'Hasil Produk',
|
||||
'results.*.product_variant_id' => 'Varian Produk',
|
||||
'results.*.cutting_result' => 'Hasil',
|
||||
'results.*.sampel' => 'Sampel',
|
||||
'results.*.original_outside_sample' => 'Diluar Sampel',
|
||||
'results.*.sample' => 'sample',
|
||||
'results.*.original_outside_sample' => 'Diluar sample',
|
||||
'sewing_cost' => 'Jasa Jahit',
|
||||
'other_cost' => 'Biaya Lainnya',
|
||||
];
|
||||
|
||||
@ -47,7 +47,7 @@ public function rules(): array
|
||||
'verification_note' => ['nullable', 'string', 'max:500'],
|
||||
'results' => ['nullable', 'array'],
|
||||
'results.*.product_variant_id' => ['required_with:results', 'integer', 'exists:product_variants,id'],
|
||||
'results.*.sampel' => ['required_with:results', 'integer', 'min:0'],
|
||||
'results.*.sample' => ['required_with:results', 'integer', 'min:0'],
|
||||
'results.*.original_outside_sample' => ['required_with:results', 'integer', 'min:0'],
|
||||
'result_prices' => ['nullable', 'array'],
|
||||
'result_prices.*.product_variant_id' => ['required_with:result_prices', 'integer', 'exists:product_variants,id'],
|
||||
@ -101,8 +101,8 @@ public function withValidator(Validator $validator): void
|
||||
$cuttingResults = $cutting->results->keyBy('product_variant_id');
|
||||
foreach ($this->input('results', []) as $index => $item) {
|
||||
$variantId = $item['product_variant_id'] ?? 0;
|
||||
$sampel = (int) ($item['sampel'] ?? 0);
|
||||
$hasilCuttingDiluarSampel = (int) ($item['original_outside_sample'] ?? 0);
|
||||
$sample = (int) ($item['sample'] ?? 0);
|
||||
$hasilCuttingDiluarsample = (int) ($item['original_outside_sample'] ?? 0);
|
||||
|
||||
$originalResult = $cuttingResults->get($variantId);
|
||||
if ($originalResult === null) {
|
||||
@ -111,8 +111,8 @@ public function withValidator(Validator $validator): void
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($sampel + $hasilCuttingDiluarSampel) !== (int) $originalResult->cutting_result) {
|
||||
$validator->errors()->add("results.{$index}.sampel", "Total jumlah (sampel + hasil cutting diluar sampel) harus sama dengan hasil cutting asli ({$originalResult->cutting_result} pcs).");
|
||||
if (($sample + $hasilCuttingDiluarsample) !== (int) $originalResult->cutting_result) {
|
||||
$validator->errors()->add("results.{$index}.sample", "Total jumlah (sample + hasil cutting diluar sample) harus sama dengan hasil cutting asli ({$originalResult->cutting_result} pcs).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ protected function casts(): array
|
||||
return [
|
||||
'cutting_result' => 'integer',
|
||||
'original_outside_sample' => 'integer',
|
||||
'sampel' => 'integer',
|
||||
'sample' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -285,8 +285,8 @@ public function syncDraftResult(array $validated, User $user): array
|
||||
->findOrFail($validated['product_variant_id']);
|
||||
|
||||
$cuttingResult = (int) $validated['cutting_result'];
|
||||
$sampel = (int) $validated['sampel'];
|
||||
$hasilCuttingDiluarSampel = (int) ($validated['original_outside_sample'] ?? 0);
|
||||
$sample = (int) $validated['sample'];
|
||||
$hasilCuttingDiluarsample = (int) ($validated['original_outside_sample'] ?? 0);
|
||||
|
||||
if ($cuttingResult < 1) {
|
||||
throw ValidationException::withMessages([
|
||||
@ -294,21 +294,21 @@ public function syncDraftResult(array $validated, User $user): array
|
||||
]);
|
||||
}
|
||||
|
||||
if ($sampel < 0) {
|
||||
if ($sample < 0) {
|
||||
throw ValidationException::withMessages([
|
||||
'sampel' => 'Sampel tidak boleh negatif.',
|
||||
'sample' => 'sample tidak boleh negatif.',
|
||||
]);
|
||||
}
|
||||
|
||||
if ($hasilCuttingDiluarSampel < 0) {
|
||||
if ($hasilCuttingDiluarsample < 0) {
|
||||
throw ValidationException::withMessages([
|
||||
'original_outside_sample' => 'Hasil cutting diluar sampel tidak boleh negatif.',
|
||||
'original_outside_sample' => 'Hasil cutting diluar sample tidak boleh negatif.',
|
||||
]);
|
||||
}
|
||||
|
||||
if (($sampel + $hasilCuttingDiluarSampel) !== $cuttingResult) {
|
||||
if (($sample + $hasilCuttingDiluarsample) !== $cuttingResult) {
|
||||
throw ValidationException::withMessages([
|
||||
'cutting_result' => 'Hasil cutting harus sama dengan sampel ditambah hasil cutting diluar sampel.',
|
||||
'cutting_result' => 'Hasil cutting harus sama dengan sample ditambah hasil cutting diluar sample.',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -320,8 +320,8 @@ public function syncDraftResult(array $validated, User $user): array
|
||||
],
|
||||
[
|
||||
'cutting_result' => $cuttingResult,
|
||||
'sampel' => $sampel,
|
||||
'original_outside_sample' => $hasilCuttingDiluarSampel,
|
||||
'sample' => $sample,
|
||||
'original_outside_sample' => $hasilCuttingDiluarsample,
|
||||
],
|
||||
);
|
||||
|
||||
@ -573,7 +573,7 @@ public function transitionStatus(
|
||||
$cutting->results()
|
||||
->where('product_variant_id', $item['product_variant_id'])
|
||||
->update([
|
||||
'sampel' => $item['sampel'],
|
||||
'sample' => $item['sample'],
|
||||
'original_outside_sample' => $item['original_outside_sample'],
|
||||
]);
|
||||
}
|
||||
@ -677,8 +677,8 @@ private function buildResults(array $results): array
|
||||
}
|
||||
|
||||
$cuttingResult = (int) $itemData['cutting_result'];
|
||||
$sampel = (int) $itemData['sampel'];
|
||||
$hasilCuttingDiluarSampel = (int) ($itemData['original_outside_sample'] ?? 0);
|
||||
$sample = (int) $itemData['sample'];
|
||||
$hasilCuttingDiluarsample = (int) ($itemData['original_outside_sample'] ?? 0);
|
||||
|
||||
if ($cuttingResult < 1) {
|
||||
throw ValidationException::withMessages([
|
||||
@ -686,29 +686,29 @@ private function buildResults(array $results): array
|
||||
]);
|
||||
}
|
||||
|
||||
if ($sampel < 0) {
|
||||
if ($sample < 0) {
|
||||
throw ValidationException::withMessages([
|
||||
"results.{$index}.sampel" => 'Sampel tidak boleh negatif.',
|
||||
"results.{$index}.sample" => 'sample tidak boleh negatif.',
|
||||
]);
|
||||
}
|
||||
|
||||
if ($hasilCuttingDiluarSampel < 0) {
|
||||
if ($hasilCuttingDiluarsample < 0) {
|
||||
throw ValidationException::withMessages([
|
||||
"results.{$index}.original_outside_sample" => 'Hasil cutting diluar sampel tidak boleh negatif.',
|
||||
"results.{$index}.original_outside_sample" => 'Hasil cutting diluar sample tidak boleh negatif.',
|
||||
]);
|
||||
}
|
||||
|
||||
if (($sampel + $hasilCuttingDiluarSampel) !== $cuttingResult) {
|
||||
if (($sample + $hasilCuttingDiluarsample) !== $cuttingResult) {
|
||||
throw ValidationException::withMessages([
|
||||
"results.{$index}.cutting_result" => 'Hasil cutting harus sama dengan sampel ditambah hasil cutting diluar sampel.',
|
||||
"results.{$index}.cutting_result" => 'Hasil cutting harus sama dengan sample ditambah hasil cutting diluar sample.',
|
||||
]);
|
||||
}
|
||||
|
||||
return [
|
||||
'product_variant_id' => $variant->id,
|
||||
'cutting_result' => $cuttingResult,
|
||||
'sampel' => $sampel,
|
||||
'original_outside_sample' => $hasilCuttingDiluarSampel,
|
||||
'sample' => $sample,
|
||||
'original_outside_sample' => $hasilCuttingDiluarsample,
|
||||
];
|
||||
})
|
||||
->all();
|
||||
@ -757,10 +757,10 @@ private function reverseMaterialStock(Cutting $cutting): void
|
||||
private function applyProductStockOnVerify(Cutting $cutting): void
|
||||
{
|
||||
foreach ($cutting->results as $result) {
|
||||
if ($result->sampel > 0) {
|
||||
if ($result->sample > 0) {
|
||||
ProductVariant::query()
|
||||
->whereKey($result->product_variant_id)
|
||||
->increment('stock', $result->sampel);
|
||||
->increment('stock', $result->sample);
|
||||
}
|
||||
|
||||
if ($result->original_outside_sample > 0) {
|
||||
@ -774,10 +774,10 @@ private function applyProductStockOnVerify(Cutting $cutting): void
|
||||
private function reverseProductStock(Cutting $cutting): void
|
||||
{
|
||||
foreach ($cutting->results as $result) {
|
||||
if ($result->sampel > 0) {
|
||||
if ($result->sample > 0) {
|
||||
ProductVariant::query()
|
||||
->whereKey($result->product_variant_id)
|
||||
->decrement('stock', $result->sampel);
|
||||
->decrement('stock', $result->sample);
|
||||
}
|
||||
|
||||
if ($result->original_outside_sample > 0) {
|
||||
@ -880,7 +880,7 @@ private function presentDraftResult(CuttingResult $item): array
|
||||
'variant_name' => $variant?->name ?? '',
|
||||
'stock' => $variant?->stock ?? 0,
|
||||
'cutting_result' => (string) $item->cutting_result,
|
||||
'sampel' => (string) $item->sampel,
|
||||
'sample' => (string) $item->sample,
|
||||
'original_outside_sample' => (string) $item->original_outside_sample,
|
||||
'images' => $variant ? MediaPresenter::collection($variant, 'images') : [],
|
||||
];
|
||||
|
||||
@ -84,7 +84,7 @@ public function submitVerification(
|
||||
$cutting->results()
|
||||
->where('product_variant_id', $item['product_variant_id'])
|
||||
->update([
|
||||
'sampel' => $item['good'],
|
||||
'sample' => $item['good'],
|
||||
'original_outside_sample' => $item['reject'],
|
||||
]);
|
||||
}
|
||||
@ -249,10 +249,10 @@ private function breakMaterialCircularReference(CuttingMaterial $material): void
|
||||
private function applyProductStockOnVerify(Cutting $cutting): void
|
||||
{
|
||||
foreach ($cutting->results as $result) {
|
||||
if ($result->sampel > 0) {
|
||||
if ($result->sample > 0) {
|
||||
ProductVariant::query()
|
||||
->whereKey($result->product_variant_id)
|
||||
->increment('stock', $result->sampel);
|
||||
->increment('stock', $result->sample);
|
||||
}
|
||||
|
||||
if ($result->original_outside_sample > 0) {
|
||||
|
||||
@ -15,14 +15,14 @@ class CuttingResultFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
$cuttingResult = fake()->numberBetween(10, 200);
|
||||
$hasilCuttingDiluarSampel = fake()->numberBetween(0, (int) ($cuttingResult * 0.1));
|
||||
$hasilCuttingDiluarsample = fake()->numberBetween(0, (int) ($cuttingResult * 0.1));
|
||||
|
||||
return [
|
||||
'cutting_id' => Cutting::factory(),
|
||||
'product_variant_id' => ProductVariant::factory(),
|
||||
'cutting_result' => $cuttingResult,
|
||||
'sampel' => $cuttingResult - $hasilCuttingDiluarSampel,
|
||||
'original_outside_sample' => $hasilCuttingDiluarSampel,
|
||||
'sample' => $cuttingResult - $hasilCuttingDiluarsample,
|
||||
'original_outside_sample' => $hasilCuttingDiluarsample,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public function up(): void
|
||||
$table->foreignId('product_variant_id')->constrained()->restrictOnDelete();
|
||||
|
||||
$table->unsignedInteger('cutting_result');
|
||||
$table->unsignedInteger('sampel');
|
||||
$table->unsignedInteger('sample');
|
||||
$table->unsignedInteger('original_outside_sample')->default(0);
|
||||
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
@ -34,7 +34,7 @@ export function cuttingStatusTransitionConfirmDescription(targetStatus: string):
|
||||
}
|
||||
|
||||
if (targetStatus === CuttingStatus.VERIFIED) {
|
||||
return 'Hasil cutting akan diverifikasi. Stok sampel dan hasil cutting diluar sampel akan ditambahkan ke produk.';
|
||||
return 'Hasil cutting akan diverifikasi. Stok sample dan hasil cutting diluar sample akan ditambahkan ke produk.';
|
||||
}
|
||||
|
||||
if (targetStatus === CuttingStatus.IN_PROGRESS) {
|
||||
|
||||
@ -38,7 +38,7 @@ const initialData = computed(() => ({
|
||||
variant_name: item.product_variant?.name ?? '',
|
||||
stock: item.product_variant?.stock ?? 0,
|
||||
cutting_result: String(item.cutting_result),
|
||||
sampel: String(item.sampel),
|
||||
sample: String(item.sample),
|
||||
original_outside_sample: String(item.original_outside_sample),
|
||||
images: item.product_variant?.images ?? [],
|
||||
})),
|
||||
|
||||
@ -43,7 +43,7 @@ const open = defineModel<boolean>('open', { required: true });
|
||||
</div>
|
||||
<div class="mt-1.5 flex items-center justify-between gap-2 text-xs text-muted-foreground">
|
||||
<span class="font-medium text-foreground">{{ formatRupiah(materialLineCost(item))
|
||||
}}</span>
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -64,9 +64,9 @@ const open = defineModel<boolean>('open', { required: true });
|
||||
<div class="mt-1.5 flex items-center gap-3 text-xs tabular-nums">
|
||||
<span>Hasil: <strong>{{ item.cutting_result }}</strong></span>
|
||||
<span class="text-muted-foreground">·</span>
|
||||
<span>Sampel: <strong>{{ item.sampel }}</strong></span>
|
||||
<span>sample: <strong>{{ item.sample }}</strong></span>
|
||||
<span class="text-muted-foreground">·</span>
|
||||
<span>Diluar Sampel: <strong>{{ item.original_outside_sample }}</strong></span>
|
||||
<span>Diluar sample: <strong>{{ item.original_outside_sample }}</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -99,7 +99,7 @@ function buildPayload() {
|
||||
payload.results = resultCart.value.map((item) => ({
|
||||
product_variant_id: item.product_variant_id,
|
||||
cutting_result: item.cutting_result,
|
||||
sampel: item.sampel,
|
||||
sample: item.sample,
|
||||
original_outside_sample: item.original_outside_sample,
|
||||
}));
|
||||
}
|
||||
|
||||
@ -59,12 +59,12 @@ const emit = defineEmits<{
|
||||
@change="emit('sync-totals', item); emit('sync-field', index)" />
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel class="text-xs">Sampel</FieldLabel>
|
||||
<NumberInput v-model="item.sampel" class="h-8"
|
||||
<FieldLabel class="text-xs">sample</FieldLabel>
|
||||
<NumberInput v-model="item.sample" class="h-8"
|
||||
@change="emit('sync-totals', item); emit('sync-field', index)" />
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel class="text-xs">Diluar Sampel</FieldLabel>
|
||||
<FieldLabel class="text-xs">Diluar sample</FieldLabel>
|
||||
<NumberInput v-model="item.original_outside_sample" class="h-8" />
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
@ -178,16 +178,16 @@ export function useCuttingPosCart(options: {
|
||||
product: CuttingProductCatalogItem,
|
||||
variant: CuttingCatalogVariant,
|
||||
cuttingResult: string,
|
||||
sampel: string,
|
||||
hasilCuttingDiluarSampel: string,
|
||||
sample: string,
|
||||
hasilCuttingDiluarsample: string,
|
||||
) {
|
||||
const { item } = await apiFetch<{ item: CuttingResultCartItem }>(draft_results.store.url(), {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
product_variant_id: variant.id,
|
||||
cutting_result: cuttingResult,
|
||||
sampel,
|
||||
original_outside_sample: hasilCuttingDiluarSampel,
|
||||
sample,
|
||||
original_outside_sample: hasilCuttingDiluarsample,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -197,16 +197,16 @@ export function useCuttingPosCart(options: {
|
||||
async function syncDraftResultById(
|
||||
variantId: number,
|
||||
cuttingResult: string,
|
||||
sampel: string,
|
||||
hasilCuttingDiluarSampel: string,
|
||||
sample: string,
|
||||
hasilCuttingDiluarsample: string,
|
||||
) {
|
||||
const { item } = await apiFetch<{ item: CuttingResultCartItem }>(draft_results.store.url(), {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
product_variant_id: variantId,
|
||||
cutting_result: cuttingResult,
|
||||
sampel,
|
||||
original_outside_sample: hasilCuttingDiluarSampel,
|
||||
sample,
|
||||
original_outside_sample: hasilCuttingDiluarsample,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -223,9 +223,9 @@ export function useCuttingPosCart(options: {
|
||||
|
||||
function syncResultTotals(item: CuttingResultCartItem) {
|
||||
const total = Number(item.cutting_result) || 0;
|
||||
const sampel = Number(item.sampel) || 0;
|
||||
const sample = Number(item.sample) || 0;
|
||||
|
||||
item.original_outside_sample = String(Math.max(total - sampel, 0));
|
||||
item.original_outside_sample = String(Math.max(total - sample, 0));
|
||||
}
|
||||
|
||||
async function removeMaterial(index: number) {
|
||||
@ -352,16 +352,16 @@ export function useCuttingPosCart(options: {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextSampel = Math.max(0, (Number(item.sampel) || 0) - 1);
|
||||
const nextHasilCuttingDiluarSampel = Math.max(nextQty - nextSampel, 0);
|
||||
const nextsample = Math.max(0, (Number(item.sample) || 0) - 1);
|
||||
const nextHasilCuttingDiluarsample = Math.max(nextQty - nextsample, 0);
|
||||
|
||||
if (toValue(options.isCreateMode)) {
|
||||
try {
|
||||
await syncDraftResultById(
|
||||
variantId,
|
||||
String(nextQty),
|
||||
String(nextSampel),
|
||||
String(nextHasilCuttingDiluarSampel),
|
||||
String(nextsample),
|
||||
String(nextHasilCuttingDiluarsample),
|
||||
);
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : 'Gagal memperbarui jumlah item.');
|
||||
@ -371,7 +371,7 @@ export function useCuttingPosCart(options: {
|
||||
}
|
||||
|
||||
item.cutting_result = String(nextQty);
|
||||
item.sampel = String(nextSampel);
|
||||
item.sample = String(nextsample);
|
||||
syncResultTotals(item);
|
||||
}
|
||||
|
||||
@ -380,8 +380,8 @@ export function useCuttingPosCart(options: {
|
||||
(item) => item.product_variant_id === variant.id,
|
||||
);
|
||||
const nextQty = existing ? (Number(existing.cutting_result) || 0) + 1 : 1;
|
||||
const nextSampel = existing ? (Number(existing.sampel) || 0) + 1 : 1;
|
||||
const nextHasilCuttingDiluarSampel = Math.max(nextQty - nextSampel, 0);
|
||||
const nextsample = existing ? (Number(existing.sample) || 0) + 1 : 1;
|
||||
const nextHasilCuttingDiluarsample = Math.max(nextQty - nextsample, 0);
|
||||
|
||||
if (toValue(options.isCreateMode)) {
|
||||
try {
|
||||
@ -389,8 +389,8 @@ export function useCuttingPosCart(options: {
|
||||
product,
|
||||
variant,
|
||||
String(nextQty),
|
||||
String(nextSampel),
|
||||
String(nextHasilCuttingDiluarSampel),
|
||||
String(nextsample),
|
||||
String(nextHasilCuttingDiluarsample),
|
||||
);
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : 'Gagal menyimpan item ke keranjang.');
|
||||
@ -401,7 +401,7 @@ export function useCuttingPosCart(options: {
|
||||
|
||||
if (existing) {
|
||||
existing.cutting_result = String(nextQty);
|
||||
existing.sampel = String(nextSampel);
|
||||
existing.sample = String(nextsample);
|
||||
syncResultTotals(existing);
|
||||
|
||||
return;
|
||||
@ -413,7 +413,7 @@ export function useCuttingPosCart(options: {
|
||||
variant_name: variant.name,
|
||||
stock: variant.stock,
|
||||
cutting_result: '1',
|
||||
sampel: '1',
|
||||
sample: '1',
|
||||
original_outside_sample: '0',
|
||||
images: variant.images ?? [],
|
||||
});
|
||||
@ -444,7 +444,7 @@ export function useCuttingPosCart(options: {
|
||||
await syncDraftResultById(
|
||||
item.product_variant_id,
|
||||
item.cutting_result,
|
||||
item.sampel,
|
||||
item.sample,
|
||||
item.original_outside_sample,
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
@ -135,7 +135,7 @@ function getGroupedResults(results: any[]): GroupedCuttingResults[] {
|
||||
0 }} pcs</strong></span>
|
||||
<span v-if="cutting.total_material_usage_summary_formatted">Total Pemakaian Bahan
|
||||
<strong class="text-primary">{{ cutting.total_material_usage_summary_formatted
|
||||
}}</strong></span>
|
||||
}}</strong></span>
|
||||
<span>Biaya Bahan <strong class="text-primary">{{
|
||||
cutting.total_material_cost_formatted ?? 'Rp 0' }}</strong></span>
|
||||
</div>
|
||||
@ -197,8 +197,8 @@ function getGroupedResults(results: any[]): GroupedCuttingResults[] {
|
||||
<TableRow>
|
||||
<TableHead>Varian</TableHead>
|
||||
<TableHead>Hasil</TableHead>
|
||||
<TableHead>Sampel</TableHead>
|
||||
<TableHead>Diluar Sampel</TableHead>
|
||||
<TableHead>sample</TableHead>
|
||||
<TableHead>Diluar sample</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@ -222,7 +222,7 @@ function getGroupedResults(results: any[]): GroupedCuttingResults[] {
|
||||
{{ result.cutting_result }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.sampel }} pcs
|
||||
{{ result.sample }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.original_outside_sample }} pcs
|
||||
|
||||
@ -49,9 +49,9 @@ const verifyForm = useForm({
|
||||
product_variant_id: res.product_variant?.id || 0,
|
||||
name: `${res.product_variant?.product?.name || ''} (${res.product_variant?.name || ''})`,
|
||||
cutting_result: res.cutting_result,
|
||||
sampel: res.sampel,
|
||||
sample: res.sample,
|
||||
original_outside_sample: res.original_outside_sample,
|
||||
original_sampel: res.sampel,
|
||||
original_sample: res.sample,
|
||||
original_original_outside_sample: res.original_outside_sample,
|
||||
prices: buildEmptyPrices(),
|
||||
})),
|
||||
@ -69,9 +69,9 @@ watch(open, (isOpen) => {
|
||||
product_variant_id: res.product_variant?.id || 0,
|
||||
name: `${res.product_variant?.product?.name || ''} (${res.product_variant?.name || ''})`,
|
||||
cutting_result: res.cutting_result,
|
||||
sampel: res.sampel,
|
||||
sample: res.sample,
|
||||
original_outside_sample: res.original_outside_sample,
|
||||
original_sampel: res.sampel,
|
||||
original_sample: res.sample,
|
||||
original_original_outside_sample: res.original_outside_sample,
|
||||
prices: buildEmptyPrices(),
|
||||
}));
|
||||
@ -87,7 +87,7 @@ watch(allMatches, (matches) => {
|
||||
|
||||
verifyForm.results = verifyForm.results.map((result) => ({
|
||||
...result,
|
||||
sampel: result.original_sampel,
|
||||
sample: result.original_sample,
|
||||
original_outside_sample: result.original_original_outside_sample,
|
||||
}));
|
||||
});
|
||||
@ -98,7 +98,7 @@ function setAllMatches(value: boolean) {
|
||||
if (value) {
|
||||
verifyForm.results = verifyForm.results.map((result) => ({
|
||||
...result,
|
||||
sampel: result.original_sampel,
|
||||
sample: result.original_sample,
|
||||
original_outside_sample: result.original_original_outside_sample,
|
||||
}));
|
||||
}
|
||||
@ -132,9 +132,9 @@ function submitVerify() {
|
||||
.transform((data) => ({
|
||||
status: data.status,
|
||||
verification_note: data.verification_note,
|
||||
results: data.results.map(({ product_variant_id, sampel, original_outside_sample }) => ({
|
||||
results: data.results.map(({ product_variant_id, sample, original_outside_sample }) => ({
|
||||
product_variant_id,
|
||||
sampel,
|
||||
sample,
|
||||
original_outside_sample,
|
||||
})),
|
||||
result_prices: buildResultPricesPayload(),
|
||||
@ -187,12 +187,12 @@ function submitVerify() {
|
||||
<div>
|
||||
<span class="text-muted-foreground block mb-0.5">Data cutting:</span>
|
||||
<span class="font-medium tabular-nums">
|
||||
{{ result.original_sampel }} sampel ·
|
||||
{{ result.original_original_outside_sample }} diluar sampel
|
||||
{{ result.original_sample }} sample ·
|
||||
{{ result.original_original_outside_sample }} diluar sample
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-muted-foreground block">Diluar Sampel:</span>
|
||||
<span class="text-muted-foreground block">Diluar sample:</span>
|
||||
<Badge variant="secondary" class="font-semibold">
|
||||
{{ result.original_outside_sample }} pcs
|
||||
</Badge>
|
||||
@ -200,23 +200,23 @@ function submitVerify() {
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-2 items-end text-xs">
|
||||
<div>
|
||||
<label :for="`sampel-${index}`" class="text-muted-foreground block mb-0.5">Sampel
|
||||
<label :for="`sample-${index}`" class="text-muted-foreground block mb-0.5">sample
|
||||
(diterima):</label>
|
||||
<Input :id="`sampel-${index}`" type="number" v-model.number="result.sampel" min="0"
|
||||
<Input :id="`sample-${index}`" type="number" v-model.number="result.sample" min="0"
|
||||
:max="result.cutting_result" class="h-8 w-full px-2 text-xs"
|
||||
:disabled="allMatches"
|
||||
@input="result.original_outside_sample = result.cutting_result - result.sampel" />
|
||||
@input="result.original_outside_sample = result.cutting_result - result.sample" />
|
||||
</div>
|
||||
<div>
|
||||
<label :for="`diluar-sampel-${index}`"
|
||||
<label :for="`diluar-sample-${index}`"
|
||||
class="text-muted-foreground block mb-0.5">Diluar
|
||||
Sampel
|
||||
sample
|
||||
(diterima):</label>
|
||||
<Input :id="`diluar-sampel-${index}`" type="number"
|
||||
<Input :id="`diluar-sample-${index}`" type="number"
|
||||
v-model.number="result.original_outside_sample" min="0"
|
||||
:max="result.cutting_result" class="h-8 w-full px-2 text-xs"
|
||||
:disabled="allMatches"
|
||||
@input="result.sampel = result.cutting_result - result.original_outside_sample" />
|
||||
@input="result.sample = result.cutting_result - result.original_outside_sample" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ defineProps<{
|
||||
{{ result.cutting_result }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.sampel }} pcs
|
||||
{{ result.sample }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.original_outside_sample }} pcs
|
||||
|
||||
@ -49,8 +49,8 @@ defineProps<{
|
||||
<TableRow>
|
||||
<TableHead>Varian</TableHead>
|
||||
<TableHead>Hasil</TableHead>
|
||||
<TableHead>Sampel</TableHead>
|
||||
<TableHead>Diluar Sampel</TableHead>
|
||||
<TableHead>sample</TableHead>
|
||||
<TableHead>Diluar sample</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@ -67,7 +67,7 @@ defineProps<{
|
||||
{{ result.cutting_result }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.sampel }} pcs
|
||||
{{ result.sample }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.original_outside_sample }} pcs
|
||||
|
||||
@ -100,8 +100,8 @@ const showingCount = computed(() => props.cuttings.length);
|
||||
<TableRow>
|
||||
<TableHead>Varian</TableHead>
|
||||
<TableHead>Hasil</TableHead>
|
||||
<TableHead>Sampel</TableHead>
|
||||
<TableHead>Diluar Sampel</TableHead>
|
||||
<TableHead>sample</TableHead>
|
||||
<TableHead>Diluar sample</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@ -125,7 +125,7 @@ const showingCount = computed(() => props.cuttings.length);
|
||||
{{ result.cutting_result }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.sampel }} pcs
|
||||
{{ result.sample }} pcs
|
||||
</TableCell>
|
||||
<TableCell class="tabular-nums">
|
||||
{{ result.original_outside_sample }} pcs
|
||||
|
||||
@ -53,7 +53,7 @@ const verifyForm = useForm({
|
||||
product_variant_id: res.product_variant?.id || 0,
|
||||
name: `${res.product_variant?.product?.name || ''} (${res.product_variant?.name || ''})`,
|
||||
cutting_result: res.cutting_result,
|
||||
original_sampel: res.sampel,
|
||||
original_sample: res.sample,
|
||||
original_outside_sample: res.original_outside_sample,
|
||||
good: res.cutting_result,
|
||||
reject: 0,
|
||||
@ -70,7 +70,7 @@ watch(open, (isOpen) => {
|
||||
product_variant_id: res.product_variant?.id || 0,
|
||||
name: `${res.product_variant?.product?.name || ''} (${res.product_variant?.name || ''})`,
|
||||
cutting_result: res.cutting_result,
|
||||
original_sampel: res.sampel,
|
||||
original_sample: res.sample,
|
||||
original_outside_sample: res.original_outside_sample,
|
||||
good: res.cutting_result,
|
||||
reject: 0,
|
||||
@ -186,7 +186,7 @@ function submitVerify() {
|
||||
<p class="font-medium text-sm truncate">{{ result.name }}</p>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
{{ result.cutting_result }} pcs
|
||||
<span class="text-[10px]">({{ result.original_sampel }} sampel, {{
|
||||
<span class="text-[10px]">({{ result.original_sample }} sample, {{
|
||||
result.original_outside_sample }} outside sample)</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -45,7 +45,7 @@ export type CuttingResultPriceItem = {
|
||||
export type CuttingResultListItem = {
|
||||
id: number;
|
||||
cutting_result: number;
|
||||
sampel: number;
|
||||
sample: number;
|
||||
original_outside_sample: number;
|
||||
product_variant?: {
|
||||
id: number;
|
||||
@ -120,7 +120,7 @@ export type CuttingResultCartItem = {
|
||||
variant_name: string;
|
||||
stock: number;
|
||||
cutting_result: string;
|
||||
sampel: string;
|
||||
sample: string;
|
||||
original_outside_sample: string;
|
||||
images?: MediaItem[];
|
||||
};
|
||||
@ -148,7 +148,7 @@ export type CuttingEditItem = {
|
||||
results: Array<{
|
||||
product_variant_id: number;
|
||||
cutting_result: number;
|
||||
sampel: number;
|
||||
sample: number;
|
||||
original_outside_sample: number;
|
||||
product_variant?: {
|
||||
name: string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user