Export for daily register working

This commit is contained in:
Amritanshu Agrawal 2024-08-16 11:45:01 +05:30
parent 3b46ac97bc
commit 28c603caee

View File

@ -4,7 +4,6 @@ import { FormGroup, FormArray, FormControl, ReactiveFormsModule, Validators } fr
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialog } from '@angular/material/dialog';
import { MatBadgeModule } from '@angular/material/badge'; import { MatBadgeModule } from '@angular/material/badge';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
@ -53,6 +52,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
MatTooltipModule, MatTooltipModule,
ReactiveFormsModule, ReactiveFormsModule,
], ],
providers: [LocalTimePipe],
}) })
export class MozimoProductRegisterComponent implements OnInit { export class MozimoProductRegisterComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator; @ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
@ -84,7 +84,7 @@ export class MozimoProductRegisterComponent implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private toCsv: ToCsvService, private toCsv: ToCsvService,
private dialog: MatDialog, private localTimePipe: LocalTimePipe,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
public auth: AuthService, public auth: AuthService,
private ser: MozimoProductRegisterService, private ser: MozimoProductRegisterService,
@ -205,11 +205,20 @@ export class MozimoProductRegisterComponent implements OnInit {
Opening: 'opening', Opening: 'opening',
Received: 'received', Received: 'received',
Sale: 'sale', 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) => ({ const d = JSON.parse(JSON.stringify(this.dataSource.data));
x, d.forEach(
})); (x: MozimoProductRegisterItem) =>
(x.lastEditDate = x.lastEditDate ? this.localTimePipe.transform(x.lastEditDate ?? '') : 'Unsaved'),
);
const csvData = new Blob([this.toCsv.toCsv(headers, d)], { const csvData = new Blob([this.toCsv.toCsv(headers, d)], {
type: 'text/csv;charset=utf-8;', type: 'text/csv;charset=utf-8;',
}); });