Просмотр исходного кода

feat(support): adiciona ticket para franchisee

ebagabee 3 недель назад
Родитель
Сommit
ac2979aac5

+ 28 - 56
src/pages/support/SupportPage.vue

@@ -21,6 +21,14 @@
         </q-td>
       </template>
 
+      <template #body-cell-origin="{ row }">
+        <q-td align="left">{{ originLabel(row) }}</q-td>
+      </template>
+
+      <template #body-cell-target="{ row }">
+        <q-td align="left">{{ targetLabel(row) }}</q-td>
+      </template>
+
       <template #body-cell-status="{ row }">
         <q-td align="left">
           <q-badge
@@ -90,64 +98,28 @@ const openAddEditTicketDialog = (ticket = null) => {
 };
 
 const columns = [
-  {
-    name: "id",
-    label: "Ticket",
-    field: "id",
-    align: "left",
-    sortable: true,
-    required: true,
-    style: "width: 5%",
-  },
-  {
-    name: "severity",
-    label: "Prioridade",
-    field: "severity",
-    align: "left",
-    sortable: true,
-    style: "width: 8%",
-  },
-  {
-    name: "created_at",
-    label: "Data",
-    field: "created_at",
-    align: "left",
-    sortable: true,
-    style: "width: 10%",
-  },
-  {
-    name: "sector",
-    label: "Setor",
-    field: "sector",
-    align: "left",
-    sortable: true,
-    style: "width: 18%",
-  },
-  {
-    name: "title",
-    label: "Título",
-    field: "title",
-    align: "left",
-    style: "width: 34%",
-  },
-  {
-    name: "status",
-    label: "Status",
-    field: "status",
-    align: "left",
-    sortable: true,
-    style: "width: 10%",
-  },
-  {
-    name: "actions",
-    label: "Ações",
-    field: "actions",
-    align: "center",
-    required: true,
-    style: "width: 15%",
-  },
+  { name: "id", label: "Ticket", field: "id", align: "left", style: "width: 5%" },
+  { name: "severity", label: "Prioridade", field: "severity", align: "left", style: "width: 8%" },
+  { name: "created_at", label: "Data", field: "created_at", align: "left", style: "width: 10%" },
+  { name: "origin", label: "Origem", field: "origin", align: "left", style: "width: 12%" },
+  { name: "target", label: "Destino", field: "target_unit_name", align: "left", style: "width: 12%" },
+  { name: "sector", label: "Setor", field: "sector", align: "left", style: "width: 12%" },
+  { name: "title", label: "Título", field: "title", align: "left", style: "width: 21%" },
+  { name: "status", label: "Status", field: "status", align: "left", style: "width: 10%" },
+  { name: "actions", label: "Ações", field: "actions", align: "center", style: "width: 10%" },
 ];
 
+const originLabel = (row) => {
+  if (row.origin === "matriz") return "Matriz";
+  return row.applicant_unit_name ?? "Unidade";
+};
+
+const targetLabel = (row) => {
+  if (row.scope === "all") return "Todas as Unidades";
+  if (row.scope === "internal") return "Interno";
+  return row.target_unit_name ?? "—";
+};
+
 const severityLabel = (severity) => {
   const map = { alta: "Alta", normal: "Normal", baixa: "Baixa" };
   return map[severity] ?? severity;

+ 2 - 2
src/pages/support/components/AddEditTicketDialog.vue

@@ -191,7 +191,7 @@ const { user } = userStore();
 const formRef = ref(null);
 const loading = ref(false);
 const currentTab = ref("ticket");
-const selectedUnit = ref(ticket?.unit_id ? { value: ticket.unit_id } : null);
+const selectedUnit = ref(ticket?.target_unit_id ? { value: ticket.target_unit_id } : null);
 
 const tabs = computed(() => {
   const base = [{ name: "ticket", label: "Ticket" }];
@@ -232,7 +232,7 @@ const buildPayload = () => ({
   scope: form.value.scope,
   sector: form.value.sector || null,
   description: form.value.description || null,
-  unit_id:
+  target_unit_id:
     form.value.scope === "specific"
       ? (selectedUnit.value?.value ?? null)
       : null,