Kaynağa Gözat

refactor: remove unused country and state pages, dialogs, and routes

- Deleted CountryPage.vue and its associated AddEditCountryDialog.vue.
- Deleted StatePage.vue and its associated AddEditStateDialog.vue.
- Removed routes for city, country, and state from config.route.js.
- Removed unit edit route from unit.route.js.
- Updated PermissionsPage.vue to use getEditableUserTypes for fetching user types.
- Removed CreateContractDialog.vue, EditContractDialog.vue, and EditContractTaxesDialog.vue components.
ebagabee 1 hafta önce
ebeveyn
işleme
4b68b42bfb

+ 0 - 15
src/api/city.js

@@ -21,18 +21,3 @@ export const getCityByCountry = async (countryId) => {
   const { data } = await api.get(`/city/country/${countryId}`);
   return data.payload;
 };
-
-export const createCity = async (city) => {
-  const { data } = await api.post("/city", city);
-  return data.payload;
-};
-
-export const updateCity = async (city, id) => {
-  const { data } = await api.put(`/city/${id}`, city);
-  return data.payload;
-};
-
-export const deleteCity = async (id) => {
-  const { data } = await api.del(`/city/${id}`);
-  return data.payload;
-};

+ 0 - 15
src/api/country.js

@@ -11,18 +11,3 @@ export const getCountries = async () => {
   const { data } = await api.get("/country");
   return data.payload;
 };
-
-export const createCountry = async (country) => {
-  const data = await api.post("/country", country);
-  return data.payload;
-};
-
-export const updateCountry = async (country, id) => {
-  const data = await api.put(`/country/${id}`, country);
-  return data.payload;
-};
-
-export const deleteCountry = async (id) => {
-  const data = await api.del(`/country/${id}`);
-  return data.payload;
-};

+ 2 - 2
src/api/franchisee_contract.js

@@ -1,11 +1,11 @@
 import api from "src/api";
 
 export const getFranchiseeContractsByUnit = async () => {
-  const { data } = await api.get("/franchisee-contract/me");
+  const { data } = await api.get("/franchisee/unit/contracts");
   return data.payload;
 };
 
 export const getFranchiseeContractTaxHistory = async (id) => {
-  const { data } = await api.get(`/franchisee-contract/me/${id}/tax-history`);
+  const { data } = await api.get(`/franchisee/unit/contracts/${id}/tax-history`);
   return data.payload;
 };

+ 0 - 15
src/api/state.js

@@ -16,18 +16,3 @@ export const getStateByCountry = async (countryId) => {
   const { data } = await api.get(`/state/country/${countryId}`);
   return data.payload;
 }
-
-export const createState = async (state) => {
-  const { data } = await api.post("/state", state);
-  return data.payload;
-}
-
-export const updateState = async (state, id) => {
-  const { data } = await api.put(`/state/${id}`, state);
-  return data.payload;
-}
-
-export const deleteState = async (id) => {
-  const { data } = await api.del(`/state/${id}`);
-  return data.payload;
-}

+ 0 - 159
src/pages/city/CityPage.vue

@@ -1,159 +0,0 @@
-<template>
-  <div>
-    <DefaultHeaderPage>
-      <template #after>
-        <q-btn
-          color="primary"
-          padding="8px 8px"
-          :label="$t('common.actions.add')"
-          icon="mdi-plus"
-          class="q-mt-md"
-          @click="onAddItem"
-        />
-      </template>
-    </DefaultHeaderPage>
-    <div>
-      <DefaultTable
-        ref="tableRef"
-        :columns="columns"
-        :api-call="getCities"
-        :delete-function="deleteCity"
-        :show-columns-select="false"
-        :title="
-          $t('common.terms.list') +
-          ' ' +
-          $t('common.ui.table.of') +
-          ' ' +
-          $t('ui.navigation.city')
-        "
-      >
-        <template #body-cell-actions="{ row }">
-          <q-btn
-            outline
-            style="width: 36px"
-            class="q-ml-auto q-mr-sm"
-            @click.prevent.stop="onRowClick(row)"
-          >
-            <q-icon name="mdi-file-edit-outline" />
-          </q-btn>
-        </template>
-      </DefaultTable>
-    </div>
-  </div>
-</template>
-<script setup>
-import { defineAsyncComponent, useTemplateRef } from "vue";
-import { useQuasar } from "quasar";
-import { useI18n } from "vue-i18n";
-import { permissionStore } from "src/stores/permission";
-import { getCities, deleteCity } from "src/api/city";
-
-import DefaultTable from "src/components/defaults/DefaultTable.vue";
-import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
-
-const AddEditCityDialog = defineAsyncComponent(
-  () => import("src/pages/city/components/AddEditCityDialog.vue"),
-);
-
-const permission_store = permissionStore();
-const $q = useQuasar();
-const tableRef = useTemplateRef("tableRef");
-const { t } = useI18n();
-
-const columns = [
-  {
-    name: "id",
-    label: "ID",
-    field: "id",
-    align: "left",
-    required: true,
-    sortable: true,
-  },
-  {
-    name: "nome",
-    label: t("common.terms.name"),
-    field: "name",
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "state",
-    label: t("ui.navigation.state"),
-    field: (row) => row.state.name,
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "country",
-    label: t("ui.navigation.country"),
-    field: (row) => row.country.name,
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "status",
-    label: t("common.terms.status"),
-    field: (row) =>
-      row.status == "ACTIVE"
-        ? t("common.status.active")
-        : t("common.status.inactive"),
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "actions",
-    label: t("common.terms.actions"),
-    align: "left",
-    required: true,
-  },
-];
-
-const onRowClick = (row) => {
-  if (permission_store.getAccess("config.city", "edit") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.edit"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditCityDialog,
-    componentProps: {
-      city: row,
-      title: () =>
-        useI18n().t("common.actions.edit") +
-        " " +
-        useI18n().t("ui.navigation.city"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-
-const onAddItem = () => {
-  if (permission_store.getAccess("config.city", "add") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.add"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditCityDialog,
-    componentProps: {
-      title: () =>
-        useI18n().t("common.actions.add") +
-        " " +
-        useI18n().t("ui.navigation.city"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-</script>

+ 0 - 158
src/pages/city/components/AddEditCityDialog.vue

@@ -1,158 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card class="q-dialog-plugin overflow-hidden" style="width: 800px">
-      <DefaultDialogHeader :title="title" @close="onDialogCancel" />
-      <q-form ref="formRef" @submit="onOKClick">
-        <q-card-section class="row q-col-gutter-sm q-pt-none">
-          <DefaultInput
-            v-model="form.name"
-            v-model:error="validationErrors.name"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.name')"
-            :placeholder="'Nome completo da cidade'"
-            class="col-md-6 col-12"
-          />
-          <CountrySelect
-            v-model="selectedCountry"
-            v-model:error="validationErrors.country_id"
-            :placeholder="'Selecione o pais desse estado'"
-            :rules="[inputRules.required]"
-            :initial-id="form.country_id"
-            class="col-md-6 col-12"
-          />
-          <StateSelect
-            v-model="selectedState"
-            v-model:error="validationErrors.state_id"
-            :country="selectedCountry"
-            :initial-id="form.state_id"
-            :placeholder="'Selecione o estado dessa cidade'"
-            :rules="[inputRules.required]"
-            class="col-md-6 col-12"
-            @selected-country-id="countrySelectRef?.selectCountryById($event)"
-          />
-          <DefaultSelect
-            v-model="selectedStatus"
-            v-model:error="validationErrors.status"
-            :options="statusOptions"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.status')"
-            :placeholder="$t('common.terms.status')"
-            class="col-md-6 col-12"
-          />
-        </q-card-section>
-        <q-card-actions>
-          <q-space />
-          <q-btn
-            outline
-            color="negative"
-            :label="$t('common.actions.cancel')"
-            @click="onDialogCancel"
-          />
-          <q-btn
-            color="primary"
-            :label="city ? $t('common.actions.save') : $t('common.actions.add')"
-            :type="'submit'"
-            :loading="loading"
-            :disable="!hasUpdatedFields"
-          />
-        </q-card-actions>
-      </q-form>
-    </q-card>
-  </q-dialog>
-</template>
-<script setup>
-import { ref, useTemplateRef, onMounted, watch } from "vue";
-import { useInputRules } from "src/composables/useInputRules";
-import { useDialogPluginComponent } from "quasar";
-import { useI18n } from "vue-i18n";
-import { createCity, updateCity } from "src/api/city";
-import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
-import { useSubmitHandler } from "src/composables/useSubmitHandler";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import CountrySelect from "src/components/selects/CountrySelect.vue";
-import StateSelect from "src/components/selects/StateSelect.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-defineEmits([
-  // REQUIRED; need to specify some events that your
-  // component will emit through useDialogPluginComponent()
-  ...useDialogPluginComponent.emits,
-]);
-
-const { city, title } = defineProps({
-  city: {
-    type: Object,
-    default: null,
-  },
-  title: {
-    type: Function,
-    default: () => useI18n().t("common.terms.title"),
-  },
-});
-
-const { t } = useI18n();
-const { inputRules } = useInputRules();
-
-const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
-  useDialogPluginComponent();
-
-const formRef = useTemplateRef("formRef");
-const countrySelectRef = useTemplateRef("countrySelectRef");
-
-const { form, getUpdatedFields, hasUpdatedFields } = useFormUpdateTracker({
-  name: city ? city?.name : "",
-  country_id: city ? city?.country_id : null,
-  state_id: city ? city?.state_id : null,
-  status: city ? city?.status : "ACTIVE",
-});
-
-const {
-  loading,
-  validationErrors,
-  execute: submitForm,
-} = useSubmitHandler({
-  onSuccess: () => onDialogOK(true),
-  formRef: formRef,
-});
-
-const selectedCountry = ref(null);
-const selectedState = ref(null);
-const selectedStatus = ref({
-  label: t("common.status.active"),
-  value: "ACTIVE",
-});
-const statusOptions = ref([
-  { label: t("common.status.active"), value: "ACTIVE" },
-  { label: t("common.status.inactive"), value: "INACTIVE" },
-]);
-
-const onOKClick = async () => {
-  if (city) {
-    await submitForm(() => updateCity(getUpdatedFields.value, city.id));
-  } else {
-    await submitForm(() => createCity({ ...form }));
-  }
-};
-
-watch(selectedStatus, () => {
-  form.status = selectedStatus.value?.value;
-});
-
-watch(selectedCountry, () => {
-  form.country_id = selectedCountry.value?.value;
-});
-
-watch(selectedState, () => {
-  form.state_id = selectedState.value?.value;
-});
-
-onMounted(async () => {
-  if (city) {
-    selectedStatus.value = statusOptions.value.find(
-      (status) => status.value === city.status,
-    );
-  }
-});
-</script>

+ 0 - 152
src/pages/country/CountryPage.vue

@@ -1,152 +0,0 @@
-<template>
-  <div>
-    <DefaultHeaderPage>
-      <template #after>
-        <q-btn
-          color="primary"
-          padding="8px 8px"
-          :label="$t('common.actions.add')"
-          icon="mdi-plus"
-          class="q-mt-md"
-          @click="onAddItem"
-        />
-      </template>
-    </DefaultHeaderPage>
-    <div>
-      <DefaultTable
-        ref="tableRef"
-        :columns="columns"
-        :api-call="getCountries"
-        :delete-function="deleteCountry"
-        :show-columns-select="false"
-        :title="
-          $t('common.terms.list') +
-          ' ' +
-          $t('common.ui.table.of') +
-          ' ' +
-          $t('ui.navigation.country')
-        "
-      >
-        <template #body-cell-actions="{ row }">
-          <q-btn
-            outline
-            style="width: 36px"
-            class="q-ml-auto q-mr-sm"
-            @click.prevent.stop="onRowClick(row)"
-          >
-            <q-icon name="mdi-file-edit-outline" />
-          </q-btn>
-        </template>
-      </DefaultTable>
-    </div>
-  </div>
-</template>
-<script setup>
-import { defineAsyncComponent, useTemplateRef } from "vue";
-import { useQuasar } from "quasar";
-import { useI18n } from "vue-i18n";
-import { permissionStore } from "src/stores/permission";
-import { getCountries, deleteCountry } from "src/api/country";
-
-import DefaultTable from "src/components/defaults/DefaultTable.vue";
-import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
-
-const AddEditCountryDialog = defineAsyncComponent(
-  () => import("src/pages/country/components/AddEditCountryDialog.vue"),
-);
-
-const permission_store = permissionStore();
-const $q = useQuasar();
-const tableRef = useTemplateRef("tableRef");
-const { t } = useI18n();
-
-const columns = [
-  {
-    name: "id",
-    label: "ID",
-    field: "id",
-    align: "left",
-    required: true,
-    sortable: true,
-  },
-  {
-    name: "nome",
-    label: t("common.terms.name"),
-    field: "name",
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "code",
-    label: t("common.terms.code"),
-    field: "code",
-    align: "center",
-    sortable: true,
-  },
-  {
-    name: "status",
-    label: t("common.terms.status"),
-    field: (row) =>
-      row.status == "ACTIVE"
-        ? t("common.status.active")
-        : t("common.status.inactive"),
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "actions",
-    label: t("common.terms.actions"),
-    align: "left",
-    required: true,
-  },
-];
-
-const onRowClick = (row) => {
-  if (permission_store.getAccess("config.country", "edit") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.edit"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditCountryDialog,
-    componentProps: {
-      country: row,
-      title: () =>
-        useI18n().t("common.actions.edit") +
-        " " +
-        useI18n().t("ui.navigation.country"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-
-const onAddItem = () => {
-  if (permission_store.getAccess("config.country", "add") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.add"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditCountryDialog,
-    componentProps: {
-      title: () =>
-        useI18n().t("common.actions.add") +
-        " " +
-        useI18n().t("ui.navigation.country"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-</script>

+ 0 - 136
src/pages/country/components/AddEditCountryDialog.vue

@@ -1,136 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card class="q-dialog-plugin overflow-hidden" style="width: 800px">
-      <DefaultDialogHeader :title="title" @close="onDialogCancel" />
-      <q-form ref="formRef" @submit="onOKClick">
-        <q-card-section class="row q-col-gutter-sm q-pt-none">
-          <DefaultInput
-            v-model="form.name"
-            v-model:error="validationErrors.name"
-            :label="$t('common.terms.name')"
-            :placeholder="'Nome completo do pais'"
-            :rules="[inputRules.required]"
-            class="col-md-6 col-12"
-          />
-          <DefaultInput
-            v-model="form.code"
-            v-model:error="validationErrors.code"
-            :label="$t('common.terms.code')"
-            :placeholder="'Ex. BR, PT...'"
-            :rules="[inputRules.required]"
-            class="col-md-6 col-12"
-          />
-          <DefaultSelect
-            v-model="selectedStatus"
-            v-model:error="validationErrors.status"
-            :options="statusOptions"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.status')"
-            :placeholder="$t('common.terms.status')"
-            class="col-md-6 col-12"
-          />
-        </q-card-section>
-        <q-card-actions>
-          <q-space />
-          <q-btn
-            outline
-            color="negative"
-            :label="$t('common.actions.cancel')"
-            @click="onDialogCancel"
-          />
-          <q-btn
-            color="primary"
-            :label="
-              country ? $t('common.actions.save') : $t('common.actions.add')
-            "
-            :type="'submit'"
-            :loading="loading"
-            :disable="!hasUpdatedFields"
-          />
-        </q-card-actions>
-      </q-form>
-    </q-card>
-  </q-dialog>
-</template>
-<script setup>
-import { ref, useTemplateRef, onMounted, watch } from "vue";
-import { useInputRules } from "src/composables/useInputRules";
-import { useDialogPluginComponent } from "quasar";
-import { useI18n } from "vue-i18n";
-import { createCountry, updateCountry } from "src/api/country";
-import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
-import { useSubmitHandler } from "src/composables/useSubmitHandler";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-defineEmits([
-  // REQUIRED; need to specify some events that your
-  // component will emit through useDialogPluginComponent()
-  ...useDialogPluginComponent.emits,
-]);
-
-const { country, title } = defineProps({
-  country: {
-    type: Object,
-    default: null,
-  },
-  title: {
-    type: Function,
-    default: () => useI18n().t("common.terms.title"),
-  },
-});
-
-const { t } = useI18n();
-const { inputRules } = useInputRules();
-
-const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
-  useDialogPluginComponent();
-
-const formRef = useTemplateRef("formRef");
-
-const { form, getUpdatedFields, hasUpdatedFields } = useFormUpdateTracker({
-  name: country ? country?.name : "",
-  code: country ? country?.code : "",
-  status: country ? country?.status : "ACTIVE",
-});
-
-const {
-  loading,
-  validationErrors,
-  execute: submitForm,
-} = useSubmitHandler({
-  onSuccess: () => onDialogOK(true),
-  formRef: formRef,
-});
-
-const selectedStatus = ref({
-  label: t("common.status.active"),
-  value: "ACTIVE",
-});
-const statusOptions = ref([
-  { label: t("common.status.active"), value: "ACTIVE" },
-  { label: t("common.status.inactive"), value: "INACTIVE" },
-]);
-
-const onOKClick = async () => {
-  if (country) {
-    await submitForm(() => updateCountry(getUpdatedFields.value, country.id));
-  } else {
-    await submitForm(() => createCountry({ ...form }));
-  }
-};
-
-watch(selectedStatus, () => {
-  form.status = selectedStatus.value.value;
-});
-
-onMounted(() => {
-  if (country) {
-    selectedStatus.value = statusOptions.value.find(
-      (status) => status.value === country.status,
-    );
-  }
-});
-</script>

+ 3 - 1
src/pages/permissions/PermissionsPage.vue

@@ -6,7 +6,7 @@
         ref="tableRef"
         title="Lista de Grupos de Permissões"
         :columns="columns"
-        :api-call="getUserTypes"
+        :api-call="getEditableUserTypes"
         description="grupos"
         :add-item="canAdd"
         add-item-label="Novo Grupo"
@@ -182,6 +182,8 @@ const saving = ref(false);
 const loadingPermissions = ref(false);
 const form = ref({ label: "", slug: "" });
 const permissions = ref({});
+const getEditableUserTypes = async () =>
+  (await getUserTypes()).filter((group) => !group.is_system);
 
 const openGroup = (group = null) => {
   editingGroup.value = group;

+ 0 - 152
src/pages/state/StatePage.vue

@@ -1,152 +0,0 @@
-<template>
-  <div>
-    <DefaultHeaderPage>
-      <template #after>
-        <q-btn
-          color="primary"
-          padding="8px 8px"
-          :label="$t('common.actions.add')"
-          icon="mdi-plus"
-          class="q-mt-md"
-          @click="onAddItem"
-        />
-      </template>
-    </DefaultHeaderPage>
-    <div>
-      <DefaultTable
-        ref="tableRef"
-        :columns="columns"
-        :api-call="getStates"
-        :delete-function="deleteState"
-        :show-columns-select="false"
-        :title="
-          $t('common.terms.list') +
-          ' ' +
-          $t('common.ui.table.of') +
-          ' ' +
-          $t('ui.navigation.state')
-        "
-      >
-        <template #body-cell-actions="{ row }">
-          <q-btn
-            outline
-            style="width: 36px"
-            class="q-ml-auto q-mr-sm"
-            @click.prevent.stop="onRowClick(row)"
-          >
-            <q-icon name="mdi-file-edit-outline" />
-          </q-btn>
-        </template>
-      </DefaultTable>
-    </div>
-  </div>
-</template>
-<script setup>
-import { defineAsyncComponent, useTemplateRef } from "vue";
-import { useQuasar } from "quasar";
-import { useI18n } from "vue-i18n";
-import { permissionStore } from "src/stores/permission";
-import { getStates, deleteState } from "src/api/state";
-
-import DefaultTable from "src/components/defaults/DefaultTable.vue";
-import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
-
-const AddEditStateDialog = defineAsyncComponent(
-  () => import("src/pages/state/components/AddEditStateDialog.vue"),
-);
-
-const permission_store = permissionStore();
-const $q = useQuasar();
-const tableRef = useTemplateRef("tableRef");
-const { t } = useI18n();
-
-const columns = [
-  {
-    name: "id",
-    label: "ID",
-    field: "id",
-    align: "left",
-    required: true,
-    sortable: true,
-  },
-  {
-    name: "nome",
-    label: t("common.terms.name"),
-    field: "name",
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "country",
-    label: t("ui.navigation.country"),
-    field: (row) => row.country.name,
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "status",
-    label: t("common.terms.status"),
-    field: (row) =>
-      row.status == "ACTIVE"
-        ? t("common.status.active")
-        : t("common.status.inactive"),
-    align: "left",
-    sortable: true,
-  },
-  {
-    name: "actions",
-    label: t("common.terms.actions"),
-    align: "left",
-    required: true,
-  },
-];
-
-const onRowClick = (row) => {
-  if (permission_store.getAccess("config.state", "edit") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.edit"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditStateDialog,
-    componentProps: {
-      state: row,
-      title: () =>
-        useI18n().t("common.actions.edit") +
-        " " +
-        useI18n().t("ui.navigation.state"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-
-const onAddItem = () => {
-  if (permission_store.getAccess("config.state", "add") === false) {
-    $q.loading.hide();
-    $q.notify({
-      type: "negative",
-      message: t("validation.permissions.add"),
-    });
-    return;
-  }
-  $q.dialog({
-    component: AddEditStateDialog,
-    componentProps: {
-      title: () =>
-        useI18n().t("common.actions.add") +
-        " " +
-        useI18n().t("ui.navigation.state"),
-    },
-  }).onOk(async (success) => {
-    if (success) {
-      tableRef.value.refresh();
-    }
-  });
-};
-</script>

+ 0 - 151
src/pages/state/components/AddEditStateDialog.vue

@@ -1,151 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card class="q-dialog-plugin overflow-hidden" style="width: 800px">
-      <DefaultDialogHeader :title="title" @close="onDialogCancel" />
-      <q-form ref="formRef" @submit="onOKClick">
-        <q-card-section class="row q-col-gutter-sm q-pt-none">
-          <DefaultInput
-            v-model="form.name"
-            v-model:error="validationErrors.name"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.name')"
-            :placeholder="'Nome completo do estado'"
-            class="col-md-6 col-12"
-          />
-          <DefaultInput
-            v-model="form.code"
-            v-model:error="validationErrors.code"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.code')"
-            :placeholder="'Ex. SP, PR...'"
-            class="col-md-6 col-12"
-          />
-          <CountrySelect
-            v-model="selectedCountry"
-            v-model:error="validationErrors.country_id"
-            :placeholder="'Selecione o pais desse estado'"
-            :rules="[inputRules.required]"
-            :initial-id="form.country_id"
-            class="col-md-6 col-12"
-          />
-          <DefaultSelect
-            v-model="selectedStatus"
-            v-model:error="validationErrors.status"
-            :options="statusOptions"
-            :rules="[inputRules.required]"
-            :label="$t('common.terms.status')"
-            :placeholder="$t('common.terms.status')"
-            class="col-md-6 col-12"
-          />
-        </q-card-section>
-        <q-card-actions>
-          <q-space />
-          <q-btn
-            outline
-            color="negative"
-            :label="$t('common.actions.cancel')"
-            @click="onDialogCancel"
-          />
-          <q-btn
-            color="primary"
-            :label="
-              state ? $t('common.actions.save') : $t('common.actions.add')
-            "
-            :type="'submit'"
-            :loading="loading"
-            :disable="!hasUpdatedFields"
-          />
-        </q-card-actions>
-      </q-form>
-    </q-card>
-  </q-dialog>
-</template>
-<script setup>
-import { ref, useTemplateRef, onMounted, watch } from "vue";
-import { useInputRules } from "src/composables/useInputRules";
-import { useDialogPluginComponent } from "quasar";
-import { useI18n } from "vue-i18n";
-import { createState, updateState } from "src/api/state";
-import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
-import { useSubmitHandler } from "src/composables/useSubmitHandler";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import CountrySelect from "src/components/selects/CountrySelect.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-defineEmits([
-  // REQUIRED; need to specify some events that your
-  // component will emit through useDialogPluginComponent()
-  ...useDialogPluginComponent.emits,
-]);
-
-const { state, title } = defineProps({
-  state: {
-    type: Object,
-    default: null,
-  },
-  title: {
-    type: Function,
-    default: () => useI18n().t("common.terms.title"),
-  },
-});
-
-const { t } = useI18n();
-const { inputRules } = useInputRules();
-
-const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
-  useDialogPluginComponent();
-
-const formRef = useTemplateRef("formRef");
-
-const { form, getUpdatedFields, hasUpdatedFields } = useFormUpdateTracker({
-  name: state ? state?.name : "",
-  code: state ? state?.code : "",
-  country_id: state ? state?.country_id : null,
-  status: state ? state?.status : "ACTIVE",
-});
-
-const {
-  loading,
-  validationErrors,
-  execute: submitForm,
-} = useSubmitHandler({
-  onSuccess: () => onDialogOK(true),
-  formRef: formRef,
-});
-
-const selectedCountry = ref(null);
-const selectedStatus = ref({
-  label: t("common.status.active"),
-  value: "ACTIVE",
-});
-const statusOptions = ref([
-  { label: t("common.status.active"), value: "ACTIVE" },
-  { label: t("common.status.inactive"), value: "INACTIVE" },
-]);
-
-const onOKClick = async () => {
-  if (state) {
-    await submitForm(() => updateState(getUpdatedFields.value, state.id));
-  } else {
-    await submitForm(() => createState({ ...form }));
-  }
-};
-
-watch(selectedCountry, () => {
-  form.country_id = selectedCountry.value.value;
-});
-
-watch(selectedStatus, () => {
-  form.status = selectedStatus.value.value;
-});
-
-onMounted(async () => {
-  if (state) {
-    selectedStatus.value = statusOptions.value.find(
-      (status) => status.value === state.status,
-    );
-  }
-});
-</script>

+ 0 - 285
src/pages/unit/components/CreateContractDialog.vue

@@ -1,285 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card
-      class="q-dialog-plugin overflow-hidden"
-      style="width: 100%; max-width: 1100px"
-    >
-      <DefaultDialogHeader
-        title="Criar novo contrato"
-        @close="onDialogCancel"
-      />
-
-      <q-card-section>
-        <div class="text-body2 q-mb-sm">Dados da Unidade</div>
-
-        <div class="row q-col-gutter-x-sm">
-          <DefaultInput
-            :model-value="unitData.id"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="ID"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_name"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Nome do Franqueado"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_document"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="CPF/CNH"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_birthday"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Data de Nascimento"
-            label-color="secondary"
-          />
-        </div>
-      </q-card-section>
-
-      <q-card-section>
-        <div class="text-body2 q-mb-sm">Definir Valores e TBR</div>
-
-        <div class="row q-col-gutter-sm">
-          <DefaultInputDatePicker
-            v-model:untreated-date="contractForm.start_date"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Data de Início"
-            label-color="secondary"
-          />
-
-          <DefaultInputDatePicker
-            v-model:untreated-date="contractForm.end_date"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Data de Fim"
-            label-color="secondary"
-          />
-
-          <DefaultCurrencyInput
-            v-model="contractForm.tbr_fixed_value"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="TBR $"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            v-model="contractForm.invoice_due_date"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Dia de Vencimento do Boleto"
-            label-color="secondary"
-            type="number"
-          >
-          </DefaultInput>
-
-          <DefaultSelect
-            v-model="contractForm.inhabitant_classification_id"
-            class="col-md-3 col-12"
-            color="secondary"
-            emit-value
-            fill-input
-            hide-selected
-            input-debounce="0"
-            label="Faixa de Habitante"
-            label-color="secondary"
-            map-options
-            use-input
-            :options="inhabitantOptions"
-          />
-
-          <DefaultInput
-            v-model="contractForm.tax_base_royalts"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Taxa Base Royalties"
-            label-color="secondary"
-            type="number"
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-
-          <DefaultInput
-            v-model="contractForm.tax_base_fnm"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Taxa Base FMN"
-            label-color="secondary"
-            type="number"
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-
-          <DefaultInput
-            v-model="contractForm.tax_base_maintenance"
-            class="col-md-3 col-12"
-            color="secondary"
-            label="Taxa Base Manutenção"
-            label-color="secondary"
-            type="number"
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-        </div>
-      </q-card-section>
-
-      <q-card-actions align="right">
-        <q-btn
-          color="primary"
-          label="Cancelar"
-          outline
-          @click="onDialogCancel"
-        />
-        <q-btn color="primary" label="Salvar" :loading="saving" @click="save" />
-      </q-card-actions>
-    </q-card>
-  </q-dialog>
-</template>
-
-<script setup>
-import { createFranchiseeContract } from "src/api/franchisee_contract";
-import { getInhabitantClassificationsForSelect } from "src/api/inhabitant_classification";
-import { getLatestTbr } from "src/api/tbr";
-import { getUnit } from "src/api/unit";
-import { onMounted, reactive, ref } from "vue";
-import { useDialogPluginComponent } from "quasar";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
-import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-defineEmits([...useDialogPluginComponent.emits]);
-
-const props = defineProps({
-  unitId: {
-    type: Number,
-    required: true,
-  },
-});
-
-const { dialogRef, onDialogHide, onDialogCancel, onDialogOK } =
-  useDialogPluginComponent();
-
-const saving = ref(false);
-
-const inhabitantOptions = ref([]);
-
-const unitData = reactive({
-  id: null,
-  franchisee_birthday: null,
-  franchisee_document: null,
-  franchisee_name: null,
-});
-
-const contractForm = reactive({
-  end_date: null,
-  inhabitant_classification_id: null,
-  invoice_due_date: null,
-  start_date: null,
-  tax_base_fnm: null,
-  tax_base_maintenance: null,
-  tax_base_royalts: null,
-  tbr_fixed_value: null,
-});
-
-async function loadData() {
-  const [unit, latestTbr, classifications] = await Promise.all([
-    getUnit(props.unitId),
-    getLatestTbr(),
-    getInhabitantClassificationsForSelect(),
-  ]);
-
-  unitData.id = unit.id;
-
-  unitData.franchisee_name = unit.name_responsible;
-
-  const firstPartner = unit.partners?.[0];
-
-  if (firstPartner) {
-    unitData.franchisee_document = firstPartner.cpf;
-    unitData.franchisee_birthday = firstPartner.birth_date;
-  }
-
-  if (latestTbr) {
-    contractForm.tbr_fixed_value = parseFloat(latestTbr.tbr_value);
-
-    contractForm.tax_base_royalts = parseFloat(
-      (latestTbr.royalties_percentage * 100).toFixed(4),
-    );
-
-    contractForm.tax_base_fnm = parseFloat(
-      (latestTbr.fnm_percentage * 100).toFixed(4),
-    );
-
-    contractForm.tax_base_maintenance = parseFloat(
-      (latestTbr.maintenance_percentage * 100).toFixed(4),
-    );
-  }
-
-  inhabitantOptions.value = classifications.map((c) => ({
-    label: `${c.description} (${c.acronym})`,
-    value: c.id,
-  }));
-}
-
-async function save() {
-  saving.value = true;
-
-  try {
-    await createFranchiseeContract({
-      unit_id: props.unitId,
-      start_date: contractForm.start_date,
-      end_date: contractForm.end_date,
-      tbr_fixed_value: contractForm.tbr_fixed_value,
-      invoice_due_date: contractForm.invoice_due_date,
-      inhabitant_classification_id: contractForm.inhabitant_classification_id,
-
-      tbr_fixed_value_percentage:
-        contractForm.tax_base_royalts != null
-          ? contractForm.tax_base_royalts / 100
-          : null,
-
-      marketing_fund_percentage:
-        contractForm.tax_base_fnm != null
-          ? contractForm.tax_base_fnm / 100
-          : null,
-
-      maintance_tax_percentage:
-        contractForm.tax_base_maintenance != null
-          ? contractForm.tax_base_maintenance / 100
-          : null,
-    });
-    onDialogOK();
-  } catch (error) {
-    console.error(error);
-  } finally {
-    saving.value = false;
-  }
-}
-
-onMounted(loadData);
-</script>

+ 0 - 335
src/pages/unit/components/EditContractDialog.vue

@@ -1,335 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card
-      class="q-dialog-plugin overflow-hidden"
-      style="width: 100%; max-width: 1100px"
-    >
-      <DefaultDialogHeader title="Editar Contrato" @close="onDialogCancel" />
-
-      <q-card-section>
-        <div class="text-body2 q-mb-sm">Dados da Unidade</div>
-
-        <div class="row q-col-gutter-x-sm">
-          <DefaultInput
-            :model-value="unitData.id"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="ID"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_name"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Nome do Franqueado"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_document"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="CPF / CNH"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            :model-value="unitData.franchisee_birthday"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Data de Nascimento"
-            label-color="secondary"
-          />
-        </div>
-      </q-card-section>
-
-      <q-card-section>
-        <div class="row q-col-gutter-sm">
-          <DefaultInputDatePicker
-            v-model:untreated-date="contractForm.start_date"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Data de Início"
-            label-color="secondary"
-          />
-
-          <DefaultInputDatePicker
-            v-model:untreated-date="contractForm.end_date"
-            class="col-md-3 col-12"
-            color="secondary"
-            disable
-            label="Data de Fim"
-            label-color="secondary"
-          />
-
-          <DefaultInput
-            v-model="contractForm.invoice_due_date"
-            label="Dia de Vencimento do Boleto"
-            color="secondary"
-            label-color="secondary"
-            type="number"
-            class="col-md-3 col-12"
-            disable
-          />
-
-          <DefaultSelect
-            v-model="contractForm.inhabitant_classification_id"
-            label="Faixa de Habitantes"
-            color="secondary"
-            label-color="secondary"
-            :options="inhabitantOptions"
-            emit-value
-            map-options
-            use-input
-            fill-input
-            hide-selected
-            input-debounce="0"
-            class="col-md-3 col-12"
-            disable
-          />
-        </div>
-
-        <div class="row q-col-gutter-sm q-mt-xs">
-          <DefaultCurrencyInput
-            v-model="contractForm.tbr_fixed_value"
-            label="TBR $"
-            color="secondary"
-            label-color="secondary"
-            class="col-md-3 col-12"
-            disable
-          />
-
-          <DefaultInput
-            v-model="contractForm.tax_base_royalts"
-            label="Taxa Base Royalties"
-            color="secondary"
-            label-color="secondary"
-            type="number"
-            class="col-md-3 col-12"
-            disable
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-
-          <DefaultInput
-            v-model="contractForm.tax_base_fnm"
-            label="Fundo Nacional de Marketing"
-            color="secondary"
-            label-color="secondary"
-            type="number"
-            class="col-md-3 col-12"
-            disable
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-
-          <div
-            class="col-md-3 col-12 row no-wrap items-center"
-            style="gap: 8px"
-          >
-            <DefaultInput
-              v-model="contractForm.tax_base_maintenance"
-              label="Taxa de Manutenção"
-              color="secondary"
-              label-color="secondary"
-              type="number"
-              class="col"
-              disable
-            >
-              <template #append>
-                <span class="text-secondary">%</span>
-              </template>
-            </DefaultInput>
-
-            <q-btn
-              color="primary"
-              icon="mdi-pencil"
-              text-color="white"
-              style="width: 40px; min-width: 40px; height: 40px"
-              @click="openTaxesDialog"
-            />
-          </div>
-        </div>
-      </q-card-section>
-
-      <q-card-section>
-        <div class="text-body2 q-mb-sm">
-          Histórico de Reajuste de Valores e TBR
-        </div>
-
-        <q-table
-          flat
-          dense
-          :rows="tbrHistory"
-          :columns="tbrColumns"
-          row-key="id"
-          :loading="loadingHistory"
-          :pagination="{ rowsPerPage: 5 }"
-          no-data-label="Nenhum histórico disponível"
-        />
-      </q-card-section>
-
-      <q-card-actions align="right">
-        <q-btn
-          outline
-          color="primary"
-          label="Cancelar"
-          @click="onDialogCancel"
-        />
-      </q-card-actions>
-    </q-card>
-  </q-dialog>
-</template>
-
-<script setup>
-import { ref, reactive, onMounted } from "vue";
-import { useDialogPluginComponent } from "quasar";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
-import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-import { getUnit } from "src/api/unit";
-import { getInhabitantClassificationsForSelect } from "src/api/inhabitant_classification";
-import { getFranchiseeContractTaxHistory } from "src/api/franchisee_contract";
-
-defineEmits([...useDialogPluginComponent.emits]);
-
-const props = defineProps({
-  contract: {
-    type: Object,
-    required: true,
-  },
-  unitId: {
-    type: Number,
-    required: true,
-  },
-});
-
-const { dialogRef, onDialogHide, onDialogCancel, onDialogOK } =
-  useDialogPluginComponent();
-
-const loadingHistory = ref(false);
-const inhabitantOptions = ref([]);
-const tbrHistory = ref([]);
-
-const unitData = reactive({
-  id: null,
-  franchisee_name: null,
-  franchisee_document: null,
-  franchisee_birthday: null,
-});
-
-const contractForm = reactive({
-  start_date: props.contract.start_date ?? null,
-  end_date: props.contract.end_date ?? null,
-  tbr_fixed_value: props.contract.tbr_fixed_value
-    ? parseFloat(props.contract.tbr_fixed_value)
-    : null,
-  invoice_due_date: props.contract.invoice_due_date ?? null,
-  inhabitant_classification_id:
-    props.contract.inhabitant_classification_id ?? null,
-  tax_base_royalts:
-    props.contract.tbr_fixed_value_percentage != null
-      ? parseFloat((props.contract.tbr_fixed_value_percentage * 100).toFixed(4))
-      : null,
-  tax_base_fnm:
-    props.contract.marketing_fund_percentage != null
-      ? parseFloat((props.contract.marketing_fund_percentage * 100).toFixed(4))
-      : null,
-  tax_base_maintenance:
-    props.contract.maintance_tax_percentage != null
-      ? parseFloat((props.contract.maintance_tax_percentage * 100).toFixed(4))
-      : null,
-});
-
-const tbrColumns = [
-  { name: "id", label: "Id", field: "id", align: "left" },
-  {
-    name: "year",
-    label: "Ano",
-    field: (row) => new Date(row.created_at).getFullYear(),
-    align: "left",
-  },
-  {
-    name: "inhabitant_classification",
-    label: "Faixa de Habitantes",
-    field: "inhabitant_classification",
-    align: "left",
-  },
-  {
-    name: "tbr_fixed_value",
-    label: "TBR",
-    field: "tbr_fixed_value",
-    align: "left",
-  },
-  {
-    name: "marketing_fund_percentage",
-    label: "FNM",
-    field: (row) =>
-      row.marketing_fund_percentage != null
-        ? `${(row.marketing_fund_percentage * 100).toFixed(0)}%`
-        : "-",
-    align: "left",
-  },
-  {
-    name: "maintance_tax_percentage",
-    label: "Manutenção",
-    field: (row) =>
-      row.maintance_tax_percentage != null
-        ? `${(row.maintance_tax_percentage * 100).toFixed(0)}%`
-        : "-",
-    align: "left",
-  },
-];
-
-function openTaxesDialog() {
-  onDialogOK({ openTaxes: true, contract: props.contract });
-}
-
-async function loadData() {
-  const [unit, classifications] = await Promise.all([
-    getUnit(props.unitId),
-    getInhabitantClassificationsForSelect(),
-  ]);
-
-  unitData.id = unit.id;
-  unitData.franchisee_name = unit.name_responsible;
-
-  const firstPartner = unit.partners?.[0];
-  if (firstPartner) {
-    unitData.franchisee_document = firstPartner.cpf;
-    unitData.franchisee_birthday = firstPartner.birth_date;
-  }
-
-  inhabitantOptions.value = classifications.map((c) => ({
-    label: `${c.description} (${c.acronym})`,
-    value: c.id,
-  }));
-
-  await loadTaxHistory();
-}
-
-async function loadTaxHistory() {
-  loadingHistory.value = true;
-  try {
-    tbrHistory.value = await getFranchiseeContractTaxHistory(props.contract.id);
-  } finally {
-    loadingHistory.value = false;
-  }
-}
-
-onMounted(loadData);
-</script>

+ 0 - 164
src/pages/unit/components/EditContractTaxesDialog.vue

@@ -1,164 +0,0 @@
-<template>
-  <q-dialog ref="dialogRef" @hide="onDialogHide">
-    <q-card
-      class="q-dialog-plugin overflow-hidden"
-      style="width: 100%; max-width: 1100px"
-    >
-      <DefaultDialogHeader title="Editar Taxas" @close="onDialogCancel" />
-
-      <q-card-section>
-        <div class="text-body2 q-mb-sm">Definir Valores</div>
-
-        <div class="row q-col-gutter-sm">
-          <DefaultSelect
-            v-model="form.inhabitant_classification_id"
-            label="Faixa de Habitantes"
-            color="secondary"
-            label-color="secondary"
-            :options="inhabitantOptions"
-            emit-value
-            map-options
-            use-input
-            fill-input
-            hide-selected
-            input-debounce="0"
-            class="col-md-3 col-12"
-          />
-
-          <DefaultCurrencyInput
-            v-model="form.tbr_fixed_value"
-            label="TBR $"
-            color="secondary"
-            label-color="secondary"
-            class="col-md-3 col-12"
-          />
-
-          <DefaultInput
-            v-model="form.tax_base_fnm"
-            label="Fundo Nacional de Marketing"
-            color="secondary"
-            label-color="secondary"
-            type="number"
-            class="col-md-3 col-12"
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-
-          <DefaultInput
-            v-model="form.tax_base_maintenance"
-            label="Taxa de Manutenção"
-            color="secondary"
-            label-color="secondary"
-            type="number"
-            class="col-md-3 col-12"
-          >
-            <template #append>
-              <span class="text-secondary">%</span>
-            </template>
-          </DefaultInput>
-        </div>
-      </q-card-section>
-
-      <q-card-actions align="right">
-        <q-btn
-          outline
-          color="primary"
-          label="Cancelar"
-          @click="onDialogCancel"
-        />
-        <q-btn
-          color="primary"
-          label="Salvar"
-          :loading="saving"
-          @click="confirmSave"
-        />
-      </q-card-actions>
-    </q-card>
-  </q-dialog>
-</template>
-
-<script setup>
-import { onMounted, reactive, ref } from "vue";
-import { useDialogPluginComponent, useQuasar } from "quasar";
-
-import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-
-import { getInhabitantClassificationsForSelect } from "src/api/inhabitant_classification";
-import { updateFranchiseeContract } from "src/api/franchisee_contract";
-
-defineEmits([...useDialogPluginComponent.emits]);
-
-const props = defineProps({
-  contract: {
-    type: Object,
-    required: true,
-  },
-});
-
-const { dialogRef, onDialogHide, onDialogCancel, onDialogOK } =
-  useDialogPluginComponent();
-
-const $q = useQuasar();
-const saving = ref(false);
-const inhabitantOptions = ref([]);
-
-const form = reactive({
-  inhabitant_classification_id:
-    props.contract.inhabitant_classification_id ?? null,
-  tax_base_fnm:
-    props.contract.marketing_fund_percentage != null
-      ? parseFloat((props.contract.marketing_fund_percentage * 100).toFixed(4))
-      : null,
-  tax_base_maintenance:
-    props.contract.maintance_tax_percentage != null
-      ? parseFloat((props.contract.maintance_tax_percentage * 100).toFixed(4))
-      : null,
-  tbr_fixed_value: props.contract.tbr_fixed_value
-    ? parseFloat(props.contract.tbr_fixed_value)
-    : null,
-});
-
-async function loadData() {
-  const classifications = await getInhabitantClassificationsForSelect();
-  inhabitantOptions.value = classifications.map((c) => ({
-    label: `${c.description} (${c.acronym})`,
-    value: c.id,
-  }));
-}
-
-function confirmSave() {
-  $q.dialog({
-    message: "Confirmar alteração nas Taxas?",
-    ok: { label: "Confirmar", color: "primary" },
-    cancel: { label: "Cancelar", color: "primary", outline: true },
-  }).onOk(save);
-}
-
-async function save() {
-  saving.value = true;
-  try {
-    await updateFranchiseeContract(props.contract.id, {
-      inhabitant_classification_id: form.inhabitant_classification_id,
-      tbr_fixed_value: form.tbr_fixed_value,
-      marketing_fund_percentage:
-        form.tax_base_fnm != null ? form.tax_base_fnm / 100 : null,
-      maintance_tax_percentage:
-        form.tax_base_maintenance != null
-          ? form.tax_base_maintenance / 100
-          : null,
-    });
-    onDialogOK();
-  } catch (error) {
-    console.error(error);
-  } finally {
-    saving.value = false;
-  }
-}
-
-onMounted(loadData);
-</script>

+ 0 - 72
src/router/routes/config.route.js

@@ -31,78 +31,6 @@ export default [
       ],
     },
   },
-  {
-    path: "/city",
-    name: "CityPage",
-    component: () => import("pages/city/CityPage.vue"),
-    meta: {
-      title: {
-        value: "ui.navigation.city",
-        translate: true,
-      },
-      description: {
-        value: "page.city.description",
-        translate: true,
-      },
-      requireAuth: true,
-      requiredPermission: "config.city",
-      breadcrumbs: [
-        {
-          name: "CityPage",
-          title: "ui.navigation.city",
-          translate: true,
-        },
-      ],
-    },
-  },
-  {
-    path: "/country",
-    name: "CountryPage",
-    component: () => import("pages/country/CountryPage.vue"),
-    meta: {
-      title: {
-        value: "ui.navigation.country",
-        translate: true,
-      },
-      description: {
-        value: "page.country.description",
-        translate: true,
-      },
-      requireAuth: true,
-      requiredPermission: "config.country",
-      breadcrumbs: [
-        {
-          name: "CountryPage",
-          title: "ui.navigation.country",
-          translate: true,
-        },
-      ],
-    },
-  },
-  {
-    path: "/state",
-    name: "StatePage",
-    component: () => import("pages/state/StatePage.vue"),
-    meta: {
-      title: {
-        value: "ui.navigation.state",
-        translate: true,
-      },
-      description: {
-        value: "page.state.description",
-        translate: true,
-      },
-      requireAuth: true,
-      requiredPermission: "config.state",
-      breadcrumbs: [
-        {
-          name: "StatePage",
-          title: "ui.navigation.state",
-          translate: true,
-        },
-      ],
-    },
-  },
   {
     path: "/users/create",
     name: "UserAddPage",

+ 0 - 23
src/router/routes/unit.route.js

@@ -15,27 +15,4 @@ export default [
       ],
     },
   },
-  {
-    path: "/unit/:id/edit",
-    name: "UnitEditPage",
-    component: () => import("pages/unit/UnitActionPage.vue"),
-    meta: {
-      title: {
-        value: "Editar Unidade",
-        translate: false,
-      },
-      requireAuth: true,
-      requiredPermission: "unit",
-      breadcrumbs: [
-        {
-          name: "FranchiseePage",
-          title: "Franqueados",
-        },
-        {
-          name: "UnitEditPage",
-          title: "Editar Unidade",
-        },
-      ],
-    },
-  },
 ];