Procházet zdrojové kódy

feat: remove FinancialTab and related financial access checks from UnitActionPage and AddEditContractDialog

alvesantos před 2 hodinami
rodič
revize
da8fa0cb65

+ 0 - 19
src/pages/students/components/AddEditContractDialog.vue

@@ -566,7 +566,6 @@ import {
 
 import { computed, nextTick, onMounted, ref, useTemplateRef, watch } from "vue";
 import { formatDateDMYtoYMD, formatDateYMDtoDMY } from "src/helpers/utils";
-import { getFinancialMe } from "src/api/unit_financial";
 import { getStudentsForSelect } from "src/api/student";
 import { getUnitMe } from "src/api/unit";
 import { getUnitPackagesForSelect } from "src/api/package";
@@ -633,10 +632,6 @@ const canAddStudents = computed(() =>
   permissions.getAccess("franchisee_students", "add"),
 );
 
-const canViewFinancial = computed(() =>
-  permissions.getAccess("franchisee_financial", "view"),
-);
-
 const currentStudent = computed(() => selectedStudent.value ?? props.student);
 
 const contractWeeks = computed(() => {
@@ -1329,19 +1324,5 @@ onMounted(async () => {
 
   students.value = unitStudents;
   filteredStudents.value = unitStudents;
-
-  if (!props.contract && canViewFinancial.value) {
-    try {
-      const financial = await getFinancialMe();
-
-      if (!financial) return;
-
-      if (financial.default_fine != null) {
-        form.late_fee = financial.default_fine;
-      }
-    } catch (error) {
-      console.error(error);
-    }
-  }
 });
 </script>

+ 0 - 15
src/pages/unit/UnitActionPage.vue

@@ -18,12 +18,6 @@
 
       <ContractsTab v-show="activeTab === 'contracts'" :unit-id="unitId" />
 
-      <FinancialTab
-        v-if="canViewFinancial"
-        v-show="activeTab === 'financial'"
-        :unit-id="unitId"
-      />
-
       <HistoryTab v-show="activeTab === 'history'" :unit-id="unitId" />
 
       <MediasTab v-show="activeTab === 'medias'" :unit-id="unitId" />
@@ -34,23 +28,17 @@
 <script setup>
 import { computed, ref } from "vue";
 import { userStore } from "src/stores/user";
-import { permissionStore } from "src/stores/permission";
 
 import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
 import CustomTabComponent from "src/components/shared/CustomTabComponent.vue";
 
 import ContractsTab from "src/pages/unit/tabs/ContractsTab.vue";
-import FinancialTab from "src/pages/unit/tabs/FinancialTab.vue";
 import HistoryTab from "src/pages/unit/tabs/HistoryTab.vue";
 import MediasTab from "src/pages/unit/tabs/MediasTab.vue";
 import PartnersTab from "src/pages/unit/tabs/PartnersTab.vue";
 import UnitDataTab from "src/pages/unit/tabs/UnitDataTab.vue";
 
 const store = userStore();
-const permissions = permissionStore();
-const canViewFinancial = computed(() =>
-  permissions.getAccess("franchisee_financial", "view"),
-);
 
 const activeTab = ref("unit_data");
 
@@ -60,9 +48,6 @@ const allTabs = computed(() => [
   { name: "unit_data", label: "Dados da Unidade" },
   { name: "partners", label: "Sócios" },
   { name: "contracts", label: "Contratos" },
-  ...(canViewFinancial.value
-    ? [{ name: "financial", label: "Financeiro" }]
-    : []),
   { name: "history", label: "Histórico" },
   { name: "medias", label: "Mídias" },
 ]);

+ 0 - 163
src/pages/unit/tabs/FinancialTab.vue

@@ -1,163 +0,0 @@
-<template>
-  <div class="q-pa-md column q-gutter-lg">
-    <!-- Dados Bancários -->
-    <div>
-      <div class="text-subtitle1 text-weight-medium q-mb-sm">
-        Dados Bancários
-      </div>
-
-      <div class="row q-col-gutter-sm">
-        <DefaultInput
-          v-model="form.account_holder"
-          label="Titular da Conta"
-          class="col-12 col-md-4"
-          outlined
-          disable
-        />
-        <DefaultInput
-          v-model="form.agency"
-          label="Agência"
-          class="col-12 col-md-4"
-          outlined
-          disable
-        />
-        <DefaultInput
-          v-model="form.account"
-          label="Conta"
-          class="col-12 col-md-4"
-          outlined
-          disable
-        />
-
-        <DefaultInput
-          v-model="form.bank"
-          label="Banco"
-          class="col-12 col-md-3"
-          outlined
-          disable
-        />
-        <DefaultInput
-          v-model="form.pix_key"
-          label="Chave Pix"
-          class="col-12 col-md-3"
-          outlined
-          disable
-        />
-        <DefaultSelect
-          v-model="form.tax_regime"
-          label="Regime Tributário"
-          :options="taxRegimeOptions"
-          class="col-12 col-md-3"
-          outlined
-          emit-value
-          map-options
-          disable
-        />
-        <DefaultSelect
-          v-model="form.account_type"
-          label="Tipo de Conta"
-          :options="accountTypeOptions"
-          class="col-12 col-md-3"
-          outlined
-          emit-value
-          map-options
-          disable
-        />
-      </div>
-    </div>
-
-    <!-- Dados para Faturamento -->
-    <div>
-      <div class="text-subtitle1 text-weight-medium q-mb-sm">
-        Dados para Faturamento
-      </div>
-
-      <div class="row q-col-gutter-sm">
-        <DefaultSelect
-          v-model="form.billing_method"
-          label="Forma de Cobrança"
-          :options="billingMethodOptions"
-          class="col-12 col-md-6"
-          outlined
-          emit-value
-          map-options
-          disable
-        />
-        <DefaultInputDatePicker
-          v-model="form.due_date"
-          label="Data de Vencimento"
-          class="col-12 col-md-6"
-          disable
-        />
-        <DefaultInput
-          v-model="form.financial_email"
-          label="E-mail Financeiro"
-          class="col-12"
-          outlined
-          disable
-        />
-      </div>
-    </div>
-  </div>
-</template>
-
-<script setup>
-import { ref, onMounted } from "vue";
-import DefaultInput from "src/components/defaults/DefaultInput.vue";
-import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
-import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
-import { getFinancialMe } from "src/api/unit_financial";
-
-const props = defineProps({
-  unitId: { type: Number, default: null },
-});
-
-const taxRegimeOptions = [
-  { label: "Selecione", value: null },
-  { label: "Simples Nacional", value: "simples_nacional" },
-  { label: "Lucro Presumido", value: "lucro_presumido" },
-  { label: "Lucro Real", value: "lucro_real" },
-  { label: "MEI", value: "mei" },
-];
-
-const accountTypeOptions = [
-  { label: "Selecione", value: null },
-  { label: "Conta Corrente", value: "corrente" },
-  { label: "Conta Poupança", value: "poupanca" },
-];
-
-const billingMethodOptions = [
-  { label: "Selecione", value: null },
-  { label: "Boleto", value: "boleto" },
-  { label: "Débito Automático", value: "debit" },
-  { label: "PIX", value: "pix" },
-  { label: "Cartão de Crédito", value: "credit_card" },
-];
-
-const defaultForm = () => ({
-  tax_regime: null,
-  bank: null,
-  agency: null,
-  account: null,
-  account_type: null,
-  account_holder: null,
-  pix_key: null,
-  billing_method: null,
-  due_date: null,
-  financial_email: null,
-});
-
-const form = ref(defaultForm());
-
-async function fetchData() {
-  if (!props.unitId) return;
-  try {
-    const data = await getFinancialMe();
-    if (data) Object.assign(form.value, data);
-  } catch (e) {
-    console.error(e);
-  }
-}
-
-onMounted(fetchData);
-</script>