Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSP-6861 : Add "Advanced Payment Served Date" #3486

Merged
merged 2 commits into from
Sep 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.IsPaymentInTrust, src => src.IsPaymentInTrust)
.Map(dest => dest.GstNumber, src => src.GstNumber)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
.Map(dest => dest.AdvancedPaymentServedDate, src => src.AdvPmtServedDt)
.Map(dest => dest.SpecialInstruction, src => src.SpecialInstruction)
.Map(dest => dest.DetailedRemarks, src => src.DetailedRemarks)
.Map(dest => dest.IsDisabled, src => src.IsDisabled)
Expand All @@ -54,6 +55,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.AgreementDt, src => src.AgreementDate)
.Map(dest => dest.ExpropNoticeServedDt, src => src.ExpropriationNoticeServedDate)
.Map(dest => dest.ExpropVestingDt, src => src.ExpropriationVestingDate)
.Map(dest => dest.AdvPmtServedDt, src => src.AdvancedPaymentServedDate)
.Map(dest => dest.GenerationDt, src => src.GenerationDate)
.Map(dest => dest.PimsCompReqFinancials, src => src.Financials)
.Map(dest => dest.AcquisitionOwnerId, src => src.AcquisitionOwnerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class CompensationRequisitionModel : BaseAppModel

public DateTime? ExpropriationVestingDate { get; set; }

public DateTime? AdvancedPaymentServedDate { get; set; }

public DateTime? GenerationDate { get; set; }

public List<CompensationFinancialModel> Financials { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class PayeeOption {
agreementDate: null,
expropriationNoticeServedDate: null,
expropriationVestingDate: null,
advancedPaymentServedDate: null,
generationDate: null,
financials: [],
legacyPayee: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,29 @@ describe('Compensation Detail View Component', () => {
isDraft: false,
finalizedDate: '2024-06-12T18:00:00',
};
const { getByText } = await setup({
const { getByTestId } = await setup({
roles: [Roles.SYSTEM_ADMINISTRATOR],
props: { compensation: mockFinalCompensation },
});

expect(getByText('Jun 12, 2024')).toBeVisible();
const compensationFinalizedDate = getByTestId('compensation-finalized-date');
expect(compensationFinalizedDate).toHaveTextContent('Jun 12, 2024');
});

it('Displays the Advanced Payment Served Date', async () => {
const mockCompensation = getMockApiDefaultCompensation();
const { queryByTestId } = await setup({
claims: [Claims.COMPENSATION_REQUISITION_VIEW],
props: {
compensation: {
...mockCompensation,
isDraft: true,
advancedPaymentServedDate: '2023-09-18T00:00:00',
},
},
});

const advancedPaymntServedDate = queryByTestId('advanced-payment-served-date');
expect(advancedPaymntServedDate).toHaveTextContent('Sep 18, 2023');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ export const CompensationRequisitionDetailView: React.FunctionComponent<
</FlexDiv>
}
>
<SectionField label="Status" labelWidth="4" data-testid="compensation-status">
<SectionField label="Status" labelWidth="4" valueTestId="compensation-status">
{compensation.isDraft ? 'Draft' : 'Final'}
</SectionField>
<SectionField label="Alternate project" labelWidth="4">
{projectName}
</SectionField>
<SectionField label="Final date" labelWidth="4" data-testid="compensation-finalized">
<SectionField label="Final date" labelWidth="4" valueTestId="compensation-finalized-date">
{prettyFormatDate(compensation.finalizedDate)}
</SectionField>
<SectionField label="Agreement date" labelWidth="4">
Expand All @@ -224,6 +224,13 @@ export const CompensationRequisitionDetailView: React.FunctionComponent<
<SectionField label="Expropriation vesting date" labelWidth="4">
{prettyFormatDate(compensation.expropriationVestingDate)}
</SectionField>
<SectionField
label="Advanced payment served date"
labelWidth="4"
valueTestId="advanced-payment-served-date"
>
{prettyFormatDate(compensation.advancedPaymentServedDate)}
</SectionField>
<SectionField label="Special instructions" labelWidth={'12'}>
{compensation.specialInstruction}
</SectionField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ exports[`Compensation Detail View Component renders as expected 1`] = `
</div>
<div
class="c8 text-left col"
data-testid="compensation-status"
>
Final
</div>
Expand Down Expand Up @@ -463,6 +464,7 @@ exports[`Compensation Detail View Component renders as expected 1`] = `
</div>
<div
class="c8 text-left col"
data-testid="compensation-finalized-date"
/>
</div>
<div
Expand Down Expand Up @@ -513,6 +515,23 @@ exports[`Compensation Detail View Component renders as expected 1`] = `
class="c8 text-left col"
/>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-4"
>
<label
class="c7"
>
Advanced payment served date:
</label>
</div>
<div
class="c8 text-left col"
data-testid="advanced-payment-served-date"
/>
</div>
<div
class="pb-2 row"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const CompensationListContainer: React.FunctionComponent<
agreementDate: null,
expropriationNoticeServedDate: null,
expropriationVestingDate: null,
advancedPaymentServedDate: null,
generationDate: null,
specialInstruction: null,
detailedRemarks: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ describe('Compensation Requisition UpdateForm component', () => {
`#typeahead-alternateProject-item-${index}`,
) as HTMLElement;
},
getAdvancedPaymentServedDate: () => {
return utils.container.querySelector(
`input[name="advancedPaymentServedDate"]`,
) as HTMLInputElement;
},
getPayeeOptionsDropDown: () =>
utils.container.querySelector(`select[name="payee.payeeKey"]`) as HTMLInputElement,
getPayeeGSTNumber: () =>
Expand Down Expand Up @@ -298,13 +303,14 @@ describe('Compensation Requisition UpdateForm component', () => {
const mockCompensation = CompensationRequisitionFormModel.fromApi({
...getMockApiDefaultCompensation(),
isDraft: false,
finalizedDate: '2024-06-12T18:00:00',
finalizedDate: '2024-06-12T00:00:00',
});
const { getByText } = await setup({
const { getByTestId } = await setup({
props: { initialValues: mockCompensation },
});

expect(getByText('Jun 12, 2024')).toBeVisible();
const compensationFinalizedDate = getByTestId('compensation-finalized-date');
expect(compensationFinalizedDate).toHaveTextContent('Jun 12, 2024');
});

it('should display the LEGACY payee information', async () => {
Expand Down Expand Up @@ -378,4 +384,18 @@ describe('Compensation Requisition UpdateForm component', () => {

expect(setShowAltProjectError).toHaveBeenCalledWith(true);
});

it('displays the compensation advanced payment served date', async () => {
const mockCompensation = CompensationRequisitionFormModel.fromApi({
...getMockApiDefaultCompensation(),
isDraft: false,
advancedPaymentServedDate: '2024-09-16T00:00:00',
});
const { getAdvancedPaymentServedDate } = await setup({
props: { initialValues: mockCompensation },
});

const inputServedDate = getAdvancedPaymentServedDate();
expect(inputServedDate).toHaveValue('Sep 16, 2024');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const UpdateCompensationRequisitionForm: React.FC<CompensationRequisitionFormPro
label="Final date"
labelWidth="5"
contentWidth="4"
data-testid="compensation-finalized"
valueTestId="compensation-finalized-date"
>
{prettyFormatDate(initialValues.finalizedDate)}
</SectionField>
Expand All @@ -195,6 +195,9 @@ const UpdateCompensationRequisitionForm: React.FC<CompensationRequisitionFormPro
<SectionField label="Expropriation vesting date" labelWidth="5" contentWidth="4">
<FastDatePicker field="expropriationVestingDateTime" formikProps={formikProps} />
</SectionField>
<SectionField label="Advanced payment served date" labelWidth="5" contentWidth="4">
<FastDatePicker field="advancedPaymentServedDate" formikProps={formikProps} />
</SectionField>
<SectionField label="Special instructions" labelWidth="12">
<MediumTextArea field="specialInstruction" />
</SectionField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ exports[`Compensation Requisition UpdateForm component renders as expected 1`] =
</div>
<div
class="c4 text-left col-4"
data-testid="compensation-finalized-date"
/>
</div>
<div
Expand Down Expand Up @@ -536,6 +537,53 @@ exports[`Compensation Requisition UpdateForm component renders as expected 1`] =
</div>
</div>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-5"
>
<label
class="c3"
>
Advanced payment served date:
</label>
</div>
<div
class="c4 text-left col-4"
>
<div
class="c6 form-group"
>
<div
class="react-datepicker-wrapper d-block"
>
<div
class="react-datepicker__input-container react-datepicker__view-calendar-icon"
>
<svg
class="react-datepicker__calendar-icon"
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"
/>
</svg>
<input
autocomplete="off"
class="c7 form-control date-picker"
id="datepicker-advancedPaymentServedDate"
name="advancedPaymentServedDate"
placeholder="MTH DD, YYYY"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
</div>
<div
class="pb-2 row"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class CompensationRequisitionFormModel {
agreementDateTime: string = '';
expropriationNoticeServedDateTime: string = '';
expropriationVestingDateTime: string = '';
advancedPaymentServedDate: string = '';
generationDatetTime: string = '';
specialInstruction: string = '';
detailedRemarks: string = '';
Expand Down Expand Up @@ -59,6 +60,7 @@ export class CompensationRequisitionFormModel {
finalizedDate: stringToUndefined(this.finalizedDate),
expropriationNoticeServedDate: stringToUndefined(this.expropriationNoticeServedDateTime),
expropriationVestingDate: stringToUndefined(this.expropriationVestingDateTime),
advancedPaymentServedDate: stringToUndefined(this.advancedPaymentServedDate),
generationDate: stringToUndefined(this.generationDatetTime),
specialInstruction: stringToUndefined(this.specialInstruction),
detailedRemarks: stringToUndefined(this.detailedRemarks),
Expand Down Expand Up @@ -96,6 +98,7 @@ export class CompensationRequisitionFormModel {
compensation.agreementDateTime = apiModel.agreementDate || '';
compensation.expropriationNoticeServedDateTime = apiModel.expropriationNoticeServedDate || '';
compensation.expropriationVestingDateTime = apiModel.expropriationVestingDate || '';
compensation.advancedPaymentServedDate = apiModel.advancedPaymentServedDate || '';
compensation.generationDatetTime = apiModel.generationDate || '';
compensation.specialInstruction = apiModel.specialInstruction || '';
compensation.detailedRemarks = apiModel.detailedRemarks || '';
Expand Down
1 change: 1 addition & 0 deletions source/frontend/src/mocks/compensations.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const emptyCompensationRequisition: Api_CompensationRequisition = {
agreementDate: null,
expropriationNoticeServedDate: null,
expropriationVestingDate: null,
advancedPaymentServedDate: null,
generationDate: null,
financials: [],
acquisitionOwnerId: null,
Expand Down
1 change: 1 addition & 0 deletions source/frontend/src/models/api/CompensationRequisition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface Api_CompensationRequisition extends Api_ConcurrentVersion, Api_
agreementDate: string | null;
expropriationNoticeServedDate: string | null;
expropriationVestingDate: string | null;
advancedPaymentServedDate: string | null;
generationDate: string | null;
financials: Api_CompensationFinancial[];
acquisitionOwnerId: number | null;
Expand Down