@@ -9,6 +9,7 @@ import { CampaignMessageStepComponent } from '../sms-campaign-stepper/campaign-m
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Create SMS Campaign Component
|
||||
@@ -35,11 +36,13 @@ export class CreateCampaignComponent {
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {OrganizationService} organizationService Organization Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private datePipe: DatePipe) {
|
||||
this.route.data.subscribe((data: { smsCampaignTemplate: any }) => {
|
||||
this.smsCampaignTemplate = data.smsCampaignTemplate;
|
||||
@@ -76,8 +79,8 @@ export class CreateCampaignComponent {
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const dateTimeFormat = 'dd MMMM yyyy HH:mm:ss';
|
||||
const smsCampaign = {
|
||||
...this.smsCampaign,
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { CampaignMessageStepComponent } from '../sms-campaign-stepper/campaign-message-step/campaign-message-step.component';
|
||||
@@ -35,11 +36,13 @@ export class EditCampaignComponent {
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {OrganizationService} organizationService Organiztion Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
private organizationService: OrganizationService) {
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { smsCampaign: any, smsCampaignTemplate: any }) => {
|
||||
this.smsCampaignTemplate = data.smsCampaignTemplate;
|
||||
this.smsCampaign = data.smsCampaign;
|
||||
@@ -67,8 +70,8 @@ export class EditCampaignComponent {
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const dateTimeFormat = 'dd MMMM yyyy HH:mm:ss';
|
||||
const smsCampaign: any = {
|
||||
campaignName: this.smsCampaign.campaignName,
|
||||
|
||||
+3
-1
@@ -8,6 +8,7 @@ import { distinctUntilChanged } from 'rxjs/operators';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from 'app/reports/reports.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Models */
|
||||
import { ReportParameter } from 'app/reports/common-models/report-parameter.model';
|
||||
@@ -45,6 +46,7 @@ export class EditBusinessRuleParametersComponent implements OnChanges {
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
*/
|
||||
constructor(private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private datePipe: DatePipe) { }
|
||||
|
||||
ngOnChanges() {
|
||||
@@ -75,7 +77,7 @@ export class EditBusinessRuleParametersComponent implements OnChanges {
|
||||
this.fetchSelectOptions(param, param.name);
|
||||
break;
|
||||
case 'date':
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const newControlValue = this.datePipe.transform(controlValue, dateFormat);
|
||||
this.ReportForm.get(param.name).patchValue(newControlValue);
|
||||
break;
|
||||
|
||||
+6
-3
@@ -5,6 +5,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from 'app/reports/reports.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Models */
|
||||
import { ReportParameter } from 'app/reports/common-models/report-parameter.model';
|
||||
@@ -38,10 +39,12 @@ export class BusinessRuleParametersComponent implements OnChanges {
|
||||
@Output() templateParameters = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {ReportsService} reportsService Reports Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
*/
|
||||
constructor(private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private datePipe: DatePipe) { }
|
||||
|
||||
ngOnChanges() {
|
||||
@@ -152,7 +155,7 @@ export class BusinessRuleParametersComponent implements OnChanges {
|
||||
formattedResponse[newKey] = value['id'];
|
||||
break;
|
||||
case 'date':
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
formattedResponse[newKey] = this.datePipe.transform(value, dateFormat);
|
||||
break;
|
||||
case 'none':
|
||||
|
||||
@@ -16,6 +16,7 @@ import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicke
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../../organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* View SMS Campaign Component
|
||||
@@ -77,13 +78,15 @@ export class ViewCampaignComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {OrganizationService} organizationService Organization Service
|
||||
* @param {SettingsService} settingsService Setting Service
|
||||
*/
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
public dialog: MatDialog,
|
||||
private formBuilder: FormBuilder,
|
||||
private datePipe: DatePipe,
|
||||
private organizationService: OrganizationService) {
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { smsCampaign: any }) => {
|
||||
this.smsCampaignData = data.smsCampaign;
|
||||
});
|
||||
@@ -140,8 +143,8 @@ export class ViewCampaignComponent implements OnInit {
|
||||
const closeCampaignDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
closeCampaignDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const dataObject = {
|
||||
closureDate: this.datePipe.transform(response.data.value.closureDate, dateFormat),
|
||||
dateFormat,
|
||||
@@ -175,8 +178,8 @@ export class ViewCampaignComponent implements OnInit {
|
||||
const activateCampaignDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
activateCampaignDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const dataObject = {
|
||||
activationDate: this.datePipe.transform(response.data.value.activationDate, dateFormat),
|
||||
dateFormat,
|
||||
@@ -210,8 +213,8 @@ export class ViewCampaignComponent implements OnInit {
|
||||
const reactivateCampaignDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
reactivateCampaignDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const dataObject = {
|
||||
activationDate: this.datePipe.transform(response.data.value.activationDate, dateFormat),
|
||||
dateFormat,
|
||||
@@ -257,14 +260,14 @@ export class ViewCampaignComponent implements OnInit {
|
||||
const prevFromDate: Date = this.smsForm.value.fromDate;
|
||||
const prevToDate: Date = this.smsForm.value.toDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.smsForm.patchValue({
|
||||
fromDate: this.datePipe.transform(prevFromDate, dateFormat),
|
||||
toDate: this.datePipe.transform(prevToDate, dateFormat)
|
||||
});
|
||||
const SMS = this.smsForm.value;
|
||||
SMS.id = this.smsCampaignData.id;
|
||||
SMS.locale = 'en';
|
||||
SMS.locale = this.settingsService.language.code;
|
||||
SMS.dateFormat = dateFormat;
|
||||
SMS.status = this.status;
|
||||
this.organizationService.getMessagebyStatus(SMS).subscribe((response: any) => {
|
||||
|
||||
Reference in New Issue
Block a user