-
Visione Servizi
+
Planning di Servizio
Visualizza orari e dotazioni per agente fisso, agente mobile o per sito
diff --git a/server/routes.ts b/server/routes.ts
index 1545548..16941e1 100644
--- a/server/routes.ts
+++ b/server/routes.ts
@@ -1501,7 +1501,7 @@ export async function registerRoutes(app: Express): Promise
{
.select()
.from(guards)
.where(eq(guards.location, location as any))
- .orderBy(guards.fullName);
+ .orderBy(guards.firstName, guards.lastName);
// Ottieni tutti i turni della settimana
const allWeekShifts = await db
@@ -1579,7 +1579,7 @@ export async function registerRoutes(app: Express): Promise {
return {
guardId: guard.id,
- guardName: guard.fullName,
+ guardName: `${guard.firstName} ${guard.lastName}`,
badgeNumber: guard.badgeNumber,
shifts,
totalHours,
@@ -1616,7 +1616,7 @@ export async function registerRoutes(app: Express): Promise {
.select()
.from(guards)
.where(eq(guards.location, location as any))
- .orderBy(guards.fullName);
+ .orderBy(guards.firstName, guards.lastName);
// Ottieni tutte le patrol routes della settimana per la sede
const weekRoutes = await db
@@ -1646,7 +1646,7 @@ export async function registerRoutes(app: Express): Promise {
})
.from(patrolRouteStops)
.innerJoin(sites, eq(patrolRouteStops.siteId, sites.id))
- .where(eq(patrolRouteStops.routeId, routeData.route.id))
+ .where(eq(patrolRouteStops.patrolRouteId, routeData.route.id))
.orderBy(asc(patrolRouteStops.sequenceOrder));
return {
@@ -1680,7 +1680,7 @@ export async function registerRoutes(app: Express): Promise {
return {
guardId: guard.id,
- guardName: guard.fullName,
+ guardName: `${guard.firstName} ${guard.lastName}`,
badgeNumber: guard.badgeNumber,
routes: guardRoutes,
totalRoutes,
@@ -1723,7 +1723,7 @@ export async function registerRoutes(app: Express): Promise {
.select()
.from(guards)
.where(eq(guards.location, location as any))
- .orderBy(guards.fullName);
+ .orderBy(guards.firstName, guards.lastName);
// Ottieni tutti i turni della settimana per la sede (con JOIN su sites per filtrare location)
const weekShifts = await db
@@ -1792,7 +1792,7 @@ export async function registerRoutes(app: Express): Promise {
return {
guardId: guard.id,
- guardName: guard.fullName,
+ guardName: `${guard.firstName} ${guard.lastName}`,
badgeNumber: guard.badgeNumber,
shifts,
totalHours,
@@ -1961,7 +1961,7 @@ export async function registerRoutes(app: Express): Promise {
.select()
.from(guards)
.where(eq(guards.location, location as any))
- .orderBy(guards.fullName);
+ .orderBy(guards.firstName, guards.lastName);
// Ottieni tutti i turni del mese per la sede
const monthShifts = await db