|
@@ -18,12 +18,37 @@
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<DefaultInput
|
|
<DefaultInput
|
|
|
- v-model="form.acronym"
|
|
|
|
|
- v-model:error="validationErrors.acronym"
|
|
|
|
|
|
|
+ v-model="form.start"
|
|
|
|
|
+ v-model:error="validationErrors.start"
|
|
|
|
|
+ class="col-6"
|
|
|
|
|
+ label="Início"
|
|
|
|
|
+ min="1"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :error-message="validationErrors.start"
|
|
|
|
|
+ :rules="[inputRules.required]"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="form.end"
|
|
|
|
|
+ v-model:error="validationErrors.end"
|
|
|
|
|
+ class="col-6"
|
|
|
|
|
+ label="Fim"
|
|
|
|
|
+ min="1"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :error-message="validationErrors.end"
|
|
|
|
|
+ :rules="[inputRules.required]"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="form.tbr_percentage"
|
|
|
|
|
+ v-model:error="validationErrors.tbr_percentage"
|
|
|
class="col-12"
|
|
class="col-12"
|
|
|
- label="Sigla"
|
|
|
|
|
- maxlength="2"
|
|
|
|
|
- :error-message="validationErrors.acronym"
|
|
|
|
|
|
|
+ label="%"
|
|
|
|
|
+ max="100"
|
|
|
|
|
+ min="0"
|
|
|
|
|
+ step="0.01"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :error-message="validationErrors.tbr_percentage"
|
|
|
:rules="[inputRules.required]"
|
|
:rules="[inputRules.required]"
|
|
|
/>
|
|
/>
|
|
|
</q-card-section>
|
|
</q-card-section>
|
|
@@ -85,7 +110,10 @@ const {
|
|
|
const formRef = useTemplateRef("formRef");
|
|
const formRef = useTemplateRef("formRef");
|
|
|
|
|
|
|
|
const { form, getUpdatedFields } = useFormUpdateTracker({
|
|
const { form, getUpdatedFields } = useFormUpdateTracker({
|
|
|
- description: item?.description ?? "", acronym: item?.acronym ?? "",
|
|
|
|
|
|
|
+ description: item?.description ?? "",
|
|
|
|
|
+ start: item?.start ?? null,
|
|
|
|
|
+ end: item?.end ?? null,
|
|
|
|
|
+ tbr_percentage: item ? Number(item.tbr_percentage) * 100 : null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const { loading, validationErrors, execute } = useSubmitHandler({
|
|
const { loading, validationErrors, execute } = useSubmitHandler({
|
|
@@ -94,12 +122,21 @@ const { loading, validationErrors, execute } = useSubmitHandler({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const onOKClick = async () => {
|
|
const onOKClick = async () => {
|
|
|
- if (item) {
|
|
|
|
|
- console.log(getUpdatedFields.value);
|
|
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ description: form.description,
|
|
|
|
|
+ start: form.start,
|
|
|
|
|
+ end: form.end,
|
|
|
|
|
+ tbr_percentage: (form.tbr_percentage ?? 0) / 100,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ if (getUpdatedFields.value.tbr_percentage !== undefined) {
|
|
|
|
|
+ getUpdatedFields.value.tbr_percentage /= 100;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if (item) {
|
|
|
await execute(() => updateInhabitantClassification(item.id, getUpdatedFields.value));
|
|
await execute(() => updateInhabitantClassification(item.id, getUpdatedFields.value));
|
|
|
} else {
|
|
} else {
|
|
|
- await execute(() => createInhabitantClassification(form));
|
|
|
|
|
|
|
+ await execute(() => createInhabitantClassification(payload));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|