Преглед изворни кода

chore: ajusta % para Porcentagem de Royalties

ebagabee пре 1 месец
родитељ
комит
a6950be53b

+ 23 - 19
src/pages/tbr/components/AddEditInhabitantClassificationDialog.vue

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

+ 28 - 13
src/pages/tbr/tabs/InhabitantClassificationsTab.vue

@@ -51,33 +51,48 @@ const $q = useQuasar();
 const rows = ref([]);
 
 const columns = [
-  { name: "id",             label: "ID",        field: "id",             align: "left" },
-  { name: "description",    label: "Descrição", field: "description",    align: "left" },
-  { name: "start",          label: "Início",    field: "start",          align: "left" },
-  { name: "end",            label: "Fim",       field: "end",            align: "left" },
-  { name: "tbr_percentage", label: "%",         field: "tbr_percentage", align: "left", format: (val) => `${(val * 100).toFixed(2)}%` },
-  { name: "actions",        label: "Ações",     field: "actions",        align: "center" },
+  { name: "id", label: "ID", field: "id", align: "left" },
+  {
+    name: "description",
+    label: "Descrição",
+    field: "description",
+    align: "left",
+  },
+  { name: "start", label: "Início", field: "start", align: "left" },
+  { name: "end", label: "Fim", field: "end", align: "left" },
+  {
+    name: "tbr_percentage",
+    label: "%",
+    field: "tbr_percentage",
+    align: "left",
+    format: (val) => `${(val * 100).toFixed(2)}%`,
+  },
+  { name: "actions", label: "Ações", field: "actions", align: "center" },
 ];
 
 const loadData = async () => {
   rows.value = await getInhabitantClassifications();
-}
+};
 
 const onAdd = () => {
-  $q.dialog({ component: AddEditInhabitantClassificationDialog }).onOk(() => loadData());
-}
+  $q.dialog({ component: AddEditInhabitantClassificationDialog }).onOk(() =>
+    loadData(),
+  );
+};
 
 const onEdit = (row) => {
   $q.dialog({
-    component: AddEditInhabitantClassificationDialog, componentProps: { item: row },
+    component: AddEditInhabitantClassificationDialog,
+    componentProps: { item: row },
   }).onOk(() => loadData());
-}
+};
 
 const onView = (row) => {
   $q.dialog({
-    component: ViewInhabitantClassificationDialog, componentProps: { item: row },
+    component: ViewInhabitantClassificationDialog,
+    componentProps: { item: row },
   });
-}
+};
 
 onMounted(loadData);
 </script>