From a9c404b1fee9b865dc2345338295b1b15e0f2b3f Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Sun, 28 Dec 2025 23:01:46 +0000 Subject: [PATCH 1/7] add ability to create multiple approved absences at once --- client/src/components/ActionButton.jsx | 226 +++++++++++++++++++++++++ client/src/entities/known-absence.jsx | 13 ++ client/src/utils/appPermissions.js | 4 + 3 files changed, 243 insertions(+) create mode 100644 client/src/components/ActionButton.jsx diff --git a/client/src/components/ActionButton.jsx b/client/src/components/ActionButton.jsx new file mode 100644 index 00000000..6f759368 --- /dev/null +++ b/client/src/components/ActionButton.jsx @@ -0,0 +1,226 @@ +import React, { useState ,useCallback} from 'react'; +import {useDataProvider, useNotify,useResourceContext,useRefresh,SaveButton,SimpleForm,TextInput,NumberInput,BooleanInput,DateInput,required,maxLength,} from 'react-admin'; +import { SaveContextProvider } from 'ra-core'; +import { Button, Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material'; +import { ActionOrDialogButton } from '@shared/components/crudContainers/ActionOrDialogButton'; +import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput'; +import { handleError } from '@shared/utils/notifyUtil'; + +const createEmptyRow = () => ({ + id: crypto.randomUUID(), + klassReferenceId: '', + lessonReferenceId: '', + absnceCount: 1, + errors: {}, +}); + +export const ActionButton = ({ label }) => { + const dataProvider = useDataProvider(); + const resource = useResourceContext(); + const refresh = useRefresh(); + const notify = useNotify(); + + const [studentReferenceId, setStudentReferenceId] = useState(''); + const [reportDate, setReportDate] = useState(''); + const [absnceCode, setAbsenceCode] = useState(''); + const [senderName, setSenderName] = useState(''); + const [reason, setReason] = useState(''); + const [comment, setComment] = useState(''); + const [isApproved, setIsApproved] = useState(true); + + const [rows, setRows] = useState([createEmptyRow()]); + + const validateRow = row => { + const errors = {}; + if (!row.klassReferenceId) errors.klassReferenceId = true; + if (!row.absnceCount || row.absnceCount <= 0) + errors.absnceCount = true; + return errors; + }; + + const updateRow = (id, field, value) => + setRows(prev => + prev.map(row => { + if (row.id !== id) return row; + const updated = { ...row, [field]: value }; + return { ...updated, errors: validateRow(updated) }; + }) + ); + + const addRow = () => setRows(prev => [...prev, createEmptyRow()]); + + const removeRow = id => { + if (rows.length === 1) { + notify('לא ניתן למחוק את השורה האחרונה', { type: 'warning' }); + return; + } + setRows(prev => prev.filter(row => row.id !== id)); + }; + + + const handleSave = useCallback( + async (onClose) => { + const validatedRows = rows.map(row => ({ + ...row, + errors: validateRow(row), + })); + setRows(validatedRows); + + const hasRowErrors = validatedRows.some( + row => Object.keys(row.errors).length > 0 + ); + + if (!studentReferenceId || !reportDate || hasRowErrors) { + notify('נא למלא את כל שדות החובה', { type: 'warning' }); + return; + } + + const payload = validatedRows.map(row => ({ + studentReferenceId, + reportDate, + absnceCode: absnceCode || null, + senderName: senderName || null, + reason: reason || null, + comment: comment || null, + isApproved, + klassReferenceId: row.klassReferenceId, + lessonReferenceId: row.lessonReferenceId || null, + absnceCount: row.absnceCount, + })); + + try { + await dataProvider.createMany(resource, payload); + refresh(); + notify('הפריט נוסף בהצלחה', { type: 'success' }); + onClose(); + } catch (err) { + notify('אירעה שגיאה', { type: 'error' }); + handleError(err); + } + }, + [rows,studentReferenceId,reportDate,absnceCode,senderName,reason,comment,isApproved,dataProvider, resource, refresh, notify, ] + ); + + + + return ( + ( + + + setReportDate(e?.target?.value ?? e)} validate={required()} label="תאריך"/> + setAbsenceCode(e?.target?.value ?? e)}label="קוד חיסור" /> + setSenderName(e?.target?.value ?? e)} validate={maxLength(500)} label="שולחת"/> + setReason(e?.target?.value ?? e)} validate={maxLength(500)} label="סיבה"/> + setComment(e?.target?.value ?? e)} validate={maxLength(500)} label="הערה"/> + setIsApproved(e.target.checked)} label="מאושר"/> + +
+ + + + + כיתה * + שיעור + מספר חיסורים * + + + + + + {rows.map(row => ( + + + + updateRow( + row.id, + 'klassReferenceId', + v?.target?.value ?? v + ) + } + error={!!row.errors.klassReferenceId} + helperText={ + row.errors.klassReferenceId + ? 'שדה חובה' + : '' + } + label={false} + /> + + + + + updateRow( + row.id, + 'lessonReferenceId', + v?.target?.value ?? v + ) + } + label={false} + + /> + + + + + updateRow( + row.id, + 'absnceCount', + Number( + e?.target?.value ?? e + ) + ) + } + error={!!row.errors.absnceCount} + helperText={ + row.errors.absnceCount + ? 'חייב להיות גדול מ־0' + : '' + } + label={false} + /> + + + + + + + ))} + +
+ + +
+ handleSave(onClose) }}> + + + +
+
+ )} + /> + ); +}; diff --git a/client/src/entities/known-absence.jsx b/client/src/entities/known-absence.jsx index a0dd05ce..003633d5 100644 --- a/client/src/entities/known-absence.jsx +++ b/client/src/entities/known-absence.jsx @@ -7,6 +7,8 @@ import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput import { defaultYearFilter, yearChoices } from '@shared/utils/yearFilter'; import CommonAutocompleteInput from '@shared/components/fields/CommonAutocompleteInput'; import { CommonHebrewDateField } from '@shared/components/fields/CommonHebrewDateField'; +import { ActionButton } from 'src/components/ActionButton'; +import {isApprovedAbsencesBulk} from 'src/utils/appPermissions'; const filters = [ ({ isAdmin }) => isAdmin && , @@ -32,6 +34,16 @@ const filterDefaultValues = { ...defaultYearFilter, }; +export const ApprovedAbsencesAction = ({ permissions }) => +{ + const approvedAbsencesBulk = isApprovedAbsencesBulk(permissions) && !isAdmin(permissions); + + if (!approvedAbsencesBulk) return null; + return( + + )}; + + const Datagrid = ({ isAdmin, children, ...props }) => { return ( @@ -88,6 +100,7 @@ const entity = { filters, importer, filterDefaultValues, + additionalListActions: , }; export default getResourceComponents(entity); diff --git a/client/src/utils/appPermissions.js b/client/src/utils/appPermissions.js index 2e941ea8..b98c9168 100644 --- a/client/src/utils/appPermissions.js +++ b/client/src/utils/appPermissions.js @@ -8,6 +8,7 @@ export const appPermissions = { inLessonReportStartWithTeacher: 'inLessonReport.startWithTeacher', absCountEffect: 'absCountEffect', lessonSignature: 'lessonSignature', + approvedAbsencesBulk:'approvedAbsencesBulk' }; export const isScannerUpload = (permissions) => hasPermissionLogic(permissions, appPermissions.scannerUpload); @@ -30,3 +31,6 @@ export const useIsAbsCountEffect = () => useHasPermission(appPermissions.absCoun export const isLessonSignature = (permissions) => isAdmin(permissions) || hasPermissionLogic(permissions, appPermissions.lessonSignature); export const useIsLessonSignature = () => useHasPermission(appPermissions.lessonSignature); + +export const isApprovedAbsencesBulk = (permissions) => isAdmin(permissions) || hasPermissionLogic(permissions, appPermissions.approvedAbsencesBulk); +export const useIsApprovedAbsencesBulk = () => useHasPermission(appPermissions.approvedAbsencesBulk); \ No newline at end of file From 650f716b6003001d456d7e54d62685f7c9651d76 Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Tue, 30 Dec 2025 18:43:39 +0000 Subject: [PATCH 2/7] refactor approved absences actions --- client/src/components/ActionButton.jsx | 224 ++++--------------------- client/src/entities/known-absence.jsx | 20 +-- 2 files changed, 44 insertions(+), 200 deletions(-) diff --git a/client/src/components/ActionButton.jsx b/client/src/components/ActionButton.jsx index 6f759368..cf85d20e 100644 --- a/client/src/components/ActionButton.jsx +++ b/client/src/components/ActionButton.jsx @@ -1,90 +1,33 @@ -import React, { useState ,useCallback} from 'react'; -import {useDataProvider, useNotify,useResourceContext,useRefresh,SaveButton,SimpleForm,TextInput,NumberInput,BooleanInput,DateInput,required,maxLength,} from 'react-admin'; -import { SaveContextProvider } from 'ra-core'; -import { Button, Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material'; + +import {useDataProvider, useNotify,useResourceContext,useRefresh,SimpleForm,TextInput,NumberInput,BooleanInput,DateInput,required,maxLength,ArrayInput,SimpleFormIterator} from 'react-admin'; import { ActionOrDialogButton } from '@shared/components/crudContainers/ActionOrDialogButton'; import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput'; import { handleError } from '@shared/utils/notifyUtil'; +import { isApprovedAbsencesBulk } from 'src/utils/appPermissions'; + -const createEmptyRow = () => ({ - id: crypto.randomUUID(), - klassReferenceId: '', - lessonReferenceId: '', - absnceCount: 1, - errors: {}, -}); -export const ActionButton = ({ label }) => { +export const ActionButton = ({ label, name, permissions }) => { + if (isApprovedAbsencesBulk(permissions)) return null; const dataProvider = useDataProvider(); const resource = useResourceContext(); const refresh = useRefresh(); const notify = useNotify(); - const [studentReferenceId, setStudentReferenceId] = useState(''); - const [reportDate, setReportDate] = useState(''); - const [absnceCode, setAbsenceCode] = useState(''); - const [senderName, setSenderName] = useState(''); - const [reason, setReason] = useState(''); - const [comment, setComment] = useState(''); - const [isApproved, setIsApproved] = useState(true); - - const [rows, setRows] = useState([createEmptyRow()]); - - const validateRow = row => { - const errors = {}; - if (!row.klassReferenceId) errors.klassReferenceId = true; - if (!row.absnceCount || row.absnceCount <= 0) - errors.absnceCount = true; - return errors; - }; - - const updateRow = (id, field, value) => - setRows(prev => - prev.map(row => { - if (row.id !== id) return row; - const updated = { ...row, [field]: value }; - return { ...updated, errors: validateRow(updated) }; - }) - ); - - const addRow = () => setRows(prev => [...prev, createEmptyRow()]); - const removeRow = id => { - if (rows.length === 1) { - notify('לא ניתן למחוק את השורה האחרונה', { type: 'warning' }); - return; - } - setRows(prev => prev.filter(row => row.id !== id)); - }; + const handleSave = async (values, onClose) => { - - const handleSave = useCallback( - async (onClose) => { - const validatedRows = rows.map(row => ({ - ...row, - errors: validateRow(row), - })); - setRows(validatedRows); - - const hasRowErrors = validatedRows.some( - row => Object.keys(row.errors).length > 0 - ); - - if (!studentReferenceId || !reportDate || hasRowErrors) { - notify('נא למלא את כל שדות החובה', { type: 'warning' }); - return; - } - const payload = validatedRows.map(row => ({ - studentReferenceId, - reportDate, - absnceCode: absnceCode || null, - senderName: senderName || null, - reason: reason || null, - comment: comment || null, - isApproved, + const payload = values.approvedAbsences.map(row => ({ + studentReferenceId: values.studentReferenceId, + reportDate: values.reportDate, + absnceCode: values.absnceCode || null, + senderName: values.senderName || null, + reason: values.reason || null, + comment:values.comment || null, + isApproved: values.isApproved, klassReferenceId: row.klassReferenceId, - lessonReferenceId: row.lessonReferenceId || null, + lessonReferenceId: row.lessonReferenceId || null, absnceCount: row.absnceCount, })); @@ -97,9 +40,8 @@ export const ActionButton = ({ label }) => { notify('אירעה שגיאה', { type: 'error' }); handleError(err); } - }, - [rows,studentReferenceId,reportDate,absnceCode,senderName,reason,comment,isApproved,dataProvider, resource, refresh, notify, ] - ); + }; + @@ -108,118 +50,24 @@ export const ActionButton = ({ label }) => { label={label} name="approvedAbsences" dialogContent={({ onClose }) => ( - - - setReportDate(e?.target?.value ?? e)} validate={required()} label="תאריך"/> - setAbsenceCode(e?.target?.value ?? e)}label="קוד חיסור" /> - setSenderName(e?.target?.value ?? e)} validate={maxLength(500)} label="שולחת"/> - setReason(e?.target?.value ?? e)} validate={maxLength(500)} label="סיבה"/> - setComment(e?.target?.value ?? e)} validate={maxLength(500)} label="הערה"/> - setIsApproved(e.target.checked)} label="מאושר"/> - -
- - - - - כיתה * - שיעור - מספר חיסורים * - - - - - - {rows.map(row => ( - - - - updateRow( - row.id, - 'klassReferenceId', - v?.target?.value ?? v - ) - } - error={!!row.errors.klassReferenceId} - helperText={ - row.errors.klassReferenceId - ? 'שדה חובה' - : '' - } - label={false} - /> - - - - - updateRow( - row.id, - 'lessonReferenceId', - v?.target?.value ?? v - ) - } - label={false} - - /> - - - - - updateRow( - row.id, - 'absnceCount', - Number( - e?.target?.value ?? e - ) - ) - } - error={!!row.errors.absnceCount} - helperText={ - row.errors.absnceCount - ? 'חייב להיות גדול מ־0' - : '' - } - label={false} - /> - - - - - - - ))} - -
- - -
- handleSave(onClose) }}> - - - -
-
+ handleSave(values, onClose)}> + + + + + + + + + + + + + + + + + )} /> ); diff --git a/client/src/entities/known-absence.jsx b/client/src/entities/known-absence.jsx index 003633d5..36493687 100644 --- a/client/src/entities/known-absence.jsx +++ b/client/src/entities/known-absence.jsx @@ -8,7 +8,6 @@ import { defaultYearFilter, yearChoices } from '@shared/utils/yearFilter'; import CommonAutocompleteInput from '@shared/components/fields/CommonAutocompleteInput'; import { CommonHebrewDateField } from '@shared/components/fields/CommonHebrewDateField'; import { ActionButton } from 'src/components/ActionButton'; -import {isApprovedAbsencesBulk} from 'src/utils/appPermissions'; const filters = [ ({ isAdmin }) => isAdmin && , @@ -34,16 +33,6 @@ const filterDefaultValues = { ...defaultYearFilter, }; -export const ApprovedAbsencesAction = ({ permissions }) => -{ - const approvedAbsencesBulk = isApprovedAbsencesBulk(permissions) && !isAdmin(permissions); - - if (!approvedAbsencesBulk) return null; - return( - - )}; - - const Datagrid = ({ isAdmin, children, ...props }) => { return ( @@ -100,7 +89,14 @@ const entity = { filters, importer, filterDefaultValues, - additionalListActions: , + additionalListActions: [ + , +], + }; export default getResourceComponents(entity); From e9e4a5a3212c2f9c2a67b41f9d2f6cf18ab75f7b Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Tue, 30 Dec 2025 19:22:13 +0000 Subject: [PATCH 3/7] improve ActionButton behavior --- client/src/components/ActionButton.jsx | 93 +++++++++++++------------- client/src/entities/known-absence.jsx | 16 +++-- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/client/src/components/ActionButton.jsx b/client/src/components/ActionButton.jsx index cf85d20e..3cc44529 100644 --- a/client/src/components/ActionButton.jsx +++ b/client/src/components/ActionButton.jsx @@ -1,48 +1,48 @@ - -import {useDataProvider, useNotify,useResourceContext,useRefresh,SimpleForm,TextInput,NumberInput,BooleanInput,DateInput,required,maxLength,ArrayInput,SimpleFormIterator} from 'react-admin'; +import { useDataProvider, useNotify, useResourceContext, useRefresh, SimpleForm, TextInput, NumberInput, BooleanInput, DateInput, required, maxLength, ArrayInput, SimpleFormIterator } from 'react-admin'; import { ActionOrDialogButton } from '@shared/components/crudContainers/ActionOrDialogButton'; import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput'; -import { handleError } from '@shared/utils/notifyUtil'; +import { handleActionSuccess, handleError } from '@shared/utils/notifyUtil'; import { isApprovedAbsencesBulk } from 'src/utils/appPermissions'; export const ActionButton = ({ label, name, permissions }) => { - if (isApprovedAbsencesBulk(permissions)) return null; const dataProvider = useDataProvider(); const resource = useResourceContext(); const refresh = useRefresh(); const notify = useNotify(); + if (!isApprovedAbsencesBulk(permissions)) return null; const handleSave = async (values, onClose) => { - - const payload = values.approvedAbsences.map(row => ({ - studentReferenceId: values.studentReferenceId, - reportDate: values.reportDate, - absnceCode: values.absnceCode || null, - senderName: values.senderName || null, - reason: values.reason || null, - comment:values.comment || null, - isApproved: values.isApproved, - klassReferenceId: row.klassReferenceId, - lessonReferenceId: row.lessonReferenceId || null, - absnceCount: row.absnceCount, - })); - - try { - await dataProvider.createMany(resource, payload); - refresh(); - notify('הפריט נוסף בהצלחה', { type: 'success' }); - onClose(); - } catch (err) { - notify('אירעה שגיאה', { type: 'error' }); - handleError(err); - } - }; - - + const payload = values.approvedAbsences.map(row => ({ + studentReferenceId: values.studentReferenceId, + reportDate: values.reportDate, + absnceCode: values.absnceCode || null, + senderName: values.senderName || null, + reason: values.reason || null, + comment: values.comment || null, + isApproved: values.isApproved, + klassReferenceId: row.klassReferenceId, + lessonReferenceId: row.lessonReferenceId || null, + absnceCount: row.absnceCount, + })); + + try { + const response = await dataProvider.createMany(resource, payload); + handleActionSuccess(notify)(response); + refresh(); + onClose?.(); + + } catch (err) { + handleError(err, notify); + } + + + }; + + return ( @@ -50,24 +50,23 @@ export const ActionButton = ({ label, name, permissions }) => { label={label} name="approvedAbsences" dialogContent={({ onClose }) => ( - handleSave(values, onClose)}> - - - - - - - - + handleSave(values, onClose)}> + + + + + + + - - - - - - - - + + + + + + + + )} /> ); diff --git a/client/src/entities/known-absence.jsx b/client/src/entities/known-absence.jsx index 36493687..ed0c868a 100644 --- a/client/src/entities/known-absence.jsx +++ b/client/src/entities/known-absence.jsx @@ -83,19 +83,21 @@ const importer = { fields: ['studentTz', 'klassId', 'lessonId', 'reportDate', 'absnceCount', 'absnceCode', 'senderName', 'reason', 'comment', 'isApproved'], } +const additionalListActions = [ + , +]; + const entity = { Datagrid, Inputs, filters, importer, filterDefaultValues, - additionalListActions: [ - , -], + additionalListActions, }; From 76e9494dc312a94a9d3170f3f93e052140d370ac Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Tue, 30 Dec 2025 21:18:41 +0000 Subject: [PATCH 4/7] rename BulkApproveAbsences --- client/src/components/ActionButton.jsx | 73 ------------------- client/src/components/BulkApproveAbsences.jsx | 58 +++++++++++++++ client/src/entities/known-absence.jsx | 4 +- 3 files changed, 60 insertions(+), 75 deletions(-) delete mode 100644 client/src/components/ActionButton.jsx create mode 100644 client/src/components/BulkApproveAbsences.jsx diff --git a/client/src/components/ActionButton.jsx b/client/src/components/ActionButton.jsx deleted file mode 100644 index 3cc44529..00000000 --- a/client/src/components/ActionButton.jsx +++ /dev/null @@ -1,73 +0,0 @@ -import { useDataProvider, useNotify, useResourceContext, useRefresh, SimpleForm, TextInput, NumberInput, BooleanInput, DateInput, required, maxLength, ArrayInput, SimpleFormIterator } from 'react-admin'; -import { ActionOrDialogButton } from '@shared/components/crudContainers/ActionOrDialogButton'; -import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput'; -import { handleActionSuccess, handleError } from '@shared/utils/notifyUtil'; -import { isApprovedAbsencesBulk } from 'src/utils/appPermissions'; - - - -export const ActionButton = ({ label, name, permissions }) => { - const dataProvider = useDataProvider(); - const resource = useResourceContext(); - const refresh = useRefresh(); - const notify = useNotify(); - if (!isApprovedAbsencesBulk(permissions)) return null; - - - const handleSave = async (values, onClose) => { - - const payload = values.approvedAbsences.map(row => ({ - studentReferenceId: values.studentReferenceId, - reportDate: values.reportDate, - absnceCode: values.absnceCode || null, - senderName: values.senderName || null, - reason: values.reason || null, - comment: values.comment || null, - isApproved: values.isApproved, - klassReferenceId: row.klassReferenceId, - lessonReferenceId: row.lessonReferenceId || null, - absnceCount: row.absnceCount, - })); - - try { - const response = await dataProvider.createMany(resource, payload); - handleActionSuccess(notify)(response); - refresh(); - onClose?.(); - - } catch (err) { - handleError(err, notify); - } - - - }; - - - - - return ( - ( - handleSave(values, onClose)}> - - - - - - - - - - - - - - - - - )} - /> - ); -}; diff --git a/client/src/components/BulkApproveAbsences.jsx b/client/src/components/BulkApproveAbsences.jsx new file mode 100644 index 00000000..05ec4f40 --- /dev/null +++ b/client/src/components/BulkApproveAbsences.jsx @@ -0,0 +1,58 @@ +import { useDataProvider, useNotify, useResourceContext, useRefresh, SimpleForm, TextInput, NumberInput, BooleanInput, DateInput, required, maxLength, ArrayInput, SimpleFormIterator } from 'react-admin'; +import { ActionOrDialogButton } from '@shared/components/crudContainers/ActionOrDialogButton'; +import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput'; +import { handleActionSuccess, handleError } from '@shared/utils/notifyUtil'; +import { isApprovedAbsencesBulk } from 'src/utils/appPermissions'; + +export const BulkApproveAbsences = ({ label, name, permissions }) => { + const dataProvider = useDataProvider(); + const resource = useResourceContext(); + const refresh = useRefresh(); + const notify = useNotify(); + if (isApprovedAbsencesBulk(permissions)) return null; + + const handleSave = async (values, onClose) => { + const payload = values.approvedAbsences.map(row => ({ + studentReferenceId: values.studentReferenceId, + reportDate: values.reportDate, + absnceCode: values.absnceCode || null, + senderName: values.senderName || null, + reason: values.reason || null, + comment: values.comment || null, + isApproved: values.isApproved, + klassReferenceId: row.klassReferenceId, + lessonReferenceId: row.lessonReferenceId || null, + absnceCount: row.absnceCount, + })); + try { + const response = await dataProvider.createMany(resource, payload); + handleActionSuccess(notify)(response); + refresh(); + onClose?.(); + } + catch (err) { + handleError(notify)(err); + } + }; + + return ( + ( + handleSave(values, onClose)}> + + + + + + + + + + + + + + + + )}/> + ); +}; diff --git a/client/src/entities/known-absence.jsx b/client/src/entities/known-absence.jsx index ed0c868a..0c325318 100644 --- a/client/src/entities/known-absence.jsx +++ b/client/src/entities/known-absence.jsx @@ -7,7 +7,7 @@ import CommonReferenceInput from '@shared/components/fields/CommonReferenceInput import { defaultYearFilter, yearChoices } from '@shared/utils/yearFilter'; import CommonAutocompleteInput from '@shared/components/fields/CommonAutocompleteInput'; import { CommonHebrewDateField } from '@shared/components/fields/CommonHebrewDateField'; -import { ActionButton } from 'src/components/ActionButton'; +import { BulkApproveAbsences } from 'src/components/BulkApproveAbsences'; const filters = [ ({ isAdmin }) => isAdmin && , @@ -84,7 +84,7 @@ const importer = { } const additionalListActions = [ - Date: Tue, 30 Dec 2025 21:20:32 +0000 Subject: [PATCH 5/7] Change permissions --- client/src/components/BulkApproveAbsences.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/BulkApproveAbsences.jsx b/client/src/components/BulkApproveAbsences.jsx index 05ec4f40..5188cfc2 100644 --- a/client/src/components/BulkApproveAbsences.jsx +++ b/client/src/components/BulkApproveAbsences.jsx @@ -9,7 +9,7 @@ export const BulkApproveAbsences = ({ label, name, permissions }) => { const resource = useResourceContext(); const refresh = useRefresh(); const notify = useNotify(); - if (isApprovedAbsencesBulk(permissions)) return null; + if ( !isApprovedAbsencesBulk(permissions)) return null; const handleSave = async (values, onClose) => { const payload = values.approvedAbsences.map(row => ({ From 6b449123f80eea91e5df17a765f38fa1beb889b7 Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Tue, 30 Dec 2025 21:36:38 +0000 Subject: [PATCH 6/7] spacing in files --- client/src/components/BulkApproveAbsences.jsx | 35 +++++++++---------- client/src/entities/known-absence.jsx | 1 - 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/client/src/components/BulkApproveAbsences.jsx b/client/src/components/BulkApproveAbsences.jsx index 5188cfc2..2fbf0593 100644 --- a/client/src/components/BulkApproveAbsences.jsx +++ b/client/src/components/BulkApproveAbsences.jsx @@ -9,26 +9,25 @@ export const BulkApproveAbsences = ({ label, name, permissions }) => { const resource = useResourceContext(); const refresh = useRefresh(); const notify = useNotify(); - if ( !isApprovedAbsencesBulk(permissions)) return null; - - const handleSave = async (values, onClose) => { + if (!isApprovedAbsencesBulk(permissions)) return null; + const handleSave = async (values, onClose) => { const payload = values.approvedAbsences.map(row => ({ - studentReferenceId: values.studentReferenceId, - reportDate: values.reportDate, - absnceCode: values.absnceCode || null, - senderName: values.senderName || null, - reason: values.reason || null, - comment: values.comment || null, - isApproved: values.isApproved, - klassReferenceId: row.klassReferenceId, - lessonReferenceId: row.lessonReferenceId || null, - absnceCount: row.absnceCount, + studentReferenceId: values.studentReferenceId, + reportDate: values.reportDate, + absnceCode: values.absnceCode || null, + senderName: values.senderName || null, + reason: values.reason || null, + comment: values.comment || null, + isApproved: values.isApproved, + klassReferenceId: row.klassReferenceId, + lessonReferenceId: row.lessonReferenceId || null, + absnceCount: row.absnceCount, })); try { - const response = await dataProvider.createMany(resource, payload); - handleActionSuccess(notify)(response); - refresh(); - onClose?.(); + const response = await dataProvider.createMany(resource, payload); + handleActionSuccess(notify)(response); + refresh(); + onClose?.(); } catch (err) { handleError(notify)(err); @@ -53,6 +52,6 @@ export const BulkApproveAbsences = ({ label, name, permissions }) => { - )}/> + )} /> ); }; diff --git a/client/src/entities/known-absence.jsx b/client/src/entities/known-absence.jsx index 0c325318..5d02c746 100644 --- a/client/src/entities/known-absence.jsx +++ b/client/src/entities/known-absence.jsx @@ -98,7 +98,6 @@ const entity = { importer, filterDefaultValues, additionalListActions, - }; export default getResourceComponents(entity); From 395956ea3c58581f78f1a547c25d3e7efae417d0 Mon Sep 17 00:00:00 2001 From: yaely20 <145603125+yaely20@users.noreply.github.com> Date: Tue, 30 Dec 2025 21:38:18 +0000 Subject: [PATCH 7/7] two spacing in BulkApproveAbsences file --- client/src/components/BulkApproveAbsences.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/BulkApproveAbsences.jsx b/client/src/components/BulkApproveAbsences.jsx index 2fbf0593..2b57705d 100644 --- a/client/src/components/BulkApproveAbsences.jsx +++ b/client/src/components/BulkApproveAbsences.jsx @@ -10,6 +10,7 @@ export const BulkApproveAbsences = ({ label, name, permissions }) => { const refresh = useRefresh(); const notify = useNotify(); if (!isApprovedAbsencesBulk(permissions)) return null; + const handleSave = async (values, onClose) => { const payload = values.approvedAbsences.map(row => ({ studentReferenceId: values.studentReferenceId,