diff --git a/pages/cart/publishers/myschedule.tsx b/pages/cart/publishers/myschedule.tsx
index 8348491..1e8d5b8 100644
--- a/pages/cart/publishers/myschedule.tsx
+++ b/pages/cart/publishers/myschedule.tsx
@@ -4,13 +4,18 @@ import ProtectedRoute from '../../../components/protectedRoute';
import { UserRole } from '@prisma/client';
import axiosServer from '../../../src/axiosServer';
import common from '../../../src/helpers/common';
-import ShiftsList from '../../../components/publisher/ShiftsList';
+import Modal from 'components/Modal';
+import PublisherSearchBox from '../../../components/publisher/PublisherSearchBox'; // Update the path
import { monthNamesBG, GetTimeFormat, GetDateFormat } from "../../../src/helpers/const"
import { useSession, getSession } from 'next-auth/react';
export default function MySchedulePage({ assignments }) {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [useFilterDate, setUseFilterDate] = useState(true);
+ const [assignment, setАssignment] = useState(null);
+
const { data: session, status } = useSession();
if (status === "loading") {
return
Loading...
;
@@ -23,7 +28,7 @@ export default function MySchedulePage({ assignments }) {
Моите смени
{assignments && assignments.map((assignment) => (
-
+
{assignment.dateStr}
@@ -31,10 +36,22 @@ export default function MySchedulePage({ assignments }) {
- Час
- -
+
-
{GetTimeFormat(assignment.shift.startTime)} - {GetTimeFormat(assignment.shift.endTime)}
+
+
- Смяна
+ -
+ {assignment.shift.assignments.map((a, index) => {
+ return (
+
+ {a.publisher.firstName} {a.publisher.lastName}
+ )
+ }
+ )}
+
+
- Действия
-
@@ -45,11 +62,20 @@ export default function MySchedulePage({ assignments }) {
Добави в календар
+ {/*
+ */}
@@ -58,7 +84,27 @@ export default function MySchedulePage({ assignments }) {
))}
+
setIsModalOpen(false)}
+ forDate={new Date(assignment?.shift.startTime)}
+ useFilterDate={useFilterDate}
+ onUseFilterDateChange={(value) => setUseFilterDate(value)}>
+ {
+ // Add publisher as assignment logic
+ setIsModalOpen(false);
+ console.log("publisher", publisher.firstName, " ", publisher.lastName, " set to shift ", assignment.shift.id);
+ //addAssignment(publisher, shift.id);
+ }}
+ showAllAuto={true}
+ showSearch={true}
+ showList={false}
+ />
+
);
@@ -97,7 +143,21 @@ export const getServerSideProps = async (context) => {
include: {
assignments: {
include: {
- shift: true,
+ shift: {
+ include: {
+ assignments: {
+ include: {
+ publisher: {
+ select: {
+ id: true,
+ firstName: true,
+ lastName: true,
+ }
+ }
+ }
+ }
+ },
+ },
},
},
},