refactor: add props showBtnSave of Employee

This commit is contained in:
Net 2024-08-01 13:08:29 +07:00
parent c2e869a74c
commit b49956c708
5 changed files with 114 additions and 35 deletions

View file

@ -40,16 +40,21 @@ const insuranceCompanyOption = defineModel<{ label: string; value: string }[]>(
const tab = ref();
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
typeCustomer?: string;
prefixId: string;
}>();
withDefaults(
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
typeCustomer?: string;
prefixId: string;
showBtnSave?: boolean;
}>(),
{
showBtnSave: false,
},
);
async function fetchProvince() {
const result = await adrressStore.fetchProvince();
@ -483,6 +488,19 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
</q-input>
</template>
</VueDatePicker>
<div class="col-12 row justify-end" style="min-height: 50px">
<q-btn
v-if="!readonly && showBtnSave"
dense
unelevated
id="save-basic-info"
color="primary"
class="q-px-md"
:label="$t('save')"
@click="$emit('save')"
/>
</div>
</div>
<q-separator

View file

@ -1,14 +1,20 @@
<script setup lang="ts">
import { EmployeeOtherCreate } from 'stores/employee/types';
defineProps<{
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
employee?: boolean;
prefixId: string;
}>();
withDefaults(
defineProps<{
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
employee?: boolean;
prefixId: string;
showBtnSave: boolean;
}>(),
{
showBtnSave: false,
},
);
const employeeOther = defineModel<EmployeeOtherCreate>('employeeOther');
</script>
<template>
@ -159,6 +165,19 @@ const employeeOther = defineModel<EmployeeOtherCreate>('employeeOther');
v-model="employeeOther.motherBirthPlace"
/>
</div>
<div class="col-12 row justify-end" style="min-height: 50px">
<q-btn
v-if="!readonly && showBtnSave"
dense
unelevated
id="save-basic-info"
color="primary"
class="q-px-md"
:label="$t('save')"
@click="$emit('save')"
/>
</div>
</div>
</div>
<q-separator

View file

@ -38,15 +38,21 @@ const visaTypeOption = defineModel<{ label: string; value: string }[]>(
{ required: true },
);
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
typeCustomer?: string;
prefixId: string;
}>();
withDefaults(
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
typeCustomer?: string;
prefixId: string;
showBtnSave: boolean;
}>(),
{
showBtnSave: false,
},
);
async function fetchProvince() {
const result = await adrressStore.fetchProvince();
@ -423,6 +429,19 @@ const visaTypeFilter = selectFilterOptionRefMod(
</q-input>
</template>
</VueDatePicker>
<div class="col-12 row justify-end" style="min-height: 50px">
<q-btn
v-if="!readonly && showBtnSave"
dense
unelevated
id="save-basic-info"
color="primary"
class="q-px-md"
:label="$t('save')"
@click="$emit('save')"
/>
</div>
</div>
<q-separator

View file

@ -23,14 +23,20 @@ const workplaceOption = defineModel<{ label: string; value: string }[]>(
const tab = ref();
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
prefixId: string;
}>();
withDefaults(
defineProps<{
title?: string;
dense?: boolean;
outlined?: boolean;
readonly?: boolean;
separator?: boolean;
prefixId: string;
showBtnSave: boolean;
}>(),
{
showBtnSave: false,
},
);
function addData() {
const canAdd = checkTabBeforeAdd(employeeWork.value || []);
@ -470,6 +476,19 @@ const workplaceFilter = selectFilterOptionRefMod(
</q-input>
</template>
</VueDatePicker>
<div class="col-12 row justify-end" style="min-height: 50px">
<q-btn
v-if="!readonly && showBtnSave"
dense
unelevated
id="save-basic-info"
color="primary"
class="q-px-md"
:label="$t('save')"
@click="$emit('save')"
/>
</div>
</div>
<q-separator