Formatting and some UI issue in reports section

This commit is contained in:
Alex beart 2023-01-13 19:36:19 +05:30
parent 6387df7050
commit 5dc54bfdb1
5 changed files with 56 additions and 19 deletions

View file

@ -14,7 +14,7 @@
<table class="table table-striped">
<thead>
<tr>
<th>Image</th>
<th>Image </th>
<th>Doc Number</th>
<th>Name</th>
</tr>
@ -25,7 +25,7 @@
<a target="_blank" [href]="'https://www.oneqlik.in'+item.image.substring(6)">
<i class="fas fa-file-pdf fa-3x pl-4"></i>
</a>
<td>
</td>
<ng-template #pdfSection>
<td>
@ -128,10 +128,22 @@
</thead>
<tr>
<td>State RTO Certificate</td>
<td>
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+statePic.substring(6)"
(click)="openModal1(template,statePic.substring(6))">
</td>
<td *ngIf="hasPdfFile(statePic); else pdfSection">
<a target="_blank" [href]="'https://www.oneqlik.in'+statePic.substring(6)">
<i class="fas fa-file-pdf fa-2x pl-4"></i>
</a>
</td>
<ng-template #pdfSection>
<td>
<img *ngIf="statePic ; else notAvaillableImg" style="width: 100px;" [src]="'https://www.oneqlik.in'+statePic.substring(6)" (click)="openModal1(template,statePic.substring(6))">
<ng-template #notAvaillableImg>Not Available</ng-template>
</td>
</ng-template>
<td>
{{state_certifcate_date |date:"medium"}}
</td>
@ -142,10 +154,22 @@
</tr>
<tr>
<td>Vahan Certificate</td>
<td>
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+vahanPic.substring(6)"
(click)="openModal1(template,vahanPic.substring(6))">
</td>
<td *ngIf="hasPdfFile(vahanPic); else pdfSection">
<a target="_blank" [href]="'https://www.oneqlik.in'+vahanPic.substring(6)">
<i class="fas fa-file-pdf fa-2x pl-4"></i>
</a>
</td>
<ng-template #pdfSection>
<td>
<img *ngIf="vahanPic ; else notAvaillableImg" style="width: 100px;" [src]="'https://www.oneqlik.in'+vahanPic.substring(6)" (click)="openModal1(template,vahanPic.substring(6))">
<ng-template #notAvaillableImg>Not Available</ng-template>
</td>
</ng-template>
<td>
{{vaahan_certifcate_date |date:"medium"}}
</td>

View file

@ -415,7 +415,9 @@ submit1(status){
base64Image
downloadImage(imageUrl,name) {
if(!this.hasPdfFile(imageUrl)) {
this.getBase64ImageFromURL(imageUrl).subscribe(base64data => {
this.base64Image = "data:image/jpg;base64," + base64data;
// save image to disk
@ -427,6 +429,17 @@ downloadImage(imageUrl,name) {
link.setAttribute("download", name);
link.click();
});
}else {
var link = document.createElement("a");
document.body.appendChild(link); // for Firefox
link.setAttribute("href", imageUrl);
link.setAttribute("download", name);
link.setAttribute("target", '_blank');
link.click();
}
}
getBase64ImageFromURL(url: string) {

View file

@ -823,7 +823,7 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth();
VRN:pdfBody[j].VRN,
'Distance(Kms)':(pdfBody[j]['Distance(Kms)']).toFixed(2),
'Moving Time':this.conversion(pdfBody[j]['Moving Time']),
'Stoppage Time':this.conversion(pdfBody[j]['Moving Time']),
'Stoppage Time':this.conversion(pdfBody[j]['Stoppage Time']),
"Idle Time":this.conversion(pdfBody[j]['Idle Time']),
fuelConsumed: this.fuleConvert((pdfBody[j]['Distance(Kms)']).toFixed(2), pdfBody[j]['Mileage']),
startAddress:pdfBody[j].startAddress,

View file

@ -701,9 +701,9 @@ export class DetailComponent implements OnInit {
// --------------------New Method for excel export-------------------
exportExcels() {
// for (var i = 0; i < this.reportArr.length; i++) {
// this.reportArr[i].deviceName = this.reportArr[i].device.Device_Name;
// }
for (var i = 0; i < this.reportArr.length; i++) {
this.reportArr[i].DateInFormat = moment(this.reportArr[i].Date).format('DD/MM/YYYY')
}
this.downloadFile(this.reportArr);
}
@ -711,7 +711,7 @@ export class DetailComponent implements OnInit {
downloadFile(data, filename = 'Distance Report Details') {
console.log(data);
let arrHeader = ["VRN", "Date", "startAddress", "endAddress", "Distance(Kms)"];
let arrHeader = ["VRN", "DateInFormat", "startAddress", "endAddress", "Distance(Kms)"];
let csvData = this.ConvertToCSV(data, arrHeader);
let blob = new Blob(['\ufeff' + csvData], { type: 'text/csv;charset=utf-8;' });
let dwldLink = document.createElement("a");

View file

@ -416,14 +416,14 @@ export class DisatanceReportComponent implements OnInit {
"data": "from_date",
"render": function (data, type, row) {
// let date=new Date(that.Fromdate).getDate()+"/"+new Date(that.Fromdate).getMonth()+"/"+new Date(that.Fromdate).getFullYear()
return that.FROMDATE;
return moment(that.FROMDATE).format('DD/MM/YYYY');
}
},
{
"data": "to_date",
"render": function (data, type, row) {
// let date=new Date(that.todate).getDate()+"/"+new Date(that.todate).getMonth()+"/"+new Date(that.todate).getFullYear()
return that.TODATE;
return moment(that.TODATE).format('DD/MM/YYYY');
}
},
{
@ -962,7 +962,7 @@ export class DisatanceReportComponent implements OnInit {
for (var j = 0; j < rowCount; j++) {
body.push({
device: pdfBody[j].device.Device_Name,
device: pdfBody[j].device && pdfBody[j].device.Device_Name ?pdfBody[j].device.Device_Name :pdfBody[j].VRN,
fromDate: this.FROMDATE,
toDate: this.TODATE,
startAddress: pdfBody[j].startAddress,