feat: detect unsave and confirmation

This commit is contained in:
Methapon2001 2024-08-06 09:22:45 +07:00
parent 64a9df2613
commit 71d8b8b06c
5 changed files with 115 additions and 10 deletions

View file

@ -0,0 +1,48 @@
<script setup lang="ts">
import { CustomerCreate } from 'src/stores/customer/types';
const branch = defineModel<CustomerCreate['customerBranch']>('customerBranch', {
default: [],
});
defineProps<{
editable?: boolean;
}>();
</script>
<template>
<div class="row q-col-gutter-md">
<div class="col-12 text-weight-bold text-body1 row items-center">
<q-icon
flat
size="xs"
class="q-pa-sm rounded q-mr-xs"
color="info"
name="mdi-briefcase"
style="background-color: var(--surface-3)"
/>
<span>{{ $t('customer.form.group.branch') }}</span>
<q-btn
type="button"
rounded
flat
dense
unelevated
color="primary"
@click="$emit('addBranch')"
v-if="editable"
icon="mdi-plus"
class="q-ml-md"
/>
</div>
<template v-for="item in branch">
<span
class="col-12 text-weight-bold"
:id="`form-branch-customer-no-${item.branchNo}`"
>
{{ $t('customer.form.branch.title', { name: item.branchNo || 0 }) }}
</span>
</template>
</div>
</template>