mangement tables, note exam api | 320

main
alireza khaji 2 years ago
parent 0fe9b16efd
commit a218d65d93
  1. 1
      package.json
  2. 21
      src/App.js
  3. 850
      src/index.css
  4. 24
      src/redux/actions/book.js
  5. 3
      src/redux/actions/index.js
  6. 27
      src/redux/actions/network.js
  7. 26
      src/redux/actions/offCode.js
  8. 1
      src/redux/reducers/book.js
  9. 2
      src/redux/reducers/index.js
  10. 40
      src/redux/reducers/network.js
  11. 40
      src/redux/reducers/offCode.js
  12. 12
      src/view/Exam2/Exam.js
  13. 196
      src/view/Exam2/NoteContainer.js
  14. 3
      src/view/addExam/views/ViewExamNote.js
  15. 100
      src/view/disountCode management/index.js
  16. 202
      src/view/disountCode management/layouts/Editor.js
  17. 93
      src/view/product management/index.js
  18. 202
      src/view/product management/layouts/Editor.js
  19. 31
      src/view/school management/index.js
  20. 9
      yarn.lock

@ -4,6 +4,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@react-pdf-viewer/core": "^3.1.2", "@react-pdf-viewer/core": "^3.1.2",
"@react-pdf-viewer/page-navigation": "3.1.2",
"@testing-library/jest-dom": "^5.16.1", "@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2", "@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",

@ -47,6 +47,8 @@ import Exam from "./view/Exam2/Exam";
import UserManagement from "./view/user-management"; import UserManagement from "./view/user-management";
import AdminNav from "./components/AdminNav"; import AdminNav from "./components/AdminNav";
import SchoolManagement from "./view/school management"; import SchoolManagement from "./view/school management";
import ProductManagement from "./view/product management";
import DisountCodeManagement from "./view/disountCode management";
let data = [ let data = [
{ {
@ -631,10 +633,10 @@ let data = [
function App() { function App() {
let location = window.location.pathname; let location = window.location.pathname;
const [dontShowNav,setDontShowNav]=useState(false); const [dontShowNav, setDontShowNav] = useState(false);
useEffect(()=>{ useEffect(() => {
location = window.location.pathname; location = window.location.pathname;
}) });
// const {id} = useParams(); // const {id} = useParams();
console.log(location); console.log(location);
let buyPackagesData = null; let buyPackagesData = null;
@ -684,7 +686,6 @@ function App() {
console.log("hhhhhhhh--------------------"); console.log("hhhhhhhh--------------------");
console.log(location.split("/")); console.log(location.split("/"));
return ( return (
<Provider store={store}> <Provider store={store}>
<div> <div>
@ -753,7 +754,15 @@ function App() {
/> />
<Route <Route
path="/adminpanel/schools" path="/adminpanel/schools"
element={<SchoolManagement/>} element={<SchoolManagement />}
/>
<Route
path="/adminpanel/products"
element={<ProductManagement />}
/>
<Route
path="/adminpanel/discount_codes"
element={<DisountCodeManagement />}
/> />
<Route <Route
path="/register" path="/register"

@ -190,3 +190,853 @@ code {
margin: 0; margin: 0;
} }
/* --------------------------------- */
.Calendar * {
font-family: "iranSans";
}
.DatePicker {
position: relative;
display: inline-block;
z-index: 100;
width: 100%;
}
.DatePicker__input {
background: #FBFBFB;
width: 100%;
height: 56px ;
border: 1px solid #F0F0F0;
/* padding: 0.6em 1.2em; */
font-family: "iranSans";
text-align: center;
font-size: 24px;
color: #046AE8;
border-radius: 7px;
}
.DatePicker__input:focus {
outline: 1px solid #046AE8;
color: #046AE8;
}
.DatePicker__input.-rtl {
direction: rtl;
}
.DatePicker__input::placeholder {
color: #979797;
}
.DatePicker__input:focus::placeholder {
color: #06bace;
}
.DatePicker_calendarContainer.-top + .DatePicker_calendarArrow {
top: auto;
bottom: calc(100% + 10px);
transform: translateY(-2.5rem) rotate(180deg);
animation: fadeArrowFlipped 0.3s forwards;
}
.DatePicker__calendarContainer {
position: absolute;
width: 80%;
top: calc(100% + 20px);
left: 50%;
transform: translateX(-50%);
/* background-color: #fff; */
}
.DatePicker__calendarContainer.-top {
top: auto;
bottom: calc(100% + 20px);
}
.Calendar,
.Calendar * {
margin: 0;
padding: 0;
box-sizing: border-box;
direction: ltr;
background-color: #fff;
}
.Calendar,
.Calendar.-rtl * {
direction: rtl;
}
.DatePicker__calendarArrow {
position: absolute;
width: 0;
height: 0;
top: calc(100% + 10px);
left: 0;
right: 0;
margin: 0 auto;
border-style: solid;
z-index: 10;
border-width: 0 10px 10px 10px;
border-color: transparent transparent #fff transparent;
}
.Calendar {
--cl-color-black: #444444;
--cl-color-disabled: #d4d4d4;
--cl-color-error: #ff2929;
font-family: "iranSans";
font-size: 10px;
background: rgba(245, 245, 245, 0.53);
border: 1px solid #dbdbdb;
box-shadow: 0 1em em rgba(0, 0, 0, 0.07);
border-radius: 1em;
position: relative;
user-select: none;
/* padding-top: 1.2em; */
display: flex;
flex-direction: column;
width: 40em;
z-index: 10;
max-width: 90vw;
min-height: 38.7em;
}
.Calendar.dashboard {
--cl-color-black: #444444;
--cl-color-disabled: #d4d4d4;
--cl-color-error: #ff2929;
font-family: "iranSans";
font-size: 10px;
background: rgb(255, 255, 255);
border: 1px solid #edf2fb;
box-shadow: 0 1em em rgba(0, 0, 0, 0.07);
border-radius: 1em;
position: relative;
user-select: none;
padding-top: 1.2em;
display: flex;
flex-direction: column;
width: 50em;
z-index: 10;
max-width: 90vw;
min-height: 38.7em;
}
.DatePicker .Calendar,
.DatePicker__calendarArrow {
transform: translateY(2.5em);
opacity: 0;
animation: fadeCalendar 0.3s forwards;
}
.DatePicker__calendarContainer.-top .Calendar {
transform: translateY(-2.5em);
}
.Calendar.-noFocusOutline *:focus {
outline: none !important;
}
.Calendar > :not(.Calendar__footer) button {
font-family: inherit;
background: transparent;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
outline: none;
}
.Calendar__header {
display: flex;
color: var(--cl-color-black);
padding: 2em 2.9em;
align-items: center;
overflow: hidden;
}
.Calendar__monthArrowWrapper {
line-height: 0;
font-size: 3em;
padding: 3px;
position: relative;
border: none;
z-index: 1;
opacity: 1;
transition: 0.2s;
background-color: #06bace;
}
.Calendar__monthArrowWrapper:focus {
outline: 1px dashed rgba(0, 0, 0, 0.4);
outline-offset: 2px;
}
.Calendar__monthArrowWrapper:disabled,
.Calendar__monthArrowWrapper.-hidden {
opacity: 0;
pointer-events: none;
}
.Calendar__monthArrowWrapper.-left {
transform: rotate(180deg);
}
.Calendar.-rtl .Calendar__monthArrowWrapper.-left {
transform: rotate(-180deg);
}
.Calendar__monthArrowWrapper.-right {
transform: rotate(-0deg);
}
.Calendar.-rtl .Calendar__monthArrowWrapper.-right {
transform: rotate(0deg);
}
.Calendar_monthArrowWrapper:active .Calendar_monthArrow {
transform: scale(0.7);
}
.Calendar__monthArrow {
border-radius: 7px;
padding: 12px;
transition: var(--animation-duration) transform;
pointer-events: none;
background-repeat: no-repeat;
display: block;
width: 0.7em;
height: 0.7em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='15' height='15' viewBox='0 0 50 80' xml:space='preserve'%3E%3Cpolyline fill='none' stroke='%23FFFFFF' stroke-width='15' stroke-linecap='round' stroke-linejoin='round' points=' 0.375,0.375 45.63,38.087 0.375,75.8 '/%3E%3C/svg%3E");
background-size: 100% 100%;
background-color: #06bace;
background-size: 10px;
background-position: center;
}
.Calendar__monthYearContainer {
flex: 1;
position: relative;
}
.Calendar__monthYear {
font-size: 2em;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
background-color: #fff;
position: absolute;
top: 0;
bottom: 0;
left: 50%;
will-change: transform, opacity;
backface-visibility: hidden;
transform: translateZ(0);
transition: var(--animation-duration);
line-height: 1;
color: #246e8a;
}
.Calendar__monthYear.dashboard {
font-size: 2em;
font-weight: 500;
display: flex;
align-items: center;
position: absolute;
top: 0;
bottom: 0;
left: 50%;
will-change: transform, opacity;
backface-visibility: hidden;
transform: translateZ(0);
transition: var(--animation-duration);
line-height: 1;
color: #65a9ff;
}
.Calendar__monthYear.-hiddenNext {
opacity: 0;
transform: translateX(50%);
}
.Calendar.-rtl .Calendar__monthYear.-hiddenNext {
transform: translateX(-150%);
}
.Calendar__monthYear.-hiddenPrevious {
opacity: 0;
transform: translateX(-150%);
}
.Calendar.-rtl .Calendar__monthYear.-hiddenPrevious {
transform: translateX(50%);
}
.Calendar__monthYear.-shown {
opacity: 1;
margin-top: auto;
margin-bottom: auto;
transform: translateX(-50%);
}
.Calendar__monthYear.-shownAnimated {
animation: var(--animation-duration) fadeTextToCenter forwards;
}
.Calendar__monthYear > * {
padding: 0.2em 0.5em;
border: 1px solid transparent;
transition: var(--animation-duration);
font-size: 1.05em;
display: flex;
justify-content: center;
align-items: center;
transform: translateX(0) scale(0.95);
will-change: transform;
border-radius: 5px;
}
.Calendar__monthYear:not(.-shown) > *,
.Calendar__monthYear > *.-hidden {
cursor: default;
pointer-events: none;
}
.Calendar__monthText {
margin-left: -0.3em;
}
.Calendar__yearText:last-child {
margin-right: -0.3em;
}
.Calendar__monthYear.-shown > *:hover,
.Calendar:not(.-noFocusOutline) .Calendar__monthYear.-shown > *:focus,
.Calendar__monthYear > *.-activeBackground {
background: #f5f5f5;
}
.Calendar__monthText:hover {
transform: translateX(-0.2em) scale(0.95);
}
.Calendar.-rtl .Calendar__monthText:hover {
transform: translateX(0.2em) scale(0.95);
}
.Calendar__yearText:hover {
transform: translateX(0.2em) scale(0.95);
}
.Calendar.-rtl .Calendar__yearText:hover {
transform: translateX(-0.2em) scale(0.95);
}
.Calendar_monthYear .Calendar_yearText.-hidden {
transform: translateX(50%);
opacity: 0;
}
.Calendar.-rtl .Calendar_monthYear .Calendar_yearText.-hidden {
transform: translateX(-50%);
}
.Calendar_monthYear .Calendar_monthText.-hidden {
transform: translateX(-50%);
opacity: 0;
}
.Calendar.-rtl .Calendar_monthYear .Calendar_monthText.-hidden {
transform: translateX(50%);
}
.Calendar__monthYear:not(.-shown) > * {
pointer-events: none;
}
.Calendar__monthSelectorAnimationWrapper,
.Calendar__yearSelectorAnimationWrapper {
position: absolute;
width: 100%;
height: 80%;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.Calendar__monthSelectorWrapper {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.Calendar__monthSelector {
padding: 0 2.5em;
align-content: center;
padding-bottom: 2em;
}
.Calendar__monthSelector,
.Calendar__yearSelector {
display: flex;
flex-wrap: wrap;
position: relative;
z-index: 2;
background-color: #fff;
transform: translateY(-150%);
will-change: transform;
transition: 0.6s;
height: 100%;
}
.Calendar__yearSelectorWrapper {
width: 100%;
height: 100%;
}
.Calendar__yearSelectorWrapper::after,
.Calendar__yearSelectorWrapper::before {
content: "";
width: 100%;
height: 5em;
position: absolute;
left: 0;
opacity: 0;
transition: 0.4s;
transition-delay: 0.2s;
}
.Calendar__yearSelectorWrapper::after {
background-image: linear-gradient(
to bottom,
#fff,
#fff 10%,
rgba(245, 245, 245, 0)
);
top: -0.1em;
}
.Calendar__yearSelectorWrapper::before {
background-image: linear-gradient(
to top,
#fff,
#fff 10%,
rgba(245, 245, 245, 0)
);
bottom: 0;
}
.Calendar__yearSelectorWrapper.-faded::after,
.Calendar__yearSelectorWrapper.-faded::before {
opacity: 1;
z-index: 3;
}
.Calendar__yearSelector {
align-content: flex-start;
scrollbar-width: 0;
overflow: scroll;
position: relative;
width: 100%;
padding: 5em 2em;
-ms-overflow-style: none;
}
.Calendar__yearSelector::-webkit-scrollbar {
display: none;
}
.Calendar__yearSelectorItem {
width: 25%;
display: flex;
justify-content: center;
}
.Calendar__yearSelectorItem:not(:nth-child(-n + 4)) {
margin-top: 1.5em;
}
.Calendar__yearSelectorText {
border: none;
font-size: 1.4em;
min-width: 85%;
padding: 0.2em 0.5em;
border-radius: 5px;
}
.Calendar__monthSelector.-open,
.Calendar__yearSelector.-open {
transform: translateY(0);
}
.Calendar__yearSelectorText:focus,
.Calendar__monthSelectorItemText:focus {
outline: 1px dashed rgba(0, 0, 0, 0.4);
outline-offset: 2px;
}
.Calendar__monthSelectorItem {
width: calc(100% / 3);
display: flex;
justify-content: center;
}
.Calendar__monthSelectorItem:not(:nth-child(-n + 3)) {
margin-top: 2em;
}
.Calendar__monthSelectorItemText {
border: none;
padding: 0.4em 0.4em;
border-radius: 8.5px;
font-size: 1.3em;
min-width: 70%;
transition: 0.3s;
}
.Calendar__monthSelectorItem:not(.-active)
.Calendar__monthSelectorItemText:not(:disabled):hover,
.Calendar__yearSelectorItem:not(.-active)
.Calendar__yearSelectorText:not(:disabled):hover {
background: #f5f5f5;
}
.Calendar__monthSelectorItemText:disabled,
.Calendar__yearSelectorText:disabled {
opacity: 0.5;
cursor: default;
}
.Calendar_monthSelectorItem.-active .Calendar_monthSelectorItemText,
.Calendar_yearSelectorItem.-active .Calendar_yearSelectorText {
background-color: #006c94;
color: #fff;
}
.Calendar__weekDays {
display: flex;
justify-content: space-between;
color: var(--cl-color-disabled);
font-size: 1.2em;
margin-bottom: 0.7em;
padding: 0 2.6em;
position: relative;
}
.Calendar__weekDays.dashboard {
display: flex;
justify-content: space-between;
color: var(--cl-color-disabled);
font-size: 1.2em;
margin-bottom: 0.7em;
padding: 0.75em 2.6em;
position: relative;
background-color: transparent;
/* background-color: #444444 !important; */
}
.Calendar__weekDay {
display: block;
width: calc(100% / 7);
background-color: transparent !important;
text-align: center;
text-decoration: none;
border: 0px;
color: #06bace;
margin: 0.2em;
white-space: nowrap;
}
.Calendar__weekDay.dashboard {
color: #a2b4cb;
}
.Calendar__weekDay[title] {
text-decoration: none;
}
.Calendar__sectionWrapper {
position: relative;
min-height: 25.8em;
overflow: hidden;
}
.Calendar__section {
display: flex;
flex-direction: column;
padding: 0 3.2em;
position: absolute;
color: var(--cl-color-black);
top: 0;
padding-top: 0.5em;
left: 0;
width: 100%;
will-change: transform, opacity;
transform: translateZ(0);
backface-visibility: hidden;
transition: var(--animation-duration);
}
.Calendar__section.-hiddenPrevious {
opacity: 0.5;
transform: translateX(-90%);
}
.Calendar.-rtl .Calendar__section.-hiddenPrevious {
transform: translateX(90%);
}
.Calendar__section.-hiddenNext {
opacity: 0.5;
transform: translateX(90%);
}
.Calendar.-rtl .Calendar__section.-hiddenNext {
transform: translateX(-90%);
}
.Calendar__section.-shown {
opacity: 1;
transform: translateX(0);
}
.Calendar__section.-shownAnimated {
animation: var(--animation-duration) FadeContentToCenter forwards;
}
.Calendar__weekRow {
display: flex;
width: 100%;
}
.Calendar__day {
width: calc(100% / 7 - 6px);
text-align: center;
padding: calc(0.25em - 1px);
font-size: 1.6em;
border-radius: 7px;
transition: 0.2s;
border: 1px solid transparent;
margin: 3px;
color: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
cursor: pointer;
vertical-align: middle;
background-color: #f3f3f3;
color: #06bace;
}
.Calendar__day.dashboard {
width: calc(100% / 7 - 6px);
text-align: center;
padding: calc(0.25em - 1px);
font-size: 1.6em;
border-radius: 7px;
transition: 0.2s;
border: 1px solid transparent;
margin: 3px;
color: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
cursor: pointer;
vertical-align: middle;
background-color: transparent;
color: #00253a;
}
.Calendar__day span {
padding: -10px;
margin-top: -30px;
font-size: 28px;
}
.Calendar__day:focus {
outline: 1px dashed rgba(0, 0, 0, 0.4);
outline-offset: 2px;
}
.Calendar__day.-ltr {
min-height: 2.6em;
font-size: 1.45em;
}
.Calendar__day.-rtl {
font-size: 1.55em;
height: 2.45em;
}
.Calendar__day:not(.-blank):not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween):not(.-selected):hover {
background-color: #dafbff;
color: #06bace;
border: 1px solid #06bace;
}
.Calendar__day.-selected,
.Calendar__day.-selectedStart,
.Calendar__day.-selectedEnd {
background: #006c94;
color: #fff;
}
.Calendar__day.-ltr.-selectedStart {
border-radius: 0;
border-top-left-radius: 7px;
border-bottom-left-radius: 7px;
}
.Calendar__day.-rtl.-selectedStart {
border-radius: 0;
border-top-right-radius: 7px;
border-bottom-right-radius: 7px;
}
.Calendar__day.-selectedBetween {
background: rgba(0, 108, 148, 0.07);
border-radius: 0;
}
.Calendar__day.-ltr.-selectedEnd {
border-radius: 0;
border-top-right-radius: 7px;
border-bottom-right-radius: 7px;
}
.Calendar__day.-rtl.-selectedEnd {
border-radius: 0;
border-top-left-radius: 7px;
border-bottom-left-radius: 7px;
}
.Calendar__day.-weekend:not(.-selected):not(.-blank):not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween) {
color: var(--cl-color-error);
}
.Calendar__day.-weekend.-today:not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween)::after {
background: var(--cl-color-error);
}
.Calendar__day.-disabled {
color: var(--cl-color-disabled) !important;
background: transparent !important;
cursor: default !important;
}
.Calendar__day.-selected {
}
.Calendar__day.-today:not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween) {
font-weight: 600;
color: var(--cl-color-black);
color: #000;
position: relative;
}
.Calendar__day.-today:not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween)::after {
content: "";
position: absolute;
bottom: 0.2em;
display: block;
width: 0.6em;
height: 1px;
background: #000;
left: 50%;
opacity: 0.5;
transform: translateX(-50%);
transition: 0.2s;
}
.Calendar__day.-today:hover:not(.-selectedStart):not(.-selectedEnd):not(.-selectedBetween)::after {
opacity: 0;
}
.Calendar__day.-blank {
color: transparent;
cursor: default;
pointer-events: none;
}
.Calendar__footer {
position: relative;
z-index: 1;
}
.Calendar_footer .footer_Events {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
font-family: "IranSans";
padding: 3px;
}
.Calendar_footer .footer_Events.dashboard {
display: flex;
justify-content: start;
width: 100%;
align-items: flex-start;
font-size: 12px;
font-family: "IranSans";
margin-top: 10px;
padding: 1em 2em;
border-top: 1px solid #edf2fb;
}
.Calendar_footer .footer_Events.dashboard p {
font-size: 15px;
margin: 2.5px 0px;
}
.Calendar .holiday span {
color: #ff2929;
}
.Calendar .DayNumDiv {
display: flex;
flex-direction: column;
}
.Calendar .DayNumDiv span {
margin: 0;
padding: 0;
margin-bottom: -5px;
}
.Calendar .DayNumDiv .eventDots {
margin-top: -10px;
font-size: 20px;
}
.GoToTodayButton {
background-color: #006c94;
padding: 7.5px;
font-size: 12px;
color: white;
font-family: "iranSans";
border-radius: 50%;
float: left;
margin: 15px;
}
@keyframes fadeCalendar {
from {
opacity: 0;
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeArrowFlipped {
from {
opacity: 0;
}
to {
opacity: 1;
transform: translateY(0) rotate(180deg);
}
}
@keyframes fadeTextToCenter {
to {
opacity: 1;
transform: translateX(-50%);
}
}
@keyframes FadeContentToCenter {
to {
opacity: 1;
transform: translateX(0);
}
}

@ -23,18 +23,18 @@ const book = {
sortFilter: (data) => async (dispatch) => sortFilter: (data) => async (dispatch) =>
await dispatch({ type: "book/sortFilter", data: data }), await dispatch({ type: "book/sortFilter", data: data }),
// update: update:
// (data = {}, data2 = {}) => (data = {}, data2 = {}) =>
// async (dispatch : Dispatch) => { async (dispatch) => {
// await proxy.put("book/update", data); await proxy.put("book/update", data);
// await proxy.get("book/list", data2, { dispatch }); await proxy.get("book/list", data2, { dispatch });
// }, },
// add: add:
// (data = {}, data2 = {}) => (data = {}, data2 = {}) =>
// async (dispatch) => { async (dispatch) => {
// await proxy.post("book/add", data); await proxy.post("book/add", data);
// await proxy.get("book/list", data2, { dispatch }); await proxy.get("book/list", data2, { dispatch });
// }, },
// del: // del:
// (data = {}, data2 = {}) => // (data = {}, data2 = {}) =>
// async (dispatch) => { // async (dispatch) => {

@ -21,6 +21,9 @@ export { default as category } from "./category";
export { default as examQuestion } from "./examQuestion"; export { default as examQuestion } from "./examQuestion";
export { default as note } from "./note"; export { default as note } from "./note";
export { default as table } from "./table"; export { default as table } from "./table";
export { default as network } from "./network";
export { default as offCode } from "./offCode";

@ -0,0 +1,27 @@
import proxy from "../proxy";
const network = {
info:
(data = {}) =>
async (dispatch) =>
await proxy.get("network/info", data, { dispatch }),
schoolList:
(data = {}) =>
async (dispatch) =>
await proxy.get("network/schoolList", data, { dispatch }),
add:
(data = {}) =>
async (dispatch) =>
await proxy.post("network/add", data, { dispatch }),
update:
(data = {}) =>
async (dispatch) =>
await proxy.put("network/update", data, { dispatch }),
delete:
(data = {}) =>
async (dispatch) =>
await proxy.delete("network/delete", data, { dispatch }),
};
export default network;

@ -0,0 +1,26 @@
import proxy from "../proxy";
const offCode = {
info:
(data = {}) =>
async (dispatch) =>
await proxy.get("offCode/info", data, { dispatch }),
schoolList:
(data = {}) =>
async (dispatch) =>
await proxy.get("offCode/list", data, { dispatch }),
add:
(data = {}) =>
async (dispatch) =>
await proxy.post("offCode/add", data, { dispatch }),
update:
(data = {}) =>
async (dispatch) =>
await proxy.put("offCode/update", data, { dispatch }),
delete:
(data = {}) =>
async (dispatch) =>
await proxy.delete("offCode/delete", data, { dispatch }),
};
export default offCode;

@ -57,6 +57,7 @@ export default function book(state = initialState, action) {
...state, ...state,
loading: false, loading: false,
list: data, list: data,
schema:schema,
subjects: Array.from(new Set(itemsSubject)), subjects: Array.from(new Set(itemsSubject)),
levels: Array.from(new Set(itemsLevel)), levels: Array.from(new Set(itemsLevel)),
filterResult: data, filterResult: data,

@ -21,5 +21,7 @@ export { default as category } from "./category";
export { default as examQuestion } from "./examQuestion"; export { default as examQuestion } from "./examQuestion";
export { default as note } from "./note"; export { default as note } from "./note";
export { default as table } from "./table"; export { default as table } from "./table";
export { default as network } from "./network";
export { default as offCode } from "./offCode";

@ -0,0 +1,40 @@
import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
info: null,
list: null,
lastAdd: null,
schema: [],
};
export default function network(state = initialState, action) {
let { type, data, schema } = action;
switch (type) {
case "network/info":
return { ...state, loading: false, info: data, error: null };
case "network/add":
toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null, lastAdd: data.id };
case "network/update":
toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null };
case "network/schoolList":
return {
...state,
loading: false,
error: null,
list: data,
schema: schema,
};
case "network/loading":
return { ...state, loading: true };
case "network/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}

@ -0,0 +1,40 @@
import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
info: null,
list: null,
lastAdd: null,
schema: [],
};
export default function offCode(state = initialState, action) {
let { type, data, schema } = action;
switch (type) {
case "offCode/info":
return { ...state, loading: false, info: data, error: null };
case "offCode/add":
toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null, lastAdd: data.id };
case "offCode/update":
toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null };
case "offCode/list":
return {
...state,
loading: false,
error: null,
list: data,
schema: schema,
};
case "offCode/loading":
return { ...state, loading: true };
case "offCode/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}

@ -6,6 +6,7 @@ import { exam } from "../../redux/actions";
import { Link, useParams } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import { useEffect } from "react"; import { useEffect } from "react";
import { useState } from "react"; import { useState } from "react";
import NoteContainer from "./NoteContainer";
let loadingCondition = false; let loadingCondition = false;
const Exam = ({ const Exam = ({
@ -44,7 +45,7 @@ const Exam = ({
style={{ width: "calc(100vw - 5px)" }} style={{ width: "calc(100vw - 5px)" }}
> >
{examData && <Header info={examData?.exam} examData={examData} />} {examData && <Header info={examData?.exam} examData={examData} />}
{examData && examData ( {examData && examData?.exam?.examInfo?.type !== 2 && (
<Questions <Questions
questions={examData?.questions} questions={examData?.questions}
setAnswer={setAnswer} setAnswer={setAnswer}
@ -52,6 +53,15 @@ const Exam = ({
info={examData?.exam} info={examData?.exam}
/> />
)} )}
{examData && examData?.exam?.examInfo?.type === 2 && (
<NoteContainer
questions={examData?.questions}
setAnswer={setAnswer}
endExam={endExam}
notes={examData?.notes}
info={examData?.exam}
/>
)}
{examLoading && !examData && ( {examLoading && !examData && (
<div className="w-full text-center text-xl rtl mt-8"> <div className="w-full text-center text-xl rtl mt-8">
در حال گرفتن اطلاعات.. در حال گرفتن اطلاعات..

@ -0,0 +1,196 @@
import React, { useEffect } from "react";
import { useState } from "react";
// import { Document, Page } from "react-pdf";
import { Viewer, Worker } from "@react-pdf-viewer/core";
import { pageNavigationPlugin } from "@react-pdf-viewer/page-navigation";
// Import the styles
import "@react-pdf-viewer/core/lib/styles/index.css";
import "@react-pdf-viewer/page-navigation/lib/styles/index.css";
import { RenderCurrentPageInputProps } from "@react-pdf-viewer/page-navigation";
const optionNum = ["", "الف", "ب", "پ", "ت", "ث", "ج", "چ", "ح"];
const NoteContainer = ({ notes, questions, setAnswer, endExam, info }) => {
const [activeNote, setActiveNote] = useState(0);
const [activeFileId, setActiveFileId] = useState(null);
const changeNoteHandler = (index, fileId) => {
setActiveNote(index);
setActiveFileId(fileId);
};
const [answerList, setAnswerList] = useState([]);
const [fake, setFake] = useState(0);
useEffect(() => {
setActiveFileId(notes[0].fileId);
let newlist = [];
for (let i = 0; i < questions?.length; i++) {
newlist.push(0);
}
setAnswerList(newlist);
}, [notes]);
const chooseOption = (index, answer, id) => {
let newlist = answerList;
if (newlist[index] === answer) {
newlist[index] = 0;
setAnswer({
userAnswerId: id,
answer: "0",
});
} else {
newlist[index] = answer;
setAnswer({
userAnswerId: id,
answer: String(answer),
});
}
setAnswerList(newlist);
setFake(Math.random() * 1000);
};
console.log(answerList);
//================================
const pageNavigationPluginInstance = pageNavigationPlugin();
const { CurrentPageInput } = pageNavigationPluginInstance;
//end exam ============================
const endExamHandler = () => {
endExam({
userExamId: info.id,
});
};
return (
<div className="w-full mt-3 rtl" style={{ height: "calc(100vh - 90px)" }}>
<div className="w-full h-full flex items-start">
{/* -----notes--------- */}
<div className="flex-1 h-full">
<div className="w-full h-10 border flex items-center">
{notes?.map((item, index) => (
<div
key={index}
className="h-full px-3 flex items-center text-sm cursor-pointer"
style={
activeNote === index
? { backgroundColor: "black", color: "#fff" }
: null
}
onClick={() => changeNoteHandler(index, item.fileId)}
>
{item?.name}
</div>
))}
</div>
<div className="w-full flex justify-center mt-2">
<div className="w-1/6">
<CurrentPageInput />
</div>
</div>
{activeFileId && (
<div
className="pdf-viewer w-full mt-2"
style={{ height: "calc(100% - 88px)" }}
>
<Worker workerUrl="https://unpkg.com/pdfjs-dist@2.13.216/build/pdf.worker.min.js">
<Viewer
fileUrl={`https://api.andishmand.ir/api/v1/file/${activeFileId}`}
plugins={[pageNavigationPluginInstance]}
/>
</Worker>
</div>
)}
</div>
{/* -----answers----------- */}
<div className="w-[300px] h-full px-3 overflow-y-auto">
<div className="w-full h-10 text-center text-lg">پاسخنامه</div>
<div className="w-full mt-2">
{questions?.map((item, index) => (
<div className="w-full flex items-center h-10 mb-2">
<div className="w-[40px] h-full bg-[#9999] flex items-center justify-center text-sm rounded-md">
{item?.questionNumber}
</div>
<div
className="h-full flex items-center"
style={{ width: "calc(100% - 40px)" }}
>
<div className="flex-1 h-full flex items-center justify-center">
<div
className="w-2/3 h-6 rounded-full border border-[#999] cursor-pointer"
onClick={() => chooseOption(index, 1, item.id)}
style={
answerList[index] === 1
? { backgroundColor: "#5ec427" }
: null
}
></div>
</div>
<div className="flex-1 h-full flex items-center justify-center">
<div
className="w-2/3 h-6 rounded-full border border-[#999] cursor-pointer"
onClick={() => chooseOption(index, 2, item.id)}
style={
answerList[index] === 2
? { backgroundColor: "#5ec427" }
: null
}
></div>
</div>
{item["question.type"] > 2 && (
<div className="flex-1 h-full flex items-center justify-center">
<div
className="w-2/3 h-6 rounded-full border border-[#999] cursor-pointer"
onClick={() => chooseOption(index, 3, item.id)}
style={
answerList[index] === 3
? { backgroundColor: "#5ec427" }
: null
}
></div>
</div>
)}
{item["question.type"] > 3 && (
<div className="flex-1 h-full flex items-center justify-center">
<div
className="w-2/3 h-6 rounded-full border border-[#999] cursor-pointer"
onClick={() => chooseOption(index, 4, item.id)}
style={
answerList[index] === 4
? { backgroundColor: "#5ec427" }
: null
}
></div>
</div>
)}
{item["question.type"] > 4 && (
<div className="flex-1 h-full flex items-center justify-center">
<div
className="w-2/3 h-6 rounded-full border border-[#999] cursor-pointer"
onClick={() => chooseOption(index, 5, item.id)}
style={
answerList[index] === 5
? { backgroundColor: "#5ec427" }
: null
}
></div>
</div>
)}
</div>
</div>
))}
</div>
<div
className="w-full h-10 rounded-full flex items-center justify-center text-center text-sm text-white bg-red52 cursor-pointer mx-auto mt-8"
onClick={endExamHandler}
>
ثبت و اتمام آزمون
</div>
</div>
</div>
</div>
);
};
export default NoteContainer;

@ -1,5 +1,4 @@
import React, { useEffect } from "react"; import { useState, useEffect } from "react";
import { useState } from "react";
// import { Document, Page } from "react-pdf"; // import { Document, Page } from "react-pdf";
import { Viewer, Worker } from "@react-pdf-viewer/core"; import { Viewer, Worker } from "@react-pdf-viewer/core";

@ -0,0 +1,100 @@
import React, { useMemo, useState } from "react";
import { useEffect } from "react";
import { connect } from "react-redux";
import Table from "../../components/Table";
import * as actions from "../../redux/actions";
import Editor from "./layouts/Editor";
const source = "offCode";
const title = " مدیریت کدهای تخفیف";
const DisCountCodeManagements = ({
info,
getData,
tabs,
setTabs,
add,
update,
CodeList,
schema,
}) => {
useMemo(() => {
// getData({ num: 1000 });
// getSchoolList();
getData({ num: 1000 });
}, []);
// console.log(info);
console.log("SchoolManagement render---------------------------------");
console.log(info);
console.log(CodeList);
console.log(schema);
// console.log("==============^tabs^==============");
// console.log(tabs);
useEffect(() => {
setTabs([
{
id: 0,
name: title,
isActive: true,
element: "table",
},
]);
}, []);
// console.log(tabs);
// const [tabs, setTabs] = useState([
// {
// id: 0,
// name: title,
// isActive: true,
// },
// ]);
const [activeOtherTab, setActiveOtherTab] = useState(false);
const [fake, setFake] = useState(0);
return (
<div
className="UserManagement h-screen max-h-screen bg-[#F8F8F8] overflow-y-auto rtl relative"
style={{ width: "calc(100vw - 120px)" }}
>
<div className="flex flex-1 w-full pt-12 pb-4">
<Table
data={CodeList || []}
// data={[]}
schema={schema || []}
Editor={Editor}
add={add}
update={update}
getData={getData}
title={title}
tabs={tabs}
setTabs={setTabs}
fake={fake}
setFake={setFake}
activeOtherTab={activeOtherTab}
setActiveOtherTab={setActiveOtherTab}
/>
</div>
</div>
);
};
const mapStateToProps = (state) => ({
info: state[source],
tabs: state.table.tabs,
CodeList: state.offCode.list,
schema: state.offCode.schema,
});
const mapDispatchToProps = {
// getData: actions[source].list,
getData: actions[source].schoolList,
setTabs: actions.table.setTab,
update: actions[source].update,
add: actions[source].add,
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(DisCountCodeManagements);

@ -0,0 +1,202 @@
import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import { file } from "../../../redux/actions";
import loadingGiff from "../../../assets/img/Rolling-1s-200px.gif";
import SimpleDatePicker from "../../../components/SimpleDatePicker";
import moment from "jalali-moment";
const baseUrl = "https://api.andishmand.ir/api/v1";
const components = (props) => ({
text: (
<input
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
string: (
<textarea
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
number: (
<input
type="number"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
select: (
<select
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
>
{Object.entries(props?.options || {}).map(([v, k]) => (
<option value={v} key={v}>
{k}
</option>
))}
</select>
),
file: (
<div className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA] flex justify-between bg-[#fff]">
<div className="w-full flex items-center">
<div
className="w-fit w-24 text-center py-1 rounded bg-[#111] text-white text-sm cursor-pointer"
onClick={props.chooseFile}
>
انتخاب فایل
</div>
{/* <div className="text-xs mt-2 text-right">{props.fileNmae}</div> */}
{props.fileNmae && !props.loading && (
<div
className="w-fit w-24 py-1 rounded bg-[#65A9FF] text-white text-sm mr-2 cursor-pointer"
onClick={props.uploadHandler}
>
آپلود
</div>
)}
{props.loading && (
<img src={loadingGiff} alt="loadingGiff" className="h-10 mr-2" />
)}
<input
className="edit-file-input w-0 h-0 hidden"
id="edit-file-input"
type={"file"}
// onChange={(e) => {
// props.setFileName(e.target.value);
// }}
onChange={(e) => props.fileInputHandler(e)}
/>
</div>
{props.defaultValue && !props?.fileNmae ? (
<img
src={baseUrl + "/file/" + props.defaultValue}
className="edit-file-img-placeholder h-10"
/>
) : null}
{props?.fileNmae && (
<img src={props?.fileNmae} className="edit-file-img-placeholder h-10" />
)}
</div>
),
date: (
<div className="w-full">
<SimpleDatePicker returnValue={props.setDateInfo} mode={props.mode} />
</div>
),
});
const Filed = (props) => {
return components(props)[props.type] || <div>{props.type}</div>;
};
const Editor = ({ data, schema, update, add, loading,lastUpload,uploadFile }) => {
const [info, setInfo] = useState(data ? { id: data?.original?.id } : {});
const changeInputHandler = (e, key) => {
setInfo({ ...info, [key]: e.target.value });
};
useEffect(() => {
if (lastUpload) {
setInfo({ ...info, fileId: String(lastUpload) });
}
}, [lastUpload]);
const submitHandler = () => {
if (data) update(info);
else add(info);
console.log(info);
};
const [fileNmae, setFileName] = useState(null);
const chooseFile = () => {
document.querySelector(".edit-file-input").click();
};
const fileInputHandler = (e) => {
console.log(e.target.value);
if (e.target.files && e.target.files[0]) {
var reader = new FileReader();
reader.onload = function (event) {
setFileName(event.target.result);
};
reader.readAsDataURL(e.target.files[0]);
}
};
const uploadHandler=()=>{
uploadFile({
file: document.querySelector("#edit-file-input").files[0],
});
}
const [dateInfo,setDateInfo]=useState(null);
const datehandler=(value,mode)=>{
setDateInfo({ ...value,mode});
}
useEffect(() => {
console.log("::::::::::::::::::::::::::::::::::::::::::::-")
console.log(dateInfo);
if(dateInfo?.day){
setInfo({
...info,
[dateInfo.mode]: moment(
`${dateInfo?.year}/${dateInfo?.month}/${dateInfo?.day}`
)
.locale("en")
.format("YYYY-MM-DD"),
});
}
}, [dateInfo]);
return (
<div className="w-full py-3" key={data?.id || 0}>
{console.log({ data })}
<div className="w-full flex rtl flex-wrap items-center justify-between gap-y-6">
{schema?.map((item, index) => (
<div key={index} className="w-1/2 shrink-0 flex items-center ">
<div className="w-1/6 text-sm ml-2">{item?.description}:</div>
<Filed
type={
item?.options
? "select"
: item.name == "fileId"
? "file"
: item?.type
}
options={item?.options}
defaultValue={data?.original[item?.name]}
onChange={(e) => changeInputHandler(e, item?.name)}
fileNmae={fileNmae}
setFileName={setFileName}
chooseFile={chooseFile}
fileInputHandler={fileInputHandler}
uploadHandler={uploadHandler}
loading={loading}
setDateInfo={datehandler}
mode={item?.name}
/>
</div>
))}
</div>
<div
className="px-6 py-4 w-fit rounded-md bg-[#df1452] text-[#fff] text-base cursor-pointer mx-auto mt-6"
onClick={submitHandler}
>
{data ? "ثبت تغییرات" : "ثبت ردیف"}
</div>
</div>
);
};
const mapStateToProps = (state) => ({
loading: state.file.loading,
lastUpload: state.file.lastUpload,
});
const mapDispatchToProps = {
uploadFile : file.upload
};
export default connect(mapStateToProps, mapDispatchToProps)(Editor);

@ -0,0 +1,93 @@
import React, { useMemo, useState } from "react";
import { useEffect } from "react";
import { connect } from "react-redux";
import Table from "../../components/Table";
import * as actions from "../../redux/actions";
import Editor from "./layouts/Editor";
const source = "book";
const title = " مدیریت محصولات";
const ProductMangement = ({
info,
getData,
tabs,
setTabs,
add,
update,
productList,
schema,
}) => {
useMemo(() => {
getData({ num: 1000 });
}, []);
console.log("productManagement render---------------------------------");
console.log(info);
console.log(productList);
console.log(schema);
// console.log("==============^tabs^==============");
// console.log(tabs);
useEffect(() => {
setTabs([
{
id: 0,
name: title,
isActive: true,
element: "table",
},
]);
}, []);
// console.log(tabs);
// const [tabs, setTabs] = useState([
// {
// id: 0,
// name: title,
// isActive: true,
// },
// ]);
const [activeOtherTab, setActiveOtherTab] = useState(false);
const [fake, setFake] = useState(0);
return (
<div
className="UserManagement h-screen max-h-screen bg-[#F8F8F8] overflow-y-auto rtl relative"
style={{ width: "calc(100vw - 120px)" }}
>
<div className="flex flex-1 w-full pt-12 pb-4">
<Table
data={productList || []}
schema={schema || []}
Editor={Editor}
add={add}
update={update}
getData={getData}
title={title}
tabs={tabs}
setTabs={setTabs}
fake={fake}
setFake={setFake}
activeOtherTab={activeOtherTab}
setActiveOtherTab={setActiveOtherTab}
/>
</div>
</div>
);
};
const mapStateToProps = (state) => ({
info: state[source],
tabs: state.table.tabs,
productList: state.book.list,
schema: state.book.schema,
});
const mapDispatchToProps = {
// getData: actions[source].list,
getData: actions[source].list,
setTabs: actions.table.setTab,
update: actions[source].update,
add: actions[source].add,
};
export default connect(mapStateToProps, mapDispatchToProps)(ProductMangement);

@ -0,0 +1,202 @@
import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import { file } from "../../../redux/actions";
import loadingGiff from "../../../assets/img/Rolling-1s-200px.gif";
import SimpleDatePicker from "../../../components/SimpleDatePicker";
import moment from "jalali-moment";
const baseUrl = "https://light.barnamenegar.com/api/v1";
const components = (props) => ({
text: (
<input
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
string: (
<textarea
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
number: (
<input
type="number"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
/>
),
select: (
<select
type="text"
className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA]"
{...props}
>
{Object.entries(props?.options || {}).map(([v, k]) => (
<option value={v} key={v}>
{k}
</option>
))}
</select>
),
file: (
<div className="table-edit-input w-full py-3 px-2 rounded-md border border-[#D5DEEA] flex justify-between bg-[#fff]">
<div className="w-full flex items-center">
<div
className="w-fit w-24 text-center py-1 rounded bg-[#111] text-white text-sm cursor-pointer"
onClick={props.chooseFile}
>
انتخاب فایل
</div>
{/* <div className="text-xs mt-2 text-right">{props.fileNmae}</div> */}
{props.fileNmae && !props.loading && (
<div
className="w-fit w-24 py-1 rounded bg-[#65A9FF] text-white text-sm mr-2 cursor-pointer"
onClick={props.uploadHandler}
>
آپلود
</div>
)}
{props.loading && (
<img src={loadingGiff} alt="loadingGiff" className="h-10 mr-2" />
)}
<input
className="edit-file-input w-0 h-0 hidden"
id="edit-file-input"
type={"file"}
// onChange={(e) => {
// props.setFileName(e.target.value);
// }}
onChange={(e) => props.fileInputHandler(e)}
/>
</div>
{props.defaultValue && !props?.fileNmae ? (
<img
src={baseUrl + "/file/" + props.defaultValue}
className="edit-file-img-placeholder h-10"
/>
) : null}
{props?.fileNmae && (
<img src={props?.fileNmae} className="edit-file-img-placeholder h-10" />
)}
</div>
),
date: (
<div className="w-full">
<SimpleDatePicker returnValue={props.setDateInfo} mode={props.mode} />
</div>
),
});
const Filed = (props) => {
return components(props)[props.type] || <div>{props.type}</div>;
};
const Editor = ({ data, schema, update, add, loading,lastUpload,uploadFile }) => {
const [info, setInfo] = useState(data ? { id: data?.original?.id } : {});
const changeInputHandler = (e, key) => {
setInfo({ ...info, [key]: e.target.value });
};
useEffect(() => {
if (lastUpload) {
setInfo({ ...info, fileId: String(lastUpload) });
}
}, [lastUpload]);
const submitHandler = () => {
if (data) update(info);
else add(info);
console.log(info);
};
const [fileNmae, setFileName] = useState(null);
const chooseFile = () => {
document.querySelector(".edit-file-input").click();
};
const fileInputHandler = (e) => {
console.log(e.target.value);
if (e.target.files && e.target.files[0]) {
var reader = new FileReader();
reader.onload = function (event) {
setFileName(event.target.result);
};
reader.readAsDataURL(e.target.files[0]);
}
};
const uploadHandler=()=>{
uploadFile({
file: document.querySelector("#edit-file-input").files[0],
});
}
const [dateInfo,setDateInfo]=useState(null);
const datehandler=(value,mode)=>{
setDateInfo({ ...value,mode});
}
useEffect(() => {
console.log("::::::::::::::::::::::::::::::::::::::::::::-")
console.log(dateInfo);
if(dateInfo?.day){
setInfo({
...info,
[dateInfo.mode]: moment(
`${dateInfo?.year}/${dateInfo?.month}/${dateInfo?.day}`
)
.locale("en")
.format("YYYY-MM-DD"),
});
}
}, [dateInfo]);
return (
<div className="w-full py-3" key={data?.id || 0}>
{console.log({ data })}
<div className="w-full flex rtl flex-wrap items-center justify-between gap-y-6">
{schema?.map((item, index) => (
<div key={index} className="w-1/2 shrink-0 flex items-center ">
<div className="w-1/6 text-sm ml-2">{item?.description}:</div>
<Filed
type={
item?.options
? "select"
: item.name == "fileId"
? "file"
: item?.type
}
options={item?.options}
defaultValue={data?.original[item?.name]}
onChange={(e) => changeInputHandler(e, item?.name)}
fileNmae={fileNmae}
setFileName={setFileName}
chooseFile={chooseFile}
fileInputHandler={fileInputHandler}
uploadHandler={uploadHandler}
loading={loading}
setDateInfo={datehandler}
mode={item?.name}
/>
</div>
))}
</div>
<div
className="px-6 py-4 w-fit rounded-md bg-[#df1452] text-[#fff] text-base cursor-pointer mx-auto mt-6"
onClick={submitHandler}
>
{data ? "ثبت تغییرات" : "ثبت ردیف"}
</div>
</div>
);
};
const mapStateToProps = (state) => ({
loading: state.file.loading,
lastUpload: state.file.lastUpload,
});
const mapDispatchToProps = {
uploadFile : file.upload
};
export default connect(mapStateToProps, mapDispatchToProps)(Editor);

@ -7,8 +7,8 @@ import Table from "../../components/Table";
import * as actions from "../../redux/actions"; import * as actions from "../../redux/actions";
import Editor from "./layouts/Editor"; import Editor from "./layouts/Editor";
const source = "book"; const source = "network";
const title = " مدیریت کاربران"; const title = " مدیریت مدارس";
const SchoolMangement = ({ const SchoolMangement = ({
info, info,
@ -24,13 +24,14 @@ const SchoolMangement = ({
}) => { }) => {
useMemo(() => { useMemo(() => {
// getData({ num: 1000 }); // getData({ num: 1000 });
getSchoolList(); // getSchoolList();
getData({ num: 1000 });
}, []); }, []);
// console.log(info); // console.log(info);
console.log("SchoolManagement render---------------------------------"); console.log("SchoolManagement render---------------------------------");
console.log(info);
console.log(schoolList); console.log(schoolList);
console.log(schema); console.log(schema);
console.log(info);
// console.log("==============^tabs^=============="); // console.log("==============^tabs^==============");
// console.log(tabs); // console.log(tabs);
useEffect(() => { useEffect(() => {
@ -53,22 +54,16 @@ const SchoolMangement = ({
// ]); // ]);
const [activeOtherTab, setActiveOtherTab] = useState(false); const [activeOtherTab, setActiveOtherTab] = useState(false);
const [fake, setFake] = useState(0); const [fake, setFake] = useState(0);
const [schoolId, setSchoolId] = useState(null);
const [setp, setStep] = useState(1);
const submitHandler = () => {
getData({ id: schoolId });
setStep(2);
};
return ( return (
<div <div
className="UserManagement w-[95.5%] h-screen max-h-screen bg-[#F8F8F8] overflow-y-auto rtl relative" className="UserManagement h-screen max-h-screen bg-[#F8F8F8] overflow-y-auto rtl relative"
// style={{ width: "calc(100% - 4.5%)" }} style={{ width: "calc(100vw - 120px)" }}
> >
<div className="flex flex-1 w-full pt-12 pb-4"> <div className="flex flex-1 w-full pt-12 pb-4">
<Table <Table
// data={schoolList || []} data={schoolList || []}
data={[]} // data={[]}
schema={schema || []} schema={schema || []}
Editor={Editor} Editor={Editor}
add={add} add={add}
@ -89,18 +84,16 @@ const SchoolMangement = ({
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
info: state[source], info: state[source],
tabs: state.table.tabs, tabs: state.table.tabs,
schoolList: state.book.schoolList, schoolList: state.network.list,
schoolUserList: state.book.schoolUserList, schema:state.network.schema
schema:state.book.schema
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
// getData: actions[source].list, // getData: actions[source].list,
getData: actions[source].schoolUser, getData: actions[source].schoolList,
setTabs: actions.table.setTab, setTabs: actions.table.setTab,
update: actions[source].update, update: actions[source].update,
add: actions[source].add, add: actions[source].add,
getSchoolList: actions.book.schoolList,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(SchoolMangement); export default connect(mapStateToProps, mapDispatchToProps)(SchoolMangement);

@ -1424,11 +1424,18 @@
resolved "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz" resolved "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz"
integrity sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw== integrity sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw==
"@react-pdf-viewer/core@^3.1.2": "@react-pdf-viewer/core@3.1.2", "@react-pdf-viewer/core@^3.1.2":
version "3.1.2" version "3.1.2"
resolved "https://registry.npmjs.org/@react-pdf-viewer/core/-/core-3.1.2.tgz" resolved "https://registry.npmjs.org/@react-pdf-viewer/core/-/core-3.1.2.tgz"
integrity sha512-tctjW98NjIN/BaZO42r0ZPx63H41EubU/n+E9nS1zS/3K/xrILQU5s+UP0WqEYoBFNs/mMI7pTJWsxV4WUhdDg== integrity sha512-tctjW98NjIN/BaZO42r0ZPx63H41EubU/n+E9nS1zS/3K/xrILQU5s+UP0WqEYoBFNs/mMI7pTJWsxV4WUhdDg==
"@react-pdf-viewer/page-navigation@3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@react-pdf-viewer/page-navigation/-/page-navigation-3.1.2.tgz#2754e750f24d5f166557571b85f212cbcc96150d"
integrity sha512-mQIe2wGApiAzVahMvFgCD+c9JLWCllxDMfcM3fXpk9YUuvN3J2qtkX1a30qncoH51pFdAA+Iy6dnHYxoMsNeag==
dependencies:
"@react-pdf-viewer/core" "3.1.2"
"@rollup/plugin-babel@^5.2.0": "@rollup/plugin-babel@^5.2.0":
version "5.3.0" version "5.3.0"
resolved "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz" resolved "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz"

Loading…
Cancel
Save