renames
This commit is contained in:
@ -100,7 +100,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
console.log("Setting date to '" + date.toLocaleDateString() + "' from '" + selectedDate.toLocaleDateString() + "'. ISO: " + date.toISOString(), "locale ISO:", common.getISODateOnly(date));
|
||||
if (isCheckboxChecked) {
|
||||
console.log(`getting unassigned publishers for ${common.getMonthName(date.getMonth())} ${date.getFullYear()}`);
|
||||
const { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=getUnassignedPublishers&date=${dateStr}&select=id,firstName,lastName,isactive,desiredShiftsPerMonth`);
|
||||
const { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=getUnassignedPublishers&date=${dateStr}&select=id,firstName,lastName,isActive,desiredShiftsPerMonth`);
|
||||
setAvailablePubs(availablePubsForDate);
|
||||
}
|
||||
else {
|
||||
@ -108,7 +108,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
try {
|
||||
const { data: shiftsForDate } = await axiosInstance.get(`/api/?action=getShiftsForDay&date=${dateStr}`);
|
||||
setShifts(shiftsForDate);
|
||||
let { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=filterPublishers&assignments=true&availabilities=true&date=${dateStr}&select=id,firstName,lastName,isactive,desiredShiftsPerMonth`);
|
||||
let { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=filterPublishers&assignments=true&availabilities=true&date=${dateStr}&select=id,firstName,lastName,isActive,desiredShiftsPerMonth`);
|
||||
|
||||
availablePubsForDate.forEach(pub => {
|
||||
pub.canTransport = pub.availabilities.some(av =>
|
||||
@ -172,8 +172,8 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
// currentMonthAssignments and previousMonthAssignments properties
|
||||
// Sort publishers based on availability and then by assignment counts.
|
||||
const sortedPubs = updatedPubs.sort((a, b) => {
|
||||
if (a.isactive !== b.isactive) {
|
||||
return a.isactive ? -1 : 1;
|
||||
if (a.isActive !== b.isActive) {
|
||||
return a.isActive ? -1 : 1;
|
||||
}
|
||||
// First, sort by isselected.
|
||||
if (a.isSelected !== b.isSelected) {
|
||||
@ -355,7 +355,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
const newAssignment = {
|
||||
publisher: { connect: { id: publisher.id } },
|
||||
shift: { connect: { id: shiftId } },
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
isConfirmed: true
|
||||
};
|
||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||
@ -669,7 +669,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
// Determine border class if selected
|
||||
const selectedBorderClass = pub.isSelected ? 'border-blue-400 border-b-4' : '';
|
||||
// Determine opacity class
|
||||
const activeOpacityClass = pub.isactive ? '' : 'opacity-25';
|
||||
const activeOpacityClass = pub.isActive ? '' : 'opacity-25';
|
||||
|
||||
|
||||
return (
|
||||
@ -878,20 +878,20 @@ export const getServerSideProps = async (context) => {
|
||||
const url = `/api/data/shifts?where={"startTime":{"$and":[{"$gte":"${common.getISODateOnly(firstDayOfMonth)}","$lt":"${common.getISODateOnly(lastDayOfMonth)}"}]}}`;
|
||||
|
||||
const prismaClient = common.getPrismaClient();
|
||||
// let events = await prismaClient.cartEvent.findMany({ where: { isactive: true } });
|
||||
// let events = await prismaClient.cartEvent.findMany({ where: { isActive: true } });
|
||||
// events = events.map(event => ({
|
||||
// ...event,
|
||||
// // Convert Date objects to ISO strings
|
||||
// startTime: event.startTime.toISOString(),
|
||||
// endTime: event.endTime.toISOString(),
|
||||
// }));
|
||||
const { data: events } = await axios.get(`/api/data/cartevents?where={"isactive":true}`);
|
||||
const { data: events } = await axios.get(`/api/data/cartevents?where={"isActive":true}`);
|
||||
//const { data: shifts } = await axios.get(url);
|
||||
|
||||
// get all shifts for the month, including assigments
|
||||
let shifts = await prismaClient.shift.findMany({
|
||||
where: {
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
startTime: {
|
||||
gte: firstDayOfMonth,
|
||||
//lt: lastDayOfMonth
|
||||
|
Reference in New Issue
Block a user