Update WorkorderCompanyPWA.php

This commit is contained in:
Luca Haid
2025-09-08 08:55:02 +00:00
parent ac5c8e5c24
commit 12453cfa3a

View File

@@ -145,7 +145,55 @@
);
}
return filtered.sort((a,b) => (a.deadlineDate || 0) - (b.deadlineDate || 0));
const getStatusRank = (status) => {
switch (status) {
// Priority 0: Active and scheduled, sorted by appointment date
case 'scheduled':
case 'civil_engineering_completed':
return 0;
// Priority 1: New/Assigned tasks, sorted by deadline
case 'assigned':
case 'new':
case 'problem_solved':
return 1;
// Priority 2: Tasks with issues, sorted by deadline
case 'intervention_required':
case 'correction_requested':
case 'civil_engineering_required':
return 2;
// Priority 3: Finished tasks, sorted by deadline
case 'documented':
case 'completed':
return 3;
// Priority 4: Cancelled tasks
case 'cancelled':
return 4;
default:
return 99; // Fallback for any other status
}
};
return filtered.sort((a, b) => {
const rankA = getStatusRank(a.status);
const rankB = getStatusRank(b.status);
if (rankA !== rankB) {
return rankA - rankB;
}
// For the highest priority group, sort by appointment date
if (rankA === 0) {
const dateA = a.appointmentDate || Infinity;
const dateB = b.appointmentDate || Infinity;
if (dateA === dateB) {
return (a.deadlineDate || Infinity) - (b.deadlineDate || Infinity);
}
return dateA - dateB;
}
// For all other groups, sort by deadline
return (a.deadlineDate || Infinity) - (b.deadlineDate || Infinity);
});
});
@@ -386,7 +434,7 @@
<div v-if="isDetailsPanelOpen || installModal.show || isFcpSelectOpen" @click="closeDetails(); isFcpSelectOpen = false" class="overlay"></div>
</transition>
<div :class="{'panel-open': isDetailsPanelOpen}" class="list-container flex flex-col h-full bg-slate-100">
<div :class="{'panel-open': isDetailsPanelOpen}" class="list-container flex flex-col h-full bg-slate-100 overflow-hidden">
<header class="bg-white shadow p-4 flex-shrink-0 z-10">
<div class="flex justify-between items-center">
<img src="/assets/images/xinon-full.png" alt="Logo" class="h-8 w-auto">
@@ -577,13 +625,12 @@
</div>
</transition>
<!-- FCP Select Modal -->
<transition name="fade">
<div v-if="isFcpSelectOpen" class="fixed inset-0 z-30 flex items-end sm:items-center sm:justify-center p-4 sm:p-0" @click.self="isFcpSelectOpen = false">
<div class="bg-white rounded-t-lg sm:rounded-lg p-4 w-full max-w-sm flex flex-col max-h-[80vh] sm:max-h-[70vh]">
<div v-if="isFcpSelectOpen" class="fixed inset-0 z-30 flex items-center justify-center p-4" @click.self="isFcpSelectOpen = false">
<div class="bg-white rounded-lg p-4 w-full max-w-sm flex flex-col max-h-[80vh]">
<div class="flex justify-between items-center mb-2 flex-shrink-0">
<h3 class="font-bold text-lg">FCP auswählen</h3>
<button @click="isFcpSelectOpen = false" class="p-1 rounded-full hover:bg-slate-100 text-2xl leading-none">&times;</button>
<button @click="isFcpSelectOpen = false" class="p-1 rounded-full hover:bg-slate-100 text-2xl leading-none">×</button>
</div>
<div class="relative mb-2 flex-shrink-0">
<input type="text" v-model="fcpSearchTerm" placeholder="FCP suchen..." class="w-full p-2 pl-8 border border-slate-300 rounded-md">
@@ -646,7 +693,7 @@
<div class="bg-white rounded-lg p-6 w-full max-w-md max-h-[80vh] flex flex-col">
<div class="flex justify-between items-center mb-4 flex-shrink-0">
<h3 class="font-bold text-lg">App installieren</h3>
<button @click="installModal.show = false" class="p-1 rounded-full hover:bg-slate-100">&times;</button>
<button @click="installModal.show = false" class="p-1 rounded-full hover:bg-slate-100">×</button>
</div>
<div class="overflow-y-auto text-sm text-slate-700 space-y-6">
<div>
@@ -698,4 +745,3 @@
<script src="/js/pages/WorkorderBase/WorkorderServiceWorker.js"></script>
</body>
</html>