import {Component, OnInit, ViewChild} from '@angular/core';
import {Router} from "@angular/router";
import * as moment from 'moment';
@Component({
selector: 'app-pricing-info',
templateUrl: './pricing-info.component.html',
styleUrls: ['./pricing-info.component.scss']
})
export class PricingInfoComponent implements OnInit {
public data=[
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "JQD315",
"notes": "",
"images": [],
"modifiedBy": "JQD315",
"modifiedDateTime": "2017-08-09 09:30:21 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "ECH716",
"notes": "",
"images": [],
"modifiedBy": "ECH716",
"modifiedDateTime": "2017-08-04 15:04:21 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "RFV918",
"notes": "",
"images": [],
"modifiedBy": "RFV918",
"modifiedDateTime": "2017-08-04 08:23:07 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Created",
"fieldName": "",
"fieldValue": "",
"notes": "",
"images": [],
"modifiedBy": "eOscar",
"modifiedDateTime": "2017-07-27 12:05:47 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "DGO491",
"notes": "",
"images": [],
"modifiedBy": "DGO491",
"modifiedDateTime": "2017-07-27 13:03:10 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "FBG848",
"notes": "",
"images": [],
"modifiedBy": "FBG848",
"modifiedDateTime": "2017-07-27 15:17:34 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "RFV918",
"notes": "",
"images": [],
"modifiedBy": "RFV918",
"modifiedDateTime": "2017-08-03 13:38:18 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Assigned",
"fieldName": "agentId",
"fieldValue": "KXE006",
"notes": "",
"images": [],
"modifiedBy": "KXE006",
"modifiedDateTime": "2017-08-03 14:36:01 CDT"
},
{
"action": "UploadAndReviewImages",
"actionType": "Update",
"fieldName": "Acknowledged",
"fieldValue": "true",
"notes": "No images found in e-oscar.",
"images": [],
"modifiedBy": "DGO491",
"modifiedDateTime": "2017-07-27 13:03:38 CDT"
}
];
constructor(public router:Router) {
}
sortAuditRecords() {
console.log(this.data);
this.data = this.data.sort(function (a, b) {
let dateformat = "YYYY-MM-DD HH:mm:ss";
let dateA:any = new Date(moment(a.modifiedDateTime, dateformat).format('MM/DD/YYYY HH:mm:ss'));
let dateB:any = new Date(moment(b.modifiedDateTime, dateformat).format('MM/DD/YYYY HH:mm:ss'));
let fData:any= dateB - dateA;
console.log("=====================");
console.log(a.modifiedDateTime);
console.log(b.modifiedDateTime);
console.log(dateA);
console.log(dateB);
console.log(fData);
console.log("=====================");
return fData;
});
console.log(this.data);
}
ngOnInit() {
this.sortAuditRecords();
}
}
No comments:
Post a Comment