Skip to content

Commit

Permalink
Merge pull request openMF#1514 from josehernandezfintecheandomx/fix/v…
Browse files Browse the repository at this point in the history
…iew_errors

Fix in some views that were having missing data
  • Loading branch information
adamsaghy authored Aug 30, 2022
2 parents e17a022 + e946726 commit 3e35c13
Show file tree
Hide file tree
Showing 24 changed files with 183 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Staff</mat-label>
<mat-select formControlName="staffId">
<mat-option *ngFor="let staff of staffOptions" [value]="staff.id">
{{ staff.displayName }}
<mat-label>Legal Form</mat-label>
<mat-select formControlName="legalFormId">
<mat-option *ngFor="let legalForm of legalFormOptions" [value]="legalForm.id">
{{ legalForm.value }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Legal Form</mat-label>
<mat-select formControlName="legalFormId">
<mat-option *ngFor="let legalForm of legalFormOptions" [value]="legalForm.id">
{{ legalForm.value }}
<mat-label>Staff</mat-label>
<mat-select formControlName="staffId">
<mat-option *ngFor="let staff of staffOptions" [value]="staff.id">
{{ staff.displayName }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field *ngIf="createClientForm.contains('fullname')" fxFlex="48%">
<mat-label>Name</mat-label>
<mat-label>{{ createClientForm.value.legalFormId === 1 ? 'Name' : 'Entity Name' }}</mat-label>
<input matInput required formControlName="fullname">
<mat-error *ngIf="createClientForm.controls.fullname.hasError('required')">
Client name is <strong>required</strong>
Expand Down Expand Up @@ -85,6 +85,46 @@
<input matInput formControlName="externalId">
</mat-form-field>

<div fxFlex="100%" fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" formGroupName="clientNonPersonDetails"
*ngIf="createClientForm.contains('clientNonPersonDetails')">

<mat-form-field fxFlex="48%">
<mat-label>Constitution</mat-label>
<mat-select formControlName="constitutionId" required>
<mat-option *ngFor="let constitution of constitutionOptions" [value]="constitution.id">
{{ constitution.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Main Business Line</mat-label>
<mat-select formControlName="mainBusinessLineId">
<mat-option *ngFor="let business of businessLineOptions" [value]="business.id">
{{ business.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%" (click)="incorpValidityTillDateDatePicker.open()">
<mat-label>Incorporation Validity Till Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="incorpValidityTillDateDatePicker" formControlName="incorpValidityTillDate">
<mat-datepicker-toggle matSuffix [for]="incorpValidityTillDateDatePicker"></mat-datepicker-toggle>
<mat-datepicker #incorpValidityTillDateDatePicker></mat-datepicker>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Incorporation Number</mat-label>
<input matInput formControlName="incorpNumber">
</mat-form-field>

<mat-form-field fxFlex="98%">
<mat-label>Remarks</mat-label>
<textarea matInput formControlName="remarks"></textarea>
</mat-form-field>

</div>

<mat-form-field *ngIf="createClientForm.value.legalFormId === 1" fxFlex="48%">
<mat-label>Gender</mat-label>
<mat-select formControlName="genderId">
Expand Down Expand Up @@ -131,7 +171,7 @@

<mat-form-field fxFlex="48%" (click)="submittedOnDatePicker.open()">
<mat-label>Submitted On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" formControlName="submittedOnDate">
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" formControlName="submittedOnDate" required>
<mat-datepicker-toggle matSuffix [for]="submittedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedOnDatePicker></mat-datepicker>
</mat-form-field>
Expand Down Expand Up @@ -169,46 +209,6 @@
</mat-error>
</mat-form-field>

<div fxFlex="100%" fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" formGroupName="clientNonPersonDetails"
*ngIf="createClientForm.contains('clientNonPersonDetails')">

<mat-form-field fxFlex="48%" (click)="incorpValidityTillDateDatePicker.open()">
<mat-label>Incorporation Validity Till Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="incorpValidityTillDateDatePicker" formControlName="incorpValidityTillDate">
<mat-datepicker-toggle matSuffix [for]="incorpValidityTillDateDatePicker"></mat-datepicker-toggle>
<mat-datepicker #incorpValidityTillDateDatePicker></mat-datepicker>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Incorporation Number</mat-label>
<input matInput formControlName="incorpNumber">
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Main Business Line</mat-label>
<mat-select formControlName="mainBusinessLineId">
<mat-option *ngFor="let business of businessLineOptions" [value]="business.id">
{{ business.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Constitution</mat-label>
<mat-select formControlName="constitutionId">
<mat-option *ngFor="let constitution of constitutionOptions" [value]="constitution.id">
{{ constitution.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="98%">
<mat-label>Remarks</mat-label>
<textarea matInput formControlName="remarks"></textarea>
</mat-form-field>

</div>

</div>

<div fxLayout="row" class="margin-t" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class ClientGeneralStepComponent implements OnInit {
this.createClientForm.removeControl('lastname');
this.createClientForm.addControl('fullname', new FormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl('clientNonPersonDetails', this.formBuilder.group({
'constitutionId': [''],
'constitutionId': ['', Validators.required],
'incorpValidityTillDate': [''],
'incorpNumber': [''],
'mainBusinessLineId': [''],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ export class AcceptClientTransferComponent implements OnInit {
*/
submit() {
const acceptClientTransferFormData = this.acceptClientTransferForm.value;
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const prevTransferDate: Date = this.acceptClientTransferForm.value.transferDate;
if (acceptClientTransferFormData.transferDate instanceof Date) {
acceptClientTransferFormData.transferDate = this.dateUtils.formatDate(prevTransferDate, dateFormat);
}
const data = {
...acceptClientTransferFormData,
dateFormat,
locale
};
this.clientsService.executeClientCommand(this.clientId, 'acceptTransfer', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../']">Cancel</button>
<button mat-raised-button color="accent" [disabled]="!reactivateClientForm.valid">Confirm</button>
<button mat-raised-button color="primary" [disabled]="!reactivateClientForm.valid">Confirm</button>
</mat-card-actions>

</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ReactivateClientComponent implements OnInit {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const prevReactivationDate: Date = this.reactivateClientForm.value.reactivationDate;
if (reactivateClientFormData.closureDate instanceof Date) {
if (reactivateClientFormData.reactivationDate instanceof Date) {
reactivateClientFormData.reactivationDate = this.dateUtils.formatDate(prevReactivationDate, dateFormat);
}
const data = {
Expand Down
107 changes: 53 additions & 54 deletions src/app/clients/edit-client/edit-client.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,30 @@
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Staff</mat-label>
<mat-select formControlName="staffId">
<mat-option *ngFor="let staff of staffOptions" [value]="staff.id">
{{ staff.displayName }}
<mat-label>Legal Form</mat-label>
<mat-select formControlName="legalFormId">
<mat-option *ngFor="let legalForm of legalFormOptions" [value]="legalForm.id">
{{ legalForm.value }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Legal Form</mat-label>
<mat-select formControlName="legalFormId">
<mat-option *ngFor="let legalForm of legalFormOptions" [value]="legalForm.id">
{{ legalForm.value }}
<mat-label>Account No</mat-label>
<input matInput formControlName="accountNo">
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Staff</mat-label>
<mat-select formControlName="staffId">
<mat-option *ngFor="let staff of staffOptions" [value]="staff.id">
{{ staff.displayName }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field *ngIf="editClientForm.contains('fullname')" fxFlex="48%">
<mat-label>Name</mat-label>
<mat-label>{{ editClientForm.value.legalFormId === 1 ? 'Name' : 'Entity Name' }}</mat-label>
<input matInput required formControlName="fullname">
<mat-error *ngIf="editClientForm.controls.fullname.hasError('required')">
Client name is <strong>required</strong>
Expand Down Expand Up @@ -74,10 +79,44 @@
<mat-datepicker #dateOfBirthDatePicker></mat-datepicker>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Account No</mat-label>
<input matInput formControlName="accountNo">
</mat-form-field>
<div fxFlex="100%" fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" formGroupName="clientNonPersonDetails"
*ngIf="editClientForm.contains('clientNonPersonDetails')">

<mat-form-field fxFlex="48%">
<mat-label>Constitution</mat-label>
<mat-select formControlName="constitutionId" required>
<mat-option *ngFor="let constitution of constitutionOptions" [value]="constitution.id">
{{ constitution.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Main Business Line</mat-label>
<mat-select formControlName="mainBusinessLineId">
<mat-option *ngFor="let business of businessLineOptions" [value]="business.id">
{{ business.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%" (click)="incorpValidityTillDateDatePicker.open()">
<mat-label>Incorporation Validity Till Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="incorpValidityTillDateDatePicker" formControlName="incorpValidityTillDate">
<mat-datepicker-toggle matSuffix [for]="incorpValidityTillDateDatePicker"></mat-datepicker-toggle>
<mat-datepicker #incorpValidityTillDateDatePicker></mat-datepicker>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Incorporation No</mat-label>
<input matInput formControlName="incorpNumber">
</mat-form-field>

<mat-form-field fxFlex="98%">
<mat-label>Remarks</mat-label>
<textarea matInput formControlName="remarks"></textarea>
</mat-form-field>
</div>

<mat-form-field fxFlex="48%">
<mat-label>External Id</mat-label>
Expand Down Expand Up @@ -131,7 +170,7 @@

<mat-form-field fxFlex="48%" (click)="activatedOnDatePicker.open()">
<mat-label>Activated On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="activatedOnDatePicker"
<input matInput [min]="editClientForm.value.submittedOnDate" [max]="maxDate" [matDatepicker]="activatedOnDatePicker"
formControlName="activationDate">
<mat-datepicker-toggle matSuffix [for]="activatedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #activatedOnDatePicker></mat-datepicker>
Expand All @@ -146,46 +185,6 @@
</mat-select>
</mat-form-field>

<div fxFlex="100%" fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" formGroupName="clientNonPersonDetails"
*ngIf="editClientForm.contains('clientNonPersonDetails')">

<mat-form-field fxFlex="48%" (click)="incorpValidityTillDateDatePicker.open()">
<mat-label>Incorporation Validity Till Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="incorpValidityTillDateDatePicker" formControlName="incorpValidityTillDate">
<mat-datepicker-toggle matSuffix [for]="incorpValidityTillDateDatePicker"></mat-datepicker-toggle>
<mat-datepicker #incorpValidityTillDateDatePicker></mat-datepicker>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Incorporation No</mat-label>
<input matInput formControlName="incorpNumber">
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Main Business Line</mat-label>
<mat-select formControlName="mainBusinessLineId">
<mat-option *ngFor="let business of businessLineOptions" [value]="business.id">
{{ business.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Constitution</mat-label>
<mat-select formControlName="constitutionId">
<mat-option *ngFor="let constitution of constitutionOptions" [value]="constitution.id">
{{ constitution.name }}
</mat-option>
</mat-select>
</mat-form-field>

<mat-form-field fxFlex="98%">
<mat-label>Remarks</mat-label>
<textarea matInput formControlName="remarks"></textarea>
</mat-form-field>

</div>

</div>

</mat-card-content>
Expand Down
4 changes: 2 additions & 2 deletions src/app/clients/edit-client/edit-client.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class EditClientComponent implements OnInit {
this.editClientForm = this.formBuilder.group({
'officeId': [{ value: '', disabled: true }],
'staffId': [''],
'legalFormId': [''],
'legalFormId': [{ value: '', disabled: true }],
'isStaff': [false],
'active': [false],
'accountNo': [{ value: '', disabled: true }],
Expand Down Expand Up @@ -143,7 +143,7 @@ export class EditClientComponent implements OnInit {
this.editClientForm.removeControl('lastname');
this.editClientForm.addControl('fullname', new FormControl(this.clientDataAndTemplate.fullname, Validators.required));
this.editClientForm.addControl('clientNonPersonDetails', this.formBuilder.group({
'constitutionId': [this.clientDataAndTemplate.clientNonPersonDetails.constitution && this.clientDataAndTemplate.clientNonPersonDetails.constitution.id],
'constitutionId': [this.clientDataAndTemplate.clientNonPersonDetails.constitution && this.clientDataAndTemplate.clientNonPersonDetails.constitution.id, Validators.required],
'incorpValidityTillDate': [this.clientDataAndTemplate.clientNonPersonDetails.incorpValidityTillDate && new Date(this.clientDataAndTemplate.clientNonPersonDetails.incorpValidityTillDate)],
'incorpNumber': [this.clientDataAndTemplate.clientNonPersonDetails.incorpNumber],
'mainBusinessLineId': [this.clientDataAndTemplate.clientNonPersonDetails.mainBusinessLine && this.clientDataAndTemplate.clientNonPersonDetails.mainBusinessLine.id],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<button mat-raised-button color="primary" [routerLink]="'edit'" *ngIf="allowEdition">
<fa-icon icon="edit"></fa-icon>&nbsp;&nbsp;Edit
</button>
<button mat-raised-button color="warn" *ngIf="allowEdition" (click)="undoTransaction()">

<button mat-raised-button color="warn" (click)="undoTransaction()">
<fa-icon icon="undo"></fa-icon>&nbsp;&nbsp;Undo
</button>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@

<mat-form-field fxFlex="48%" (click)="toDatePicker.open()">
<mat-label>To</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="toDatePicker" required formControlName="endDate">
<mat-datepicker-toggle matSuffix [for]="toDatePicker"></mat-datepicker-toggle>
<input matInput [min]="createCashierForm.value.startDate" [max]="maxDate" [matDatepicker]="toDatePicker" required formControlName="endDate"> <mat-datepicker-toggle matSuffix [for]="toDatePicker"></mat-datepicker-toggle>
<mat-datepicker #toDatePicker></mat-datepicker>
<mat-error *ngIf="createCashierForm.controls.endDate.hasError('required')">
To Date <strong>is required</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class CreateCashierComponent implements OnInit {
}

ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.maxDate = this.settingsService.maxFutureDate;
this.setCreateCashierForm();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@

<mat-form-field fxFlex="48%" (click)="toDatePicker.open()">
<mat-label>To</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="toDatePicker" required formControlName="endDate">
<mat-datepicker-toggle matSuffix [for]="toDatePicker"></mat-datepicker-toggle>
<input matInput [min]="editCashierForm.value.startDate" [max]="maxDate" [matDatepicker]="toDatePicker" required formControlName="endDate"> <mat-datepicker-toggle matSuffix [for]="toDatePicker"></mat-datepicker-toggle>
<mat-datepicker #toDatePicker></mat-datepicker>
<mat-error *ngIf="editCashierForm.controls.endDate.hasError('required')">
To Date <strong>is required</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class EditCashierComponent implements OnInit {
}

ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.maxDate = this.settingsService.maxFutureDate;
this.setEditChargeForm();
}

Expand Down
Loading

0 comments on commit 3e35c13

Please sign in to comment.