diff --git a/_doc/ToDo.md b/_doc/ToDo.md index d111925..abcbef7 100644 --- a/_doc/ToDo.md +++ b/_doc/ToDo.md @@ -238,3 +238,6 @@ in schedule admin - if a publisher is always pair & family is not in the shift - [] new page to show EventLog (substitutions) [] fix "login as" [] list with open shift replacements (coverMe requests) +[] fix statistics +[] add notification to statistics info +[] fix logins (apple/azure) diff --git a/components/ConfirmationModal.tsx b/components/ConfirmationModal.tsx index 787be29..ddf646b 100644 --- a/components/ConfirmationModal.tsx +++ b/components/ConfirmationModal.tsx @@ -1,29 +1,29 @@ import zIndex from "@mui/material/styles/zIndex"; +import ReactDOM from 'react-dom'; export default function ConfirmationModal({ isOpen, onClose, onConfirm, message }) { //export default function ConfirmationModal({ isOpen, onClose, onConfirm, message }) if (!isOpen) return null; - return ( -
-
+ const modalContent = ( +
+

{message}

- -
); + + return ReactDOM.createPortal( + modalContent, + document.getElementById('modal-root') + ); }; // const CustomCalendar = ({ month, year, shifts }) => { // export default function CustomCalendar({ date, shifts }: CustomCalendarProps) { \ No newline at end of file diff --git a/components/layout.tsx b/components/layout.tsx index 7c5639b..77f1073 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -63,6 +63,7 @@ export default function Layout({ children }) {
{children}
+ {/* Modal container */}
diff --git a/components/publisher/PublisherForm.js b/components/publisher/PublisherForm.js index fa81b47..51ae652 100644 --- a/components/publisher/PublisherForm.js +++ b/components/publisher/PublisherForm.js @@ -221,6 +221,15 @@ export default function PublisherForm({ item, me }) { + {/* language preference */} +
+ + +
diff --git a/components/publisher/PublisherSearchBox.js b/components/publisher/PublisherSearchBox.js index 7ad9925..18085c7 100644 --- a/components/publisher/PublisherSearchBox.js +++ b/components/publisher/PublisherSearchBox.js @@ -127,7 +127,7 @@ function PublisherSearchBox({ id, selectedId, onChange, isFocused, filterDate, s ) : null} {showList ? ( // Display only clickable list of all publishers -
+ ) : null + } + ); } diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 098b95b..6020c99 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -70,21 +70,6 @@ export const authOptions: NextAuthOptions = { password: { label: "Парола", type: "password" } }, async authorize(credentials, req) { - //const user = { id: "1", name: "Администратора", email: "jsmith@example.com" } - //return user - // const res = await fetch("/your/endpoint", { - // method: 'POST', - // body: JSON.stringify(credentials), - // headers: { "Content-Type": "application/json" } - // }) - // const user = await res.json() - - // // If no error and we have user data, return it - // if (res.ok && user) { - // return user - // } - // // Return null if user data could not be retrieved - // return null const users = [ { id: "1", name: "admin", email: "admin@example.com", password: "admin123", role: "ADMIN", static: true }, { id: "2", name: "krasi", email: "krasi@example.com", password: "krasi123", role: "ADMIN", static: true }, @@ -272,6 +257,8 @@ export const authOptions: NextAuthOptions = { verifyRequest: "/auth/verify-request", // (used for check email message) newUser: null // If set, new users will be directed here on first sign in }, + + debug: process.env.NODE_ENV === 'development', } export default NextAuth(authOptions) \ No newline at end of file diff --git a/pages/api/index.ts b/pages/api/index.ts index f928d8c..330c407 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -361,7 +361,8 @@ export default async function handler(req, res) { res.status(200).json(data); break; case "getAllPublishersWithStatistics": - res.status(200).json(await dataHelper.getAllPublishersWithStatistics(day)); + let noEndDate = common.parseBool(req.query.noEndDate); + res.status(200).json(await dataHelper.getAllPublishersWithStatistics(day, noEndDate)); default: res.status(200).json({ @@ -834,8 +835,8 @@ async function replaceInAssignment(oldPublisherId, newPublisherId, shiftId) { where: { id: shiftId }, - select: { - startTime: true, + + include: { cartEvent: { select: { location: { @@ -844,9 +845,7 @@ async function replaceInAssignment(oldPublisherId, newPublisherId, shiftId) { } } } - } - }, - include: { + }, assignments: { include: { publisher: { @@ -879,7 +878,7 @@ async function replaceInAssignment(oldPublisherId, newPublisherId, shiftId) { publisher: { connect: { id: oldPublisherId } }, shift: { connect: { id: shiftId } }, type: EventLogType.AssignmentReplacementManual, - content: "Въведено заместване от " + originalPublisher.firstName + " " + originalPublisher.lastName + ". Ще го замества " + newPublisher.firstName + " " + newPublisher.lastName + "." + content: "Заместване въведено от " + originalPublisher.firstName + " " + originalPublisher.lastName + ". Ще го замества " + newPublisher.firstName + " " + newPublisher.lastName + "." } }); diff --git a/pages/cart/publishers/index.tsx b/pages/cart/publishers/index.tsx index 896ec40..493fe3e 100644 --- a/pages/cart/publishers/index.tsx +++ b/pages/cart/publishers/index.tsx @@ -8,11 +8,13 @@ import Layout from "../../../components/layout"; import PublisherCard from "../../../components/publisher/PublisherCard"; import axiosInstance from "../../../src/axiosSecure"; import axiosServer from '../../../src/axiosServer'; +const common = require("../../../src/helpers/common"); import toast from "react-hot-toast"; import { levenshteinEditDistance } from "levenshtein-edit-distance"; import ProtectedRoute from '../../../components/protectedRoute'; import ConfirmationModal from '../../../components/ConfirmationModal'; +import { relative } from "path"; @@ -164,7 +166,7 @@ function PublishersPage({ publishers = [] }: IProps) { return ( -
+
Добави вестител @@ -195,23 +197,24 @@ function PublishersPage({ publishers = [] }: IProps) {
-
- - - -