Skip to content

Commit ef7e04b

Browse files
author
朱龚
committed
1 parent d8ed637 commit ef7e04b

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/constants/workPeriods.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ export const REASON_DISABLED_MESSAGE_MAP = {
149149
"Billing Account is not set for the Resource Booking",
150150
[REASON_DISABLED.NO_DAYS_TO_PAY_FOR]: "There are no days to pay for",
151151
[REASON_DISABLED.NO_MEMBER_RATE]: "Member Rate should be greater than 0",
152+
[REASON_DISABLED.NOT_ALLOW_FUTURE_WEEK]:
153+
"Not allow processing payments for the future weeks",
152154
};
153155

154156
export const ALERT_MESSAGE_MAP = {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const NO_BILLING_ACCOUNT = "NO_BILLING_ACCOUNT";
22
export const NO_DAYS_TO_PAY_FOR = "NO_DAYS_TO_PAY_FOR";
33
export const NO_MEMBER_RATE = "NO_MEMBER_RATE";
4+
export const NOT_ALLOW_FUTURE_WEEK = "NOT_ALLOW_FUTURE_WEEK";

src/store/reducers/workPeriods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const actionHandlers = {
141141
periodEnd
142142
);
143143
periodsData[period.id] = periodData;
144-
let reasonsDisabled = findReasonsDisabled(period);
144+
let reasonsDisabled = findReasonsDisabled(period, dateRange);
145145
if (reasonsDisabled) {
146146
periodsDisabledMap.set(period.id, reasonsDisabled);
147147
}

src/utils/workPeriods.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,16 @@ export function createPeriodAlerts(period, periodEnd) {
6363
* payment processing.
6464
*
6565
* @param {Object} period working period object
66+
* @param {Array} dateRange date range array
6667
* @returns {?string[]}
6768
*/
68-
export function findReasonsDisabled(period) {
69+
export function findReasonsDisabled(period, dateRange) {
6970
const reasons = [];
71+
if (dateRange && dateRange.length > 0) {
72+
if (dateRange[0].isAfter(moment())) {
73+
reasons.push(REASON_DISABLED.NOT_ALLOW_FUTURE_WEEK);
74+
}
75+
}
7076
if (!period.billingAccountId) {
7177
reasons.push(REASON_DISABLED.NO_BILLING_ACCOUNT);
7278
}

0 commit comments

Comments
 (0)