Skip to content

Commit

Permalink
psp-6021 add possession date to agreements form.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Oct 5, 2023
1 parent 656d951 commit 34943bd
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
.Map(dest => dest.PossessionDate, src => src.PossessionDate)
.Map(dest => dest.DepositAmount, src => src.DepositAmount)
.Map(dest => dest.NoLaterThanDays, src => src.NoLaterThanDays)
.Map(dest => dest.PurchasePrice, src => src.PurchasePrice)
Expand All @@ -35,6 +36,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
.Map(dest => dest.PossessionDate, src => src.PossessionDate)
.Map(dest => dest.DepositAmount, src => src.DepositAmount)
.Map(dest => dest.NoLaterThanDays, src => src.NoLaterThanDays)
.Map(dest => dest.PurchasePrice, src => src.PurchasePrice)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class AgreementModel : BaseAppModel

public DateTime? CommencementDate { get; set; }

public DateTime? PossessionDate { get; set; }

public decimal? DepositAmount { get; set; }

public int? NoLaterThanDays { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export const AgreementView: React.FunctionComponent<IAgreementViewProps> = ({
<SectionField labelWidth="5" label="Termination date">
{prettyFormatDate(agreement.terminationDate)}
</SectionField>
<SectionField labelWidth="5" label="Possession date">
{prettyFormatDate(agreement.possessionDate)}
</SectionField>

<StyledSectionSubheader>Financial</StyledSectionSubheader>
<SectionField labelWidth="5" label="Purchase price">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,22 @@ exports[`AgreementView component renders as expected 1`] = `
class="c9 text-left col"
/>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-5"
>
<label
class="c8"
>
Possession date:
</label>
</div>
<div
class="c9 text-left col"
/>
</div>
<div
class="c7"
>
Expand Down Expand Up @@ -679,6 +695,24 @@ exports[`AgreementView component renders as expected 1`] = `
Apr 5, 2023
</div>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-5"
>
<label
class="c8"
>
Possession date:
</label>
</div>
<div
class="c9 text-left col"
>
Apr 5, 2023
</div>
</div>
<div
class="c7"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export const AgreementSubForm: React.FunctionComponent<IAgreementSubFormProps> =
formikProps={formikProps}
/>
</SectionField>
<SectionField labelWidth="5" label="Possession date">
<FastDatePicker
field={withNameSpace(nameSpace, 'possessionDate')}
formikProps={formikProps}
/>
</SectionField>

<StyledSectionSubheader>Financial</StyledSectionSubheader>
<SectionField labelWidth="5" label="Purchase price">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,53 @@ exports[`UpdateAgreementsForm component renders as expected 1`] = `
</div>
</div>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-5"
>
<label
class="c7"
>
Possession date:
</label>
</div>
<div
class="c8 text-left col"
>
<div
class="c9 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="c10 form-control date-picker"
id="datepicker-agreements.0.possessionDate"
name="agreements.0.possessionDate"
placeholder="MTH DD, YYYY"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
</div>
<div
class="c6"
>
Expand Down Expand Up @@ -1180,6 +1227,53 @@ exports[`UpdateAgreementsForm component renders as expected 1`] = `
</div>
</div>
</div>
<div
class="pb-2 row"
>
<div
class="pr-0 text-left col-5"
>
<label
class="c7"
>
Possession date:
</label>
</div>
<div
class="c8 text-left col"
>
<div
class="c9 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="c10 form-control date-picker"
id="datepicker-agreements.1.possessionDate"
name="agreements.1.possessionDate"
placeholder="MTH DD, YYYY"
type="text"
value="Apr 05, 2023"
/>
</div>
</div>
</div>
</div>
</div>
<div
class="c6"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class SingleAgreementFormModel {
public completionDate: string = '';
public terminationDate: string = '';
public commencementDate: string = '';
public possessionDate: string = '';
public depositAmount: string = '';
public noLaterThanDays: string = '';
public purchasePrice: string = '';
Expand All @@ -38,6 +39,7 @@ export class SingleAgreementFormModel {
agreement.completionDate = apiModel.completionDate || '';
agreement.terminationDate = apiModel.terminationDate || '';
agreement.commencementDate = apiModel.commencementDate || '';
agreement.possessionDate = apiModel.possessionDate || '';
agreement.depositAmount = apiModel.depositAmount?.toString() || '';
agreement.noLaterThanDays = apiModel.noLaterThanDays?.toString() || '';
agreement.purchasePrice = apiModel.purchasePrice?.toString() || '';
Expand All @@ -61,6 +63,7 @@ export class SingleAgreementFormModel {
completionDate: stringToUndefined(this.completionDate),
terminationDate: stringToUndefined(this.terminationDate),
commencementDate: stringToUndefined(this.commencementDate),
possessionDate: stringToUndefined(this.possessionDate),
depositAmount: this.depositAmount !== '' ? Number(this.depositAmount) : null,
noLaterThanDays: stringToUndefined(this.noLaterThanDays),
purchasePrice: stringToUndefined(this.purchasePrice),
Expand Down
2 changes: 2 additions & 0 deletions source/frontend/src/mocks/agreements.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const mockAgreementsResponse = (): Api_Agreement[] => [
completionDate: null,
terminationDate: null,
commencementDate: null,
possessionDate: null,
depositAmount: null,
noLaterThanDays: null,
purchasePrice: null,
Expand Down Expand Up @@ -42,6 +43,7 @@ export const mockAgreementsResponse = (): Api_Agreement[] => [
completionDate: '2023-04-05T21:00:00.0',
terminationDate: '2023-04-05T21:00:00.0',
commencementDate: '2023-04-05T21:00:00.0',
possessionDate: '2023-04-05T21:00:00.0',
depositAmount: 1000,
noLaterThanDays: 20,
purchasePrice: 2000,
Expand Down
1 change: 1 addition & 0 deletions source/frontend/src/models/api/Agreement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Api_Agreement extends Api_ConcurrentVersion, Api_AuditFields {
completionDate: string | null;
terminationDate: string | null;
commencementDate: string | null;
possessionDate: string | null;
depositAmount: number | null;
noLaterThanDays: number | null;
purchasePrice: number | null;
Expand Down

0 comments on commit 34943bd

Please sign in to comment.