refactor: switch mode and color

This commit is contained in:
Thanaphon Frappet 2024-11-08 10:42:27 +07:00
parent f3fdaac2b1
commit 983f48f7e2
3 changed files with 17 additions and 34 deletions

View file

@ -31,6 +31,7 @@ import { deleteItem } from 'stores/utils';
import { runOcr, parseResultMRZ } from 'src/utils/ocr';
// NOTE Import Types
import { View } from './types.ts';
import { QuotationPayload } from 'src/stores/quotations/types';
import { EmployeeWorker } from 'src/stores/quotations/types';
import { Employee } from 'src/stores/employee/types';
@ -964,7 +965,6 @@ function storeDataLocal() {
productServiceList: productService.value,
},
meta: {
viewMod: view.value,
source: {
...quotationFormState.value.source,
code:
@ -987,14 +987,11 @@ function storeDataLocal() {
}),
);
const documentTypes: Record<number, string> = {
3: 'invoice',
4: 'payment',
7: 'receipt',
};
const documentType = documentTypes[view.value] || '';
const url = new URL('/quotation/document-view', window.location.origin);
window.open(`/quotation/document-view?type=${documentType}`, '_blank');
url.searchParams.append('type', view.value);
window.open(url, '_blank');
}
const QUOTATION_STATUS = [
'Issued',
@ -1031,17 +1028,6 @@ const statusQuotationForm = ref<
}[]
>([]);
enum View {
Quotation,
Accepted,
InvoicePre,
Invoice,
PaymentPre,
Payment,
Receipt,
Complete,
}
const view = ref<View>(View.Quotation);
const code = ref<string>('');
@ -1686,9 +1672,6 @@ async function getInvoiceCodeFullPay() {
:option="templateFormOption"
:label="$t('quotation.templateForm')"
:option-label="locale === 'eng' ? 'labelEN' : 'label'"
@filter="
(val: string, update) => filter(val, update, 'branch')
"
/>
<MainButton
outlined

View file

@ -3,6 +3,8 @@ import { Icon } from '@iconify/vue';
import { ref, watch, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { View } from './types.ts';
import { formatNumberDecimal, commaInput } from 'stores/utils';
import { useConfigStore } from 'stores/config';
@ -13,18 +15,6 @@ import SelectInput from 'src/components/shared/SelectInput.vue';
import { storeToRefs } from 'pinia';
import { precisionRound } from 'src/utils/arithmetic';
enum View {
Quotation,
Accepted,
InvoicePre,
Invoice,
PaymentPre,
Payment,
ReceiptPre,
Receipt,
Complete,
}
const props = defineProps<{
readonly?: boolean;
quotationNo?: string;

View file

@ -0,0 +1,10 @@
export enum View {
Quotation = 'quotation',
Accepted = 'accepted',
InvoicePre = 'invoice-pre',
Invoice = 'invoice',
PaymentPre = 'payment-pre',
Payment = 'payment',
Receipt = 'receipt',
Complete = 'complete',
}