Vaihda tiketin Poista-nappi Sulje-napiksi
Tiketti merkataan suljetuksi poistamisen sijaan. Ei enää confirm-dialogia. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1652,7 +1652,7 @@ async function showTicketDetail(id, companyId = '') {
|
||||
<option value="">Ei asiakkuutta</option>
|
||||
</select>
|
||||
<button class="btn-secondary" id="btn-ticket-to-todo" style="padding:6px 12px;font-size:0.82rem;" title="Luo tehtävä tästä tiketistä">📋 Tehtävä</button>
|
||||
<button class="btn-danger" id="btn-ticket-delete" style="padding:6px 12px;font-size:0.82rem;">Poista</button>
|
||||
<button class="btn-secondary" id="btn-ticket-close" style="padding:6px 12px;font-size:0.82rem;background:#fef2f2;color:#e74c3c;border-color:#f5c6cb;">✕ Sulje</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap;margin-top:0.5rem;">
|
||||
@@ -1769,11 +1769,10 @@ async function showTicketDetail(id, companyId = '') {
|
||||
} catch (e) { alert(e.message); }
|
||||
});
|
||||
|
||||
// Delete handler
|
||||
document.getElementById('btn-ticket-delete').addEventListener('click', async () => {
|
||||
if (!confirm('Poistetaanko tiketti "' + ticket.subject + '"?')) return;
|
||||
// Close handler — merkkaa tiketti suljetuksi
|
||||
document.getElementById('btn-ticket-close').addEventListener('click', async () => {
|
||||
try {
|
||||
await apiCall('ticket_delete' + ticketCompanyParam(), 'POST', { id: currentTicketId });
|
||||
await apiCall('ticket_status' + ticketCompanyParam(), 'POST', { id: currentTicketId, status: 'suljettu' });
|
||||
showTicketListView();
|
||||
loadTickets();
|
||||
} catch (e) { alert(e.message); }
|
||||
|
||||
Reference in New Issue
Block a user