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 Aug 21, 2024
2 parents 596824c + 1514c73 commit b7a71a0
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ <h1 style="width: 100%;margin-bottom: 0px;">{{'addCampaign' | translate}}</h1>
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill" class="input-half-right">
<mat-label>{{'campaignPlacementPeriods' | translate}}</mat-label>
<mat-select id="campaignPlacementPeriods" formControlName="campaignPlacementPeriods" multiple>
<mat-option *ngFor="let value of getCampaignPlacementPeriods()" [value]="value">{{value |translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="in-line-forms">
<mat-form-field appearance="fill" class="input-half-left">
Expand Down Expand Up @@ -652,6 +658,12 @@ <h1 style="width: 100%;margin-bottom: 0px;">{{'modifyCampaign' | translate}} -
|translate}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill" class="input-half-right">
<mat-label>{{'campaignPlacementPeriods' | translate}}</mat-label>
<mat-select id="campaignPlacementPeriods" formControlName="campaignPlacementPeriods" multiple>
<mat-option *ngFor="let value of getCampaignPlacementPeriods()" [value]="value">{{value |translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="in-line-forms">
<mat-form-field appearance="fill" class="input-half-left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class CampaignAddFormComponent implements OnInit {
this.campaignCreated.campaignPlacement = {
active: false,
title: {},
configuration: {},
};
const keysWebHook = Object.keys(CampaignWebhook.EventsEnum);
keysWebHook.forEach((item) => {
Expand Down Expand Up @@ -356,6 +357,15 @@ export class CampaignAddFormComponent implements OnInit {
this.validatingForm.patchValue({
placementTitleEn: this.campaignUpdated.campaignPlacement.title["en"],
});
const periods = [];
for(let key of this.getCampaignPlacementPeriods()) {
if(this.campaignUpdated.campaignPlacement.configuration[key] && (this.campaignUpdated.campaignPlacement.configuration[key] == true)) {
periods.push(key);
}
}
this.validatingForm.patchValue({
campaignPlacementPeriods: periods,
});
} else {
this.validatingForm.patchValue({
placementActive: false,
Expand All @@ -366,6 +376,9 @@ export class CampaignAddFormComponent implements OnInit {
this.validatingForm.patchValue({
placementTitleEn: "Company standings",
});
this.validatingForm.patchValue({
campaignPlacementPeriods: [],
});
}
if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[USE_MULTI_LOCATION]){
this.validatingForm.patchValue({
Expand Down Expand Up @@ -469,6 +482,7 @@ export class CampaignAddFormComponent implements OnInit {
placementActive: new FormControl("",),
placementTitleIt: new FormControl("",),
placementTitleEn: new FormControl("",),
campaignPlacementPeriods: new FormControl("",),
});
} else {
this.validatingForm = this.formBuilder.group({
Expand Down Expand Up @@ -504,6 +518,7 @@ export class CampaignAddFormComponent implements OnInit {
placementActive: new FormControl("",),
placementTitleIt: new FormControl("",),
placementTitleEn: new FormControl("",),
campaignPlacementPeriods: new FormControl("",),
});
}
}
Expand Down Expand Up @@ -964,6 +979,14 @@ export class CampaignAddFormComponent implements OnInit {
} else {
this.campaignCreated.campaignPlacement.title["en"] = "";
}
if(this.validatingForm.get("campaignPlacementPeriods")) {
for (let p of this.getCampaignPlacementPeriods()) {
this.campaignCreated.campaignPlacement.configuration[p] = false;
}
for (let p of this.validatingForm.get("campaignPlacementPeriods").value) {
this.campaignCreated.campaignPlacement.configuration[p] = true;
}
}
if(this.validatingForm.get(USE_MULTI_LOCATION).value!==null){
this.campaignCreated.specificData[USE_MULTI_LOCATION] = this.validatingForm.get(USE_MULTI_LOCATION).value;
}else{
Expand Down Expand Up @@ -1497,6 +1520,11 @@ export class CampaignAddFormComponent implements OnInit {
}
}

getCampaignPlacementPeriods() {
const vals = ['periodToday', 'periodCurrentWeek', 'periodLastWeek', 'periodCurrentMonth', 'periodGeneral'];
return vals;
}


}

Expand Down
12 changes: 6 additions & 6 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,12 @@
"placementTitleItPlaceholder":"Titolo italiano (dafault 'Clasifiche azienda')",
"placementTitleEn":"titolo inglese",
"placementTitleEnPlaceholder":"Titolo inglese (default 'Company standings')",
"":"",
"":"",
"":"",
"":"",
"":"",
"":"",
"periodToday":"Today",
"periodCurrentWeek":"Current week",
"periodLastWeek":"Last week",
"periodCurrentMonth":"Current month",
"periodGeneral":"General",
"campaignPlacementPeriods":"Periods",
"":"",
"":"",
"":"",
Expand Down
12 changes: 6 additions & 6 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@
"placementTitleItPlaceholder":"Titolo italiano (dafault 'Clasifiche azienda')",
"placementTitleEn":"titolo inglese",
"placementTitleEnPlaceholder":"Titolo inglese (default 'Company standings')",
"":"",
"":"",
"":"",
"":"",
"":"",
"":"",
"periodToday":"Oggi",
"periodCurrentWeek":"Questa settimana",
"periodLastWeek":"Settimana scorsa",
"periodCurrentMonth":"Questo mese",
"periodGeneral":"Generale",
"campaignPlacementPeriods":"Periodi",
"":"",
"":"",
"":""
Expand Down

0 comments on commit b7a71a0

Please sign in to comment.