Move out DatePipe to use in one place Dates
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ClientsService } from 'app/clients/clients.service';
|
||||
|
||||
/**
|
||||
@@ -26,7 +25,6 @@ export class ViewChargeComponent implements OnInit {
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private date: DatePipe,
|
||||
private clientService: ClientsService) {
|
||||
this.route.data.subscribe((data: { clientChargeData: any }) => {
|
||||
this.chargeData = data.clientChargeData;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ export class ActivateClientComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {clientsService} clientsService Cliens Service
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export class AddClientChargeComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ClientsService} clientsService Clients Service
|
||||
* @param {SettingsService} settingsService Setting service
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ export class CloseClientComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {ClientsService} clientsService Clients Service
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Setting service
|
||||
|
||||
@@ -6,7 +6,6 @@ import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { CheckboxBase } from 'app/shared/form-dialog/formfield/model/checkbox-base';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
@@ -15,6 +14,7 @@ import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-d
|
||||
/** Custom Services */
|
||||
import { ClientsService } from '../../../clients.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-multi-row',
|
||||
@@ -31,7 +31,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
showDeleteBotton: boolean;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private clientsService: ClientsService,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -118,7 +118,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
if (response.data) {
|
||||
// format Dates
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.clientsService.addClientDatatableEntry(this.clientId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { CheckboxBase } from 'app/shared/form-dialog/formfield/model/checkbox-base';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
@@ -14,6 +13,7 @@ import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-d
|
||||
/** Custom Services */
|
||||
import { ClientsService } from '../../../clients.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -28,7 +28,7 @@ export class SingleRowComponent implements OnInit {
|
||||
clientId: string;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private clientsService: ClientsService,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -59,7 +59,7 @@ export class SingleRowComponent implements OnInit {
|
||||
if (response.data) {
|
||||
// format Dates
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.clientsService.addClientDatatableEntry(this.clientId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
@@ -93,7 +93,7 @@ export class SingleRowComponent implements OnInit {
|
||||
if (response.data) {
|
||||
// format Dates
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.clientsService.editClientDatatableEntry(this.clientId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export class AddFamilyMemberComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder FormBuilder
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {Router} router Router
|
||||
* @param {Route} route Route
|
||||
* @param {ClientsService} clientsService Clients Service
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export class EditFamilyMemberComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {Dates} dateUtils DatePipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {Router} router Router
|
||||
* @param {ActivatedRoute} route Route
|
||||
* @param {ClientsService} clientsService Clients Service
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Modules */
|
||||
import { ClientsRoutingModule } from './clients-routing.module';
|
||||
@@ -123,7 +122,7 @@ import { CreateSelfServiceUserComponent } from './clients-view/client-actions/cr
|
||||
CaptureImageDialogComponent,
|
||||
CreateSelfServiceUserComponent
|
||||
],
|
||||
providers: [DatePipe]
|
||||
providers: [ ]
|
||||
|
||||
})
|
||||
export class ClientsModule { }
|
||||
|
||||
Reference in New Issue
Block a user