fix: remark handling
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
This commit is contained in:
parent
8ca3f784f1
commit
968aa04aa9
4 changed files with 66 additions and 18 deletions
|
|
@ -96,7 +96,7 @@ const pageState = reactive({
|
||||||
mode: 'view' as 'view' | 'edit' | 'info',
|
mode: 'view' as 'view' | 'edit' | 'info',
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultRemark = '#[quotation-labor]<br/><br/>#[quotation-payment]';
|
const defaultRemark = '';
|
||||||
|
|
||||||
const formData = ref<CreditNotePayload>({
|
const formData = ref<CreditNotePayload>({
|
||||||
quotationId: '',
|
quotationId: '',
|
||||||
|
|
@ -798,16 +798,7 @@ onMounted(async () => {
|
||||||
:default-remark="defaultRemark"
|
:default-remark="defaultRemark"
|
||||||
:items="[]"
|
:items="[]"
|
||||||
:readonly="pageState.mode === 'info'"
|
:readonly="pageState.mode === 'info'"
|
||||||
>
|
></RemarkExpansion>
|
||||||
<template #hint>
|
|
||||||
{{ $t('general.hintRemark') }}
|
|
||||||
<code>#[quotation-labor]</code>
|
|
||||||
{{ $t('general.quotationLabor') }}
|
|
||||||
{{ $t('general.or') }}
|
|
||||||
<code>#[quotation-payment]</code>
|
|
||||||
{{ $t('general.quotationPayment') }}
|
|
||||||
</template>
|
|
||||||
</RemarkExpansion>
|
|
||||||
|
|
||||||
<QuotationFormReceipt
|
<QuotationFormReceipt
|
||||||
v-if="creditNoteData && view === CreditNoteStatus.Success"
|
v-if="creditNoteData && view === CreditNoteStatus.Success"
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ async function assignFormData(id: string) {
|
||||||
selectedProductGroup.value =
|
selectedProductGroup.value =
|
||||||
data.productServiceList[0]?.product.productGroup?.id || '';
|
data.productServiceList[0]?.product.productGroup?.id || '';
|
||||||
|
|
||||||
(previousValue = {
|
((previousValue = {
|
||||||
id: data.id || undefined,
|
id: data.id || undefined,
|
||||||
debitNoteQuotationId: data.debitNoteQuotationId || undefined,
|
debitNoteQuotationId: data.debitNoteQuotationId || undefined,
|
||||||
productServiceList: structuredClone(
|
productServiceList: structuredClone(
|
||||||
|
|
@ -412,7 +412,7 @@ async function assignFormData(id: string) {
|
||||||
quotationId: data.debitNoteQuotationId,
|
quotationId: data.debitNoteQuotationId,
|
||||||
remark: data.remark || undefined,
|
remark: data.remark || undefined,
|
||||||
}),
|
}),
|
||||||
(currentFormData.value = structuredClone(previousValue));
|
(currentFormData.value = structuredClone(previousValue)));
|
||||||
|
|
||||||
assignProductServiceList();
|
assignProductServiceList();
|
||||||
assignSelectedWorker();
|
assignSelectedWorker();
|
||||||
|
|
@ -1192,7 +1192,6 @@ async function submitAccepted() {
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- TODO: bind remark -->
|
|
||||||
<RemarkExpansion
|
<RemarkExpansion
|
||||||
v-if="
|
v-if="
|
||||||
view === QuotationStatus.Issued ||
|
view === QuotationStatus.Issued ||
|
||||||
|
|
@ -1200,6 +1199,8 @@ async function submitAccepted() {
|
||||||
view === QuotationStatus.PaymentPending
|
view === QuotationStatus.PaymentPending
|
||||||
"
|
"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:final-price="summaryPrice.finalPrice"
|
||||||
|
:selected-worker
|
||||||
v-model:remark="currentFormData.remark"
|
v-model:remark="currentFormData.remark"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -492,9 +492,8 @@ function print() {
|
||||||
v-html="
|
v-html="
|
||||||
convertTemplate(data?.remark || '', {
|
convertTemplate(data?.remark || '', {
|
||||||
'quotation-payment': {
|
'quotation-payment': {
|
||||||
paymentType: data?.payCondition || 'Full',
|
paymentType: 'Full',
|
||||||
amount: summaryPrice.finalPrice,
|
amount: summaryPrice.finalPrice,
|
||||||
installments: data?.paySplit,
|
|
||||||
},
|
},
|
||||||
'quotation-labor': {
|
'quotation-labor': {
|
||||||
name:
|
name:
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { convertTemplate } from 'src/utils/string-template';
|
||||||
|
import { RequestWork } from 'src/stores/request-list';
|
||||||
|
import { Employee } from 'src/stores/employee/types';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
items?: {
|
||||||
|
product: RequestWork['productService']['product'];
|
||||||
|
list: RequestWork[];
|
||||||
|
}[];
|
||||||
|
finalPrice?: number;
|
||||||
|
selectedWorker?: Employee[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const remark = defineModel<string>('remark', { default: '' });
|
const remark = defineModel<string>('remark', { default: '' });
|
||||||
|
const remarkWrite = ref<boolean>(false);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
|
|
@ -24,7 +36,23 @@ const remark = defineModel<string>('remark', { default: '' });
|
||||||
<q-editor
|
<q-editor
|
||||||
dense
|
dense
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:model-value="remark"
|
:model-value="
|
||||||
|
!remarkWrite || readonly
|
||||||
|
? convertTemplate(remark || '', {
|
||||||
|
'quotation-payment': {
|
||||||
|
paymentType: 'Full',
|
||||||
|
amount: finalPrice,
|
||||||
|
},
|
||||||
|
'quotation-labor': {
|
||||||
|
name: selectedWorker.map(
|
||||||
|
(v, i) =>
|
||||||
|
`${i + 1}. ` +
|
||||||
|
`${v.employeePassport.length !== 0 ? v.employeePassport[0].number + '_' : ''} ${v.namePrefix}.${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: remark || ''
|
||||||
|
"
|
||||||
min-height="5rem"
|
min-height="5rem"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
toolbar-bg="input-border"
|
toolbar-bg="input-border"
|
||||||
|
|
@ -48,7 +76,36 @@ const remark = defineModel<string>('remark', { default: '' });
|
||||||
remark = v;
|
remark = v;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
>
|
||||||
|
<template v-if="!readonly" v-slot:toggle>
|
||||||
|
<div class="text-caption row no-wrap q-px-sm">
|
||||||
|
<MainButton
|
||||||
|
:solid="!remarkWrite"
|
||||||
|
icon="mdi-eye-outline"
|
||||||
|
color="0 0% 40%"
|
||||||
|
@click="remarkWrite = false"
|
||||||
|
style="padding: 0 var(--size-2); cursor: pointer"
|
||||||
|
:style="{
|
||||||
|
color: remarkWrite ? 'hsl(0 0% 40%)' : undefined,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||||
|
</MainButton>
|
||||||
|
<MainButton
|
||||||
|
:solid="remarkWrite"
|
||||||
|
icon="mdi-pencil-outline"
|
||||||
|
color="0 0% 40%"
|
||||||
|
@click="remarkWrite = true"
|
||||||
|
style="padding: 0 var(--size-2); cursor: pointer"
|
||||||
|
:style="{
|
||||||
|
color: !remarkWrite ? 'hsl(0 0% 40%)' : undefined,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ $t('general.edit') }}
|
||||||
|
</MainButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-editor>
|
||||||
</main>
|
</main>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue