|
@@ -5,13 +5,22 @@
|
|
|
ref="tableRef"
|
|
ref="tableRef"
|
|
|
:columns="columns"
|
|
:columns="columns"
|
|
|
:api-call="getSupportTickets"
|
|
:api-call="getSupportTickets"
|
|
|
- :delete-function="deleteSupportTicket"
|
|
|
|
|
add-item
|
|
add-item
|
|
|
title="Tickets"
|
|
title="Tickets"
|
|
|
:female="false"
|
|
:female="false"
|
|
|
description="tickets"
|
|
description="tickets"
|
|
|
@on-add-item="openAddEditTicketDialog()"
|
|
@on-add-item="openAddEditTicketDialog()"
|
|
|
>
|
|
>
|
|
|
|
|
+ <template #body-cell-status="{ row }">
|
|
|
|
|
+ <q-td align="center">
|
|
|
|
|
+ <q-badge
|
|
|
|
|
+ :color="statusColor(row.status)"
|
|
|
|
|
+ :label="statusLabel(row.status)"
|
|
|
|
|
+ style="padding: 6px 10px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template #body-cell-actions="{ row }">
|
|
<template #body-cell-actions="{ row }">
|
|
|
<q-btn
|
|
<q-btn
|
|
|
outline
|
|
outline
|
|
@@ -19,6 +28,22 @@
|
|
|
style="width: 36px"
|
|
style="width: 36px"
|
|
|
@click.prevent.stop="handleEdit(row)"
|
|
@click.prevent.stop="handleEdit(row)"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ v-if="row.status === 'in_progress'"
|
|
|
|
|
+ outline
|
|
|
|
|
+ icon="mdi-check-circle-outline"
|
|
|
|
|
+ style="width: 36px"
|
|
|
|
|
+ color="warning"
|
|
|
|
|
+ @click.prevent.stop="handleClose(row)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ v-if="row.status === 'in_progress'"
|
|
|
|
|
+ outline
|
|
|
|
|
+ icon="mdi-trash-can-outline"
|
|
|
|
|
+ style="width: 36px"
|
|
|
|
|
+ color="negative"
|
|
|
|
|
+ @click.prevent.stop="handleDelete(row)"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
</DefaultTable>
|
|
</DefaultTable>
|
|
|
</div>
|
|
</div>
|
|
@@ -36,6 +61,10 @@ const AddEditTicketDialog = defineAsyncComponent(
|
|
|
() => import("src/pages/support/components/AddEditTicketDialog.vue"),
|
|
() => import("src/pages/support/components/AddEditTicketDialog.vue"),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+const CloseTicketDialog = defineAsyncComponent(
|
|
|
|
|
+ () => import("src/pages/support/components/CloseTicketDialog.vue"),
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
const $q = useQuasar();
|
|
const $q = useQuasar();
|
|
|
const tableRef = useTemplateRef("tableRef");
|
|
const tableRef = useTemplateRef("tableRef");
|
|
|
|
|
|
|
@@ -80,15 +109,15 @@ const columns = [
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "title",
|
|
name: "title",
|
|
|
- label: "Descrição",
|
|
|
|
|
|
|
+ label: "Título",
|
|
|
field: "title",
|
|
field: "title",
|
|
|
align: "left",
|
|
align: "left",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- name: "support_status_id",
|
|
|
|
|
|
|
+ name: "status",
|
|
|
label: "Status",
|
|
label: "Status",
|
|
|
- field: "support_status_id",
|
|
|
|
|
- align: "left",
|
|
|
|
|
|
|
+ field: "status",
|
|
|
|
|
+ align: "center",
|
|
|
sortable: true,
|
|
sortable: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -100,7 +129,46 @@ const columns = [
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+const statusLabel = (status) => {
|
|
|
|
|
+ const map = {
|
|
|
|
|
+ in_progress: "Em andamento",
|
|
|
|
|
+ resolved: "Resolvido",
|
|
|
|
|
+ unresolved: "Não resolvido",
|
|
|
|
|
+ };
|
|
|
|
|
+ return map[status] ?? status;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const statusColor = (status) => {
|
|
|
|
|
+ const map = {
|
|
|
|
|
+ in_progress: "warning",
|
|
|
|
|
+ resolved: "positive",
|
|
|
|
|
+ unresolved: "negative",
|
|
|
|
|
+ };
|
|
|
|
|
+ return map[status] ?? "grey";
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const handleEdit = (row) => {
|
|
const handleEdit = (row) => {
|
|
|
openAddEditTicketDialog(row);
|
|
openAddEditTicketDialog(row);
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+const handleClose = (row) => {
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ component: CloseTicketDialog,
|
|
|
|
|
+ componentProps: { ticket: row },
|
|
|
|
|
+ }).onOk(() => {
|
|
|
|
|
+ tableRef.value?.refresh();
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleDelete = (row) => {
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ title: "Confirmar exclusão",
|
|
|
|
|
+ message: "Tem certeza que deseja excluir este ticket?",
|
|
|
|
|
+ ok: { color: "negative", label: "Excluir" },
|
|
|
|
|
+ cancel: { color: "primary", outline: true, label: "Cancelar" },
|
|
|
|
|
+ }).onOk(async () => {
|
|
|
|
|
+ await deleteSupportTicket(row.id);
|
|
|
|
|
+ tableRef.value?.refresh();
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|