fix: form variable name
This commit is contained in:
parent
e6c0378762
commit
20307f0ddd
1 changed files with 205 additions and 194 deletions
|
|
@ -4,21 +4,19 @@ import AppBox from 'components/app/AppBox.vue';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title: string;
|
title: string;
|
||||||
addressLocaleTitle: string;
|
addressTitle: string;
|
||||||
addressEngTitle: string;
|
addressENTitle: string;
|
||||||
|
submit?: (...args: unknown[]) => void;
|
||||||
|
close?: (...args: unknown[]) => void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
interface Address {
|
|
||||||
address: string;
|
|
||||||
province: string;
|
|
||||||
district: string;
|
|
||||||
subDistrict: string;
|
|
||||||
zip: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const modal = defineModel('modal', { default: false });
|
const modal = defineModel('modal', { default: false });
|
||||||
const addressL = defineModel<Address>('addressL');
|
const address = defineModel('address', { default: '' });
|
||||||
const addressEng = defineModel<Address>('addressEng');
|
const addressEN = defineModel('addressEN', { default: '' });
|
||||||
|
const provinceId = defineModel('provinceId');
|
||||||
|
const districtId = defineModel('districtId');
|
||||||
|
const subDistrictId = defineModel('subDistrictId');
|
||||||
|
const zipCode = defineModel('zipCode', { default: '' });
|
||||||
|
|
||||||
const addrOptions = ref({
|
const addrOptions = ref({
|
||||||
provinceOps: [
|
provinceOps: [
|
||||||
|
|
@ -37,10 +35,8 @@ const addrOptions = ref({
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-dialog full-width v-model="modal">
|
<q-dialog full-width v-model="modal">
|
||||||
<AppBox
|
<AppBox style="padding: 0; border-radius: var(--radius-2)">
|
||||||
v-if="addressL && addressEng"
|
<q-form greedy @submit.prevent @validation-success="submit">
|
||||||
style="padding: 0; border-radius: var(--radius-2)"
|
|
||||||
>
|
|
||||||
<!-- header -->
|
<!-- header -->
|
||||||
<q-card-section class="form-header">
|
<q-card-section class="form-header">
|
||||||
<div class="row items-center justity-between">
|
<div class="row items-center justity-between">
|
||||||
|
|
@ -53,11 +49,13 @@ const addrOptions = ref({
|
||||||
<q-btn
|
<q-btn
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
|
id="closeDialog"
|
||||||
icon="mdi-close"
|
icon="mdi-close"
|
||||||
padding="xs"
|
padding="xs"
|
||||||
class="close-btn"
|
class="close-btn"
|
||||||
:class="{ dark: $q.dark.isActive }"
|
:class="{ dark: $q.dark.isActive }"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
@click="close"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
@ -91,21 +89,23 @@ const addrOptions = ref({
|
||||||
>
|
>
|
||||||
<slot name="midTop"></slot>
|
<slot name="midTop"></slot>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ addressLocaleTitle }}
|
{{ addressTitle }}
|
||||||
</div>
|
</div>
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
id="AddrL"
|
||||||
label="ที่อยู่"
|
label="ที่อยู่"
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-model="addressL.address"
|
v-model="address"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="addressL.province"
|
id="selectProvinceL"
|
||||||
|
v-model="provinceId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="จังหวัด"
|
label="จังหวัด"
|
||||||
|
|
@ -117,7 +117,8 @@ const addrOptions = ref({
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="addressL.district"
|
id="selectDistrictL"
|
||||||
|
v-model="districtId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="อำเภอ"
|
label="อำเภอ"
|
||||||
|
|
@ -128,8 +129,9 @@ const addrOptions = ref({
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-
|
||||||
v-model="addressL.subDistrict"
|
id="selectSubDistrictL"
|
||||||
|
v-model="subDistrictId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="ตำบล"
|
label="ตำบล"
|
||||||
|
|
@ -140,26 +142,29 @@ const addrOptions = ref({
|
||||||
dense
|
dense
|
||||||
readonly
|
readonly
|
||||||
outlined
|
outlined
|
||||||
|
id="zipL"
|
||||||
label="รหัสไปรษณีย์"
|
label="รหัสไปรษณีย์"
|
||||||
class="col-3"
|
class="col-3"
|
||||||
v-model="addressL.zip"
|
v-model="zipCode"
|
||||||
/>
|
/>
|
||||||
<span class="col-12">
|
<span class="col-12">
|
||||||
{{ addressEngTitle }}
|
{{ addressENTitle }}
|
||||||
</span>
|
</span>
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
id="addressEN"
|
||||||
label="ที่อยู่"
|
label="ที่อยู่"
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-model="addressEng.address"
|
v-model="addressEN"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="addressEng.province"
|
id="selectProvinceEN"
|
||||||
|
v-model="provinceId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="จังหวัด"
|
label="จังหวัด"
|
||||||
|
|
@ -171,7 +176,8 @@ const addrOptions = ref({
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="addressEng.district"
|
id="selectDistrictEN"
|
||||||
|
v-model="districtId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="อำเภอ"
|
label="อำเภอ"
|
||||||
|
|
@ -183,7 +189,8 @@ const addrOptions = ref({
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="addressEng.subDistrict"
|
id="SelectSubDistrictEN"
|
||||||
|
v-model="subDistrictId"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
label="ตำบล"
|
label="ตำบล"
|
||||||
|
|
@ -194,9 +201,10 @@ const addrOptions = ref({
|
||||||
dense
|
dense
|
||||||
readonly
|
readonly
|
||||||
outlined
|
outlined
|
||||||
|
zip="zipEN"
|
||||||
label="รหัสไปรษณีย์"
|
label="รหัสไปรษณีย์"
|
||||||
class="col-3"
|
class="col-3"
|
||||||
v-model="addressEng.zip"
|
v-model="zipCode"
|
||||||
/>
|
/>
|
||||||
<div class="col-12" v-if="$slots.midBottom">
|
<div class="col-12" v-if="$slots.midBottom">
|
||||||
<q-separator size="1px" />
|
<q-separator size="1px" />
|
||||||
|
|
@ -219,12 +227,15 @@ const addrOptions = ref({
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
unelevated
|
unelevated
|
||||||
|
id="submitBtn"
|
||||||
|
type="submit"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
:label="$t('save')"
|
:label="$t('save')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
</q-form>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue