Skip to content
Open
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# [1.293.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.291.0...v1.293.0) (2026-02-13)

### Bug Fixes

- show deleted data in changelog ([1736831](https://github.com/bcgov/CONN-CCBC-portal/commit/17368318ed4fd8c88cbcb5248d40cbe3705745c3))
- update users with intake access in intake_users ([c690ced](https://github.com/bcgov/CONN-CCBC-portal/commit/c690cedeef180fc6a397ea39cf257b45be1c1b4f))

### Features

- automate intake openning ([04279dd](https://github.com/bcgov/CONN-CCBC-portal/commit/04279dde7a86326b25376e2c2df20e0e7d0d7606))
- empty space on gcpe report instead of null ([8983b78](https://github.com/bcgov/CONN-CCBC-portal/commit/8983b78ede34496eea8de8bb0231f41f812fdce0))
- skip build and jest on release ([efeed13](https://github.com/bcgov/CONN-CCBC-portal/commit/efeed137a5b7f06de14be92160dd9095b6956b42))

# [1.292.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.291.0...v1.292.0) (2026-02-12)

### Features
Expand Down
9 changes: 5 additions & 4 deletions app/backend/lib/intake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ intake.get('/api/intake', limiter, async (req, res) => {
},
};
// first check if the user is already on the table
// NOTE: adjust logic if there are future intakes
const intakeUsers =
currentIntake?.data?.session?.ccbcUserBySub?.intakeUsersByUserId?.nodes;
if (intakeUsers.length > 0) {
const userAlreadyOnIntake =
currentIntake?.data?.session?.ccbcUserBySub?.intakeUsersByUserId?.nodes?.some(
(node) => node.intakeId === intakeRowId
) ?? false;
if (userAlreadyOnIntake) {
return res.redirect('/applicantportal/dashboard');
}
const userResult = await performQuery(
Expand Down
45 changes: 34 additions & 11 deletions app/components/Admin/AddIntake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DateTime } from 'luxon';
import styled from 'styled-components';
import { IChangeEvent, ThemeProps } from '@rjsf/core';
import { CustomValidator, RJSFValidationError } from '@rjsf/utils';
import ALL_INTAKE_ZONES from 'data/intakeZones';

interface EditProps {
isFormEditMode: boolean;
Expand Down Expand Up @@ -41,10 +42,10 @@ const StyledBtnContainer = styled.div<EditProps>`

const StyledForm = styled.section<EditProps>`
overflow: hidden;
max-height: ${({ isFormEditMode }) => (isFormEditMode ? '560px' : '0px')};
max-height: ${({ isFormEditMode }) => (isFormEditMode ? '760px' : '0px')};
transition: max-height 0.5s;
padding-left: 4px;
max-width: 480px;
max-width: 680px;
margin-top: ${({ isFormEditMode }) => (isFormEditMode ? '24px' : '0px')};

.datetime-widget {
Expand Down Expand Up @@ -160,12 +161,22 @@ const AddIntake: React.FC<Props> = ({
setIsStartDateDisabled(false);
setFormData({
intakeNumber: newIntakeNumber,
zones: [...ALL_INTAKE_ZONES],
allowUnlistedFnLedZones: false,
});
};

const handleSubmit = (e) => {
const { startDate, endDate, intakeNumber, description, rollingIntake } =
e.formData;
const {
startDate,
endDate,
intakeNumber,
description,
rollingIntake,
inviteOnlyIntake,
zones,
allowUnlistedFnLedZones,
} = e.formData;

if (isIntakeEdit) {
updateIntake({
Expand All @@ -176,6 +187,9 @@ const AddIntake: React.FC<Props> = ({
endTime: endDate,
intakeDescription: description,
isRollingIntake: rollingIntake,
intakeZones: zones,
isAllowUnlistedFnLedZones: allowUnlistedFnLedZones ?? false,
hiddenIntakeCode: inviteOnlyIntake ? crypto.randomUUID() : null,
},
},
onCompleted: () => {
Expand All @@ -191,6 +205,9 @@ const AddIntake: React.FC<Props> = ({
endTime: endDate,
startTime: startDate,
rollingIntake,
zones,
allowUnlistedFnLedZones: allowUnlistedFnLedZones ?? false,
hiddenCode: inviteOnlyIntake ? crypto.randomUUID() : null,
},
},
onCompleted: () => {
Expand Down Expand Up @@ -231,15 +248,19 @@ const AddIntake: React.FC<Props> = ({
nextIntake && DateTime.fromISO(nextIntake?.openTimestamp);

if (!startDate && isFormSubmitting) {
errors?.startDate.addError('Start date & time must be entered');
errors?.startDate?.addError('Start date & time must be entered');
}

if (!endDate && isFormSubmitting) {
errors?.endDate.addError('End date & time must be entered');
errors?.endDate?.addError('End date & time must be entered');
}

if ((!jsonData?.zones || jsonData.zones.length === 0) && isFormSubmitting) {
errors?.zones?.addError('At least one zone must be selected');
}

if (isEdit && nextIntake && endDateTime >= nextIntakeStartDateTime) {
errors?.endDate.addError(
errors?.endDate?.addError(
'End date & time must not overlap with the next intake'
);
}
Expand All @@ -251,7 +272,7 @@ const AddIntake: React.FC<Props> = ({
currentDateTime <= intakeStartDate &&
startDateTime <= currentDateTime)
) {
errors?.startDate.addError(
errors?.startDate?.addError(
'Start date & time must be after current date & time'
);
} else if (
Expand All @@ -260,13 +281,13 @@ const AddIntake: React.FC<Props> = ({
// check previous intake end date overlap if editing an intake
(isEdit && startDateTime <= previousIntakeEndDateTime)
) {
errors?.startDate.addError(
errors?.startDate?.addError(
'Start date & time must not overlap with the previous intake'
);
}

if (endDateTime <= startDateTime) {
errors?.endDate.addError(
errors?.endDate?.addError(
'End date & time must be after start date & time'
);
}
Expand All @@ -283,6 +304,8 @@ const AddIntake: React.FC<Props> = ({
setIsFormEditMode(true);
setFormData({
intakeNumber: newIntakeNumber,
zones: [...ALL_INTAKE_ZONES],
allowUnlistedFnLedZones: false,
});
}}
variant="secondary"
Expand Down Expand Up @@ -319,7 +342,7 @@ const AddIntake: React.FC<Props> = ({
>
Save
</StyledSaveBtn>
<Button onClick={handleResetForm} variant="secondary">
<Button type="button" onClick={handleResetForm} variant="secondary">
Cancel
</Button>
</FormBase>
Expand Down
56 changes: 49 additions & 7 deletions app/components/Admin/Intake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const StyledEdit = styled.button`
const StyledFlex = styled.div`
display: flex;
flex-direction: column;
margin-bottom: 24px;

& div {
margin-bottom: 16px;
Expand Down Expand Up @@ -88,9 +89,17 @@ const StyledFlex = styled.div`
}
`;

const StyledDescription = styled.h4`
font-weight: 400;
color: ${({ theme }) => theme.color.components};
const StyledLinkFlex = styled.div`
display: flex;
flex-direction: column;

& div {
margin-bottom: 16px;
}

& h4 {
margin-bottom: 4px;
}
`;

interface IntakeProps {
Expand All @@ -117,15 +126,23 @@ const Intake: React.FC<IntakeProps> = ({
description
closeTimestamp
openTimestamp
hiddenCode
rollingIntake
zones
rowId
}
`,
intake
);

const { ccbcIntakeNumber, closeTimestamp, description, openTimestamp } =
queryFragment;
const {
ccbcIntakeNumber,
closeTimestamp,
description,
hiddenCode,
openTimestamp,
zones,
} = queryFragment;

const [archiveIntake] = useArchiveIntakeMutation();

Expand All @@ -136,6 +153,9 @@ const Intake: React.FC<IntakeProps> = ({
const formattedCloseDate = DateTime.fromISO(closeTimestamp).toLocaleString(
DateTime.DATETIME_FULL
);
const displayCloseDate = DateTime.fromISO(closeTimestamp)
.minus({ minutes: 30 })
.toLocaleString(DateTime.DATETIME_FULL);

const mockedDateCookie = cookie.get('mocks.mocked_date');
const currentDateTime = mockedDateCookie
Expand All @@ -146,6 +166,10 @@ const Intake: React.FC<IntakeProps> = ({
const endDateTime = DateTime.fromISO(closeTimestamp);
const isAllowedDelete = currentDateTime <= startDateTime;
const isAllowedEdit = currentDateTime <= endDateTime;
const hiddenIntakeLink =
origin && hiddenCode
? `${window.location.origin}/api/intake?code=${hiddenCode}`
: null;

const handleDelete = () => {
archiveIntake({
Expand Down Expand Up @@ -191,16 +215,34 @@ const Intake: React.FC<IntakeProps> = ({
<span>{formattedOpenDate}</span>
</div>
<div>
<h4>End date & time</h4>
<h4>Actual end date and time</h4>
<span>{formattedCloseDate}</span>
</div>
<div>
<h4>Display end date and time</h4>
<span>{displayCloseDate}</span>
</div>
{description && (
<div>
<StyledDescription>Description</StyledDescription>
<h4>Description</h4>
<span>{description}</span>
</div>
)}
{zones && (
<div>
<h4>Zones</h4>
<span>{zones.length ? zones.join(', ') : 'None'}</span>
</div>
)}
</StyledFlex>
{!isFormEditMode && hiddenIntakeLink && (
<StyledLinkFlex>
<div>
<h4>Applicant access link</h4>
<em>{hiddenIntakeLink}</em>
</div>
</StyledLinkFlex>
)}
</StyledContainer>
);
};
Expand Down
Loading
Loading