Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
micnori committed Jan 9, 2024
2 parents 60bcbd4 + 9120854 commit a9e2789
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ <h1 style="width: 100%;margin-bottom: 0px;">{{'addCampaign' | translate}}</h1>
</div>
<div
*ngIf="!!validatingForm && !!validatingForm.get('type').value && validatingForm.get('type').value==='company'">
<mat-card-header style="border-bottom: 1px black solid; font-weight: bold;">
{{"modality" | translate}}
</mat-card-header>
<mat-form-field appearance="fill" class="input-half-left">
<mat-label>{{'useMultiLocation' | translate}}</mat-label>
<mat-select id="useMultiLocation" formControlName="useMultiLocation">
<mat-option *ngFor="let val of [true,false]" [value]="val">{{ transformActiveBoolean(val)
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill" class="input-half-right">
<mat-label>{{'useEmployeeLocation' | translate}}</mat-label>
<mat-select id="useEmployeeLocation" formControlName="useEmployeeLocation">
<mat-option *ngFor="let val of [true,false]" [value]="val">{{ transformActiveBoolean(val)
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-card-header style="border-bottom: 1px black solid; font-weight: bold;">
{{"indicator" | translate}}
</mat-card-header>
Expand Down Expand Up @@ -545,6 +562,23 @@ <h1 style="width: 100%;margin-bottom: 0px;">{{'modifyCampaign' | translate}} -
</div>
<div
*ngIf="!!validatingForm && !!validatingForm.get('type').value && validatingForm.get('type').value==='company'">
<mat-card-header style="border-bottom: 1px black solid; font-weight: bold;">
{{"modality" | translate}}
</mat-card-header>
<mat-form-field appearance="fill" class="input-half-left">
<mat-label>{{'useMultiLocation' | translate}}</mat-label>
<mat-select id="useMultiLocation" formControlName="useMultiLocation">
<mat-option *ngFor="let val of [true,false]" [value]="val">{{ transformActiveBoolean(val)
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill" class="input-half-right">
<mat-label>{{'useEmployeeLocation' | translate}}</mat-label>
<mat-select id="useEmployeeLocation" formControlName="useEmployeeLocation">
<mat-option *ngFor="let val of [true,false]" [value]="val">{{ transformActiveBoolean(val)
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-card-header style="border-bottom: 1px black solid; font-weight: bold;">
{{"indicator" | translate}}
</mat-card-header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ import {
MONTHLY_LIMIT_VIRTUAL_POINTS_SPEC_LABLE,
DAILY_LIMIT_TRIPS_NUMBER_SPEC_LABLE,
WEEKLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE,
MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE
MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE,
USE_MULTI_LOCATION,
USE_EMPLOYEE_LOCATION
} from "src/app/shared/constants/constants";
import {
trigger,
Expand Down Expand Up @@ -227,6 +229,8 @@ export class CampaignAddFormComponent implements OnInit {
this.validatingForm.patchValue({
territoryId: localStorage.getItem(TERRITORY_ID_LOCAL_STORAGE_KEY),
active: false,
useMultiLocation: false,
useEmployeeLocation: false,
});
this.expandableDescription = false;
this.campaignCreated.specificData.periods = [];
Expand Down Expand Up @@ -329,6 +333,25 @@ export class CampaignAddFormComponent implements OnInit {
labelAddModifyCampaign: this.campaignUpdated.specificData[VIRTUAL_SCORE][LABEL],
});
}
if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[USE_MULTI_LOCATION]){
this.validatingForm.patchValue({
useMultiLocation: this.campaignUpdated.specificData[USE_MULTI_LOCATION],
});
} else {
this.validatingForm.patchValue({
useMultiLocation: false,
});
}
if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[USE_EMPLOYEE_LOCATION]){
this.validatingForm.patchValue({
useEmployeeLocation: this.campaignUpdated.specificData[USE_EMPLOYEE_LOCATION],
});
} else {
this.validatingForm.patchValue({
useEmployeeLocation: false,
});
}

// if (
// !this.campaignUpdated.specificData || !this.campaignUpdated.specificData[VIRTUAL_SCORE] ||
// Object.keys(this.campaignUpdated.specificData[VIRTUAL_SCORE]).length <= 0
Expand Down Expand Up @@ -396,6 +419,8 @@ export class CampaignAddFormComponent implements OnInit {
monthlyLimitTripsNumber: new FormControl("",),
periodFrom: new FormControl("",),
periodTo: new FormControl("",),
useMultiLocation: new FormControl("", [Validators.required]),
useEmployeeLocation: new FormControl("", [Validators.required]),
});
} else {
this.validatingForm = this.formBuilder.group({
Expand Down Expand Up @@ -425,6 +450,8 @@ export class CampaignAddFormComponent implements OnInit {
monthlyLimitTripsNumber: new FormControl("",),
periodFrom: new FormControl("",),
periodTo: new FormControl("",),
useMultiLocation: new FormControl("", [Validators.required]),
useEmployeeLocation: new FormControl("", [Validators.required]),
});
}
}
Expand Down Expand Up @@ -870,6 +897,16 @@ export class CampaignAddFormComponent implements OnInit {
}else{
this.campaignCreated.specificData[VIRTUAL_SCORE][MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE] = undefined;
}
if(this.validatingForm.get(USE_MULTI_LOCATION).value!==null){
this.campaignCreated.specificData[USE_MULTI_LOCATION] = this.validatingForm.get(USE_MULTI_LOCATION).value;
}else{
this.campaignCreated.specificData[USE_MULTI_LOCATION] = false;
}
if(this.validatingForm.get(USE_EMPLOYEE_LOCATION).value!==null){
this.campaignCreated.specificData[USE_EMPLOYEE_LOCATION] = this.validatingForm.get(USE_EMPLOYEE_LOCATION).value;
}else{
this.campaignCreated.specificData[USE_EMPLOYEE_LOCATION] = false;
}
}
if(this.campaignCreated.type === "city" || this.campaignCreated.type === "school"){
if(this.validatingForm.get("challengePlayerProposedHour").value!==null && this.validatingForm.get("challengePlayerProposedDay").value!==null){
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ export const WEEKLY_LIMIT_VIRTUAL_POINTS_SPEC_LABLE= "scoreWeeklyLimit";
export const MONTHLY_LIMIT_VIRTUAL_POINTS_SPEC_LABLE= "scoreMonthlyLimit";
export const DAILY_LIMIT_TRIPS_NUMBER_SPEC_LABLE= "trackDailyLimit";
export const WEEKLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE= "trackWeeklyLimit";
export const MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE= "trackMonthlyLimit";
export const MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE= "trackMonthlyLimit";
export const USE_MULTI_LOCATION= "useMultiLocation";
export const USE_EMPLOYEE_LOCATION= "useEmployeeLocation";
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@
"COMPUTED":"Computed",
"UNASSIGNED":"Unassigned",
"indicator":"Indicator",
"modality":"Modality",
"useMultiLocation":"Check all the company locations",
"useEmployeeLocation":"Check the employee's location",
"periods":"Pay periods",
"labelAddModifyCampaign":"Label",
"labelAddModifyCampaignPlaceholder": "Indicator denomitation for the APP (Default ecoLeaves)",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@
"COMPUTED":"Valutato",
"UNASSIGNED":"Non assegnato",
"indicator":"Indicatore",
"modality":"Modalità",
"useMultiLocation":"Controlla tutte le sedi",
"useEmployeeLocation":"Controlla sede del dipendente",
"periods": "Periodi di retribuzione",
"labelAddModifyCampaign":"Label",
"labelAddModifyCampaignPlaceholder": "Denominazione indicatore per la APP (Default ecoLeaves)",
Expand Down

0 comments on commit a9e2789

Please sign in to comment.