diff --git a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts index 266cdadc..5aaf7695 100644 --- a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts +++ b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts @@ -4,7 +4,6 @@ import { FormGroup, FormArray, FormControl, ReactiveFormsModule, Validators } fr import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatDialog } from '@angular/material/dialog'; import { MatBadgeModule } from '@angular/material/badge'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; @@ -53,6 +52,7 @@ import { MatTooltipModule } from '@angular/material/tooltip'; MatTooltipModule, ReactiveFormsModule, ], + providers: [LocalTimePipe], }) export class MozimoProductRegisterComponent implements OnInit { @ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator; @@ -84,7 +84,7 @@ export class MozimoProductRegisterComponent implements OnInit { private route: ActivatedRoute, private router: Router, private toCsv: ToCsvService, - private dialog: MatDialog, + private localTimePipe: LocalTimePipe, private snackBar: MatSnackBar, public auth: AuthService, private ser: MozimoProductRegisterService, @@ -205,11 +205,20 @@ export class MozimoProductRegisterComponent implements OnInit { Opening: 'opening', Received: 'received', Sale: 'sale', + Nc: 'nc', + Display: 'display', + Ageing: 'ageing', + Variance: 'variance', + Closing: 'closing', + 'Last Edit Date': 'lastEditDate', }; - const d = JSON.parse(JSON.stringify(this.dataSource.data)).map((x: MozimoProductRegisterItem) => ({ - x, - })); + const d = JSON.parse(JSON.stringify(this.dataSource.data)); + d.forEach( + (x: MozimoProductRegisterItem) => + (x.lastEditDate = x.lastEditDate ? this.localTimePipe.transform(x.lastEditDate ?? '') : 'Unsaved'), + ); + const csvData = new Blob([this.toCsv.toCsv(headers, d)], { type: 'text/csv;charset=utf-8;', });