Improve site creation and editing display and optimize date filtering
Adjust dialog content height for better site form visibility and optimize shift retrieval by using SQL date comparison instead of date range filtering. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/BjRzszS
This commit is contained in:
parent
54d0048d5d
commit
3b2c347aec
4
.replit
4
.replit
@ -19,6 +19,10 @@ externalPort = 80
|
|||||||
localPort = 33035
|
localPort = 33035
|
||||||
externalPort = 3001
|
externalPort = 3001
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 37125
|
||||||
|
externalPort = 4200
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 41343
|
localPort = 41343
|
||||||
externalPort = 3000
|
externalPort = 3000
|
||||||
|
|||||||
@ -184,7 +184,7 @@ export default function Sites() {
|
|||||||
Aggiungi Sito
|
Aggiungi Sito
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="max-w-2xl">
|
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Nuovo Sito</DialogTitle>
|
<DialogTitle>Nuovo Sito</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
@ -422,7 +422,7 @@ export default function Sites() {
|
|||||||
|
|
||||||
{/* Edit Site Dialog */}
|
{/* Edit Site Dialog */}
|
||||||
<Dialog open={!!editingSite} onOpenChange={(open) => !open && setEditingSite(null)}>
|
<Dialog open={!!editingSite} onOpenChange={(open) => !open && setEditingSite(null)}>
|
||||||
<DialogContent className="max-w-2xl">
|
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Modifica Sito</DialogTitle>
|
<DialogTitle>Modifica Sito</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
|
|||||||
@ -659,10 +659,6 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
try {
|
try {
|
||||||
const dateStr = req.query.date as string || format(new Date(), "yyyy-MM-dd");
|
const dateStr = req.query.date as string || format(new Date(), "yyyy-MM-dd");
|
||||||
|
|
||||||
// Imposta inizio e fine giornata in UTC
|
|
||||||
const startOfDay = new Date(dateStr + "T00:00:00.000Z");
|
|
||||||
const endOfDay = new Date(dateStr + "T23:59:59.999Z");
|
|
||||||
|
|
||||||
// Ottieni tutti i siti attivi
|
// Ottieni tutti i siti attivi
|
||||||
const allSites = await db
|
const allSites = await db
|
||||||
.select()
|
.select()
|
||||||
@ -690,7 +686,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
return selectedDate >= contractStart && selectedDate <= contractEnd;
|
return selectedDate >= contractStart && selectedDate <= contractEnd;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ottieni turni del giorno con assegnazioni
|
// Ottieni turni del giorno con assegnazioni (usando SQL date comparison)
|
||||||
const dayShifts = await db
|
const dayShifts = await db
|
||||||
.select({
|
.select({
|
||||||
shift: shifts,
|
shift: shifts,
|
||||||
@ -700,8 +696,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
.leftJoin(shiftAssignments, eq(shifts.id, shiftAssignments.shiftId))
|
.leftJoin(shiftAssignments, eq(shifts.id, shiftAssignments.shiftId))
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
gte(shifts.startTime, startOfDay),
|
sql`DATE(${shifts.startTime}) = ${dateStr}`,
|
||||||
lte(shifts.startTime, endOfDay),
|
|
||||||
ne(shifts.status, "cancelled")
|
ne(shifts.status, "cancelled")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user