Skip to content

Commit

Permalink
fix: handle rename of subject via breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Nov 28, 2024
1 parent 624c061 commit ae628b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
6 changes: 0 additions & 6 deletions desk/src/components/ticket/TicketAgentFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ const options = computed(() => {
type: "select",
placeholder: "Select Customer",
},
{
field: "subject",
label: "Subject",
type: "textarea",
placeholder: "Problem in XYZ",
},
];
});
Expand Down
34 changes: 17 additions & 17 deletions desk/src/pages/TicketAgent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,21 @@
"
/>
<!-- Rename Subject Dialog -->
<Dialog v-model="showSubjectDialog">
<template #body-title>
<h3 class="text-2xl font-semibold leading-6 text-gray-900">Rename</h3>
</template>
<Dialog v-model="showSubjectDialog" :options="{ title: 'Rename Subject' }">
<template #body-content>
<div class="flex flex-col flex-1 gap-5">
<div class="flex flex-col flex-1 gap-3">
<FormControl
v-model="subjectInput"
type="text"
v-model="renameSubject"
type="textarea"
size="sm"
variant="subtle"
:disabled="false"
/>
<Button
variant="solid"
:disabled="!subjectInput"
:loading="isLoading"
label="Rename"
@click="
() => {
updateTicket('subject', subjectInput);
showSubjectDialog = false;
}
"
@click="handleRename"
/>
</div>
</template>
Expand Down Expand Up @@ -168,7 +159,7 @@ const ticketStatusStore = useTicketStatusStore();
const { getUser } = useUserStore();
const ticketAgentActivitiesRef = ref(null);
const communicationAreaRef = ref(null);
const subjectInput = ref(null);
const renameSubject = ref("");
const isLoading = ref(false);
const props = defineProps({
Expand Down Expand Up @@ -205,9 +196,10 @@ const ticket = createResource({
};
});
}
console.log(data);
renameSubject.value = data.subject;
},
onSuccess: (data) => {
subjectInput.value = data.subject;
setupCustomActions(data, {
doc: data,
});
Expand All @@ -218,11 +210,19 @@ const breadcrumbs = computed(() => {
let items = [{ label: "Tickets", route: { name: "TicketsAgent" } }];
items.push({
label: ticket.data?.subject,
route: { name: "TicketAgent" },
onClick: () => {
showSubjectDialog.value = true;
},
});
return items;
});
const handleRename = () => {
if (renameSubject.value === ticket.data?.subject) return;
updateTicket("subject", renameSubject.value);
showSubjectDialog.value = false;
};
watch(
() => showFullActivity.value,
(value) => {
Expand Down

0 comments on commit ae628b5

Please sign in to comment.