no-mistakes(review): Guard photo cleanup; add transitions helper and assign auto-advance
This commit is contained in:
@@ -204,21 +204,9 @@
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Current: <span class="font-bold" x-text="ticket.status"></span></label>
|
||||
<select x-model="statusForm.newStatus" class="w-full px-4 py-2.5 rounded-lg border border-gray-300 focus:ring-2 focus:ring-denya-500 outline-none">
|
||||
<option value="">Select new status</option>
|
||||
<option value="Logged">Logged</option>
|
||||
<option value="Triage">Triage</option>
|
||||
<option value="Assigned">Assigned</option>
|
||||
<option value="Accepted">Accepted</option>
|
||||
<option value="Travelling">Travelling</option>
|
||||
<option value="On Site">On Site</option>
|
||||
<option value="In Progress">In Progress</option>
|
||||
<option value="Waiting Parts">Waiting Parts</option>
|
||||
<option value="Escalated">Escalated</option>
|
||||
<option value="Completed">Completed</option>
|
||||
<option value="On-Field Verification">On-Field Verification</option>
|
||||
<option value="Wahab Review">Wahab Review</option>
|
||||
<option value="Closed">Closed</option>
|
||||
<option value="Reopened">Reopened</option>
|
||||
<option value="Cancelled">Cancelled</option>
|
||||
<template x-for="target in availableTransitions" :key="target">
|
||||
<option :value="target" x-text="target"></option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
@@ -303,6 +291,7 @@
|
||||
statusForm: { newStatus: '', note: '' },
|
||||
statusSubmitting: false,
|
||||
statusError: '',
|
||||
availableTransitions: [],
|
||||
|
||||
// Assign form
|
||||
assignForm: { technicianId: '' },
|
||||
@@ -316,6 +305,7 @@
|
||||
|
||||
async init() {
|
||||
await this.loadTicket();
|
||||
await this.loadTransitions();
|
||||
if (app().isFM || app().isAdmin) {
|
||||
await this.loadTechnicians();
|
||||
}
|
||||
@@ -332,6 +322,16 @@
|
||||
}
|
||||
},
|
||||
|
||||
async loadTransitions() {
|
||||
try {
|
||||
const data = await app().apiGet(`/api/tickets/${this.ticketId}/transitions`);
|
||||
this.availableTransitions = (data && data.transitions) || [];
|
||||
} catch (e) {
|
||||
console.error('Transitions load error', e);
|
||||
this.availableTransitions = [];
|
||||
}
|
||||
},
|
||||
|
||||
async loadTechnicians() {
|
||||
try {
|
||||
const users = await app().apiGet('/api/auth/users');
|
||||
@@ -356,6 +356,7 @@
|
||||
|
||||
const updated = await app().apiPatch(`/api/tickets/${this.ticketId}`, payload);
|
||||
this.ticket = updated;
|
||||
await this.loadTransitions();
|
||||
this.showStatusModal = false;
|
||||
this.statusForm = { newStatus: '', note: '' };
|
||||
app().showToast('Status updated', 'success');
|
||||
@@ -378,6 +379,7 @@
|
||||
assigned_to: parseInt(this.assignForm.technicianId)
|
||||
});
|
||||
this.ticket = updated;
|
||||
await this.loadTransitions();
|
||||
this.showAssignModal = false;
|
||||
app().showToast('Technician assigned', 'success');
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user