diff --git a/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.html b/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.html
index 66ef6d21..f7f4b835 100644
--- a/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.html
+++ b/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.html
@@ -101,12 +101,35 @@
{{'addCampaign' | translate}}
|translate}}
+
+
+
+ {{'campaignPlacementMetrics' | translate}}
+
+ {{value |translate}}
+
+
+ {{'campaignPlacementMeans' | translate}}
+
+ {{ transformActiveBoolean(val)
+ |translate}}
+
+
+
+
+
{{'campaignPlacementPeriods' | translate}}
{{value |translate}}
+
+ {{'defaultPlacementPeriod' | translate}}
+
+ {{value |translate}}
+
+
@@ -246,6 +269,26 @@ {{'addCampaign' | translate}}
+
+ {{"firstLimitBar" | translate}}
+
+
+
+
+ {{value |translate}}
+
+
+
+
+ {{"secondLimitBar" | translate}}
+
+
+
+
+ {{value |translate}}
+
+
+
@@ -658,12 +701,35 @@ {{'modifyCampaign' | translate}} -
|translate}}
+
+
+
+ {{'campaignPlacementMetrics' | translate}}
+
+ {{value |translate}}
+
+
+ {{'campaignPlacementMeans' | translate}}
+
+ {{ transformActiveBoolean(val)
+ |translate}}
+
+
+
+
+
{{'campaignPlacementPeriods' | translate}}
{{value |translate}}
+
+ {{'defaultPlacementPeriod' | translate}}
+
+ {{value |translate}}
+
+
@@ -807,6 +873,26 @@ {{'modifyCampaign' | translate}} -
+
+ {{"firstLimitBar" | translate}}
+
+
+
+
+ {{value |translate}}
+
+
+
+
+ {{"secondLimitBar" | translate}}
+
+
+
+
+ {{value |translate}}
+
+
+
diff --git a/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.ts b/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.ts
index 16cb1256..e806580f 100644
--- a/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.ts
+++ b/src/app/pages/campaign/campaign-add-form/campaign-add-form.component.ts
@@ -347,6 +347,16 @@ export class CampaignAddFormComponent implements OnInit {
labelAddModifyCampaign: this.campaignUpdated.specificData[VIRTUAL_SCORE][LABEL],
});
}
+ if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[VIRTUAL_SCORE] && this.campaignUpdated.specificData[VIRTUAL_SCORE]['firstLimitBar']){
+ this.validatingForm.patchValue({
+ firstLimitBar: this.campaignUpdated.specificData[VIRTUAL_SCORE]['firstLimitBar'],
+ });
+ }
+ if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[VIRTUAL_SCORE] && this.campaignUpdated.specificData[VIRTUAL_SCORE]['secondLimitBar']){
+ this.validatingForm.patchValue({
+ secondLimitBar: this.campaignUpdated.specificData[VIRTUAL_SCORE]['secondLimitBar'],
+ });
+ }
if(!!this.campaignUpdated.campaignPlacement){
this.validatingForm.patchValue({
placementActive: this.campaignUpdated.campaignPlacement.active,
@@ -366,6 +376,30 @@ export class CampaignAddFormComponent implements OnInit {
this.validatingForm.patchValue({
campaignPlacementPeriods: periods,
});
+ const metrics = [];
+ for(let key of this.getCampaignPlacementMetrics()) {
+ if(this.campaignUpdated.campaignPlacement.configuration[key] && (this.campaignUpdated.campaignPlacement.configuration[key] == true)) {
+ metrics.push(key);
+ }
+ }
+ if(!metrics.includes("metricVirtualScore")){
+ metrics.push("metricVirtualScore");
+ }
+ this.validatingForm.patchValue({
+ campaignPlacementMetrics: metrics,
+ });
+ this.validatingForm.patchValue({
+ campaignDefaultPlacementPeriod: this.campaignUpdated.campaignPlacement.configuration["periodDefault"],
+ })
+ if(!!this.campaignUpdated.campaignPlacement.configuration["meansShow"]){
+ this.validatingForm.patchValue({
+ campaignPlacementMeans: this.campaignUpdated.campaignPlacement.configuration["meansShow"],
+ });
+ } else {
+ this.validatingForm.patchValue({
+ campaignPlacementMeans: false,
+ });
+ }
} else {
this.validatingForm.patchValue({
placementActive: false,
@@ -379,6 +413,12 @@ export class CampaignAddFormComponent implements OnInit {
this.validatingForm.patchValue({
campaignPlacementPeriods: [],
});
+ this.validatingForm.patchValue({
+ campaignPlacementMetrics: ["metricVirtualScore"],
+ });
+ this.validatingForm.patchValue({
+ campaignPlacementMeans: false,
+ })
}
if(!!this.campaignUpdated.specificData && !!this.campaignUpdated.specificData[USE_MULTI_LOCATION]){
this.validatingForm.patchValue({
@@ -483,6 +523,11 @@ export class CampaignAddFormComponent implements OnInit {
placementTitleIt: new FormControl("",),
placementTitleEn: new FormControl("",),
campaignPlacementPeriods: new FormControl("",),
+ campaignDefaultPlacementPeriod: new FormControl("",),
+ campaignPlacementMetrics: new FormControl("",),
+ campaignPlacementMeans: new FormControl("",),
+ firstLimitBar: new FormControl("",),
+ secondLimitBar: new FormControl("",)
});
} else {
this.validatingForm = this.formBuilder.group({
@@ -519,6 +564,11 @@ export class CampaignAddFormComponent implements OnInit {
placementTitleIt: new FormControl("",),
placementTitleEn: new FormControl("",),
campaignPlacementPeriods: new FormControl("",),
+ campaignDefaultPlacementPeriod: new FormControl("",),
+ campaignPlacementMetrics: new FormControl("",),
+ campaignPlacementMeans: new FormControl("",),
+ firstLimitBar: new FormControl("",),
+ secondLimitBar: new FormControl("",)
});
}
}
@@ -964,11 +1014,26 @@ export class CampaignAddFormComponent implements OnInit {
}else{
this.campaignCreated.specificData[VIRTUAL_SCORE][MONTHLY_LIMIT_TRIPS_NUMBER_SPEC_LABLE] = undefined;
}
+ if(this.validatingForm.get("firstLimitBar")) {
+ this.campaignCreated.specificData[VIRTUAL_SCORE]['firstLimitBar'] = this.validatingForm.get("firstLimitBar").value;
+ } else {
+ this.campaignCreated.specificData[VIRTUAL_SCORE]['firstLimitBar'] = undefined;
+ }
+ if(this.validatingForm.get("secondLimitBar")) {
+ this.campaignCreated.specificData[VIRTUAL_SCORE]['secondLimitBar'] = this.validatingForm.get("secondLimitBar").value;
+ } else {
+ this.campaignCreated.specificData[VIRTUAL_SCORE]['secondLimitBar'] = undefined;
+ }
if(this.validatingForm.get("placementActive")) {
this.campaignCreated.campaignPlacement.active = this.validatingForm.get("placementActive").value;
} else {
this.campaignCreated.campaignPlacement.active = false;
}
+ if(this.validatingForm.get("campaignPlacementMeans")) {
+ this.campaignCreated.campaignPlacement.configuration['meansShow'] = this.validatingForm.get("campaignPlacementMeans").value;
+ } else {
+ this.campaignCreated.campaignPlacement.configuration['meansShow'] = false;
+ }
if(this.validatingForm.get("placementTitleIt")) {
this.campaignCreated.campaignPlacement.title["it"] = this.validatingForm.get("placementTitleIt").value;
} else {
@@ -987,6 +1052,18 @@ export class CampaignAddFormComponent implements OnInit {
this.campaignCreated.campaignPlacement.configuration[p] = true;
}
}
+ if(this.validatingForm.get("campaignDefaultPlacementPeriod")) {
+ this.campaignCreated.campaignPlacement.configuration["periodDefault"] = this.validatingForm.get("campaignDefaultPlacementPeriod").value;
+ }
+ if(this.validatingForm.get("campaignPlacementMetrics")) {
+ for (let p of this.getCampaignPlacementMetrics()) {
+ this.campaignCreated.campaignPlacement.configuration[p] = false;
+ }
+ for (let p of this.validatingForm.get("campaignPlacementMetrics").value) {
+ this.campaignCreated.campaignPlacement.configuration[p] = true;
+ }
+ this.campaignCreated.campaignPlacement.configuration["metricVirtualScore"] = true;
+ }
if(this.validatingForm.get(USE_MULTI_LOCATION).value!==null){
this.campaignCreated.specificData[USE_MULTI_LOCATION] = this.validatingForm.get(USE_MULTI_LOCATION).value;
}else{
@@ -1525,6 +1602,25 @@ export class CampaignAddFormComponent implements OnInit {
return vals;
}
+ getSelectedCampaignPlacementPeriods() {
+ const values = [];
+ if(this.validatingForm.get("campaignPlacementPeriods")) {
+ for (let p of this.validatingForm.get("campaignPlacementPeriods").value) {
+ values.push(p);
+ }
+ }
+ return values;
+ }
+
+ getCampaignPlacementMetrics() {
+ const vals = ['metricCo2', 'metricDistance', 'metricDuration', 'metricTrackNumber', 'metricVirtualScore', 'metricVirtualTrack'];
+ return vals;
+ }
+
+ getLimits() {
+ const vals = ['scoreDailyLimit', 'scoreWeeklyLimit', 'scoreMonthlyLimit', 'trackDailyLimit', 'trackWeeklyLimit', 'trackMonthlyLimit'];
+ return vals;
+ }
}
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index db59fc21..ac7e824b 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -367,9 +367,22 @@
"periodCurrentMonth":"Current month",
"periodGeneral":"General",
"campaignPlacementPeriods":"Periods",
- "":"",
- "":"",
- "":"",
- "":""
- }
+ "defaultPlacementPeriod": "Default period",
+ "campaignPlacementMetrics":"Indicatori",
+ "campaignPlacementMeans":"Mostra dettaglio mezzi",
+ "metricCo2":"CO2",
+ "metricTrackNumber":"Num. tracce",
+ "metricDistance":"Distanza",
+ "metricDuration":"Durata",
+ "metricVirtualScore":"Punti virtuali",
+ "metricVirtualTrack":"Num. viaggi",
+ "firstLimitBar": "Primo limite",
+ "secondLimitBar": "Secondo limite",
+ "scoreDailyLimit": "Punti virtuali - limite giornaliero",
+ "scoreWeeklyLimit": "Punti virtuali - limite settimanale",
+ "scoreMonthlyLimit": "Punti virtuali - limite mensile",
+ "trackDailyLimit": "Numero viaggi - limite giornaliero",
+ "trackWeeklyLimit": "Numero viaggi - limite settimanale",
+ "trackMonthlyLimit": "Numero viaggi - limite mensile"
+}
\ No newline at end of file
diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json
index 4fc8c93b..54ea9942 100644
--- a/src/assets/i18n/it.json
+++ b/src/assets/i18n/it.json
@@ -371,7 +371,21 @@
"periodCurrentMonth":"Questo mese",
"periodGeneral":"Generale",
"campaignPlacementPeriods":"Periodi",
-"":"",
-"":"",
-"":""
+"defaultPlacementPeriod": "Periodo di default",
+"campaignPlacementMetrics":"Indicatori",
+"campaignPlacementMeans":"Mostra dettaglio mezzi",
+"metricCo2":"CO2",
+"metricTrackNumber":"Num. tracce",
+"metricDistance":"Distanza",
+"metricDuration":"Durata",
+"metricVirtualScore":"Punti virtuali",
+"metricVirtualTrack":"Num. viaggi",
+"firstLimitBar": "Primo limite",
+"secondLimitBar": "Secondo limite",
+"scoreDailyLimit": "Punti virtuali - limite giornaliero",
+"scoreWeeklyLimit": "Punti virtuali - limite settimanale",
+"scoreMonthlyLimit": "Punti virtuali - limite mensile",
+"trackDailyLimit": "Numero viaggi - limite giornaliero",
+"trackWeeklyLimit": "Numero viaggi - limite settimanale",
+"trackMonthlyLimit": "Numero viaggi - limite mensile"
}