Skip to content

Commit

Permalink
PIM-1700: Verified Grain - Yield Summary Grid - Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
vivid-esnauffer committed Dec 23, 2024
1 parent 707f524 commit 5a53960
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ import { VerifiedYieldCommodityComponent } from './components/verified-yield/com
import { VerifiedYieldAmendmentListComponent } from "./components/verified-yield/amendment-list/verified-yield-amendment-list.component";
import { VerifiedYieldAmendmentComponent } from "./components/verified-yield/amendment/verified-yield-amendment.component";
import { OtherYearPolicyComponent } from "./components/grower-contract-header/other-year-policy/other-year-policy.component";
import { VerifiedYieldSummaryListComponent } from "./components/verified-yield/summary-list/verified-yield-summary-list.component";
import { VerifiedYieldSummaryComponent } from "./components/verified-yield/summary/verified-yield-summary.component";

/**
* Function that initializes the Configuration injector with the application base url from the app config service.
Expand Down Expand Up @@ -245,7 +247,9 @@ if (!environment.production || !environment.restrict_imports) {
VerifiedYieldCommodityListComponent,
VerifiedYieldCommodityComponent,
VerifiedYieldAmendmentListComponent,
VerifiedYieldAmendmentComponent
VerifiedYieldAmendmentComponent,
VerifiedYieldSummaryListComponent,
VerifiedYieldSummaryComponent
],
bootstrap: [AppComponent], imports: [CirrasUnderwritingAPIServiceModule,
DragDropModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<div class="plcy-inv-cmdty-totals-header"
style="grid-template-columns: 140px 100px 115px 115px 115px 115px 130px 125px 60px; padding-left: 10px;">

<div *ngIf="isUnsaved" class="table-header border-top border-left border-right"
style="grid-column-start: 1; grid-column-end: 10;">
<span #el matTooltip="" style="margin-left:10px;">
<mat-icon
[ngStyle]="{'color':'orangered', 'font-size':'large', 'padding-top': '4px'}">warning_amber</mat-icon>
</span>
<span style="color:orangered; font-size: 14px;">
Verified Yield Summary is calculated on save.
</span>
</div>

<div class="table-header border-top border-left border-right" style="grid-column-start: 1; grid-column-end: 10; padding-top: 8px;">
Yield Summary
</div>

<div class="header border-top border-bottom border-right border-left">
Commodity
</div>
<div class="border-right header border-top border-bottom">
Insured Acres
</div>
<div class="border-right header border-top border-bottom">
Harvested Acres
</div>
<div class="border-right header border-top border-bottom">
Harvested Yield/Acre
</div>
<div class="header border-top border-bottom border-right">
Appraised Yield
</div>
<div class="header border-top border-bottom border-right">
Assessed Yield
</div>
<div class="header border-top border-bottom border-right">
Yield to Count
</div>
<div class="header border-top border-bottom border-right">
Yield % PY
</div>

<div class="header border-top border-bottom border-right">
Comments
</div>

<div class="grain-unsdd-inv-tot-cmdty-container"
style="grid-template-columns: 140px 100px 115px 115px 115px 115px 130px 125px 60px; margin-left: 0px;">
<verified-yield-summary *ngFor="let summary of summaries" [summary]="summary"
[summariesFormArray]="summariesFormArray"
style="display: contents;"></verified-yield-summary>
</div>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { UntypedFormArray } from '@angular/forms';
import { VerifiedYieldSummary } from 'src/app/conversion/models-yield';

@Component({
selector: 'verified-yield-summary-list',
templateUrl: './verified-yield-summary-list.component.html',
styleUrl: './verified-yield-summary-list.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class VerifiedYieldSummaryListComponent {
@Input() summaries: Array<VerifiedYieldSummary>
@Input() summariesFormArray: UntypedFormArray;
@Input() isUnsaved: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div [formGroup]="summaryFormGroup" style="display: contents;">
<div class="readonly border-right border-bottom border-left" style="padding-left: 6px;">
{{ summaryFormGroup.value.cropCommodityName | titlecase }}
<span *ngIf="summaryFormGroup.value.isPedigreeInd == true" >&nbsp; Pedigreed</span>
</div>
<div class="readonly border-right border-bottom center">
{{ summaryFormGroup.value.totalInsuredAcres | number: '1.0-1' }}
</div>
<div class="readonly border-right border-bottom center">
{{ summaryFormGroup.value.harvestedYield | number: '1.0-3' }}
</div>

<div class="inventory-fill number border-right border-bottom">
{{ summaryFormGroup.value.harvestedYieldPerAcre | number: '1.0-3' }}
</div>

<div class="readonly border-right border-bottom center">
{{ summaryFormGroup.value.appraisedYield | number: '1.0-3' }}
</div>
<div class="readonly border-right border-bottom center">
{{ summaryFormGroup.value.assessedYield | number: '1.0-3' }}
</div>

<div class="inventory-fill number border-right border-bottom">
{{ summaryFormGroup.value.yieldToCount | number: '1.0-3' }}
</div>

<div class="readonly border-right border-bottom center">
{{ summaryFormGroup.value.yieldPercentPy | number: '1.0-3' }}
</div>

<div class="readonly border-right border-bottom center">
<!-- TODO add comments button -->
<!-- <uw-comments-button
[underwritingCommentTypeCode]="'DOP'"
[growerContractYearId]="dopYieldContract?.growerContractYearId"
[declaredYieldContractGuid]="dopYieldContract?.declaredYieldContractGuid"
[policyNumber]="growerContract?.policyNumber"
[growerName]="growerContract?.growerName"
[growerNumber]="growerContract?.growerNumber"
[uwComments]="dopYieldContract?.uwComments"
(onDone)="onDopCommentsDone($event)"></uw-comments-button> -->
</div>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ChangeDetectionStrategy, Component, Input, SimpleChanges } from '@angular/core';
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Store } from '@ngrx/store';
import { VerifiedYieldSummary } from 'src/app/conversion/models-yield';
import { SecurityUtilService } from 'src/app/services/security-util.service';
import { RootState } from 'src/app/store';

@Component({
selector: 'verified-yield-summary',
templateUrl: './verified-yield-summary.component.html',
styleUrl: './verified-yield-summary.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class VerifiedYieldSummaryComponent {
@Input() summary: VerifiedYieldSummary;
@Input() summariesFormArray: UntypedFormArray;

summaryFormGroup: UntypedFormGroup;

constructor(private fb: UntypedFormBuilder,
private store: Store<RootState>,
public securityUtilService: SecurityUtilService,
) { }

ngOnChanges(changes: SimpleChanges) {
if (changes.summary && this.summary) {
this.setupForm()
}
}

setupForm() {
this.summaryFormGroup = this.fb.group({
verifiedYieldSummaryGuid: [this.summary.verifiedYieldSummaryGuid],
verifiedYieldContractGuid: [this.summary.verifiedYieldContractGuid],
cropCommodityId: [this.summary.cropCommodityId],
isPedigreeInd: [this.summary.isPedigreeInd],
// TODO: insuread acres is missing
harvestedYield: [this.summary.harvestedYield],
harvestedYieldPerAcre: [this.summary.harvestedYieldPerAcre],
appraisedYield: [this.summary.appraisedYield],
assessedYield: [this.summary.assessedYield],
yieldToCount: [this.summary.yieldToCount],
yieldPercentPy: [this.summary.yieldPercentPy],
productionGuarantee: [this.summary.productionGuarantee],
probableYield: [this.summary.probableYield],
cropCommodityName: [this.summary.cropCommodityName],
uwComments: [this.summary.uwComments] // Array<UnderwritingComment>
});
this.summariesFormArray.push(this.summaryFormGroup);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ <h2>Verified Yield</h2>
></verified-yield-amendment-list>
</div>

<div style="margin-top: 16px;">
<!-- yield summary -->
<verified-yield-summary-list
*ngIf="verifiedYieldContract && verifiedYieldContract.verifiedYieldSummaries"
[summaries]="verifiedYieldContract.verifiedYieldSummaries"
[summariesFormArray]="getViewModel().formGroup.controls.verifiedYieldSummaries"
[isUnsaved]="isUnsaved"
></verified-yield-summary-list>
</div>


</form>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export class VerifiedYieldComponentModel extends BaseComponentModel {
super(sanitizer);

this.formGroup = this.fb.group({
// todo - add the summary grid
updateProductValuesInd: [false],
verifiedYieldContractCommodities: new UntypedFormArray([]), // subform responsible for the commodities grid
verifiedYieldAmendments: new UntypedFormArray([]) , // subform responsible for the appraisals and assessments grid
verifiedYieldSummaries: new UntypedFormArray([]) // subform responsible for the yield summary and comments
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function convertToYieldMeasUnit(yieldMeasUnitRes: YieldMeasUnitTypeCodeRs
fields: verifiedYieldContract.fields,
verifiedYieldContractCommodities: verifiedYieldContract.verifiedYieldContractCommodities,
verifiedYieldAmendments: verifiedYieldContract.verifiedYieldAmendments,
verifiedYieldSummaries: verifiedYieldContract.verifiedYieldSummaries,
productWarningMessages: verifiedYieldContract.productWarningMessages,

etag: etag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function convertToDopYieldContractRsrc(dopYieldContract: DopYieldContract
fields: verifiedYieldContract.fields,
verifiedYieldContractCommodities: verifiedYieldContract.verifiedYieldContractCommodities,
verifiedYieldAmendments: verifiedYieldContract.verifiedYieldAmendments,
verifiedYieldSummaries: verifiedYieldContract.verifiedYieldSummaries,
productWarningMessages: verifiedYieldContract.productWarningMessages,
etag: verifiedYieldContract.etag,
type: "VerifiedYieldContractRsrc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export interface VerifiedYieldContract {
fields?: Array<AnnualField>;
verifiedYieldContractCommodities?: Array<VerifiedYieldContractCommodity>;
verifiedYieldAmendments?: Array<VerifiedYieldAmendment>;
verifiedYieldSummaries?: Array<VerifiedYieldSummary>;
productWarningMessages?: Array<MessageRsrc>;
etag?: string;
type: string;
Expand Down Expand Up @@ -231,4 +232,21 @@ export interface VerifiedYieldContract {
cropCommodityId?: number;
cropCommodityName?: string;
isPedigreeInd?: boolean;
}
}

export interface VerifiedYieldSummary {
verifiedYieldSummaryGuid?: string;
verifiedYieldContractGuid?: string;
cropCommodityId?: number;
isPedigreeInd?: boolean;
harvestedYield?: number;
harvestedYieldPerAcre?: number;
appraisedYield?: number;
assessedYield?: number;
yieldToCount?: number;
yieldPercentPy?: number;
productionGuarantee?: number;
probableYield?: number;
cropCommodityName?: string;
uwComments?: Array<UnderwritingComment>;
}

0 comments on commit 5a53960

Please sign in to comment.