Эх сурвалжийг харах

Merge branch 'feat/GINC-GAB-modulo-financeiro' of Softpar/sfp_vue_franchisor_ginastica_cerebro into development

Gabriel Alves 1 долоо хоног өмнө
parent
commit
dda9392564

+ 16 - 0
src/api/tbr.js

@@ -0,0 +1,16 @@
+import api from "src/api";
+
+export const getRoyaltiesBaseBrackets = async () => {
+  const { data } = await api.get("/royalties-base-bracket");
+  return data.payload;
+};
+
+export const getFnmBaseBrackets = async () => {
+  const { data } = await api.get("/fnm-base-bracket");
+  return data.payload;
+};
+
+export const getMaintenanceBaseBrackets = async () => {
+  const { data } = await api.get("/maintenance-base-bracket");
+  return data.payload;
+};

+ 39 - 0
src/pages/tbr/TbrPage.vue

@@ -0,0 +1,39 @@
+<script setup>
+import { ref, defineAsyncComponent } from "vue";
+import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
+import CustomTabComponent from "src/components/shared/CustomTabComponent.vue";
+
+const SettingsTab = defineAsyncComponent(() => import("./tabs/SettingsTab.vue"));
+const BillingGenerationTab = defineAsyncComponent(() => import("./tabs/BillingGenerationTab.vue"));
+const GeneratedBillingsTab = defineAsyncComponent(() => import("./tabs/GeneratedBillingsTab.vue"));
+
+const currentTab = ref("settings");
+
+const tabs = [
+  { name: "settings", label: "Configurações" },
+  { name: "billing-generation", label: "Geração de Cobranças" },
+  { name: "generated-billings", label: "Ver Cobranças Geradas" },
+];
+</script>
+
+<template>
+  <div>
+    <DefaultHeaderPage title="TBR - Configurações" />
+
+    <div class="q-px-sm">
+      <CustomTabComponent v-model:active-tab="currentTab" :tabs="tabs" class="q-mb-md" />
+
+      <div v-show="currentTab === 'settings'">
+        <SettingsTab />
+      </div>
+
+      <div v-show="currentTab === 'billing-generation'">
+        <BillingGenerationTab />
+      </div>
+
+      <div v-show="currentTab === 'generated-billings'">
+        <GeneratedBillingsTab />
+      </div>
+    </div>
+  </div>
+</template>

+ 8 - 0
src/pages/tbr/tabs/BillingGenerationTab.vue

@@ -0,0 +1,8 @@
+<script setup>
+</script>
+
+<template>
+  <div>
+    <h6>Geração de Cobranças</h6>
+  </div>
+</template>

+ 8 - 0
src/pages/tbr/tabs/GeneratedBillingsTab.vue

@@ -0,0 +1,8 @@
+<script setup>
+</script>
+
+<template>
+  <div>
+    <h6>Ver Cobranças Geradas</h6>
+  </div>
+</template>

+ 73 - 0
src/pages/tbr/tabs/SettingsTab.vue

@@ -0,0 +1,73 @@
+<script setup>
+import { ref, onMounted } from "vue";
+import DefaultInput from "src/components/defaults/DefaultInput.vue";
+import {
+  getRoyaltiesBaseBrackets,
+  getFnmBaseBrackets,
+  getMaintenanceBaseBrackets,
+} from "src/api/tbr";
+
+const royaltiesBrackets = ref([]);
+const fnmBrackets = ref([]);
+const maintenanceBrackets = ref([]);
+
+function bracketRangeLabel(bracket) {
+  return `Meses ${bracket.start_month} a ${bracket.end_month}`;
+}
+
+onMounted(async () => {
+  const [royalties, fnm, maintenance] = await Promise.all([
+    getRoyaltiesBaseBrackets(),
+    getFnmBaseBrackets(),
+    getMaintenanceBaseBrackets(),
+  ]);
+
+  royaltiesBrackets.value = royalties;
+  fnmBrackets.value = fnm;
+  maintenanceBrackets.value = maintenance;
+});
+</script>
+
+<template>
+  <div class="q-pa-sm">
+    <p class="text-subtitle2 q-mb-md">Definir Faixa (Mês de Contrato)</p>
+
+    <div
+      v-for="(royalties, index) in royaltiesBrackets"
+      :key="royalties.id"
+      class="row q-col-gutter-md q-mb-sm"
+    >
+      <div class="col-12 col-md-3">
+        <DefaultInput
+          :model-value="bracketRangeLabel(royalties)"
+          label="Faixa (mês de contrato)"
+          readonly
+        />
+      </div>
+
+      <div class="col-12 col-md-3">
+        <DefaultInput
+          :model-value="royalties.description"
+          label="Royalties"
+          readonly
+        />
+      </div>
+
+      <div class="col-12 col-md-3">
+        <DefaultInput
+          :model-value="fnmBrackets[index]?.description"
+          label="FNM"
+          readonly
+        />
+      </div>
+
+      <div class="col-12 col-md-3">
+        <DefaultInput
+          :model-value="maintenanceBrackets[index]?.description"
+          label="Taxa de Manutenção"
+          readonly
+        />
+      </div>
+    </div>
+  </div>
+</template>

+ 24 - 0
src/router/routes/tbr.route.js

@@ -0,0 +1,24 @@
+export default [
+  {
+    path: "/tbr",
+    name: "TbrPage",
+    component: () => import("pages/tbr/TbrPage.vue"),
+    meta: {
+      title: {
+        value: "TBR - Configurações",
+        translate: false,
+      },
+      requireAuth: true,
+      breadcrumbs: [
+        {
+          name: "DashboardPage",
+          title: "Dashboard",
+        },
+        {
+          name: "TbrPage",
+          title: "TBR",
+        },
+      ],
+    },
+  },
+];

+ 9 - 0
src/stores/navigation.js

@@ -39,6 +39,15 @@ export const navigationStore = defineStore("navigation", () => {
       disable: false,
       permission: false,
       permissionScope: "dashboard"
+    },
+    {
+      type: "single",
+      title: "TBR",
+      name: "TbrPage",
+      icon: "mdi-database-outline",
+      disable: false,
+      permission: false,
+      permissionScope: "dashboard"
     }
   ]);