feat: add preview template text

This commit is contained in:
Methapon2001 2024-11-27 14:27:02 +07:00
parent 9eca449031
commit 435d2ce4c8
3 changed files with 43 additions and 3 deletions

View file

@ -28,6 +28,7 @@ import ViewHeader from './ViewHeader.vue';
import ViewFooter from './ViewFooter.vue';
import BankComponents from './BankComponents.vue';
import PrintButton from 'src/components/button/PrintButton.vue';
import { convertTemplate } from 'src/utils/string-template';
const quotationForm = useQuotationForm();
const optionStore = useOptionStore();
@ -164,6 +165,7 @@ onMounted(async () => {
contactTel: parsed.meta.source.contactTel,
workName: parsed.meta.source.workName,
dueDate: parsed.meta.source.dueDate,
worker: parsed.meta.selectedWorker,
};
const resBranch = await branchStore.fetchById(
@ -437,7 +439,25 @@ function print() {
class="border-5 surface-0 detail-note q-mb-md"
style="width: 100%; padding: 8px 16px; white-space: pre-wrap"
>
<div v-html="data?.remark || '-'"></div>
<div
v-html="
convertTemplate(data?.remark || '', {
'quotation-payment': {
paymentType: data?.payCondition || 'Full',
amount: summaryPrice.finalPrice,
installments: data?.paySplit,
},
'quotation-labor': {
name:
details?.worker.map(
(v, i) =>
`${i + 1}. ` +
`${v.namePrefix}. ${v.firstNameEN} ${v.lastNameEN}`.toUpperCase(),
) || [],
},
}) || '-'
"
></div>
</div>
</section>