View | Details | Raw Unified | Return to bug 37707
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js (-1 / +104 lines)
Lines 922-927 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
922
                    );
922
                    );
923
                }
923
                }
924
924
925
                // Create feedback message container below the calendar
926
                let feedbackDiv = periodPicker.calendarContainer.querySelector(
927
                    ".booking-conflict-feedback"
928
                );
929
                if (!feedbackDiv) {
930
                    feedbackDiv = document.createElement("div");
931
                    feedbackDiv.className = "booking-conflict-feedback";
932
                    feedbackDiv.style.cssText =
933
                        "padding: 8px 12px; margin-top: 8px; border-radius: 4px; font-size: 13px; min-height: 20px; text-align: center;";
934
                    periodPicker.calendarContainer.appendChild(feedbackDiv);
935
                }
936
925
                // Add hints for days before the start range and after the end range
937
                // Add hints for days before the start range and after the end range
926
                periodPicker.calendarContainer.addEventListener(
938
                periodPicker.calendarContainer.addEventListener(
927
                    "mouseover",
939
                    "mouseover",
Lines 1291-1296 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
1291
                                    true
1303
                                    true
1292
                                );
1304
                                );
1293
                            }
1305
                            }
1306
1307
                            // Update feedback message
1308
                            const feedbackDiv =
1309
                                periodPicker.calendarContainer.querySelector(
1310
                                    ".booking-conflict-feedback"
1311
                                );
1312
                            if (feedbackDiv) {
1313
                                let message = "";
1314
                                let messageType = "info"; // info, warning, error
1315
1316
                                if (leadDisable || trailDisable) {
1317
                                    messageType = "error";
1318
                                    if (
1319
                                        leadDisable &&
1320
                                        !periodPicker.selectedDates[0]
1321
                                    ) {
1322
                                        // Check what type of conflict
1323
                                        if (
1324
                                            target.classList.contains(
1325
                                                "existingBookingTrail"
1326
                                            )
1327
                                        ) {
1328
                                            message = `Cannot select: Lead period (${leadDays} days before start) conflicts with existing booking's processing time`;
1329
                                        } else {
1330
                                            message = `Cannot select: Lead period (${leadDays} days before start) conflicts with existing booking`;
1331
                                        }
1332
                                    } else if (trailDisable) {
1333
                                        // Check what type of conflict
1334
                                        if (
1335
                                            target.classList.contains(
1336
                                                "existingBookingLead"
1337
                                            )
1338
                                        ) {
1339
                                            message = `Cannot select: Processing period (${trailDays} days after return) conflicts with existing booking's preparation time`;
1340
                                        } else {
1341
                                            message = `Cannot select: Processing period (${trailDays} days after return) conflicts with existing booking`;
1342
                                        }
1343
                                    }
1344
                                } else {
1345
                                    // Show helpful info about lead/trail periods
1346
                                    if (!periodPicker.selectedDates[0]) {
1347
                                        message = `Selecting start date. Lead period: ${leadDays} days for item preparation`;
1348
                                        messageType = "info";
1349
                                    } else {
1350
                                        message = `Selecting end date. Processing period: ${trailDays} days after return`;
1351
                                        messageType = "info";
1352
                                    }
1353
1354
                                    // Show if periods are visible
1355
                                    if (
1356
                                        target.classList.contains(
1357
                                            "existingBookingLead"
1358
                                        )
1359
                                    ) {
1360
                                        message +=
1361
                                            " • Hovering existing booking preparation period";
1362
                                    } else if (
1363
                                        target.classList.contains(
1364
                                            "existingBookingTrail"
1365
                                        )
1366
                                    ) {
1367
                                        message +=
1368
                                            " • Hovering existing booking processing period";
1369
                                    }
1370
                                }
1371
1372
                                feedbackDiv.textContent = message;
1373
                                feedbackDiv.style.display = message
1374
                                    ? "block"
1375
                                    : "none";
1376
1377
                                // Style based on message type
1378
                                if (messageType === "error") {
1379
                                    feedbackDiv.style.backgroundColor =
1380
                                        "#f8d7da";
1381
                                    feedbackDiv.style.color = "#721c24";
1382
                                    feedbackDiv.style.border =
1383
                                        "1px solid #f5c6cb";
1384
                                } else if (messageType === "warning") {
1385
                                    feedbackDiv.style.backgroundColor =
1386
                                        "#fff3cd";
1387
                                    feedbackDiv.style.color = "#856404";
1388
                                    feedbackDiv.style.border =
1389
                                        "1px solid #ffeeba";
1390
                                } else {
1391
                                    feedbackDiv.style.backgroundColor =
1392
                                        "#d1ecf1";
1393
                                    feedbackDiv.style.color = "#0c5460";
1394
                                    feedbackDiv.style.border =
1395
                                        "1px solid #bee5eb";
1396
                                }
1397
                            }
1294
                        }
1398
                        }
1295
                    }
1399
                    }
1296
                );
1400
                );
1297
- 

Return to bug 37707