Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,18 @@ const App = () => (
)}
{isPhoneCampaign(permissions) && (
<>
<Resource name="phone_template" {...phoneTemplate} options={{ menuGroup: 'phone' }} icon={PhoneIcon} />
<Resource name="phone_campaign" {...phoneCampaign} options={{ menuGroup: 'phone' }} icon={PhoneIcon} />
<Resource
name="phone_template"
{...phoneTemplate}
options={{ menuGroup: 'phone' }}
icon={PhoneIcon}
/>
<Resource
name="phone_campaign"
{...phoneCampaign}
options={{ menuGroup: 'phone' }}
icon={PhoneIcon}
/>
</>
)}
<Resource
Expand Down
11 changes: 7 additions & 4 deletions client/src/components/StudentView/student-event-report.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { defaultYearFilter } from '@shared/utils/yearFilter';
import { CommonYearInput } from '@shared/components/fields/CommonYear';
import { handleActionSuccess, handleError } from '@shared/utils/notifyUtil';
import SignatureInput from '@shared/components/fields/signature/SignatureInput';
import { useObjectStore } from "src/utils/storeUtil";
import { useObjectStore } from 'src/utils/storeUtil';
import { CommonFileInput } from '@shared/components/fields/CommonFileInput';

const DynamicFields = ({ absenceType, isLoading }) => {
Expand Down Expand Up @@ -64,8 +64,7 @@ const extractBasePayload = (rootValues, reportValues, userId, studentId, absence
reason: finalReason,
absenceTypeId: rootValues.absenceTypeId,
absnceCode: rootValues.absnceCode,
fileData: rootValues.fileData

fileData: rootValues.fileData,
};
};

Expand Down Expand Up @@ -233,7 +232,11 @@ const StudentEventReport = (props) => {
</div>
</SimpleFormIterator>
</ArrayInput>
<CommonFileInput source="fileData" validate={absenceType?.isFileRequired ? [required()] : []} label=" צירוף קובץ אסמכתא לאירוע" />
<CommonFileInput
source="fileData"
validate={absenceType?.isFileRequired ? [required()] : []}
label=" צירוף קובץ אסמכתא לאירוע"
/>
<NumberInput source="absnceCode" validate={required()} />
<CommonYearInput disabled />
<BooleanInput source="isApproved" defaultValue={true} disabled />
Expand Down
8 changes: 1 addition & 7 deletions client/src/components/fields/ThresholdColorField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import { getColorForValue } from '@shared/utils/thresholdUtil';

const defaultFormat = (v) => `${(v * 100).toFixed(1)}%`;

const ThresholdColorField = ({
source,
label,
thresholds = [],
format = defaultFormat,
sortable = false,
}) => (
const ThresholdColorField = ({ source, label, thresholds = [], format = defaultFormat, sortable = false }) => (
<FunctionField
source={source}
label={label}
Expand Down
4 changes: 2 additions & 2 deletions client/src/domainTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default {
isApproved: 'מאושר',
absenceTypeId: 'סוג אירוע',
fileData: 'קובץ מצורף',
}
},
},
lesson: {
name: 'שיעור |||| שיעורים',
Expand Down Expand Up @@ -221,7 +221,7 @@ export default {
name: 'שם האירוע',
quota: 'מכסה שנתית',
requiredLabels: 'שדות חובה לדיווח',
isFileRequired:'חובה לצרף קובץ',
isFileRequired: 'חובה לצרף קובץ',
},
},
student_klass_report: {
Expand Down
8 changes: 2 additions & 6 deletions client/src/entities/absenceType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import { defaultYearFilter } from '@shared/utils/yearFilter';
import { CommonYearField, CommonYearInput, CommonYearInputFilter } from '@shared/components/fields/CommonYear';
import { CommonRepresentation } from '@shared/components/CommonRepresentation';

const filters = [
...commonAdminFilters,
<CommonYearInputFilter />,
<TextInput source="name:$cont" />,
];
const filters = [...commonAdminFilters, <CommonYearInputFilter />, <TextInput source="name:$cont" />];

const filterDefaultValues = {
year: defaultYearFilter.year,
Expand Down Expand Up @@ -88,4 +84,4 @@ const entity = {
importer,
};

export default getResourceComponents(entity);
export default getResourceComponents(entity);
10 changes: 8 additions & 2 deletions client/src/entities/att-report-with-report-month.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
NumberInput,
BooleanInput,
NullableBooleanInput,
maxLength
maxLength,
} from 'react-admin';
import PlaylistRemoveIcon from '@mui/icons-material/PlaylistRemove';
import HelpIcon from '@mui/icons-material/Help';
Expand Down Expand Up @@ -77,7 +77,13 @@ const filterDefaultValues = {

export const Datagrid = ({ isAdmin, children, ...props }) => {
const additionalBulkButtons = [
<BulkActionButton label="שינוי כיתה" icon={<ClassIcon />} name="bulkChangeKlass" key="bulkChangeKlass" reloadOnEnd>
<BulkActionButton
label="שינוי כיתה"
icon={<ClassIcon />}
name="bulkChangeKlass"
key="bulkChangeKlass"
reloadOnEnd
>
{isAdmin && <CommonReferenceInput source="userId" reference="user" />}
{isAdmin && <CommonYearInput />}
<CommonReferenceInput source="klassReferenceId" reference="klass" dynamicFilter={filterByUserIdAndYear} />
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/att-report.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ReferenceField,
required,
minValue,
maxLength
maxLength,
} from 'react-admin';
import { useIsLessonSignature, useIsTeacherView } from 'src/utils/appPermissions';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/grade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ReferenceField,
required,
maxLength,
NullableBooleanInput
NullableBooleanInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/klass.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
NumberInput,
NumberField,
required,
maxLength
maxLength,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/known-absence.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ReferenceField,
required,
TextField,
TextInput
TextInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/lesson.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
required,
TextField,
TextInput,
minValue
minValue,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField, MultiReferenceArrayField } from '@shared/components/fields/CommonReferenceField';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/report-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ReferenceManyCount,
DateTimeInput,
required,
maxLength
maxLength,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/report-month.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ReferenceField,
required,
TextField,
TextInput
TextInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { CommonRepresentation } from '@shared/components/CommonRepresentation';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/student-klass.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ReferenceField,
required,
TextField,
TextInput
TextInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
Expand Down
9 changes: 1 addition & 8 deletions client/src/entities/student-percent-report.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
DateInput,
NumberField,
TextField,
ReferenceField,
useRecordContext,
TextInput
} from 'react-admin';
import { DateInput, NumberField, TextField, ReferenceField, useRecordContext, TextInput } from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/student.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
required,
SelectInput,
TextField,
TextInput
TextInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { CommonRepresentation } from '@shared/components/CommonRepresentation';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/teacher-grade-report-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
required,
BooleanInput,
TextInput,
useGetList
useGetList,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/teacher-report-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
required,
BooleanInput,
TextInput,
useGetList
useGetList,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity';
Expand Down
2 changes: 1 addition & 1 deletion client/src/entities/transportation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TextField,
TextInput,
NumberInput,
maxLength
maxLength,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pivots/PercentReportWithDatesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useAuthState,
usePermissions,
BooleanInput,
NullableBooleanInput
NullableBooleanInput,
} from 'react-admin';
import { CommonDatagrid } from '@shared/components/crudContainers/CommonList';
import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField';
Expand Down
7 changes: 6 additions & 1 deletion client/src/pivots/StudentAttendanceByKlassList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ const Datagrid = ({ isAdmin, children, ...props }) => {

{summaryHeaders.map((h) =>
PCT_SUMMARY_KEYS.has(h.value) ? (
<ThresholdColorField key={h.value} source={h.value} label={h.label} thresholds={ABSENCE_THRESHOLDS} />
<ThresholdColorField
key={h.value}
source={h.value}
label={h.label}
thresholds={ABSENCE_THRESHOLDS}
/>
) : (
<TextField key={h.value} source={h.value} label={h.label} sortable={false} />
),
Expand Down
8 changes: 4 additions & 4 deletions client/src/utils/absenceThresholds.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getColorForValue } from '@shared/utils/thresholdUtil';

export const ABSENCE_THRESHOLDS = [
{ min: 0.80, color: '#ff0000' },
{ min: 0.60, color: '#ff6666' },
{ min: 0.40, color: '#ffa500' },
{ min: 0.20, color: '#ffff88' },
{ min: 0.8, color: '#ff0000' },
{ min: 0.6, color: '#ff6666' },
{ min: 0.4, color: '#ffa500' },
{ min: 0.2, color: '#ffff88' },
];

export function getThresholdColor(value) {
Expand Down
44 changes: 22 additions & 22 deletions server/src/db/entities/KnownAbsence.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ import {
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
} from "typeorm";
import { IHasUserId } from "@shared/base-entity/interface";
import { User } from "src/db/entities/User.entity";
import { findOneAndAssignReferenceId, getDataSource } from "@shared/utils/entity/foreignKey.util";
import { Student } from "./Student.entity";
import { IsOptional, ValidateIf } from "class-validator";
import { CrudValidationGroups } from "@dataui/crud";
import { IsBoolean, IsDate, IsNotEmpty, IsNumber, MaxLength } from "@shared/utils/validation/class-validator-he";
import { fillDefaultYearValue } from "@shared/utils/entity/year.util";
import { fillDefaultReportDateValue } from "@shared/utils/entity/deafultValues.util";
import { Klass } from "./Klass.entity";
import { Lesson } from "./Lesson.entity";
import { KlassType } from "./KlassType.entity";
import { Teacher } from "./Teacher.entity";
import { AbsenceType } from "./AbsenceType.entity";
import { BooleanType, DateType, NumberType, StringType } from "@shared/utils/entity/class-transformer";
import { LessonKlassName } from "../view-entities/LessonKlassName.entity";
import { CreatedAtColumn, DateColumn, UpdatedAtColumn } from "@shared/utils/entity/column-types.util";
import { FileData } from "@shared/entities/Image.entity";

@Index("known_users_idx", ["userId"], {})
} from 'typeorm';
import { IHasUserId } from '@shared/base-entity/interface';
import { User } from 'src/db/entities/User.entity';
import { findOneAndAssignReferenceId, getDataSource } from '@shared/utils/entity/foreignKey.util';
import { Student } from './Student.entity';
import { IsOptional, ValidateIf } from 'class-validator';
import { CrudValidationGroups } from '@dataui/crud';
import { IsBoolean, IsDate, IsNotEmpty, IsNumber, MaxLength } from '@shared/utils/validation/class-validator-he';
import { fillDefaultYearValue } from '@shared/utils/entity/year.util';
import { fillDefaultReportDateValue } from '@shared/utils/entity/deafultValues.util';
import { Klass } from './Klass.entity';
import { Lesson } from './Lesson.entity';
import { KlassType } from './KlassType.entity';
import { Teacher } from './Teacher.entity';
import { AbsenceType } from './AbsenceType.entity';
import { BooleanType, DateType, NumberType, StringType } from '@shared/utils/entity/class-transformer';
import { LessonKlassName } from '../view-entities/LessonKlassName.entity';
import { CreatedAtColumn, DateColumn, UpdatedAtColumn } from '@shared/utils/entity/column-types.util';
import { FileData } from '@shared/entities/Image.entity';

@Index('known_users_idx', ['userId'], {})
@Index(['studentReferenceId', 'year'])
@Index('known_absences_lookup_idx', ['userId', 'year', 'isApproved', 'studentReferenceId'])
@Entity('known_absences')
Expand Down Expand Up @@ -209,4 +209,4 @@ export class KnownAbsence implements IHasUserId {
@ManyToOne(() => AbsenceType, { createForeignKeyConstraints: false })
@JoinColumn({ name: 'absence_type_id' })
absenceType: AbsenceType;
}
}
9 changes: 2 additions & 7 deletions server/src/entity-modules/student-by-year.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ class StudentByYearService<T extends Entity | StudentByYear> extends BaseEntityS
if (!selectedKlassIds?.length) return;

const data = list as StudentByYear[];
const studentMap: Record<number, IDynamicStudentPivot> = data.reduce(
(a, b) => ({ ...a, [b.id]: b }),
{},
);
const studentMap: Record<number, IDynamicStudentPivot> = data.reduce((a, b) => ({ ...a, [b.id]: b }), {});
const klassTypeReferenceIds = getAsNumberArray(extra.klassTypeReferenceIds);
const excludedLessonIds = getAsNumberArray(extra?.excludedLessonIds);

Expand Down Expand Up @@ -212,9 +209,7 @@ class StudentByYearService<T extends Entity | StudentByYear> extends BaseEntityS
const selectedKlasses = await this.dataSource.getRepository(Klass).find({
where: { id: In(selectedKlassIds) },
});
const klassNameMap: Record<number, string> = Object.fromEntries(
selectedKlasses.map((k) => [k.id, k.name]),
);
const klassNameMap: Record<number, string> = Object.fromEntries(selectedKlasses.map((k) => [k.id, k.name]));
selectedKlassIds.forEach((kid) => {
const key = `klass_${kid}`;
headers[key] = {
Expand Down
10 changes: 4 additions & 6 deletions server/src/entity-modules/student-percent-report.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ class StudentPercentReportService<T extends Entity | StudentPercentReport> exten

switch (pivotName) {
case 'PercentReportWithDates': {
const pivotData = await this.dataSource
.getRepository(AttReportAndGrade)
.find({
where: getReportDataFilterBySprAndDates(sprIds, extra?.fromDate, extra?.toDate),
order: { reportDate: 'ASC' },
});
const pivotData = await this.dataSource.getRepository(AttReportAndGrade).find({
where: getReportDataFilterBySprAndDates(sprIds, extra?.fromDate, extra?.toDate),
order: { reportDate: 'ASC' },
});
const pivotDataMap = groupDataByKeys(pivotData, [
'studentReferenceId',
'teacherReferenceId',
Expand Down
4 changes: 3 additions & 1 deletion server/src/reports/klassAttendanceReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ const getReportData: IGetReportDataFunction<KlassAttendanceReportParams, KlassAt
const sessions: SessionData[] = getDateRange(startDate, endDate).flatMap((date) => {
const dateSessions = sessionsByDate[formatDate(date)] || [];
if (!dateSessions.length) return [buildEmptySession(date)];
return groupByDate ? [buildGroupedSession(date, dateSessions, lessonCountsBySession)] : buildSingleSessions(date, dateSessions, lessonCountsBySession);
return groupByDate
? [buildGroupedSession(date, dateSessions, lessonCountsBySession)]
: buildSingleSessions(date, dateSessions, lessonCountsBySession);
});

// Build student data
Expand Down
Loading
Loading