Skip to content

Commit

Permalink
Merge branch 'main' into OD-19448-Update-Gradle-to-8.8-version-on-Angel
Browse files Browse the repository at this point in the history
  • Loading branch information
KeyrisXdSnow authored Jan 2, 2025
2 parents 1c52900 + 07e5d9e commit a1a036a
Show file tree
Hide file tree
Showing 51 changed files with 1,386 additions and 430 deletions.
517 changes: 359 additions & 158 deletions api-doc/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ in ish.oncourse.aql.model.EntityFactory in server module.
<attribute name="class" ref="CourseClass"/>
<attribute name="tags" ref="Tag"/>
<attribute name="isClassCompleted" ref="Boolean"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="PaymentOut">
<attribute name="accountTransactions" ref="AccountTransaction"/>
Expand Down Expand Up @@ -64,6 +68,8 @@ in ish.oncourse.aql.model.EntityFactory in server module.
<attribute name="type" ref="ish.common.types.ProductType"/>
<attribute name="allRelatedCourses" ref="Course"/>
<attribute name="allRelatedProducts" ref="Product"/>
<attribute name="tags" ref="Tag"/>
<attribute name="taggingRelations" ref="TagRelation"/>
</entity>
<entity name="ProductItem">
<attribute name="redeemedInvoice" ref="Invoice"/>
Expand All @@ -86,6 +92,10 @@ in ish.oncourse.aql.model.EntityFactory in server module.
<attribute name="classes" ref="CourseClass"/>
<attribute name="isActive" ref="Boolean"/>
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Contact">
<attribute name="accountTransactions" ref="AccountTransaction"/>
Expand All @@ -100,10 +110,18 @@ in ish.oncourse.aql.model.EntityFactory in server module.
<attribute name="allRelatedContactsToCourse" ref="Course"/>
<attribute name="allRelatedContactsToAssessment" ref="Assessment"/>
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Student">
<attribute name="outcomes" ref="Outcome"/>
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Outcome">
<attribute name="vet" ref="Boolean"/>
Expand All @@ -114,45 +132,97 @@ in ish.oncourse.aql.model.EntityFactory in server module.
</entity>
<entity name="Application">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Assessment">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Document">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Invoice">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Faculty">
<attribute name="tags" ref="Tag"/>
</entity>
<entity name="Lead">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Message">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Payslip">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Quote">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Report">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Room">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
<attribute name="classes" ref="CourseClass"/>
</entity>
<entity name="Site">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="Tutor">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
<entity name="WaitingList">
<attribute name="tags" ref="Tag"/>
<attribute name="completedChecklists" ref="Tag"/>
<attribute name="notCompletedChecklists" ref="Tag"/>
<attribute name="checkedTasks" ref="Tag"/>
<attribute name="uncheckedTasks" ref="Tag"/>
</entity>
</attributes>
3 changes: 3 additions & 0 deletions buildSrc/aql/src/main/resources/Aql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ predicate
// Identifier with '{expression}' block will be resolved as segment
| (pathSegment SEPARATOR)* pathSegment # PathSegmentPredicate
| path? tag # TagPredicate
| path? notTag # NotTagPredicate
| path unaryOperator # UnaryOperatorPredicate
| LIKE termOp # EntityRootSearch
| filterTag # FilterTagReference
Expand Down Expand Up @@ -115,6 +116,8 @@ amount : (IntegerLiteral unit)+;

tag : '#' (Identifier | SingleQuotedStringLiteral | DoubleQuotedStringLiteral);

notTag : 'not #' (Identifier | SingleQuotedStringLiteral | DoubleQuotedStringLiteral);

filterTag : '@' (Identifier | SingleQuotedStringLiteral | DoubleQuotedStringLiteral);

value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ const FormEditor: React.FC<Props & WrappedFieldProps> = (
component="div"
onClick={onEditButtonFocus}
className={clsx(classes.editable, {
[fieldClasses.text]: value
[fieldClasses.text]: value,
'pointer-events-none': disabled
})}
>
<span
Expand Down
4 changes: 2 additions & 2 deletions client-html/src/js/containers/checkout/actions/chekoutItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export const checkoutGetProduct = (id: number) => ({
payload: id
});

export const checkoutGetMembership = (item: CheckoutItem) => ({
export const checkoutGetMembership = (id: number) => ({
type: CHECKOUT_GET_ITEM_MEMBERSHIP,
payload: item
payload: { id }
});

export const checkoutGetVoucher = (item: CheckoutItem) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
removeItem: (itemId: number, itemType: string) => dispatch(removeItem(itemId, itemType)),
checkoutGetCourseClassList: (search: string) => dispatch(checkoutGetCourseClassList(search)),
checkoutClearCourseClassList: () => dispatch(checkoutClearCourseClassList()),
getMemberShipRecord: (item: any) => dispatch(checkoutGetMembership(item)),
getMemberShipRecord: (item: any) => dispatch(checkoutGetMembership(item.id)),
getProductRecord: (id: number) => dispatch(checkoutGetProduct(id)),
getVoucherRecord: (item: any) => dispatch(checkoutGetVoucher(item)),
clearItemRecord: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,32 @@
* No copying or use of this code is allowed without permission in writing from ish.
*/

import { CheckoutMembershipProduct } from "@api/model";
import Grid from "@mui/material/Grid";
import { format as formatDate } from "date-fns";
import { III_DD_MMM_YYYY } from "ish-ui";
import React from "react";
import { FormEditorField } from "../../../../../common/components/form/formFields/FormEditor";
import Uneditable from "../../../../../common/components/form/formFields/Uneditable";

const MembershipEditView: React.FC<any> = props => {
const { values } = props;

return values ? (
<Grid container columnSpacing={3} rowSpacing={2} className="ml-0">
<Grid item xs={2}>
<Uneditable label="SKU" value={values.code} />
</Grid>
<Grid item xs={8}>
<Uneditable label="Sale price" value={values.totalFee} money />
</Grid>

<Grid item xs={6}>
<Uneditable label="Description" value={values.description} multiline />
</Grid>
<Grid item xs={6}>
{values.validTo && (
<Uneditable label="Expires on" value={values.validTo} format={v => formatDate(new Date(v), III_DD_MMM_YYYY)} />
)}
{values.expireNever && (
<Uneditable label="Expires on" value={values.expireNever} />
)}
</Grid>

const MembershipEditView = ({ values }: { values: CheckoutMembershipProduct }) => values ? (
<Grid container columnSpacing={3} rowSpacing={2} className="ml-0">
<Grid item xs={4}>
<Uneditable label="SKU" value={values.code} />
</Grid>
<Grid item xs={4}>
<Uneditable label="Sale price" value={values.totalFee} money />
</Grid>
<Grid item xs={4}>
<Uneditable label="Expires on" {...values.expiresOn
? { value: values.expiresOn, format: v => formatDate(new Date(v), III_DD_MMM_YYYY) }
: { value: "Never (Lifetime)" }
} />
</Grid>
<Grid item xs={12}>
<FormEditorField label="Description" name="description" disabled />
</Grid>
) : null;
};
</Grid>
) : null;

export default MembershipEditView;
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
* No copying or use of this code is allowed without permission in writing from ish.
*/

import { CheckoutMembershipProduct } from "@api/model";
import { initialize } from "redux-form";
import { Epic } from "redux-observable";
import FetchErrorHandler from "../../../../common/api/fetch-errors-handlers/FetchErrorHandler";
import * as EpicUtils from "../../../../common/epics/EpicUtils";
import { CheckoutItem } from "../../../../model/checkout";
import { getEntityItemById } from "../../../entities/common/entityItemsService";
import MembershipProductService
from "../../../../containers/entities/membershipProducts/services/MembershipProductService";
import { CHECKOUT_GET_ITEM_MEMBERSHIP, CHECKOUT_GET_ITEM_MEMBERSHIP_FULFILLED } from "../../actions/chekoutItem";
import { CHECKOUT_ITEM_EDIT_VIEW_FORM } from "../../components/items/components/CkecoutItemViewForm";

const request: EpicUtils.Request<any, CheckoutItem> = {
const request: EpicUtils.Request<CheckoutMembershipProduct, { id: number }> = {
type: CHECKOUT_GET_ITEM_MEMBERSHIP,
getData: ({ id }) => getEntityItemById("MembershipProduct", id),
processData: (memberShipProduct: any, s, item) => {
memberShipProduct.validTo = item.validTo;
memberShipProduct.expiryType = item.expiryType;

getData: ({ id }, s) => MembershipProductService.getCheckoutModel(id, s.checkout.summary.list.find(c => c.payer)?.contact.id),
processData: memberShipProduct => {
return [
{
type: CHECKOUT_GET_ITEM_MEMBERSHIP_FULFILLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import {
checkoutUpdateSummaryPrices
} from "../../actions/checkoutSummary";
import CheckoutService from "../../services/CheckoutService";
import { getCheckoutModel } from "../../utils";
import { getCheckoutModel, getCheckoutModelMembershipsValidTo } from "../../utils";

const request: EpicUtils.Request = {
type: CHECKOUT_UPDATE_SUMMARY_PRICES,
hideLoadIndicator: true,
getData: (p, s) => {
getData: async (p, s) => {
const model = getCheckoutModel(s.checkout, [], null, {}, true);
await getCheckoutModelMembershipsValidTo(model);
return CheckoutService.checkoutSubmitPayment(
model,
true,
Expand Down
40 changes: 18 additions & 22 deletions client-html/src/js/containers/checkout/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
CheckoutSummaryListItem
} from "../../../model/checkout";
import { CheckoutFundingInvoice } from "../../../model/checkout/fundingInvoice";
import MembershipProductService from "../../entities/membershipProducts/services/MembershipProductService";
import {
CHECKOUT_MEMBERSHIP_COLUMNS,
CHECKOUT_PRODUCT_COLUMNS,
Expand Down Expand Up @@ -187,6 +188,14 @@ export const mergeInvoicePaymentPlans = (paymentPlans: InvoicePaymentPlan[]) =>
}));
};

export const getCheckoutModelMembershipsValidTo = async (model: CheckoutModel) => {
for (const node of model.contactNodes) {
for (const mem of node.memberships) {
mem.validTo = await MembershipProductService.getCheckoutModel(mem.productId, node.contactId).then(res => res.expiresOn);
}
}
};

export const getCheckoutModel = (
state: CheckoutState,
paymentPlans: CheckoutPaymentPlan[],
Expand Down Expand Up @@ -358,6 +367,7 @@ export const getInvoiceLineKey = (entity: CheckoutEntity) => {
};

const getInvoiceLinePrices = (item: CheckoutItem, lines: AbstractInvoiceLine[], itemOriginal: CheckoutItem) => {

const id = item.type === "course" && item.class ? item.class.id : item.id;
const lineKey = getInvoiceLineKey(item.type);
const targetLine = lines.find(l => l[lineKey] && (l[lineKey].productId === id || l[lineKey].classId === id));
Expand Down Expand Up @@ -401,10 +411,15 @@ const getInvoiceLinePrices = (item: CheckoutItem, lines: AbstractInvoiceLine[],
price: 0
};

const validTo = item.type === "membership" ? {
validTo: lines[0]?.membership?.validTo
} : {};

return {
...item,
...paymentPlansObj,
...prices
...prices,
...validTo
};
};

Expand Down Expand Up @@ -549,7 +564,7 @@ export const checkoutCourseMap = (courseBase, skipCheck?: boolean): CheckoutCour
return course;
};

export const calculateVoucherOrMembershipExpiry = (item: CheckoutItem) => {
export const calculateVoucherExpiry = (item: CheckoutItem) => {
switch (item.type) {
case "voucher": {
if (item.expiryDays) {
Expand All @@ -559,25 +574,6 @@ export const calculateVoucherOrMembershipExpiry = (item: CheckoutItem) => {
}
break;
}
case "membership": {
if (item.expiryType === "Never (Lifetime)") {
item.expireNever = item.expiryType;
} else {
if (item.expiryType === "Days") {
const today = new Date();
today.setDate(today.getDate() + Number(item.expiryDays));
item.validTo = format(today, YYYY_MM_DD_MINUSED);
}
if (item.expiryType === "1st July") {
const date = getExpireDate(6);
item.validTo = format(date, YYYY_MM_DD_MINUSED);
}
if (item.expiryType === "1st January") {
const date = getExpireDate(0);
item.validTo = format(date, YYYY_MM_DD_MINUSED);
}
}
}
}
};

Expand All @@ -592,7 +588,7 @@ export const processCheckoutSale = (row, type) => {
if ( type === "voucher") {
row.restrictToPayer = false;
}
calculateVoucherOrMembershipExpiry(row);
calculateVoucherExpiry(row);
};

export const getCheckoutCurrentStep = (step: CheckoutCurrentStepType): number => {
Expand Down
Loading

0 comments on commit a1a036a

Please sign in to comment.