|
@@ -1,8 +1,13 @@
|
|
|
<template>
|
|
<template>
|
|
|
<q-dialog ref="dialogRef" @hide="onDialogHide">
|
|
<q-dialog ref="dialogRef" @hide="onDialogHide">
|
|
|
- <q-card class="q-dialog-plugin overflow-hidden" style="width: 100%; max-width: 500px">
|
|
|
|
|
|
|
+ <q-card
|
|
|
|
|
+ class="q-dialog-plugin overflow-hidden"
|
|
|
|
|
+ style="width: 100%; max-width: 500px"
|
|
|
|
|
+ >
|
|
|
<DefaultDialogHeader
|
|
<DefaultDialogHeader
|
|
|
- :title="() => (item ? 'Editar Faixa de Habitante' : 'Nova Faixa de Habitante')"
|
|
|
|
|
|
|
+ :title="
|
|
|
|
|
+ () => (item ? 'Editar Faixa de Habitante' : 'Nova Faixa de Habitante')
|
|
|
|
|
+ "
|
|
|
@close="onDialogCancel"
|
|
@close="onDialogCancel"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
@@ -43,7 +48,7 @@
|
|
|
v-model="form.tbr_percentage"
|
|
v-model="form.tbr_percentage"
|
|
|
v-model:error="validationErrors.tbr_percentage"
|
|
v-model:error="validationErrors.tbr_percentage"
|
|
|
class="col-12"
|
|
class="col-12"
|
|
|
- label="%"
|
|
|
|
|
|
|
+ label="Porcentagem de Royalties"
|
|
|
max="100"
|
|
max="100"
|
|
|
min="0"
|
|
min="0"
|
|
|
step="0.01"
|
|
step="0.01"
|
|
@@ -61,7 +66,7 @@
|
|
|
label="Cancelar"
|
|
label="Cancelar"
|
|
|
outline
|
|
outline
|
|
|
@click="onDialogCancel"
|
|
@click="onDialogCancel"
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
<q-btn
|
|
<q-btn
|
|
|
color="primary-2"
|
|
color="primary-2"
|
|
@@ -94,25 +99,22 @@ defineEmits([...useDialogPluginComponent.emits]);
|
|
|
|
|
|
|
|
const { item } = defineProps({
|
|
const { item } = defineProps({
|
|
|
item: {
|
|
item: {
|
|
|
- type: Object, default: null,
|
|
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default: null,
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const { inputRules } = useInputRules();
|
|
const { inputRules } = useInputRules();
|
|
|
|
|
|
|
|
-const {
|
|
|
|
|
- dialogRef,
|
|
|
|
|
- onDialogCancel,
|
|
|
|
|
- onDialogHide,
|
|
|
|
|
- onDialogOK,
|
|
|
|
|
-} = useDialogPluginComponent();
|
|
|
|
|
|
|
+const { dialogRef, onDialogCancel, onDialogHide, onDialogOK } =
|
|
|
|
|
+ useDialogPluginComponent();
|
|
|
|
|
|
|
|
const formRef = useTemplateRef("formRef");
|
|
const formRef = useTemplateRef("formRef");
|
|
|
|
|
|
|
|
const { form, getUpdatedFields } = useFormUpdateTracker({
|
|
const { form, getUpdatedFields } = useFormUpdateTracker({
|
|
|
- description: item?.description ?? "",
|
|
|
|
|
- start: item?.start ?? null,
|
|
|
|
|
- end: item?.end ?? null,
|
|
|
|
|
|
|
+ description: item?.description ?? "",
|
|
|
|
|
+ start: item?.start ?? null,
|
|
|
|
|
+ end: item?.end ?? null,
|
|
|
tbr_percentage: item ? Number(item.tbr_percentage) * 100 : null,
|
|
tbr_percentage: item ? Number(item.tbr_percentage) * 100 : null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -123,9 +125,9 @@ const { loading, validationErrors, execute } = useSubmitHandler({
|
|
|
|
|
|
|
|
const onOKClick = async () => {
|
|
const onOKClick = async () => {
|
|
|
const payload = {
|
|
const payload = {
|
|
|
- description: form.description,
|
|
|
|
|
- start: form.start,
|
|
|
|
|
- end: form.end,
|
|
|
|
|
|
|
+ description: form.description,
|
|
|
|
|
+ start: form.start,
|
|
|
|
|
+ end: form.end,
|
|
|
tbr_percentage: (form.tbr_percentage ?? 0) / 100,
|
|
tbr_percentage: (form.tbr_percentage ?? 0) / 100,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -134,9 +136,11 @@ const onOKClick = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (item) {
|
|
if (item) {
|
|
|
- await execute(() => updateInhabitantClassification(item.id, getUpdatedFields.value));
|
|
|
|
|
|
|
+ await execute(() =>
|
|
|
|
|
+ updateInhabitantClassification(item.id, getUpdatedFields.value),
|
|
|
|
|
+ );
|
|
|
} else {
|
|
} else {
|
|
|
await execute(() => createInhabitantClassification(payload));
|
|
await execute(() => createInhabitantClassification(payload));
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|