refactor: special

This commit is contained in:
puriphatt 2024-10-04 15:12:13 +07:00
parent 20dc04c769
commit 0461da4bf8
2 changed files with 22 additions and 13 deletions

View file

@ -13,6 +13,7 @@ const customerStore = useCustomerStore();
const branchId = defineModel<string>('branchId');
const customerBranchId = defineModel<string>('customerBranchId');
const agentPrice = defineModel<boolean>('agentPrice');
const special = defineModel<boolean>('special');
const branchOption = ref();
const customerOption = ref();
@ -116,6 +117,13 @@ watch(
v-model="agentPrice"
style="font-size: 14px"
/>
<q-checkbox
class="q-ml-md"
:label="$t('quotation.special')"
size="xs"
v-model="special"
style="font-size: 14px"
/>
</div>
</div>
<div class="col-12 row q-col-gutter-sm">

View file

@ -89,6 +89,7 @@ const { state: employeeFormState, currentFromDataEmployee } =
storeToRefs(employeeFormStore);
const { currentMyBranch } = storeToRefs(userBranch);
const special = ref(false);
const branchId = ref('');
const agentPrice = ref<boolean>(false);
const currentCustomerId = ref<string | undefined>();
@ -355,17 +356,16 @@ function triggerAddQuotationDialog() {
}
function triggerQuotationDialog() {
const params = new URLSearchParams();
const url = new URL('/quotation/add-quotation', window.location.origin);
url.searchParams.set('branchId', branchId.value);
url.searchParams.set(
'customerBranchId',
quotationFormData.value.customerBranchId,
);
url.searchParams.set('agentPrice', agentPrice.value.toString());
url.searchParams.set('special', special.value.toString());
params.set('branchId', branchId.value);
params.set('customerBranchId', branchId.value);
params.set('date', Date.now().toString());
params.set('agentPrice', agentPrice.value.toString());
const query = params.toString();
window.open(`/quotation/add-quotation?${query}`, '_blank');
// TODO: form and state controll
window.open(url.toString(), '_blank');
}
function triggerSelectEmployeeDialog() {
@ -831,7 +831,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
<!-- NOTE: SEC START - Dialog -->
<!-- NOTE: START - Quotation Form -->
<!-- NOTE: START - Quotation Form, Add Quotation -->
<DialogForm
:title="$t('general.add', { text: $t('quotation.title') })"
@ -868,9 +868,10 @@ watch(() => pageState.currentTab, fetchQuotationList);
>
<FormAbout
on-create
v-model:branch-id="branchId"
v-model:customer-branch-id="quotationFormData.customerBranchId"
v-model:agent-price="agentPrice"
v-model:branch-id="branchId"
v-model:special="special"
v-model:customer-branch-id="quotationFormData.customerBranchId"
@add-customer="triggerSelectTypeCustomerd()"
/>
</div>