Skip to content

Commit

Permalink
Timetable UI updates and fixes OD-17164 (#728)
Browse files Browse the repository at this point in the history
* Upgrade printing dependencies.

JasperReports (6 years of updates) plus PDF box and some minor iText updates.

* OD-13536 Update jackson libs, use separate (gone from core now) javaTime module to seralize LocalDate type

* OD-16217 More useful comments

* OD-16217 Adjust locked date usages due to model changes. Adjust related types

* OD-16217 replace deprecated API

* Migrate two reports to catalog.yaml so we can review the new import process for reports OD-17123

* OD-17164 Add find related 'timetable' to Class,Course,Site,Room. Add related 'student timetable' and 'tutor timetable' to contact

* OD-17165 Fixed typescript compilation

* OD-17164 Added Timetable aql search sync with url. Adjusted timetable link constructors in consistency with list view

* OD-17165 feat: add filter to sessions api

* OD-17164 Adjusted Timetable aql search handlers. Remove redundant code

* OD-17170 feat: change format of getDates method, replace days with hours on it

* OD-17170 feat: calculating of intensity of session hours on current day

* OD-17170 Implemented heat map ui for timetable mini calendar

* OD-17170 Adjusted mini calendar default selection

* OD-17170 fix: add check for month without sessions

* OD-17170 feat: add filter to getDates request body, change method type to post

* OD-17165 Added custom filters sync with url

* OD-17170 feat: replace params into request body with separate model

* OD-17165 Added selected date sync with url. Added requests number optimisation

* OD-17165 Added calendar mode sync with urls. Adjusted initial state setting by url. Added more optimizations

* OD-17166 Added alter tags option for timetable components. Added rendering optimizations

* OD-17168 Added Timetable settings saving in local storage

* OD-17167 Changed contact timetable links labels. Adjusted search strings

* OD-17169 Added timetable grouping by tutor and by room options

* OD-17169 Adjusted common dynamic size virtual list initial settings

* OD-17164 Added target month auto detection for timetable view

* OD-17170 feat: change tests in accordance with api changes

* OD-17170 feat: return some reports properties for tests and api functionality

* OD-17170 feat: add checks for nullable search requests for tests

* OD-17170 fix: change timetable api tests in accordance with logic changes

* OD-17170 feat: add ability for some sessions at the same time; refactor some code

* OD-17169 Fixed timetable group by room mode rendering logic

* tests fix

* tests fix 2

Co-authored-by: Ari Maniatis <[email protected]>
Co-authored-by: Artyom Kravchenko <[email protected]>
Co-authored-by: Yury Yasuchenya <[email protected]>
Co-authored-by: dmitrij <[email protected]>
Co-authored-by: George Filipovich <[email protected]>
  • Loading branch information
6 people authored Apr 21, 2022
1 parent 738d492 commit 18d3a07
Show file tree
Hide file tree
Showing 74 changed files with 1,364 additions and 753 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ buildscript {
bouncycastleVersion = '1.67'
bootiqueVersion = '1.2'
cfxVersion = '3.3.5'
jacksonVersion = '2.9.9'
//latest jackson version 2.12.2 (no any conflicts with spring, see AbstractApplicationContext), same version jasper uses also
jacksonVersion = '2.12.2'
javaxActivationVersion = '1.2.0'
}

Expand Down
1 change: 1 addition & 0 deletions client-html/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ module.exports = {
"react/prop-types": "off",
"react/state-in-constructor": "off",
"react/sort-comp": "off",
"react/require-default-props": "off",
"react/destructuring-assignment": "off",
"react/no-did-update-set-state": "off",
"react/jsx-props-no-spreading": "off",
Expand Down
19 changes: 6 additions & 13 deletions client-html/src/dev/mock/data/preferences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
* No copying or use of this code is allowed without permission in writing from ish.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

import * as Model from "../../../js/model/preferences";
Expand All @@ -11,17 +14,7 @@ export function mockPreferences() {
valueString: this.preference[key]
}));

this.preferencesLockedDate = () => ({
year: 2015,
month: "DECEMBER",
leapYear: false,
dayOfYear: 365,
dayOfWeek: "THURSDAY",
era: "CE",
chronology: { calendarType: "iso8601", id: "ISO" },
monthValue: 12,
dayOfMonth: 31
});
this.preferencesLockedDate = () => "2015-02-02";

this.savePreferences = fields =>
fields.forEach(item => {
Expand Down
14 changes: 11 additions & 3 deletions client-html/src/js/common/components/form/DynamicSizeList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
* No copying or use of this code is allowed without permission in writing from ish.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

// Temporary implementation
Expand Down Expand Up @@ -107,7 +110,12 @@ class DynamicSizeList extends React.Component<any> {
// @ts-ignore
this.listRef.current = node;
}
if (listRef) {

if (typeof listRef === "function") {
listRef(node);
}

if (typeof listRef === "object") {
listRef.current = node;
}
}
Expand Down
25 changes: 9 additions & 16 deletions client-html/src/js/common/components/list-view/ListView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright ish group pty ltd 2021.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
Expand Down Expand Up @@ -80,7 +80,12 @@ import { ConfirmProps, ShowConfirmCaller } from "../../../model/common/Confirm";
import { EntityName, FindEntityState } from "../../../model/entities/common";
import { saveCategoryAQLLink } from "../../utils/links";
import ReactTableList, { TableListProps } from "./components/list/ReactTableList";
import { getActiveTags, getFiltersNameString, getTagsUpdatedByIds } from "./utils/listFiltersUtils";
import {
getActiveTags,
getFiltersNameString,
getTagsUpdatedByIds,
setActiveFiltersBySearch
} from "./utils/listFiltersUtils";
import { setSwipeableDrawerDirtyForm } from "../layout/swipeable-sidebar/actions";
import { LSGetItem } from "../../utils/storage";
import { getCustomFieldTypes } from "../../../containers/entities/customFieldTypes/actions";
Expand Down Expand Up @@ -427,7 +432,7 @@ class ListView extends React.PureComponent<Props, ComponentState> {
const filtersString = getFiltersNameString(filterGroups);
if (filtersString !== filtersUrlString) {
const updated = [...filterGroups];
this.setActiveFiltersBySearch(filtersUrlString, filterGroups);
setActiveFiltersBySearch(filtersUrlString, filterGroups);
this.onChangeFilters(updated, "filters");
}
}
Expand Down Expand Up @@ -464,18 +469,6 @@ class ListView extends React.PureComponent<Props, ComponentState> {
this.props.clearListState();
}

setActiveFiltersBySearch = (search: string, filters: FilterGroup[]) => {
const filterNames = search ? search.replace(/[@_]/g, " ")
.split(",")
.map(f => f.trim()) : [];
filters.forEach(g => {
g.filters.forEach(f => {
// eslint-disable-next-line no-param-reassign
f.active = filterNames.includes(f.name);
});
});
};

synchronizeAllFilters = () => {
const {
setListUserAQLSearch,
Expand All @@ -495,7 +488,7 @@ class ListView extends React.PureComponent<Props, ComponentState> {
const tagsSearch = searchParams.get("tag");

if (filtersSearch) {
this.setActiveFiltersBySearch(filtersSearch, targetFilters);
setActiveFiltersBySearch(filtersSearch, targetFilters);
}
this.onChangeFilters(targetFilters, "filters");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const NestedTableLinkCell = props => {
return (
<div className="centeredFlex linkDecoration" onClick={() => openInternalLink(link)}>
<span className="text-truncate">{value}</span>
<OpenInNew className={classes.linkIcon} color="secondary" />
<OpenInNew className={classes.linkIcon} color="primary" />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
* No copying or use of this code is allowed without permission in writing from ish.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/
import { TagGroup, Tag } from "@api/model";
import { MenuTag } from "../../../../model/tags";
Expand All @@ -26,6 +29,18 @@ export const getFiltersString = (filterGroups: FilterGroup[]) => filterGroups
.filter(v => v.trim())
.join(" and ");

export const setActiveFiltersBySearch = (search: string, filters: FilterGroup[]) => {
const filterNames = search ? search.replace(/[@_]/g, " ")
.split(",")
.map(f => f.trim()) : [];
filters.forEach(g => {
g.filters.forEach(f => {
// eslint-disable-next-line no-param-reassign
f.active = filterNames.includes(f.name);
});
});
};

export const getActiveTags = (tags: MenuTag[], res?: MenuTag[]): MenuTag[] => {
const result = res || [];

Expand Down
10 changes: 9 additions & 1 deletion client-html/src/js/common/themes/ishTheme.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

import { createTheme } from '@mui/material/styles';
import { Components } from "@mui/material/styles/components";
import { PaletteMode } from "@mui/material";
Expand Down Expand Up @@ -388,6 +396,6 @@ export const getTheme = (): AppTheme => {
return actualTheme;
};

export const useTheme = () => ({
export const useAppTheme = (): AppTheme => ({
...getTheme()
});
4 changes: 2 additions & 2 deletions client-html/src/js/common/utils/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { Dispatch } from "redux";
import { IAction } from "../../actions/IshAction";
import { State } from "../../../reducers/state";

export const usePrevious = <T = any>(value: any) => {
const ref = useRef<T>();
export const usePrevious = <T = any>(value: any, initial?: any) => {
const ref = useRef<T>(initial);

useEffect(() => {
ref.current = value;
Expand Down
8 changes: 6 additions & 2 deletions client-html/src/js/constants/Bugsnag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
* No copying or use of this code is allowed without permission in writing from ish.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

import React from "react";
Expand All @@ -17,6 +20,7 @@ export const bugsnagClient = IS_JEST
: Bugsnag.start( {
apiKey: "8fc0c45fd7cbb17b6e8d6cad20738799",
appVersion: String(process.env.RELEASE_VERSION),
autoTrackSessions: false,
releaseStage: process.env.NODE_ENV === EnvironmentConstants.production
&& process.env.RELEASE_VERSION !== "99-SNAPSHOT" ? "production" : "development",
plugins: [new BugsnagPluginReact(React)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const CheckoutPaymentHeaderFieldForm: React.FC<PaymentHeaderFieldProps> = props
return undefined;
}

const date = new Date(lockedDate.lockedDate);
const date = new Date(lockedDate);

return compareAsc(addDays(date, 1), new Date(dateChanged)) > 0
? `Date must be after ${format(date, D_MMM_YYYY)}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class BankingCreateView extends React.PureComponent<any, any> {
if (!lockedDate || !editRecord || editRecord.settlementDate === value) {
return undefined;
}
const date = new Date(lockedDate.lockedDate);
const date = new Date(lockedDate);
const dateString = date.toISOString();
return validateMinMaxDate(
value,
Expand Down Expand Up @@ -246,7 +246,7 @@ class BankingCreateView extends React.PureComponent<any, any> {
validate={this.validateSettlementDate}
minDate={
lockedDate
? addDays(new Date(lockedDate.lockedDate), 1)
? addDays(new Date(lockedDate), 1)
: undefined
}
disabled={hasNoAccounts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class BankingEditView extends React.PureComponent<any, any> {
}
return (
compareAsc(
new Date(lockedDate.lockedDate),
new Date(lockedDate),
new Date(editRecord.settlementDate)
) > 0
);
Expand All @@ -149,7 +149,7 @@ class BankingEditView extends React.PureComponent<any, any> {
if (!lockedDate || !editRecord || editRecord.settlementDate === value) {
return undefined;
}
const date = new Date(lockedDate.lockedDate);
const date = new Date(lockedDate);
const dateString = date.toISOString();
return validateMinMaxDate(
value,
Expand Down Expand Up @@ -249,7 +249,7 @@ class BankingEditView extends React.PureComponent<any, any> {
validate={[validateSingleMandatoryField, this.validateSettlementDate]}
minDate={
lockedDate
? addDays(new Date(lockedDate.lockedDate), 1)
? addDays(new Date(lockedDate), 1)
: undefined
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import BankingEditView from "./BankingEditView";
import BankingCreateView from "./BankingCreateView";
import { openInternalLink } from "../../../../common/utils/links";
import { PaymentInType } from "../consts";
import { EditViewProps } from "../../../../model/common/ListView";

class BankingEditViewResolver extends React.PureComponent<any, any> {
class BankingEditViewResolver extends React.PureComponent<EditViewProps, any> {
openNestedView = item => {
const url = `/${item.paymentTypeName === PaymentInType ? "paymentIn" : "paymentOut"}/` + item.paymentId;
openInternalLink(url);
Expand Down
12 changes: 5 additions & 7 deletions client-html/src/js/containers/entities/contacts/Contacts.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/*
* Copyright ish group pty ltd 2021.
* Copyright ish group pty ltd 2022.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

import { isBefore } from "date-fns";
import React, {
Dispatch, useCallback, useEffect, useState
} from "react";
import React, { Dispatch, useCallback, useEffect, useState } from "react";
import { connect } from "react-redux";
import { initialize } from "redux-form";
import Typography from "@mui/material/Typography";
Expand All @@ -31,9 +29,7 @@ import {
} from "./actions";
import ContactEditView from "./components/ContactEditView";
import { getManualLink } from "../../../common/utils/getManualLink";
import {
getContactRelationTypes, getCountries, getLanguages, getPaymentTypes
} from "../../preferences/actions";
import { getContactRelationTypes, getCountries, getLanguages, getPaymentTypes } from "../../preferences/actions";
import { getDefaultInvoiceTerms } from "../invoices/actions";
import ContactCogWheel from "./components/ContactCogWheel";
import { checkPermissions } from "../../../common/actions";
Expand Down Expand Up @@ -173,6 +169,8 @@ const findRelatedGroup: any[] = [
{ title: "Payments out", list: "paymentOut", expression: "payee.id" },
{ title: "Payslips", list: "payslip", expression: "contact.id" },
{ title: "Sales", list: "sale", expression: "purchasedBy.id" },
{ title: "Student timetable", list: "timetable", expression: "courseClass.enrolments.student.id" },
{ title: "Tutor timetable", list: "timetable", expression: "tutor.contact.id" },
{ title: "Transactions", list: "transaction", expression: "contact.id" },
{ title: "Waiting lists", list: "waitingList", expression: "student.contact.id" }
];
Expand Down
Loading

0 comments on commit 18d3a07

Please sign in to comment.