fix bugs 31 ordibehesht

main
حسین معصومی پور 2024-05-20 22:03:46 +03:30
parent 94d03ca1ae
commit f548d3e1ec
30 changed files with 8066 additions and 362 deletions

View File

@ -6,6 +6,8 @@ import Buttonbriz from "plugins/Buttonbriz/page";
import Input from "plugins/Input/page";
import React, { useContext, useRef, useState } from "react";
import SimpleReactValidator from "simple-react-validator";
import PersianNumber from "plugins/PersianNumber";
import moment from "jalali-moment";
const ActivityCard = ({ data }) => {
const CTX = useContext(AppContext);
@ -83,6 +85,15 @@ const ActivityCard = ({ data }) => {
<div className=" w-fit relative text-[11px] rounded-full bg-gray-300 text-black px-2 h-fit">
{data?.userFullName}
</div>
{data?.doneAt !== "0001-01-01T00:00:00" && (
<div className=" w-fit relative text-[11px] rounded-full bg-primary-100 text-primary-300 px-2 h-fit mr-1 mt-[-1px]">
<PersianNumber
number={moment(data?.doneAt).locale("fa").format("HH:mm")}
style={"!text-[11px]"}
/>{" "}
</div>
)}
</div>
</div>

View File

@ -1,4 +1,24 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
const withPWA = require("@ducanh2912/next-pwa").default({
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
swcMinify: true,
dest: "public",
fallbacks: {
//image: "/static/images/fallback.png",
document: "/offline", // if you want to fallback to a custom page rather than /_offline
// font: '/static/font/fallback.woff2',
// audio: ...,
// video: ...,
},
workboxOptions: {
disableDevLogs: true,
},
// ... other options you like
});
const nextConfig = {};
module.exports = withPWA(nextConfig);

3840
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,11 @@
"lint": "next lint"
},
"dependencies": {
"@ducanh2912/next-pwa": "^10.2.7",
"@emailjs/browser": "^3.11.0",
"@hassanmojab/react-modern-calendar-datepicker": "^3.1.7",
"@react-three/drei": "^9.88.11",
"@react-three/fiber": "^8.15.9",
"@uidotdev/usehooks": "^2.4.0",
"autoprefixer": "10.4.15",
"axios": "^1.5.1",
@ -19,6 +23,7 @@
"framer-motion": "^10.16.1",
"jalali-moment": "^3.3.11",
"lodash": "^4.17.21",
"maath": "^0.10.4",
"next": "13.4.19",
"postcss": "8.4.28",
"rc-slider": "^10.5.0",
@ -27,18 +32,14 @@
"react-dom": "18.2.0",
"react-infinite-scroll-component": "^6.1.0",
"react-modern-calendar-datepicker": "^3.1.6",
"react-router-dom": "^6.18.0",
"react-spring-bottom-sheet": "^3.4.1",
"react-tilt": "^1.0.2",
"react-toastify": "^9.1.3",
"react-vertical-timeline-component": "^3.6.0",
"simple-react-validator": "^1.6.2",
"swiper": "^10.2.0",
"tailwindcss": "3.3.3",
"@emailjs/browser": "^3.11.0",
"@react-three/drei": "^9.88.11",
"@react-three/fiber": "^8.15.9",
"maath": "^0.10.4",
"react-router-dom": "^6.18.0",
"react-tilt": "^1.0.2",
"react-vertical-timeline-component": "^3.6.0"
"tailwindcss": "3.3.3"
},
"devDependencies": {
"css-loader": "^6.8.1",

View File

@ -10,6 +10,7 @@ import Buttonbriz from "plugins/Buttonbriz/page";
import { toast } from "react-toastify";
import moment from "jalali-moment";
import HasPermission from "plugins/HasPermission/page";
import PersianNumber from "plugins/PersianNumber";
const BottomFilterActivities = (props) => {
const CTX = useContext(AppContext);
@ -22,6 +23,8 @@ const BottomFilterActivities = (props) => {
const handleChangeFilter = () => {
CTX.GetActivity(null, null, 0, typeFilter);
CTX.setBottomFilterActivitiesOpen(false);
CTX.setStopGetActivities(false);
CTX.setPageGetActivity(0);
};
return (
@ -36,13 +39,41 @@ const BottomFilterActivities = (props) => {
</div>
<div className="bg-body-100 p-3 ">
<div
className={`rounded-xl border-[1px] border-gray-200 p-5 m-2 tr03 ${
typeFilter == 3 ? " bg-primary-100" : "bg-gray-100 "
}`}
onClick={() => handleFilterActivity(3)}
>
<p className="mb-0 text-right">
اکتیویتی های دیروز
<small className="mr-2">
<PersianNumber
number={moment()
.locale("fa")
.subtract(1, "day")
.format("D MMMM YYYY")}
style="mx-1 text-sm !text-gray-600"
/>
</small>
</p>
</div>
<div
className={`rounded-xl border-[1px] border-gray-200 p-5 m-2 tr03 ${
typeFilter == 0 ? " bg-primary-100" : "bg-gray-100 "
}`}
onClick={() => handleFilterActivity(0)}
>
<p className="mb-0 text-right">اکتیویتی های امروز</p>
<p className="mb-0 text-right">
اکتیویتی های امروز
<small className="mr-2">
<PersianNumber
number={moment().locale("fa").format("D MMMM YYYY")}
style="mx-1 text-sm !text-gray-600"
/>
</small>
</p>
</div>
<div
@ -51,7 +82,18 @@ const BottomFilterActivities = (props) => {
}`}
onClick={() => handleFilterActivity(1)}
>
<p className="mb-0 text-right">اکتیویتی های فردا</p>
<p className="mb-0 text-right">
اکتیویتی های فردا
<small className="mr-2">
<PersianNumber
number={moment()
.locale("fa")
.add(1, "day")
.format("D MMMM YYYY")}
style="mx-1 text-sm !text-gray-600"
/>
</small>
</p>
</div>
<div

View File

@ -66,15 +66,43 @@ const BottomSheetReportManageShift = (props) => {
// Sort the groupedArray by the planFor date
groupedArray.sort((a, b) => new Date(a.planFor) - new Date(b.planFor));
console.log(groupedArray);
setShiftplans(groupedArray);
};
const formatShiftPlans = () => {
let formattedText = "";
shiftplans.forEach((e, dayIndex) => {
if (dayIndex > 0) {
formattedText += "\n\n\n"; // Add three newlines between each day
}
formattedText += `${moment(e.planFor)
.locale("fa")
.format("dddd، jD jMMMM jYYYY")}\n\n`;
e.data.forEach((shift, shiftIndex) => {
if (shiftIndex > 0) {
formattedText += "\n"; // Add one newline between each shift
}
formattedText += `${shift.shiftTitle}\n`;
shift.users.forEach((user) => {
formattedText += `${user.positionName} : ${user.userFullName}\n`;
});
formattedText += `سوپروایزر : ${shift.supervisorFullName}\n`;
});
});
return formattedText.trim(); // Trim the final result to remove any leading/trailing newlines
};
useEffect(() => {
groupObjectsByPlanFor(shiftplansData);
}, [shiftplansData]);
console.log(shiftplans);
console.log("shiftplans", shiftplans);
return (
<BottomSheet
@ -90,53 +118,45 @@ const BottomSheetReportManageShift = (props) => {
<div className="px-3 pt-10 ">
<p id="MYTEXT" className="mb-0 text-center text-sm font-light">
{shiftplans?.map((e, index) => (
<>
<div className={`h-fit mb-10`}>
<div className={`flex justify-between rtl`}>
<div className="flex">
<PersianNumber
number={moment(e.planFor).format("jYYYY/jM/jD")}
/>
<div key={index} className="mb-4 h-fit mb-10">
<div className="flex justify-between rtl mb-2">
<div className="flex">
<PersianNumber
number={moment(e.planFor)
.locale("fa")
.format("dddd، jD jMMMM jYYYY")}
/>
</div>
</div>
{e.data.map((shift, shiftIndex) => (
<div key={shiftIndex} className="rtl mb-3">
<div className="flex justify-between mb-2">
<div className="ml-2 rounded-xl">
<p className="text-sm mb-0 text-gray-700 font-medium">
{shift.shiftTitle}
</p>
</div>
</div>
<div className="flex flex-wrap mb-2">
{shift.users.map((user, userIndex) => (
<div
key={userIndex}
className="flex p-1 rounded-full w-fit"
>
<p className="mb-0 text-[12px] font-medium">
{user.positionName} : {user.userFullName}
</p>
</div>
))}
<div className="flex p-1 rounded-full w-fit">
<p className="mb-0 text-[12px] font-medium text-red-600">
سوپروایزر : {shift.supervisorFullName}
</p>
</div>
</div>
</div>
<>
{e.data.map((e) => (
<div className=" rtl">
<div className="flex justify-between">
<div className="ml-2 rounded-xl ">
<p className="text-sm mb-0 text-gray-700 font-medium">
{" "}
{e.shiftTitle}
</p>
</div>
</div>
<div className="flex flex-wrap">
{e.users.map((i) => (
<div className="flex p-1 rounded-full w-fit ">
<p className="mb-0 text-[12px] font-medium">
{i.positionName} :{" "}
</p>{" "}
<p className="mb-0 text-[12px] mr-1">
{i.userFullName}
</p>
</div>
))}
<div className="flex p-1 rounded-full w-fit ">
<p className="mb-0 text-[12px] font-medium text-red-600 ">
سوپروایزر :{" "}
</p>{" "}
<p className="mb-0 text-[12px] mr-1 font-medium text-red-600 ">
{e.supervisorFullName}
</p>
</div>
</div>
</div>
))}
</>
</div>
</>
))}
</div>
))}
</p>
</div>
@ -147,13 +167,13 @@ const BottomSheetReportManageShift = (props) => {
color="INFO"
icon="CHECK"
buttonEvent={() => {
var text = document.getElementById("MYTEXT").innerText;
var elem = document.createElement("textarea");
document.body.appendChild(elem);
elem.value = text;
elem.select();
document.execCommand("copy");
document.body.removeChild(elem);
const text = formatShiftPlans();
navigator.clipboard
.writeText(text)
.then(() => {
toast.success("کپی شد");
})
.catch((err) => {});
}}
/>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

View File

@ -0,0 +1,102 @@
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@ducanh2912/next-pwa/dist/fallback.js":
/*!************************************************************!*\
!*** ./node_modules/@ducanh2912/next-pwa/dist/fallback.js ***!
\************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\nself.fallback = async (_)=>{\n let { destination: e, url: A } = _, s = {\n document: \"/offline\",\n image: false,\n audio: false,\n video: false,\n font: false\n }[e];\n return s ? caches.match(s, {\n ignoreSearch: !0\n }) : \"\" === e && false && 0 ? 0 : Response.error();\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2R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S19EQVRBX18gJiYgQS5tYXRjaCgvXFwvX25leHRcXC9kYXRhXFwvLitcXC8uK1xcLmpzb24kL2kpID8gY2FjaGVzLm1hdGNoKHByb2Nlc3MuZW52Ll9fUFdBX0ZBTExCQUNLX0RBVEFfXywge1xuICAgICAgICBpZ25vcmVTZWFyY2g6ICEwXG4gICAgfSkgOiBSZXNwb25zZS5lcnJvcigpO1xufTsiXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/@ducanh2912/next-pwa/dist/fallback.js\n"));
/***/ })
/******/ });
/************************************************************************/
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/trusted types policy */
/******/ !function() {
/******/ var policy;
/******/ __webpack_require__.tt = function() {
/******/ // Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.
/******/ if (policy === undefined) {
/******/ policy = {
/******/ createScript: function(script) { return script; }
/******/ };
/******/ if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {
/******/ policy = trustedTypes.createPolicy("nextjs#bundler", policy);
/******/ }
/******/ }
/******/ return policy;
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/trusted types script */
/******/ !function() {
/******/ __webpack_require__.ts = function(script) { return __webpack_require__.tt().createScript(script); };
/******/ }();
/******/
/******/ /* webpack/runtime/react refresh */
/******/ !function() {
/******/ if (__webpack_require__.i) {
/******/ __webpack_require__.i.push(function(options) {
/******/ var originalFactory = options.factory;
/******/ options.factory = function(moduleObject, moduleExports, webpackRequire) {
/******/ var hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$;
/******/ var cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : function() {};
/******/ try {
/******/ originalFactory.call(this, moduleObject, moduleExports, webpackRequire);
/******/ } finally {
/******/ cleanup();
/******/ }
/******/ }
/******/ })
/******/ }
/******/ }();
/******/
/******/ /* webpack/runtime/compat */
/******/
/******/
/******/ // noop fns to prevent runtime errors during initialization
/******/ if (typeof self !== "undefined") {
/******/ self.$RefreshReg$ = function () {};
/******/ self.$RefreshSig$ = function () {
/******/ return function (type) {
/******/ return type;
/******/ };
/******/ };
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./node_modules/@ducanh2912/next-pwa/dist/fallback.js"](0, __webpack_exports__, __webpack_require__);
/******/
/******/ })()
;

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
public/favicon.ico 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,24 @@
{
"name": "brizco",
"short_name": "briz",
"description": "harmonious Routine Management",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#356859",
"orientation": "any",
"scope": "/",
"icons": [
{
"src": "../public/images/logo2.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "../public/images/logo2.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-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8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1891.000000pt" height="1891.000000pt" viewBox="0 0 1891.000000 1891.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1891.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M3167 13028 c15 -28 273 -506 573 -1062 l546 -1011 49 2 c28 0 2596
185 5708 409 l5657 409 0 652 0 653 -6281 0 -6280 0 28 -52z"/>
<path d="M3140 9454 l0 -1407 48 7 c39 5 12275 1471 12455 1492 l57 7 0 342 0
343 -92 7 c-94 6 -12410 615 -12448 615 l-20 0 0 -1406z"/>
<path d="M9645 8159 c-179 -24 -352 -90 -501 -189 -108 -72 -265 -235 -333
-344 -293 -473 -216 -1075 186 -1457 209 -199 448 -301 740 -316 734 -38 1316
614 1198 1343 -77 475 -438 850 -914 949 -94 19 -285 27 -376 14z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1013 B

View File

@ -0,0 +1,19 @@
{
"name": "briz",
"short_name": "briz",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

115
public/sw.js 100644
View File

@ -0,0 +1,115 @@
/**
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If the loader is already loaded, just stop.
if (!self.define) {
let registry = {};
// Used for `eval` and `importScripts` where we can't get script URL by other means.
// In both cases, it's safe to use a global var because those functions are synchronous.
let nextDefineUri;
const singleRequire = (uri, parentUri) => {
uri = new URL(uri + ".js", parentUri).href;
return registry[uri] || (
new Promise(resolve => {
if ("document" in self) {
const script = document.createElement("script");
script.src = uri;
script.onload = resolve;
document.head.appendChild(script);
} else {
nextDefineUri = uri;
importScripts(uri);
resolve();
}
})
.then(() => {
let promise = registry[uri];
if (!promise) {
throw new Error(`Module ${uri} didnt register its module`);
}
return promise;
})
);
};
self.define = (depsNames, factory) => {
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
if (registry[uri]) {
// Module is already loading or loaded.
return;
}
let exports = {};
const require = depUri => singleRequire(depUri, uri);
const specialDeps = {
module: { uri },
exports,
require
};
registry[uri] = Promise.all(depsNames.map(
depName => specialDeps[depName] || require(depName)
)).then(deps => {
factory(...deps);
return exports;
});
};
}
define(['./workbox-1e54d6fe'], (function (workbox) { 'use strict';
importScripts("/fallback-development.js");
self.skipWaiting();
workbox.clientsClaim();
/**
* The precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
workbox.precacheAndRoute([{
"url": "/offline",
"revision": "development"
}], {
"ignoreURLParametersMatching": [/^utm_/, /^fbclid$/, /ts/]
});
workbox.cleanupOutdatedCaches();
workbox.registerRoute("/", new workbox.NetworkFirst({
"cacheName": "start-url",
plugins: [{
cacheWillUpdate: async ({
response: e
}) => e && "opaqueredirect" === e.type ? new Response(e.body, {
status: 200,
statusText: "OK",
headers: e.headers
}) : e
}, {
handlerDidError: async ({
request: e
}) => "undefined" != typeof self ? self.fallback(e) : Response.error()
}]
}), 'GET');
workbox.registerRoute(/.*/i, new workbox.NetworkOnly({
"cacheName": "dev",
plugins: [{
handlerDidError: async ({
request: e
}) => "undefined" != typeof self ? self.fallback(e) : Response.error()
}]
}), 'GET');
self.__WB_DISABLE_DEV_LOGS = true;
}));
//# sourceMappingURL=sw.js.map

1
public/sw.js.map 100644

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,102 @@
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@ducanh2912/next-pwa/dist/sw-entry-worker.js":
/*!*******************************************************************!*\
!*** ./node_modules/@ducanh2912/next-pwa/dist/sw-entry-worker.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\nself.onmessage = async (e)=>{\n switch(e.data.type){\n case \"__START_URL_CACHE__\":\n {\n let t = e.data.url, a = await fetch(t);\n if (!a.redirected) return (await caches.open(\"start-url\")).put(t, a);\n return Promise.resolve();\n }\n case \"__FRONTEND_NAV_CACHE__\":\n {\n let t = e.data.url, a = await caches.open(\"pages\");\n if (await a.match(t, {\n ignoreSearch: !0\n })) return;\n let s = await fetch(t);\n if (!s.ok) return;\n if (a.put(t, s.clone()), e.data.shouldCacheAggressively && s.headers.get(\"Content-Type\")?.includes(\"text/html\")) try {\n let e = await s.text(), t = [], a = await caches.open(\"static-style-assets\"), r = await caches.open(\"next-static-js-assets\"), c = await caches.open(\"static-js-assets\");\n for (let [s, r] of e.matchAll(/<link.*?href=['\"](.*?)['\"].*?>/g))/rel=['\"]stylesheet['\"]/.test(s) && t.push(a.match(r).then((e)=>e ? Promise.resolve() : a.add(r)));\n for (let [, a] of e.matchAll(/<script.*?src=['\"](.*?)['\"].*?>/g)){\n let e = /\\/_next\\/static.+\\.js$/i.test(a) ? r : c;\n t.push(e.match(a).then((t)=>t ? Promise.resolve() : e.add(a)));\n }\n return await Promise.all(t);\n } catch {}\n return Promise.resolve();\n }\n default:\n return Promise.resolve();\n }\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvQGR1Y2FuaDI5MTIvbmV4dC1wd2EvZGlzdC9zdy1lbnRyeS13b3JrZXIuanMiLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWlCO0FBQ2pCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esa0JBQWtCO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZXMiOlsid2VicGFjazovL19OX0UvLi9ub2RlX21vZHVsZXMvQGR1Y2FuaDI5MTIvbmV4dC1wd2EvZGlzdC9zdy1lbnRyeS13b3JrZXIuanM/NmM4NCJdLCJzb3VyY2VzQ29udGVudCI6WyJzZWxmLm9ubWVzc2FnZSA9IGFzeW5jIChlKT0+e1xuICAgIHN3aXRjaChlLmRhdGEudHlwZSl7XG4gICAgICAgIGNhc2UgXCJfX1NUQVJUX1VSTF9DQUNIRV9fXCI6XG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgbGV0IHQgPSBlLmRhdGEudXJsLCBhID0gYXdhaXQgZmV0Y2godCk7XG4gICAgICAgICAgICAgICAgaWYgKCFhLnJlZGlyZWN0ZWQpIHJldHVybiAoYXdhaXQ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3R5bGVzaGVldFsnXCJdLy50ZXN0KHMpICYmIHQucHVzaChhLm1hdGNoKHIpLnRoZW4oKGUpPT5lID8gUHJvbWlzZS5yZXNvbHZlKCkgOiBhLmFkZChyKSkpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBbLCBhXSBvZiBlLm1hdGNoQWxsKC88c2NyaXB0Lio/c3JjPVsnXCJdKC4qPylbJ1wiXS4qPz4vZykpe1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGUgPSAvXFwvX25leHRcXC9zdGF0aWMuK1xcLmpzJC9pLnRlc3QoYSkgPyByIDogYztcbiAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChlLm1hdGNoKGEpLnRoZW4oKHQpPT50ID8gUHJvbWlzZS5yZXNvbHZlKCkgOiBlLmFkZChhKSkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBQcm9taXNlLmFsbCh0KTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoICB7fVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICB9XG59OyJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/@ducanh2912/next-pwa/dist/sw-entry-worker.js\n"));
/***/ })
/******/ });
/************************************************************************/
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/trusted types policy */
/******/ !function() {
/******/ var policy;
/******/ __webpack_require__.tt = function() {
/******/ // Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.
/******/ if (policy === undefined) {
/******/ policy = {
/******/ createScript: function(script) { return script; }
/******/ };
/******/ if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {
/******/ policy = trustedTypes.createPolicy("nextjs#bundler", policy);
/******/ }
/******/ }
/******/ return policy;
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/trusted types script */
/******/ !function() {
/******/ __webpack_require__.ts = function(script) { return __webpack_require__.tt().createScript(script); };
/******/ }();
/******/
/******/ /* webpack/runtime/react refresh */
/******/ !function() {
/******/ if (__webpack_require__.i) {
/******/ __webpack_require__.i.push(function(options) {
/******/ var originalFactory = options.factory;
/******/ options.factory = function(moduleObject, moduleExports, webpackRequire) {
/******/ var hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$;
/******/ var cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : function() {};
/******/ try {
/******/ originalFactory.call(this, moduleObject, moduleExports, webpackRequire);
/******/ } finally {
/******/ cleanup();
/******/ }
/******/ }
/******/ })
/******/ }
/******/ }();
/******/
/******/ /* webpack/runtime/compat */
/******/
/******/
/******/ // noop fns to prevent runtime errors during initialization
/******/ if (typeof self !== "undefined") {
/******/ self.$RefreshReg$ = function () {};
/******/ self.$RefreshSig$ = function () {
/******/ return function (type) {
/******/ return type;
/******/ };
/******/ };
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./node_modules/@ducanh2912/next-pwa/dist/sw-entry-worker.js"](0, __webpack_exports__, __webpack_require__);
/******/
/******/ })()
;

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>

Before

Width:  |  Height:  |  Size: 629 B

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -934,62 +934,7 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
// const UpdateShiftPlan = async (body, id) => {
// setLoading(true);
// try {
// const data = await Chapar.put(
// `${process.env.NEXT_PUBLIC_API_URL}/shift/plan`,
// body,
// {
// headers: {
// Authorization: "Bearer " + localStorage.getItem("token"),
// },
// }
// );
// toast.success(`شیفت ویرایش شد`, {
// position: "bottom-right",
// closeOnClick: true,
// });
// setLoading(false);
// setShiftPlanData(id);
// router.push("/shifts");
// } catch ({ error, status }) {
// toast.error(`${error?.response?.data?.message}`, {
// position: "bottom-right",
// closeOnClick: true,
// });
// setLoading(false);
// }
// };
// const CreateShifPlan = async (body) => {
// setLoading(true);
// try {
// const data = await Chapar.post(
// `${process.env.NEXT_PUBLIC_API_URL}/shift/plan`,
// JSON.stringify(body),
// {
// headers: {
// Authorization: "Bearer " + localStorage.getItem("token"),
// },
// }
// );
// toast.success(`مدیریت شیفت ساخته شد`, {
// position: "bottom-right",
// closeOnClick: true,
// });
// router.push("/shifts");
// } catch ({ error, status }) {
// toast.error(`${error?.response?.data?.message}`, {
// position: "bottom-right",
// closeOnClick: true,
// });
// setLoading(false);
// }
// };
const GetShifPlans = async (page, dataFilter) => {
setLoading(true);
try {
@ -1307,7 +1252,7 @@ export default function RootLayout({ children }) {
const data = await Chapar.get(
`${process.env.NEXT_PUBLIC_API_URL}/activity?page=${page}${
date ? `&selectedDate=${date}` : ""
}${shift ? `&selectedShift=${shift}` : ""}${
}${shift ? `&selectedShiftPlanId=${shift}` : ""}${
dateQueryFilter != null ? `&dateQueryFilter=${dateQueryFilter}` : ""
}`,
@ -1545,7 +1490,7 @@ export default function RootLayout({ children }) {
setLoading(true);
try {
const data = await Chapar.get(
`${process.env.NEXT_PUBLIC_API_URL}/page/dashboard/app`,
`${process.env.NEXT_PUBLIC_API_URL}/page/app/dashboard`,
{
headers: {

View File

@ -98,19 +98,19 @@ const CompleteShift = () => {
if (selectDayForShift == 0) {
CTX.GetActivity(
moment().locale("fa").subtract(1, "day").unix() * 1000,
id,
siftsData[index].currentShiftPlanId,
0
);
} else if (selectDayForShift == 1) {
CTX.GetActivity(
moment().locale("fa").startOf("day").unix() * 1000,
id,
siftsData[index].currentShiftPlanId,
0
);
} else if (selectDayForShift == 2) {
CTX.GetActivity(
moment().locale("fa").add(1, "day").unix() * 1000,
id,
siftsData[index].currentShiftPlanId,
0
);
}
@ -178,19 +178,19 @@ const CompleteShift = () => {
if (selectDayForShift == 0) {
CTX.GetActivity(
moment().locale("fa").subtract(1, "day")?.unix() * 1000,
siftsData[activeShifPlan].id,
siftsData[activeShifPlan].currentShiftPlanId,
pageGetActivity + 1
);
} else if (selectDayForShift == 1) {
CTX.GetActivity(
moment().locale("fa").startOf("day").unix() * 1000,
siftsData[activeShifPlan].id,
siftsData[activeShifPlan].currentShiftPlanId,
pageGetActivity + 1
);
} else if (selectDayForShift == 2) {
CTX.GetActivity(
moment().locale("fa").add(1, "day").unix() * 1000,
siftsData[activeShifPlan].id,
siftsData[activeShifPlan].currentShiftPlanId,
pageGetActivity + 1
);
}
@ -271,7 +271,12 @@ const CompleteShift = () => {
)
}
>
<p className="mb-0">{e?.title} </p>
<p className="mb-0 font-medium text-sm mt-1 pr-2">
{e?.title}{" "}
<small className="text-red-900">
({e?.currentSupervisorFullName})
</small>{" "}
</p>
<div className="flex">
<div
className={`bg-gray-400 rounded-full mr-1 ${
@ -280,23 +285,22 @@ const CompleteShift = () => {
: ""
}`}
>
<p className="mb-0 text-sm p-1 text-white ">
<p className="mb-0 text-[12px] p-1 text-white ">
{" "}
<PersianNumber
number={e?.totalActivitiesCount}
style="mx-1 text-base"
style="mx-1 !text-[12px]"
/>
{!e?.isCompleted && "فعالیت"}
</p>
</div>
{e?.undoneActivitiesCount != 0 && (
<div className="bg-red-700 w-[30px] h-[30px] rounded-full mr-1">
<p className="mb-0 text-sm p-1 text-white text-center mt-[2px]">
<p className="mb-0 text-[12px] p-1 text-white text-center mt-[2px]">
{" "}
<PersianNumber
number={e?.undoneActivitiesCount}
style="mx-1 text-base"
style="mx-1 !text-[12px]"
/>
</p>
</div>
@ -304,7 +308,7 @@ const CompleteShift = () => {
</div>
</div>
<div className={` ${e?.isCompleted ? "w-[170px]" : ""}`}>
<div className={` ${e?.isCompleted ? "" : ""}`}>
{e?.isCompleted && (
<div
className="bg-sky-600 w-fit px-2 h-[30px] rounded-full mr-1 !z-50 relative"
@ -312,9 +316,9 @@ const CompleteShift = () => {
handleGoToReport(e.title, e.currentShiftPlanId)
}
>
<p className="mb-0 text-sm p-1 text-white text-center mt-[2px]">
<p className="mb-0 text-[12px] p-1 text-white text-center mt-[2px]">
{" "}
گزارش شیفت{" "}
گزارش{" "}
</p>
</div>
)}

View File

@ -19,24 +19,23 @@ import Chapar from "plugins/Chapar";
const Calendar = () => {
const CTX = useContext(AppContext);
const shiftsData = CTX.state.shiftsData;
const searchUserChoose = CTX.state.searchUserChoose;
const usersData = CTX.state.usersData;
const routinesData = CTX.state.routinesData;
const routineShiftPlan = CTX.state.routineShiftPlan;
const positionsData = CTX.state.positionsData;
const shiftPlanData = CTX.state.shiftPlanData;
const shiftplansData = CTX.state.shiftPlansData;
const [daysUntilWeek, setDaysUntilWeek] = useState([]);
const [selectDay, setSelectDay] = useState(null);
const [selectShift, setselectShift] = useState(-1);
const [selectRoutine, setSelectRoutine] = useState(-1);
const [shiftsPlan, setShiftsPlan] = useState([]);
const [manageShiftEmployeesData, setManageShiftEmployeesData] = useState([]);
const [shiftsCurrentDaysData, setShiftsCurrentDaysData] = useState([]);
const [daysManageShiftData, setDaysManageShiftData] = useState([]);
const [editManageShift, setEditManageShift] = useState(false);
const [superId, setSuperId] = useState(null);
const [superData, setSuperData] = useState(false);
const [shiftPlanSteps, setShiftPlanSteps] = useState(0);
const [positionSelectNameBottomSheet, setPositionSelectNameBottomSheet] =
@ -47,63 +46,47 @@ const Calendar = () => {
const [idRoutineShiftPlan, setIdRoutineShiftPlan] = useState(null);
const [currentShiftPlanId, setCurrentShiftPlanId] = useState(null);
const week = [
{ key: "شنبه", value: 6 },
{ key: "یکشنبه", value: 0 },
{ key: "دوشنبه", value: 1 },
{ key: "سه شنبه", value: 2 },
{ key: "چهار شنبه", value: 3 },
{ key: "پنج شنبه", value: 4 },
{ key: "جمعه", value: 5 },
];
const today = moment().format("jYYYY/jM/jD"); // Get the current Jalali date
const daysInCurrentMonth = moment(today, "jYYYY/jM/jD")
.endOf("jMonth")
.jDate();
const daysEndOfMonth = () => {
const today = moment();
const lastDayOfNextWeek = today.clone().add(1, "week").endOf("week");
const transformData = (responseArray) => {
console.log("responseArray", responseArray);
const daysArray = [];
let currentDate = today.clone();
while (currentDate.isBefore(lastDayOfNextWeek, "day")) {
const shamsiDate = currentDate.format("jYYYY/jM/jD");
const dayOfWeek = week.find((day) => day.value === currentDate.day()).key;
const isToday = currentDate.isSame(moment(), "day");
const value = currentDate.day();
return responseArray.map((item) => {
const date = moment(item.dateTime).locale("fa");
const isToday = date.isSame(moment(), "day");
daysArray.push({
checkDay: shamsiDate,
date: currentDate.format("jD / jM"),
dayOfWeek,
isToday,
value,
checkDay: date.format("jYYYY/jM/jD"),
date: date.format("jD / jM"),
dayOfWeek: date.format("dddd"),
isToday: isToday,
totalShiftPercent: (item.totalShiftPlans / item.totalShifts) * 100,
});
currentDate.add(1, "day");
}
console.log(daysArray);
return setDaysUntilWeek(daysArray);
return setDaysUntilWeek(daysArray);
});
};
const handleManageShiftEmployeesOpen = (e) => {
setManageShiftEmployeesData(
usersData.map((item) => ({
key:
item.firstName +
" " +
item.lastName +
"( " +
item.roleNames[0] +
" )",
const GetListDaysWithShiftByRoutine = async (id) => {
try {
const data = await Chapar.get(
`${process.env.NEXT_PUBLIC_API_URL}/page/app/shifting?routineId=${id}`,
value: item.userId,
}))
);
{
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
},
}
);
setDaysManageShiftData(data);
transformData(data);
} catch ({ error, status }) {
toast.error(`${error?.response?.data?.message}`, {
position: "bottom-right",
closeOnClick: true,
});
setLoading(false);
}
};
const body = {
@ -111,7 +94,7 @@ const Calendar = () => {
daysUntilWeek[selectDay]?.checkDay &&
moment.utc(daysUntilWeek[selectDay].checkDay, "jYYYY-jMM-jDDTHH").unix() *
1000,
shiftId: shiftsPlan && shiftsPlan[selectShift]?.id,
shiftId: shiftPlanData && shiftPlanData.shiftId,
routineId: routinesData && routinesData[selectRoutine]?.id,
supervisionUserId: superId,
userAndPositionIds,
@ -122,7 +105,7 @@ const Calendar = () => {
daysUntilWeek[selectDay]?.checkDay &&
moment.utc(daysUntilWeek[selectDay].checkDay, "jYYYY-jMM-jDDTHH").unix() *
1000,
shiftId: shiftsPlan && shiftsPlan[selectShift]?.id,
shiftId: shiftPlanData && shiftPlanData.shiftId,
routineId: routinesData && routinesData[selectRoutine]?.id,
userAndPositionIds,
supervisionUserId: superId,
@ -133,20 +116,37 @@ const Calendar = () => {
setSelectRoutine(index);
setShiftPlanSteps(1);
setIdRoutineShiftPlan(id);
GetListDaysWithShiftByRoutine(id);
};
const handleRoutineShiftPlanWithDay = (index) => {
setSelectDay(index);
setShiftPlanSteps(2);
setShiftsCurrentDaysData(daysManageShiftData[index]?.shifts);
setselectShift(-1);
CTX.GetRoutineShiftPlan(
idRoutineShiftPlan,
moment(daysUntilWeek[index]?.checkDay, "jYYYY-jM-jD").unix() * 1000
);
// CTX.GetRoutineShiftPlan(
// idRoutineShiftPlan,
// moment(daysUntilWeek[index]?.checkDay, "jYYYY-jM-jD").unix() * 1000
// );
};
const handleSelectShift = (index) => {
console.log("usersData.length", usersData.length);
setselectShift(index);
setShiftPlanSteps(3);
if (usersData.length <= 0) {
// User data is not in state, send request to get user
CTX.GetUsers();
}
if (positionsData.length <= 0) {
CTX.GetPositions();
}
};
const UpdateShiftPlan = async (body, id) => {
setLoading(true);
CTX.setLoading(true);
try {
const data = await Chapar.put(
`${process.env.NEXT_PUBLIC_API_URL}/shift/plan`,
@ -163,11 +163,17 @@ const Calendar = () => {
closeOnClick: true,
});
CTX.setLoading(false);
CTX.setShiftPlanData(id);
router.push("/shifts");
setSelectDay(null);
setSuperId(null);
setUserAndPositionIds([]);
setShiftPlanSteps(1);
GetListDaysWithShiftByRoutine(idRoutineShiftPlan);
CTX.setLoading(false);
} catch ({ error, status }) {
toast.error(`${error?.response?.data?.message}`, {
toast.error(`${error?.response?.data?.message}dsdsdsds`, {
position: "bottom-right",
closeOnClick: true,
});
@ -192,10 +198,10 @@ const Calendar = () => {
});
setSelectDay(null);
setShiftsPlan([]);
setSuperId(null);
setUserAndPositionIds([]);
setShiftPlanSteps(1);
GetListDaysWithShiftByRoutine(idRoutineShiftPlan);
CTX.setLoading(false);
// router.push("/shifts");
@ -216,50 +222,38 @@ const Calendar = () => {
}
};
const handleDeleteUser = (id) => {
const updatedUsers = userAndPositionIds.filter((user) => user.key !== id);
setUserAndPositionIds(updatedUsers);
};
useEffect(() => {
CTX.GetRoutines();
daysEndOfMonth();
setSelectDay(-1);
CTX.GetShifts();
CTX.GetPositions();
}, []);
useEffect(() => {
handleManageShiftEmployeesOpen();
}, [usersData]);
useEffect(() => {
setShiftsPlan(
routineShiftPlan?.find((e) => e?.day == daysUntilWeek[selectDay]?.value)
?.shifts
);
setselectShift(-1);
}, [routineShiftPlan]);
useEffect(() => {
console.log("11111", shiftsPlan && shiftsPlan[selectShift]);
// console.log("11111", shiftsPlan && shiftsPlan[selectShift]);
setEditManageShift(false);
CTX.setShiftPlanData(null);
if (shiftsPlan && shiftsPlan[selectShift]?.hasCurrentShiftPlan) {
if (
shiftsCurrentDaysData &&
shiftsCurrentDaysData[selectShift]?.hasCurrentShiftPlan
) {
setEditManageShift(true);
setCurrentShiftPlanId(shiftsPlan[selectShift]?.currentShiftPlanId);
CTX.GetShiftPlan(shiftsPlan[selectShift]?.currentShiftPlanId);
}
if (!!usersData.length <= 0) {
// User data is not in state, send request to get user
CTX.GetUsers();
setCurrentShiftPlanId(
shiftsCurrentDaysData[selectShift]?.currentShiftPlanId
);
CTX.GetShiftPlan(shiftsCurrentDaysData[selectShift]?.currentShiftPlanId);
}
}, [selectShift]);
useEffect(() => {
console.log(
"shiftPlanDataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
shiftPlanData
);
setUserAndPositionIds(
shiftPlanData?.users?.map((e) => ({ key: e.positionId, value: e.userId }))
shiftPlanData?.users?.map((e) => ({
key: e.positionId,
value: e.userId,
}))
);
setSuperId(shiftPlanData?.supervisorId);
@ -278,18 +272,16 @@ const Calendar = () => {
);
}, [usersData]);
console.log(superData, usersData);
console.log("shiftPlanData", shiftPlanData);
console.log(
"hiftsCurrentDaysData[selectShift]",
shiftsCurrentDaysData[selectShift]
);
return (
<div className="pb-20">
<AppHeader
title=" شیفت بندی های هفتگی"
sub={`شیفت بندی
تا
${daysInCurrentMonth}
${PersianM(moment().format("jM"))}
`}
sub={`شیفت بندی`}
icon2={true}
iconName2="ARROW"
iconHref2="#"
@ -300,7 +292,7 @@ const Calendar = () => {
<div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden px-4 rtl ">
<div className="font-medium text-right mt-5">
<p className="mb-0">روتین را انتخاب کنید</p>
<p className="mb-0 text-sm">روتین را انتخاب کنید</p>
</div>
<div
className="flex overflow-auto whitespace-nowrap mb-5"
@ -335,11 +327,11 @@ const Calendar = () => {
</div>
</div>
{shiftPlanSteps >= 0 && (
<div className="bg-body-100 relative top-[-40px] rounded-t-3xl overflow-hidden px-4 rtl ">
{shiftPlanSteps >= 1 && (
<div className="bg-body-100 relative top-[-40px] rounded-t-3xl overflow-hidden px-4 rtl ">
<>
<div className="font-medium text-right mt-3 pb-2">
<p className="mb-0">تاریخ را انتخاب کنید</p>
<div className="font-medium text-right mt-5 pb-2">
<p className="mb-0 text-sm">تاریخ را انتخاب کنید</p>
</div>
<Swiper
spaceBetween={10}
@ -350,7 +342,7 @@ const Calendar = () => {
{daysUntilWeek?.map((e, index) => (
<SwiperSlide>
<div
className={`h-[70px] tr03 ${
className={`h-[75px] tr03 ${
selectDay == index
? "bg-white rounded-xl"
: " opacity-70"
@ -367,7 +359,7 @@ const Calendar = () => {
}
}}
>
<div className="py-2">
<div className="pt-3">
<p className="mb-0 text-center ">
<PersianNumber
number={e.date}
@ -390,7 +382,7 @@ const Calendar = () => {
? "bg-secondary-100 text-gray-100"
: !!holidays.y1402?.find((b) => b.date == e.checkDay)
? "bg-transparent text-red-500"
: "bg-white text-gray-500"
: " text-gray-600"
}`}
>
<p className="mb-0 text-center text-sm ">
@ -398,6 +390,40 @@ const Calendar = () => {
{e.dayOfWeek}
</p>
</div>
<div
className={`mt-5 relative w-8/12 mx-auto ${
selectDay == index ? " hidden" : "block"
}`}
>
<div className="absolute w-full mt-[-10px]">
<div className="bg-gray-300 p-1 rounded-full "></div>
</div>
<div
className={`absolute ${
e.totalShiftPercent === 0
? "w-0"
: e.totalShiftPercent > 0 &&
e.totalShiftPercent < 50
? "w-5/12"
: e.totalShiftPercent === 50
? "w-1/2"
: e.totalShiftPercent > 50 &&
e.totalShiftPercent < 100
? "w-9/12"
: e.totalShiftPercent === 100
? "w-full"
: `w-[${e.totalShiftPercent}%]`
} mt-[-10px]`}
>
<div
className={`bg-green-500 ${
e.totalShiftPercent !== 0 ? "p-1" : ""
} rounded-full `}
></div>
</div>
</div>
</div>
</SwiperSlide>
))}
@ -405,30 +431,32 @@ const Calendar = () => {
</>
</div>
)}
{shiftPlanSteps >= 0 && (
{shiftPlanSteps > 1 && (
<>
<div className="bg-body-100 relative top-[-40px] rounded-t-3xl overflow-hidden px-4 rtl">
<>
<div className="font-medium text-right mt-3">
<p className="mb-0">شیفت را انتخاب کنید</p>
<div className="font-medium text-right mt-5">
<p className="mb-0 text-sm">شیفت را انتخاب کنید</p>
</div>
{!!routineShiftPlan?.find(
(e) => e?.day == daysUntilWeek[selectDay]?.value
) && shiftsData.length > 0 ? (
{shiftsCurrentDaysData.length > 0 ? (
<div
className="flex overflow-auto whitespace-nowrap"
id="swich-shifts"
>
{shiftsPlan?.map((e, index) => (
{shiftsCurrentDaysData?.map((e, index) => (
<div
className={` shadow-sm relative block max-w-fit mx-2 rounded-full mt-2 px-4 py-2 tr03 ${
selectShift == index
? "!bg-secondary-100 text-white w-full"
: " opacity-60 "
}${e.hasCurrentShiftPlan ? "bg-yellow-200" : "bg-white"}`}
: " "
}${
e.hasCurrentShiftPlan
? "bg-green-500 text-white"
: "bg-white"
}`}
onClick={() => {
setselectShift(index);
setShiftPlanSteps(3);
handleSelectShift(index);
}}
>
<p className="mb-0 text-sm">{e?.title}</p>
@ -456,7 +484,7 @@ const Calendar = () => {
<p className="mb-0 text-right text-sm rtl opacity-80">
ویرایش برای{" "}
<small className=" text-sm font-bold">
{shiftsPlan && shiftsPlan[selectShift]?.title}
{shiftsCurrentDaysData[selectShift]?.title}
</small>{" "}
تاریخ{" "}
<small className=" text-sm font-bold text-primary-300 bg-white px-2 rounded-full">
@ -501,7 +529,10 @@ const Calendar = () => {
? userAndPositionIds?.map((item) => (
<>
{e.id == item.key && (
<div className="flex bg-gray-100 p-1 rounded-full m-1 justify-start mb-7 ">
<div
className="flex bg-gray-100 p-1 rounded-full m-1 justify-start mb-7 "
onClick={() => handleDeleteUser(item.key)}
>
<div
className="w-[30px] h-[30px] rounded-full bg-gray-400 "
// onClick={() => deleteSearchUser(e)}

View File

@ -111,6 +111,8 @@ const Shifts = (props) => {
console.log(shiftplans[0]?.data[0]?.users);
console.log("shiftplans555", shiftplans);
return (
<>
<div className="pb-20">

View File

@ -55,8 +55,6 @@ const page = () => {
);
};
console.log(activities.length);
return (
<div className="pb-20">
<AppHeader