refactor: handle title mode paview

This commit is contained in:
Thanaphon Frappet 2024-11-01 10:12:04 +07:00
parent 241c20356f
commit 2264686a34

View file

@ -8,11 +8,36 @@ import { Branch } from 'src/stores/branch/types';
import { CustomerBranchRelation, Details } from 'src/stores/quotations/types';
// NOTE: Import Components
enum View {
Quotation,
Invoice,
Payment,
Receipt,
}
defineProps<{
branch: Branch;
customer: CustomerBranchRelation;
details: Details;
view: View;
}>();
function titleMode(mode: View): string {
if (mode === View.Quotation) {
return 'preview.title.quotation';
}
if (mode === View.Invoice) {
return 'preview.title.invoice';
}
if (mode === View.Payment) {
return 'preview.title.payment';
}
if (mode === View.Receipt) {
return 'preview.title.receipt';
}
return '';
}
</script>
<template>
@ -24,7 +49,7 @@ defineProps<{
class="column"
style="text-align: center; width: 50%; font-weight: 800; font-size: 24px"
>
ใบเสนอราคา
{{ $t(titleMode(view)) }}
</div>
</div>
@ -57,7 +82,7 @@ defineProps<{
</section>
<section class="detail-quotation-info">
<div>
<div>เลขทใบเสนอราคา</div>
<div>{{ $t('general.itemNo', { msg: `${$t(titleMode(view))}` }) }}</div>
<div>{{ details.code }}</div>
</div>
<div>