ss
This commit is contained in:
commit
10e3744f5d
Binary file not shown.
37573
package-lock.json
generated
37573
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,7 @@
|
||||
"core-js": "2.5.1",
|
||||
"echarts": "^4.9.0",
|
||||
"eva-icons": "^1.1.3",
|
||||
"firebase-admin": "^11.10.1",
|
||||
"file-saver": "^2.0.5",
|
||||
"html2pdf.js": "^0.10.1",
|
||||
"intl": "1.2.5",
|
||||
"ionicons": "2.0.1",
|
||||
@ -80,6 +80,8 @@
|
||||
"tslib": "^2.3.1",
|
||||
"typeface-exo": "0.0.22",
|
||||
"web-animations-js": "^2.3.2",
|
||||
"ws": "^8.14.0",
|
||||
"xlsx": "^0.18.5",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -95,10 +97,12 @@
|
||||
"@compodoc/compodoc": "1.0.1",
|
||||
"@fortawesome/fontawesome-free": "^5.2.0",
|
||||
"@types/d3-color": "1.0.5",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/jasmine": "~3.3.0",
|
||||
"@types/jasminewd2": "2.0.3",
|
||||
"@types/leaflet": "1.2.3",
|
||||
"@types/node": "^12.12.70",
|
||||
"@types/ws": "^8.5.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
||||
"@typescript-eslint/parser": "^5.36.2",
|
||||
"codelyzer": "^6.0.2",
|
||||
|
||||
16
src/app/pages/_guard/order-d.guard.spec.ts
Normal file
16
src/app/pages/_guard/order-d.guard.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OrderDGuard } from './order-d.guard';
|
||||
|
||||
describe('OrderDGuard', () => {
|
||||
let guard: OrderDGuard;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
guard = TestBed.inject(OrderDGuard);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(guard).toBeTruthy();
|
||||
});
|
||||
});
|
||||
38
src/app/pages/_guard/order-d.guard.ts
Normal file
38
src/app/pages/_guard/order-d.guard.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class OrderDGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(): boolean {
|
||||
// Implement your logic to decide whether to redirect or not.
|
||||
// For example, you can check if a certain condition is met.
|
||||
// const shouldRedirect = false
|
||||
let shouldRedirect = localStorage.getItem('graud')
|
||||
if (shouldRedirect == '1') {
|
||||
console.log('shouldRedirect','In')
|
||||
// Redirect to the desired route upon browser refresh
|
||||
this.router.navigate(['/pages/order']);
|
||||
return false; // Prevent navigation to the original route
|
||||
}
|
||||
console.log('shouldRedirect','out')
|
||||
return true; // Allow navigation to the original route
|
||||
|
||||
// console.log('canActivate')
|
||||
// // Add your logic here to determine if a refresh should redirect to another page
|
||||
// let dd = localStorage.getItem('gruad')
|
||||
// if(dd == '1'){
|
||||
// console.log('dd')
|
||||
// console.log('shouldRedirect')
|
||||
// this.router.navigate(['../']); // Redirect to the desired page
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,6 +12,10 @@ export class AuthService {
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private _http: HttpClient) { }
|
||||
|
||||
update_token(params): Observable<any> {
|
||||
console.log(params.id)
|
||||
return this._http.post<any>(this.apiUrl + "updateToken",params)
|
||||
}
|
||||
|
||||
getLoginToken(params): Observable<any> {
|
||||
console.log(params.email)
|
||||
@ -21,7 +25,7 @@ export class AuthService {
|
||||
|
||||
getForgotToken(params): Observable<any> {
|
||||
console.log(params.email)
|
||||
return this._http.post<any>(this.apiUrl + "forget-password",{'email':params.email,'password':params.password})
|
||||
return this._http.post<any>(this.apiUrl + "_api",{'email':params.email,'password':params.password})
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -69,9 +69,13 @@ export class LoginComponent implements OnInit {
|
||||
localStorage.setItem('email',JSON.stringify(auth))
|
||||
this.disable= true
|
||||
this.showToast('success', 'Login Successfully', 'Welcome..!');
|
||||
setTimeout(() => {
|
||||
this.router.navigate(['/home'])
|
||||
}, 500);
|
||||
|
||||
if(res.role == 'FRONT-OFFICE'){
|
||||
this.router.navigate(['/home'])
|
||||
}else{
|
||||
this.router.navigate(['/pages/dashboard'])
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -93,10 +93,11 @@
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<nb-form-field>
|
||||
<label for="subject">Pincode:</label>
|
||||
<input formControlName="pincode" nbInput id="pincode" type="text" [status]="userForm.get('pincode').invalid && userForm.get('pincode').touched? 'danger' : 'basic'">
|
||||
<input formControlName="pincode" nbInput id="pincode" type="text" [status]="userForm.get('pincode').invalid && userForm.get('pincode').touched? 'danger' : 'basic'">
|
||||
<ng-container nbInputErrorMessage>
|
||||
<div style="color:#7c0e0e" *ngIf="userForm.get('pincode').hasError('required') && userForm.get('pincode').touched">Pincode is required.</div>
|
||||
</ng-container>
|
||||
<div style="color: #7c0e0e" *ngIf="userForm.get('pincode').hasError('pattern') && userForm.get('pincode').touched">Pincode must be a 6-digit number.</div>
|
||||
</ng-container>
|
||||
</nb-form-field>
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-12">
|
||||
|
||||
@ -45,7 +45,10 @@ export class CustomerFormComponent implements OnInit {
|
||||
address_1: new FormControl('', [Validators.required]),
|
||||
state: new FormControl('', [Validators.required]),
|
||||
city: new FormControl('', [Validators.required]),
|
||||
pincode: new FormControl('', [Validators.required]),
|
||||
pincode: new FormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern('^[0-9]{6}$'), // Allow only 6 digits
|
||||
]),
|
||||
cusType: new FormControl('', [Validators.required]),
|
||||
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5">
|
||||
<div> <nb-icon icon="people-outline"></nb-icon> Customer Management</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
<div style=" text-align: end;">
|
||||
<!-- <button (click)="Assign()" nbButton status="primary" hero>
|
||||
Assign Driver
|
||||
|
||||
16
src/app/pages/excel-export/excel-export.service.spec.ts
Normal file
16
src/app/pages/excel-export/excel-export.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExcelExportService } from './excel-export.service';
|
||||
|
||||
describe('ExcelExportService', () => {
|
||||
let service: ExcelExportService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ExcelExportService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
56
src/app/pages/excel-export/excel-export.service.ts
Normal file
56
src/app/pages/excel-export/excel-export.service.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ExcelExportService {
|
||||
|
||||
constructor() { }
|
||||
fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
||||
fileExtension = '.xlsx';
|
||||
|
||||
public exportExcel(jsonData: any, fileName: string): void {
|
||||
|
||||
console.log(jsonData)
|
||||
if(jsonData instanceof Array ){
|
||||
|
||||
|
||||
|
||||
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData);
|
||||
const wb: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] };
|
||||
const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||
this.saveExcelFile(excelBuffer, fileName);
|
||||
|
||||
}else{
|
||||
let wb = XLSX.utils.table_to_book(jsonData);
|
||||
console.log(wb)
|
||||
const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||
this.saveExcelFile(excelBuffer, fileName);
|
||||
// XLSX.writeFile(wb, fileName + this.fileExtension);
|
||||
}
|
||||
|
||||
|
||||
/* table id is passed over here */
|
||||
// console.log(jsonData, typeof(jsonData),jsonData.getElementsByTagName('mat-icon'))
|
||||
// let temp = jsonData.getElementsByClassName('mat-icon')
|
||||
// temp.innerHTML = ''
|
||||
// console.log(temp)
|
||||
// // jsonData.removeChild()
|
||||
// const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(jsonData);
|
||||
|
||||
// /* generate workbook and add the worksheet */
|
||||
// const wb: XLSX.WorkBook = XLSX.utils.book_new();
|
||||
// XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||
// const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||
// this.saveExcelFile(excelBuffer, fileName);
|
||||
// /* save to file */
|
||||
// XLSX.writeFile(wb, this.fileName);
|
||||
}
|
||||
|
||||
private saveExcelFile(buffer: any, fileName: string): void {
|
||||
const data: Blob = new Blob([buffer], {type: this.fileType});
|
||||
FileSaver.saveAs(data, fileName + this.fileExtension);
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@
|
||||
<div>
|
||||
|
||||
<!-- <label for="subject" style=" font-weight: 600;">{{ fieldGroup.qty }}</label> -->
|
||||
<input nbInput style="width: 50%;" [(ngModel)]="fieldGroup.qty" type="number">
|
||||
<input nbInput style="width: 70%;" [(ngModel)]="fieldGroup.qty" type="number" min="1">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,126 +1,247 @@
|
||||
<nb-card>
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-4">
|
||||
<div> {{fieldTitle}}</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div style="text-align: end;">
|
||||
<button nbTooltip="Back" nbTooltipPlacement="top" (click)="back()" nbButton status="warning" hero>
|
||||
<nb-icon icon="corner-down-left-outline"></nb-icon>
|
||||
|
||||
|
||||
</button>
|
||||
|
||||
<button nbTooltip="Edit" nbTooltipPlacement="top" *ngIf=" fieldTitle != 'Edit Order'" style=" margin-left: 2rem;" (click)="edit()" nbButton status="primary" hero>
|
||||
<nb-icon icon="edit-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<button nbTooltip="Download" nbTooltipPlacement="top" style=" margin-left: 2rem;"(click)="generatePDF('download')" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="exampleInputEmail1" class="label">Customer</label> <br />
|
||||
<span *ngIf="fieldTitle == 'View Order'">{{selectCustomer}}</span>
|
||||
<nb-select selected="" [(ngModel)]="selectCustomer" *ngIf="fieldTitle != 'View Order'" [disabled]="fieldTitle =='Edit Order' ">
|
||||
|
||||
<nb-option value="" hidden>Select Customer</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of customer; index as i; first as isFirst " (click)="checkType(user)" [value]="user['CusDetails.cusName']
|
||||
">{{user['CusDetails.cusName']
|
||||
}}</nb-option>
|
||||
|
||||
</nb-select>
|
||||
<hr>
|
||||
<div style="font-size: larger;margin-top: 1rem;;margin-bottom: 1rem;"> Shipping Information</div>
|
||||
<div class="row show-grid" *ngIf="product.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 500;">{{selectCustomerData['CusDetails.address_1']}} , {{selectCustomerData['CusDetails.city']}},<br />Contact No-({{selectCustomerData['CusDetails.phoneNo']}}) </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;"></label>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <input type="text" nbInput fullWidth placeholder="Project">-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<!-- <nb-select selected="DRIVER" >
|
||||
<nb-option value="DRIVER">DRIVER</nb-option>
|
||||
|
||||
</nb-select> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div *ngIf="fieldTitle == 'Edit Order' || fieldTitle == 'View Order'">
|
||||
<div style="font-size: larger;font-weight: 600;"> ORDER ID</div>
|
||||
|
||||
<p> {{setData.orderId}} </p> <br />
|
||||
<div style="font-size: larger;font-weight: 600;"> Status</div>
|
||||
<p style="text-transform: capitalize;" *ngIf="fieldTitle == 'View Order' " [ngStyle] = "{'color':setData.status =='ordered'?'#1f1dc9f5':setData.status =='Delivered' ?'green':'red' }" > ({{setData.status}}) </p>
|
||||
<nb-select selected="" *ngIf="fieldTitle != 'View Order' " placeholder="Change Status" clearable style="width: 57% !important;margin-top: 1rem;" [(ngModel)]="selectStatus" >
|
||||
<!-- <nb-option value="">Change Status</nb-option> -->
|
||||
<nb-option value="ordered" >Ordered</nb-option>
|
||||
<nb-option value="In Progress" >In Progresss</nb-option>
|
||||
<nb-option value="Out For Delivery" >Out For Delivery</nb-option>
|
||||
|
||||
<nb-option value="Delivered" >Delivered</nb-option>
|
||||
<nb-option value="Cancelled" >Cancelled</nb-option>
|
||||
|
||||
</nb-select>
|
||||
|
||||
<nb-select selected="" placeholder="Select Drivers" *ngIf="fieldTitle != 'View Order' && selectStatus == 'Out For Delivery'" [(ngModel)]="selectDriver" style="width: 57% !important;margin-right: 1rem;margin-top: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && selectStatus == 'Cancelled'" [(ngModel)]="CancelReason" placeholder="Reason" style=" margin-right: 2%;margin-top: 1rem;" id="text"> <br />
|
||||
<button *ngIf="fieldTitle != 'View Order' " (click)="onSubmit2()" style="margin-top: 1rem;" type="submit" nbButton status="success" hero>
|
||||
Save
|
||||
</button>
|
||||
<span *ngIf="setData.status =='Cancelled'">Reason: {{setData.reason}} </span>
|
||||
<!-- <nb-select selected="DRIVER" >
|
||||
<nb-option value="DRIVER">DRIVER</nb-option>
|
||||
|
||||
</nb-select> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
|
||||
|
||||
<nb-card-header>
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-4">
|
||||
<div> {{fieldTitle}}</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div style="text-align: end;">
|
||||
<button nbTooltip="Back" nbTooltipPlacement="top" (click)="back()" nbButton status="warning" hero>
|
||||
<nb-icon icon="corner-down-left-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<div class="row show-grid">
|
||||
<button nbTooltip="Edit" nbTooltipPlacement="top" *ngIf=" fieldTitle != 'Edit Order' && this.selectStatus != 'Delivered' && addFormBtn != 0" style=" margin-left: 2rem;" (click)="edit()" nbButton status="primary" hero>
|
||||
<nb-icon icon="edit-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<button nbTooltip="Download" nbTooltipPlacement="top" *ngIf=" fieldTitle != 'Edit Order' && addFormBtn != 0" style=" margin-left: 2rem;"(click)="generatePDF('download')" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-5">
|
||||
<div>
|
||||
<label for="exampleInputEmail1" class="label">Customer</label> <br />
|
||||
<span *ngIf="fieldTitle == 'View Order'">{{selectCustomer}}</span>
|
||||
<nb-select selected="" [(ngModel)]="selectCustomer" *ngIf="fieldTitle != 'View Order'" [disabled]="fieldTitle =='Edit Order' ">
|
||||
|
||||
<nb-option value="" hidden>Select Customer</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of customer; index as i; first as isFirst " (click)="checkType(user)" [value]="user['CusDetails.cusName']
|
||||
">{{user['CusDetails.cusName']
|
||||
}}</nb-option>
|
||||
|
||||
</nb-select>
|
||||
<hr>
|
||||
<div style="font-size: larger;margin-top: 1rem;;margin-bottom: 1rem;"> Shipping Information</div>
|
||||
<div class="row show-grid" *ngIf="product.length>0">
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 500;">{{selectCustomerData['CusDetails.address_1']}} , {{selectCustomerData['CusDetails.city']}}, {{selectCustomerData['CusDetails.pincode']}}<br />Contact No-({{selectCustomerData['CusDetails.phoneNo']}}) </label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-6 col-md-1">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;"></label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <input type="text" nbInput fullWidth placeholder="Project">-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
<!-- <nb-select selected="DRIVER" >
|
||||
<nb-option value="DRIVER">DRIVER</nb-option>
|
||||
|
||||
</nb-select> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div *ngIf="fieldTitle == 'Edit Order' || fieldTitle == 'View Order'">
|
||||
<div style="font-size: larger;font-weight: 600;"> ORDER ID</div>
|
||||
|
||||
<p> {{setData.orderId}} </p> <br />
|
||||
<div style="font-size: larger;font-weight: 600;"> Status</div>
|
||||
<p style="text-transform: capitalize;" *ngIf="fieldTitle == 'View Order' " [ngStyle] = "{'color':setData.status =='ordered'?'#1f1dc9f5':setData.status =='Delivered' ?'green':'red' }" > {{setData.status}} <br> <span *ngIf="setData.status == 'Delivered' || setData.status == 'Out For Delivery'" style="color: black;">({{setData['UserDetails.userName']}}) </span></p>
|
||||
<nb-select selected="" *ngIf="fieldTitle != 'View Order'" (ngModelChange)="onSelectChange($event)" placeholder="Change Status" clearable style="width: 57% !important;margin-top: 1rem;" [(ngModel)]="selectStatus" >
|
||||
<!-- <nb-option value="">Change Status</nb-option> -->
|
||||
<nb-option value="ordered" >Ordered</nb-option>
|
||||
<nb-option value="In Progress" >In Progresss</nb-option>
|
||||
<nb-option value="Out For Delivery" >Out For Delivery</nb-option>
|
||||
|
||||
<nb-option value="Delivered" >Delivered</nb-option>
|
||||
<nb-option value="Cancelled" >Cancelled</nb-option>
|
||||
|
||||
</nb-select>
|
||||
|
||||
<nb-select (ngModelChange)="onSelectChange1($event)" selected="" placeholder="Select Drivers" *ngIf="fieldTitle != 'View Order' && selectStatus == 'Out For Delivery'" [(ngModel)]="selectDriver" style="width: 57% !important;margin-right: 1rem;margin-top: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && selectStatus == 'Cancelled'" [(ngModel)]="CancelReason" placeholder="Reason" style=" margin-right: 2%;margin-top: 1rem;" id="text"> <br />
|
||||
<button *ngIf="fieldTitle != 'View Order'" [disabled]="hiddenBtn" (click)="onSubmit2()" style="margin-top: 1rem;" type="submit" nbButton status="success" hero>
|
||||
Save
|
||||
</button>
|
||||
<span *ngIf="setData.status =='Cancelled'">Reason: {{setData.reason}} </span>
|
||||
<!-- <nb-select selected="DRIVER" >
|
||||
<nb-option value="DRIVER">DRIVER</nb-option>
|
||||
|
||||
</nb-select> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div style="font-size: larger;"> Product Information</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <div style=" text-align: end;">
|
||||
<button (click)="back()" nbButton status="success" hero>
|
||||
Back
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
<div class="row show-grid" *ngIf="product.length>0" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;">Products: ( <span style="color:#ba0404">{{selectCustomerData['CusDetails.cusType'] ||setData['OrderDetails.CusDetails.cusType'] }}</span>)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;"> </label>
|
||||
</div>
|
||||
</div>
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" (click)="addInputFieldGroup()" *ngIf="inputFieldGroups.length == 0"></nb-action>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngFor="let fieldGroup of inputFieldGroups; let i = index">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="product.length>0" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<nb-select placeholder="Select Product" [(ngModel)]="fieldGroup.id" style="width: 100% !important;margin-right: 1rem;" [disabled]="fieldTitle == 'Edit Order' ? !fieldGroup.isNew : false">
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
<!-- (click)="onProductSelect(user.id,user.productName)" -->
|
||||
<nb-option *ngFor="let user of checkProductArray(); index as i; first as isFirst" [value]="user.id"
|
||||
>{{user.productName }}({{user.skuId }} )</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<!-- <label for="subject" style=" font-weight: 600;">Mixed Gas {{i+1}}:</label> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">{{ fieldGroup.qty }}</label>
|
||||
<input nbInput style="width: 50%;" *ngIf="fieldTitle != 'View Order'" [(ngModel)]="fieldGroup.qty" type="number">
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">({{ fieldGroup.productSpec }})</label>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && fieldGroup.id == 6" style=" width: 100%;" [(ngModel)]="fieldGroup.productSpec" placeholder="eg:- N2:CO2:O2 - 50:30:20" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<nb-actions size="medium" *ngIf="fieldTitle != 'View Order'">
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" (click)="addInputFieldGroup()"></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" (click)="removeInputFieldGroup(i)"></nb-action>
|
||||
</nb-actions>
|
||||
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" *ngIf="i !=0" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of ResultDisplay; index as j">
|
||||
|
||||
<div class="row show-grid" *ngIf="fieldTitle == 'View Order'">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.ProductDetails[0].productName }} <br />({{item.ProductDetails[0].skuId}} ) <br />
|
||||
<span *ngIf="item.productSpec != null " >{{ item.productSpec }}</span>
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.qty }}</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <ngx-mixed-form (childButtonEvent)="receivedMessageHandler($event)"
|
||||
(onInitEvent)="receiveAutoMsgHandler($event)" *ngIf="item.productName == 'Mixed Gas'"></ngx-mixed-form> -->
|
||||
</div>
|
||||
<nb-card-header>
|
||||
|
||||
<hr>
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-md-6">
|
||||
<div style="font-size: larger;"> Product Information</div>
|
||||
<div style="font-size: larger; color: #182ea1;"> Return Information</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <div style=" text-align: end;">
|
||||
@ -131,266 +252,145 @@
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
<div class="row show-grid" *ngIf="product.length>0" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;">Products: ( <span style="color:#ba0404">{{selectCustomerData['CusDetails.cusType'] ||setData['OrderDetails.CusDetails.cusType'] }}</span>)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;"> </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngFor="let fieldGroup of inputFieldGroups; let i = index">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="product.length>0" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<nb-select placeholder="Select Product" [(ngModel)]="fieldGroup.id" style="width: 100% !important;margin-right: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of product; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.productName }}({{user.skuId }} )</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<!-- <label for="subject" style=" font-weight: 600;">Mixed Gas {{i+1}}:</label> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
|
||||
<div >
|
||||
<div>
|
||||
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">{{ fieldGroup.qty }}</label>
|
||||
<input nbInput style="width: 50%;" *ngIf="fieldTitle != 'View Order'" [(ngModel)]="fieldGroup.qty" type="number">
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">({{ fieldGroup.productSpec }})</label>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && fieldGroup.id == 6" style=" width: 100%;" [(ngModel)]="fieldGroup.productSpec" placeholder="eg:- N2:CO2:O2 - 50:30:20" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<nb-actions size="medium" *ngIf="fieldTitle != 'View Order'">
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" (click)="addInputFieldGroup()"></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" *ngIf="i !=0" [nbTooltip]="'Remove'" (click)="removeInputFieldGroup(i)"></nb-action>
|
||||
</nb-actions>
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of ResultDisplay; index as j">
|
||||
|
||||
<div class="row show-grid" *ngIf="fieldTitle == 'View Order'">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.ProductDetails[0].productName }} <br />({{item.ProductDetails[0].skuId}} ) <br />
|
||||
<span *ngIf="item.productSpec != null " >{{ item.productSpec }}</span>
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.qty }}</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <ngx-mixed-form (childButtonEvent)="receivedMessageHandler($event)"
|
||||
(onInitEvent)="receiveAutoMsgHandler($event)" *ngIf="item.productName == 'Mixed Gas'"></ngx-mixed-form> -->
|
||||
</div>
|
||||
<nb-card-header>
|
||||
|
||||
<hr>
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-md-6">
|
||||
<div style="font-size: larger; color: #182ea1;"> Return Information</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <div style=" text-align: end;">
|
||||
<button (click)="back()" nbButton status="success" hero>
|
||||
Back
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
|
||||
<div >
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Product Name</span></label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Qty</span></label> <br>
|
||||
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Product Name</span></label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Qty</span></label> <br>
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></nb-action>
|
||||
</nb-actions> -->
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></nb-action>
|
||||
</nb-actions> -->
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngFor="let dataVal of productlistReturn; let i = index" >
|
||||
<div *ngIf="productlistReturn.length>0">
|
||||
|
||||
|
||||
<div *ngFor="let dataVal of productlistReturn; let i = index" >
|
||||
<div *ngIf="productlistReturn.length>0">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;">#</label>
|
||||
<label for="subject" style=" font-weight: 600;margin-left: 1rem;">{{dataVal.ProductDetails[0]. productName}}</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">{{dataVal.qty}}</label> <br>
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;">Cylinder No: {{dataVal.cylinderNo}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;">#</label>
|
||||
<label for="subject" style=" font-weight: 600;margin-left: 1rem;">{{dataVal.ProductDetails[0]. productName}}</label>
|
||||
|
||||
<!-- <nb-icon icon="eye-outline" style="color: green;" ></nb-icon> -->
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></nb-action>
|
||||
</nb-actions> -->
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">{{dataVal.qty}}</label> <br>
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;">Cylinder No: {{dataVal.cylinderNo}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<!-- <nb-icon icon="eye-outline" style="color: green;" ></nb-icon> -->
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></nb-action>
|
||||
</nb-actions> -->
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
|
||||
<nb-card-footer>
|
||||
<div class="row show-grid" *ngIf="product.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
<button nbButton status="success" (click)="saveNew()" style="margin-right: 10px;" type="submit" >Submit</button>
|
||||
<button type="button" class="cancel" nbButton status="danger" (click)="cancelData()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<nb-card-footer>
|
||||
<div class="row show-grid" *ngIf="product.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</nb-card-footer>
|
||||
</nb-card-body>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
<button nbButton status="success" (click)="saveNew()" style="margin-right: 10px;" type="submit" >Submit</button>
|
||||
<button type="button" class="cancel" nbButton status="danger" (click)="cancelData()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</nb-card-footer>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
|
||||
@ -39,7 +39,7 @@ export class OrderFormComponent implements OnInit {
|
||||
{ label: 'Item 2', quantity: 0 },
|
||||
{ label: 'Item 3', quantity: 0 }
|
||||
];
|
||||
fieldTitle:any =' New Order'
|
||||
fieldTitle:any ='New Order'
|
||||
minimize = false;
|
||||
maximize = false;
|
||||
fullScreen = true;
|
||||
@ -56,20 +56,35 @@ fieldTitle:any =' New Order'
|
||||
inputFieldGroups:any = [{id:'', qty: '1', productSpec: '' }];
|
||||
selectCustomerData :any =[];selectStatus:any =[];CancelReason:any =[];selectDriver:any =[];drivers:any =[];
|
||||
invoice = new Invoice();
|
||||
constructor(private dialogService: NbDialogService,private route :ActivatedRoute,private router: Router,public _api:PageapiService,private toastrService: NbToastrService,private service: SmartTableData ,private windowService: NbWindowService) {
|
||||
hiddenBtn= false;
|
||||
delArr:any=[]
|
||||
selectedProductId: number | undefined = null;
|
||||
addFormBtn: any;
|
||||
constructor(private dialogService: NbDialogService,private route :ActivatedRoute,private router: Router,public _api:PageapiService,private toastrService: NbToastrService,private service: SmartTableData ,private windowService: NbWindowService) {
|
||||
|
||||
this._api.orderDetails_observable$.subscribe((res) => {
|
||||
console.log('booked', res);
|
||||
|
||||
|
||||
if(res){
|
||||
this.addFormBtn = 1
|
||||
this. setData = res
|
||||
console.log(this.setData)
|
||||
this.selectStatus = res.status
|
||||
console.log(this.selectStatus)
|
||||
// res.name = res.productName
|
||||
// res.qty = parseInt(res.qty)
|
||||
// res.price = this.setData['OrderDetails.CusDetails.cusType']
|
||||
// this.invoice.additionalDetails = 'https://vnms.in/services/'
|
||||
// this.invoice.products.push(res)
|
||||
|
||||
setTimeout(() => {
|
||||
localStorage.setItem('graud','1')
|
||||
}, 1300);
|
||||
|
||||
}else{
|
||||
console.log('else')
|
||||
this.addFormBtn = 0
|
||||
localStorage.setItem('graud','0')
|
||||
}
|
||||
|
||||
})
|
||||
@ -101,6 +116,8 @@ fieldTitle:any =' New Order'
|
||||
console.log(p)
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
this.getDriverlistApi()
|
||||
console.log(this.setData)
|
||||
if(this.setData != undefined){
|
||||
@ -120,11 +137,11 @@ fieldTitle:any =' New Order'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
getuserlistApi(){
|
||||
let param={}
|
||||
this._api.getusers(param).subscribe(res => {
|
||||
@ -133,7 +150,7 @@ fieldTitle:any =' New Order'
|
||||
|
||||
let passData = res.data
|
||||
|
||||
let customer = passData.filter(arr=>{return arr.role == 'CUSTOMER'})
|
||||
let customer = passData.filter(arr=>{return arr.role == 'CUSTOMER' && arr.isActive == 1})
|
||||
customer.forEach((element:any, index) => {
|
||||
element.index = index +1
|
||||
|
||||
@ -145,7 +162,7 @@ fieldTitle:any =' New Order'
|
||||
localStorage.setItem('driverId',this.setData.driverId)
|
||||
this.selectCustomer = this.setData['OrderDetails.CusDetails.cusName']
|
||||
this.invoice.customerName = this.selectCustomer
|
||||
this.invoice.address = this.setData['OrderDetails.CusDetails.address_1']
|
||||
this.invoice.address = ""+this.setData['OrderDetails.CusDetails.address_1']+","+this.setData['OrderDetails.CusDetails.city']+"-"+this.setData['OrderDetails.CusDetails.pincode']+""
|
||||
this.invoice.email = this.setData['OrderDetails.CusDetails.email']
|
||||
this.invoice.contactNo = this.setData['OrderDetails.CusDetails.phoneNo']
|
||||
|
||||
@ -176,15 +193,33 @@ fieldTitle:any =' New Order'
|
||||
}
|
||||
|
||||
getProductlistApi(param){
|
||||
let data ={type : param}
|
||||
this.getProductlistApi2( param)
|
||||
console.log(this.fieldTitle, param)
|
||||
let data
|
||||
if(this.fieldTitle != 'New Order'){
|
||||
data ={}
|
||||
}else {
|
||||
data ={type : param}
|
||||
}
|
||||
console.log(data)
|
||||
this.getProductlistApi2(param)
|
||||
this._api.getProducts(data).subscribe(res => {
|
||||
console.log(res)
|
||||
if(res.status == 200){
|
||||
|
||||
let passData = res.data
|
||||
let product = passData
|
||||
console.log(product)
|
||||
let passData = res.data
|
||||
let product
|
||||
if(this.fieldTitle != 'New Order'){
|
||||
|
||||
let UniqueProducts = this.getUniqueProducts(passData, 'productName');
|
||||
let filteredProducts = UniqueProducts.filter(product => product.productCategory === param);
|
||||
product = filteredProducts
|
||||
|
||||
} else{
|
||||
product = passData
|
||||
}
|
||||
|
||||
|
||||
console.log(product)
|
||||
product.forEach((element:any, index) => {
|
||||
element.index = index +1
|
||||
element.qty = 0;
|
||||
@ -193,6 +228,8 @@ console.log(product)
|
||||
});
|
||||
|
||||
this.product = product
|
||||
|
||||
console.log(this.product)
|
||||
// this.productfull = product
|
||||
if(this.setData != undefined){
|
||||
if( Object.keys(this.setData).length != 0){
|
||||
@ -214,6 +251,22 @@ console.log(product)
|
||||
}
|
||||
|
||||
|
||||
|
||||
getUniqueProducts(products: any[], propertyName: string): any[] {
|
||||
const uniqueProducts = [];
|
||||
const seen = new Set();
|
||||
|
||||
for (const product of products) {
|
||||
const value = product[propertyName];
|
||||
if (!seen.has(value)) {
|
||||
seen.add(value);
|
||||
uniqueProducts.push(product);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueProducts;
|
||||
}
|
||||
|
||||
getProductlistApi2(param){
|
||||
let data ={type : param}
|
||||
this._api.getProducts(data).subscribe(res => {
|
||||
@ -312,14 +365,35 @@ console.log(product)
|
||||
}
|
||||
}
|
||||
|
||||
// onProductSelect(event: any,prod:any) {
|
||||
// if(prod != 'Mixed Gas')
|
||||
// {
|
||||
// // this.selectedProductId = event;
|
||||
// this.product = this.product.filter((item) => item.id !== event);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
onProductSelect(selectedProductId: number) {
|
||||
// Find the selected product index
|
||||
const selectedIndex = this.product.findIndex(product => product.id === selectedProductId);
|
||||
|
||||
if (selectedIndex !== -1) {
|
||||
// Remove the selected product from the array
|
||||
this.product.splice(selectedIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
saveNew(){
|
||||
let data = { 'id' : this.delArr}
|
||||
this._api.delOrder(data).subscribe(res => { console.log( "success");
|
||||
})
|
||||
|
||||
console.log(this.selectCustomer,this.inputFieldGroups, this.product)
|
||||
|
||||
this.inputFieldGroups.forEach((element:any) => {
|
||||
|
||||
|
||||
delete element.isNew;
|
||||
this.product.forEach(e => {
|
||||
|
||||
|
||||
@ -361,7 +435,15 @@ this.invoice.products =[];
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// let mixedProductGas = this.inputFieldGroups.filter((arr:any)=>{return arr.name == 'Mixed Gas'})
|
||||
// console.log(mixedProductGas)
|
||||
|
||||
const filteredItems = this.inputFieldGroups.filter(item => item.name === 'Mixed Gas' && item.productSpec === '');
|
||||
console.log(filteredItems)
|
||||
if (filteredItems.length > 0) {
|
||||
this.showToast('warning', 'Please Fill Mixed Gas Fields...!', '');
|
||||
return;
|
||||
} else{
|
||||
|
||||
const buttonsConfig: NbWindowControlButtonsConfig = {
|
||||
minimize: this.minimize,
|
||||
@ -377,8 +459,14 @@ this.invoice.products =[];
|
||||
|
||||
|
||||
let results = [ ...this.mixedGas, ...mixProd];
|
||||
console.log(results)
|
||||
|
||||
if(results.length>0){
|
||||
const filteredItems = results.filter(item => !item.hasOwnProperty('name'));
|
||||
|
||||
console.log(filteredItems)
|
||||
|
||||
|
||||
if(results.length>0 && filteredItems.length == 0){
|
||||
|
||||
|
||||
|
||||
@ -406,6 +494,10 @@ this.invoice.products =[];
|
||||
}else{
|
||||
this.showToast('warning', 'Please Fill Request Fields...!', '');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private showToast(type: NbComponentStatus, title: string, body: string) {
|
||||
const config = {
|
||||
@ -431,36 +523,23 @@ this.invoice.products =[];
|
||||
|
||||
|
||||
generatePDF(action = 'open') {
|
||||
this.inputFieldGroups.forEach((element:any) => {
|
||||
|
||||
|
||||
console.log(this.setData)
|
||||
this.inputFieldGroups.forEach((element:any) => {
|
||||
this.productfull.forEach(e => {
|
||||
|
||||
|
||||
if(e.id === element.id){
|
||||
element.name = e.productName +"-("+e.skuId+")"
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
console.log( this.inputFieldGroups )
|
||||
this.invoice.products =[];
|
||||
this.inputFieldGroups.forEach((res:any) => {
|
||||
|
||||
|
||||
res.name = res.name
|
||||
res.qty = parseInt(res.qty)
|
||||
res.price = this.setData['OrderDetails.CusDetails.cusType']
|
||||
this.invoice.additionalDetails = 'https://vnms.in/services/'
|
||||
|
||||
this.invoice.products.push(res)
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
if(e.id === element.id){
|
||||
element.name = e.productName +"-("+e.skuId+")"
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log( this.inputFieldGroups )
|
||||
this.invoice.products =[];
|
||||
this.inputFieldGroups.forEach((res:any) => {
|
||||
res.name = res.name
|
||||
res.qty = parseInt(res.qty)
|
||||
res.price = this.setData['OrderDetails.CusDetails.cusType']
|
||||
this.invoice.additionalDetails = 'https://vnms.in/services/'
|
||||
this.invoice.products.push(res)
|
||||
})
|
||||
this.invoice.products = this.invoice.products.filter(arr=>{return arr.qty != 0})
|
||||
let docDefinition = {
|
||||
content: [
|
||||
@ -505,7 +584,7 @@ this.invoice.products =[];
|
||||
alignment: 'right'
|
||||
},
|
||||
{
|
||||
text: `Date: ${new Date(this.setData.createdAt).toLocaleString()}`,
|
||||
text: `Date: ${new Date(this.setData.createdAt).toLocaleDateString('en-GB')}, ${new Date(this.setData.createdAt).toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true })}`,
|
||||
alignment: 'right'
|
||||
},
|
||||
{
|
||||
@ -577,7 +656,7 @@ this.invoice.products =[];
|
||||
};
|
||||
|
||||
if(action==='download'){
|
||||
|
||||
console.log(this.selectCustomer , this.setData.orderId)
|
||||
let name= this.selectCustomer+"-"+this.setData.orderId
|
||||
pdfMake.createPdf(docDefinition).download(name);
|
||||
|
||||
@ -690,22 +769,23 @@ edit(){
|
||||
this.fieldTitle = 'View Order'
|
||||
}else{
|
||||
this.fieldTitle = 'Edit Order'
|
||||
this._api.orderDetails.next( this. setData)
|
||||
this._api.orderDetails.next( this.setData)
|
||||
|
||||
}
|
||||
console.log(this.fieldTitle)
|
||||
}
|
||||
|
||||
cancelData(){
|
||||
localStorage.setItem('viewOrder','1')
|
||||
let result = localStorage.getItem('viewOrder')
|
||||
if(result == '1'){
|
||||
this.fieldTitle = 'View Order'
|
||||
this._api.orderDetails.next( this. setData)
|
||||
}else{
|
||||
this.fieldTitle = 'Edit Order'
|
||||
}
|
||||
console.log(this.fieldTitle)
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
// localStorage.setItem('viewOrder','1')
|
||||
// let result = localStorage.getItem('viewOrder')
|
||||
// if(result == '1'){
|
||||
// this.fieldTitle = 'View Order'
|
||||
// this._api.orderDetails.next( this.setData)
|
||||
// }else{
|
||||
// this.fieldTitle = 'Edit Order'
|
||||
// }
|
||||
// console.log(this.fieldTitle)
|
||||
}
|
||||
|
||||
getDriverlistApi(){
|
||||
@ -736,6 +816,29 @@ getDriverlistApi(){
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onSelectChange(newValue: string) {
|
||||
// Handle the selected value change here
|
||||
this.selectDriver = []
|
||||
console.log(newValue);
|
||||
if(newValue == 'Out For Delivery'){
|
||||
this.hiddenBtn = true;
|
||||
}
|
||||
else{
|
||||
this.hiddenBtn = false;
|
||||
}
|
||||
}
|
||||
|
||||
onSelectChange1(newValue: string) {
|
||||
// Handle the selected value change here
|
||||
console.log(newValue);
|
||||
if(!newValue){
|
||||
this.hiddenBtn = true;
|
||||
}
|
||||
else{
|
||||
this.hiddenBtn = false;
|
||||
}
|
||||
}
|
||||
onSubmit2(){
|
||||
|
||||
|
||||
@ -802,15 +905,55 @@ this.onCreateConfirm()
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
checkProductArray() {
|
||||
console.log(this.inputFieldGroups)
|
||||
const hasNullId = this.inputFieldGroups.some((group) => group.id === null);
|
||||
console.log(hasNullId)
|
||||
if (!hasNullId) {
|
||||
// There's an object with id = null in the inputFieldGroups array
|
||||
console.log('There is an object with id = null');
|
||||
return this.product;
|
||||
} else {
|
||||
// There is no object with id = null in the inputFieldGroups array
|
||||
// Filter products based on the condition (productName !== 'Mixed Gas' in inputFieldGroups)
|
||||
const filteredProducts = this.product.filter((product) => {
|
||||
const isSelected = this.inputFieldGroups.some((group) => group.id === product.id);
|
||||
return product.productName === 'Mixed Gas' || !isSelected;
|
||||
});
|
||||
|
||||
return filteredProducts;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
addInputFieldGroup() {
|
||||
this.inputFieldGroups.push({id:null, qty: '0', productSpec: '' }); // Add a new input field group to the array
|
||||
if(this.fieldTitle != 'New Order'){
|
||||
console.log(this.product)
|
||||
let activeProductList = this.product.filter(item => item.isActive == '1')
|
||||
console.log(activeProductList)
|
||||
this.product = activeProductList
|
||||
}
|
||||
// this.inputFieldGroups.push({id:null, qty: '1', productSpec: '' });
|
||||
// Add a new input field group to the array
|
||||
const newGroup = { id: null, qty: 1, productSpec: '', isNew: true };
|
||||
this.inputFieldGroups.push(newGroup);
|
||||
//this.childButtonEvent.emit( this.inputFieldGroups);
|
||||
}
|
||||
|
||||
isReadOnly(param,index: number) {
|
||||
console.log(this.inputFieldGroups)
|
||||
console.log(param,index)
|
||||
// You can add your condition here to determine if the option should be readonly.
|
||||
// For example, if you want to make options at index 2 and 3 readonly:
|
||||
// return index === 2 || index === 3;
|
||||
}
|
||||
|
||||
removeInputFieldGroup(index: number) {
|
||||
console.log( this.inputFieldGroups)
|
||||
console.log( this.inputFieldGroups[index].primaryId)
|
||||
this.delArr.push(this.inputFieldGroups[index].primaryId)
|
||||
this.inputFieldGroups.splice(index, 1); // Remove the input field group at the specified index
|
||||
//this.childButtonEvent.emit( this.inputFieldGroups);
|
||||
}
|
||||
@ -870,4 +1013,20 @@ onCreateConfirm() {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// getProduct(param){
|
||||
// console.log(param)
|
||||
// if(param == 'Others'){
|
||||
// this.mixedBTN = true
|
||||
// }else{
|
||||
// this.mixedBTN = false
|
||||
// }
|
||||
// }
|
||||
|
||||
// isProductSpecValid(): boolean {
|
||||
// console.log(this.inputFieldGroups )
|
||||
// return !!this.inputFieldGroups.find((fieldGroup) => fieldGroup.productSpec);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
|
||||
<div class="col-6">
|
||||
<div>
|
||||
<button nbButton status="success" (click)="save()" type="submit" >Confirm</button>
|
||||
<button nbButton status="success" (click)="save()" type="submit" [disabled]="submitBtn">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -11,6 +11,7 @@ export class OrderSummaryFormComponent implements OnInit {
|
||||
customer:any =[];
|
||||
product:any =[];
|
||||
setData:any =[];
|
||||
submitBtn: boolean= false;
|
||||
constructor(@Inject(NB_WINDOW_CONTEXT) public data: any,public _api:PageapiService,private windowService: NbWindowService, private windowRef: NbWindowRef) {
|
||||
|
||||
console.log(this.data)
|
||||
@ -38,6 +39,7 @@ export class OrderSummaryFormComponent implements OnInit {
|
||||
}
|
||||
|
||||
save(){
|
||||
this.submitBtn = true
|
||||
console.log(this.data,this.setData)
|
||||
let cus = this.data.customerData['CusDetails.id']
|
||||
let role = localStorage.getItem('user_role')
|
||||
@ -45,6 +47,8 @@ export class OrderSummaryFormComponent implements OnInit {
|
||||
element.productName = element.name
|
||||
|
||||
if(element.hasOwnProperty('primaryId')){
|
||||
element.productId = element.id
|
||||
|
||||
element.id = element.primaryId
|
||||
}else{
|
||||
element.pid = element.id
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<nb-icon icon="plus-circle-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<button style=" margin-left: 1rem;" nbButton nbTooltip="Download" nbTooltipPlacement="top" (click)="download()" nbButton status="success" hero>
|
||||
<button style=" margin-left: 1rem;" nbButton nbTooltip="Download" nbTooltipPlacement="top" (click)="exportExcelData()" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
@ -61,217 +61,217 @@
|
||||
<nb-card-body>
|
||||
<!-- <ng2-smart-table [settings]="settings" (userRowSelect)="onUserRowSelect($event)" [source]="source" (edit)="onSaveConfirm($event)"
|
||||
(create)="onCreateConfirm($event)" (delete)="onDeleteConfirm($event)">
|
||||
</ng2-smart-table> -->
|
||||
</ng2-smart-table> -->
|
||||
<ng-data-table
|
||||
[id]="'i'"
|
||||
[items]=orders
|
||||
[minContentWidth]="600"
|
||||
[pageable]="true"
|
||||
[showColumnSelector]="true"
|
||||
[showHeader]="false"
|
||||
[selectMode]="'multi'"
|
||||
[minContentHeight]="350"
|
||||
[selectMode]="'multi'"
|
||||
[selectOnRowClick]="true"
|
||||
|
||||
<ng-data-table
|
||||
[id]="'i'"
|
||||
[items]=orders
|
||||
[minContentWidth]="600"
|
||||
[pageable]="true"
|
||||
[showColumnSelector]="true"
|
||||
[showHeader]="false"
|
||||
[selectMode]="'multi'"
|
||||
[minContentHeight]="350"
|
||||
[selectMode]="'multi'"
|
||||
[selectOnRowClick]="true"
|
||||
|
||||
[limit]="25"
|
||||
>
|
||||
[limit]="25"
|
||||
>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'role'"
|
||||
[sortable]="false"
|
||||
[title]="''"
|
||||
[filterable]="false"
|
||||
[width]="2">
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableHeader let-column="column" >
|
||||
<tr ><th class="center" style=" font-size: large; text-align: -webkit-center;"> <div style="text-align: center;">
|
||||
|
||||
<nb-checkbox (change)="onCheckboxChange($event)" status="primary" ></nb-checkbox>
|
||||
</div></th></tr>
|
||||
<!-- <tr ><th class="center" style="text-align: -webkit-center;" >{{tableTitle.Y4_st_type_name}}</th></tr> -->
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'role'"
|
||||
[sortable]="false"
|
||||
[title]="''"
|
||||
[filterable]="false"
|
||||
[width]="2">
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableHeader let-column="column" >
|
||||
<tr ><th class="center" style=" font-size: large; text-align: -webkit-center;"> <div style="text-align: center;">
|
||||
|
||||
<nb-checkbox (change)="onCheckboxChange($event)" status="primary" ></nb-checkbox>
|
||||
</div></th></tr>
|
||||
<!-- <tr ><th class="center" style="text-align: -webkit-center;" >{{tableTitle.Y4_st_type_name}}</th></tr> -->
|
||||
|
||||
</ng-template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td style="text-align: center;" >
|
||||
<div class="align-center" style="display: flex; align-items: center;text-align: center;">
|
||||
|
||||
|
||||
<nb-checkbox *ngIf="isChecked == true" [(ngModel)]="row.item.selected" [checked]="row.item.selected == true" (click)="selectSingleRow(row.item)" status="primary" ></nb-checkbox>
|
||||
<nb-checkbox *ngIf="isChecked == false" [(ngModel)]="row.item.selected" [checked]="row.item.selected == true" (click)="selectSingleRow(row.item)" status="primary" ></nb-checkbox>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'index'"
|
||||
[sortable]="false"
|
||||
[title]="'ID'"
|
||||
[filterable]="false"
|
||||
[width]="2">
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'orderId'"
|
||||
[sortable]="false"
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.orderId }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'customer'"
|
||||
[sortable]="false"
|
||||
[title]="'Customer Name'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
</ng-template>
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.customer }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'address'"
|
||||
[sortable]="false"
|
||||
[title]="'Address'"
|
||||
[filterable]="false"
|
||||
[width]="6">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.address }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'orderDate'"
|
||||
[sortable]="false"
|
||||
[title]="'Order Date'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.updatedAt | date :'dd/MM/yy hh:mm:ss'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'status'"
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td style="text-align: center;" >
|
||||
<div class="align-center" style="display: flex; align-items: center;text-align: center;">
|
||||
|
||||
[title]="'Status'"
|
||||
[sortable]="false"
|
||||
|
||||
|
||||
[width]="5">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span [ngStyle] = "{'color':row.item.status =='Out For Delivery'?'blue':'' }" class="checkTxt" *ngIf="row.item.status =='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" >({{row.item['UserDetails.userName']}}) <nb-icon icon="done-all-outline" style="color:#08d992" [nbTooltip]="'Driver seen at ' + (row.item.seenTime | date:'dd/MM/yyyy, h:mm a')" *ngIf="row.item.seenStatus == 1" ></nb-icon>
|
||||
<nb-icon icon="done-all-outline" nbTooltip="Not Seen" style="color: rgb(159, 167, 170);" *ngIf="row.item.seenStatus == 0" ></nb-icon> </p>
|
||||
|
||||
</span>
|
||||
<span [ngStyle] = "{'color':row.item.status =='ordered'?'#1f1dc9f5':row.item.status =='Delivered' ?'green':'red' }" class="checkTxt" *ngIf="row.item.status !='Out For Delivery'" >
|
||||
{{row.item.status}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
|
||||
<nb-checkbox *ngIf="isChecked == true" [(ngModel)]="row.item.selected" [checked]="row.item.selected == true" (click)="selectSingleRow(row.item)" status="primary" ></nb-checkbox>
|
||||
<nb-checkbox *ngIf="isChecked == false" [(ngModel)]="row.item.selected" [checked]="row.item.selected == true" (click)="selectSingleRow(row.item)" status="primary" ></nb-checkbox>
|
||||
|
||||
<!-- <ng-data-table-column
|
||||
[field]="'reason'"
|
||||
[sortable]="false"
|
||||
[title]="'Reason'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
</div>
|
||||
|
||||
</ng-data-table-column> -->
|
||||
|
||||
|
||||
<!-- <ng-data-table-column
|
||||
[field]="'role'"
|
||||
[sortable]="false"
|
||||
[title]="'view'"
|
||||
[filterable]="false"
|
||||
[width]="3">
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'index'"
|
||||
[sortable]="false"
|
||||
[title]="'ID'"
|
||||
[filterable]="false"
|
||||
[width]="2">
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'orderId'"
|
||||
[sortable]="false"
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.orderId }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'customer'"
|
||||
[sortable]="false"
|
||||
[title]="'Customer Name'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.customer }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'address'"
|
||||
[sortable]="false"
|
||||
[title]="'Address'"
|
||||
[filterable]="false"
|
||||
[width]="6">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.address }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'orderDate'"
|
||||
[sortable]="false"
|
||||
[title]="'Order Date'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.updatedAt | date :'dd/MM/yy hh:mm:ss'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'status'"
|
||||
|
||||
|
||||
|
||||
[title]="'Status'"
|
||||
[sortable]="false"
|
||||
|
||||
|
||||
[width]="5">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span [ngStyle] = "{'color':row.item.status =='Out For Delivery'?'blue':'' }" class="checkTxt" *ngIf="row.item.status =='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" >({{row.item['UserDetails.userName']}}) <nb-icon icon="done-all-outline" style="color:#08d992" [nbTooltip]="'Driver seen at ' + (row.item.seenTime | date:'dd/MM/yyyy, h:mm a')" *ngIf="row.item.seenStatus == 1" ></nb-icon>
|
||||
<nb-icon icon="done-all-outline" nbTooltip="Not Seen" style="color: rgb(159, 167, 170);" *ngIf="row.item.seenStatus == 0" ></nb-icon> </p>
|
||||
|
||||
</span>
|
||||
<span [ngStyle] = "{'color':row.item.status =='ordered'?'#1f1dc9f5':row.item.status =='Delivered' ?'green':'red' }" class="checkTxt" *ngIf="row.item.status !='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" *ngIf="row.item.status == 'Delivered'">({{row.item['UserDetails.userName']}})</p>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
|
||||
<!-- <ng-data-table-column
|
||||
[field]="'reason'"
|
||||
[sortable]="false"
|
||||
[title]="'Reason'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
</ng-data-table-column> -->
|
||||
|
||||
|
||||
<!-- <ng-data-table-column
|
||||
[field]="'role'"
|
||||
[sortable]="false"
|
||||
[title]="'view'"
|
||||
[filterable]="false"
|
||||
[width]="3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
|
||||
<div style="align-items: center;text-align: center;">
|
||||
<nb-icon icon="eye-outline" title="View" style="color: green;" (click)="onViewConfirm(row.item)"></nb-icon>
|
||||
|
||||
</div>
|
||||
<div style="align-items: center;text-align: center;">
|
||||
<nb-icon icon="eye-outline" title="View" style="color: green;" (click)="onViewConfirm(row.item)"></nb-icon>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column> -->
|
||||
</div>
|
||||
|
||||
</ng-data-table>
|
||||
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column> -->
|
||||
|
||||
</ng-data-table>
|
||||
|
||||
|
||||
</nb-card-body>
|
||||
|
||||
@ -294,7 +294,7 @@
|
||||
<nb-option value="Out For Delivery" >Out For Delivery</nb-option>
|
||||
|
||||
<!-- <nb-option value="Delivered" >Delivered</nb-option> -->
|
||||
<nb-option value="Cancelled" >Cancelled</nb-option>
|
||||
<!-- <nb-option value="Cancelled" >Cancelled</nb-option> -->
|
||||
|
||||
</nb-select>
|
||||
<!-- <label for="subject">Drivers:</label> <br /> -->
|
||||
@ -312,7 +312,7 @@
|
||||
<nb-select selected="" placeholder="Select Drivers" *ngIf="selectStatus == 'Out For Delivery'" [(ngModel)]="selectDriver" style="width: 100% !important;margin-right: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
@ -333,4 +333,123 @@
|
||||
<!-- </form> -->
|
||||
</nb-card-footer>
|
||||
|
||||
<div id="orderExcel" hidden>
|
||||
<ng-data-table
|
||||
[id]="'i'"
|
||||
[items]=orders
|
||||
[minContentWidth]="600"
|
||||
[showColumnSelector]="true"
|
||||
[showHeader]="false"
|
||||
>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'index'"
|
||||
[sortable]="false"
|
||||
[title]="'ID'"
|
||||
[filterable]="false"
|
||||
[width]="2">
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'orderId'"
|
||||
[sortable]="false"
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.orderId }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'customer'"
|
||||
[sortable]="false"
|
||||
[title]="'Customer Name'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.customer }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'address'"
|
||||
[sortable]="false"
|
||||
[title]="'Address'"
|
||||
[filterable]="false"
|
||||
[width]="6">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.address }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'orderDate'"
|
||||
[sortable]="false"
|
||||
[title]="'Order Date'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.updatedAt | date :'dd/MM/yy hh:mm:ss'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'status'"
|
||||
[title]="'Status'"
|
||||
[sortable]="false"
|
||||
[width]="5">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span [ngStyle] = "{'color':row.item.status =='Out For Delivery'?'blue':'' }" class="checkTxt" *ngIf="row.item.status =='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" >({{row.item['UserDetails.userName']}}) <nb-icon icon="done-all-outline" style="color:#08d992" [nbTooltip]="'Driver seen at ' + (row.item.seenTime | date:'dd/MM/yyyy, h:mm a')" *ngIf="row.item.seenStatus == 1" ></nb-icon>
|
||||
<nb-icon icon="done-all-outline" nbTooltip="Not Seen" style="color: rgb(159, 167, 170);" *ngIf="row.item.seenStatus == 0" ></nb-icon> </p>
|
||||
|
||||
</span>
|
||||
<span [ngStyle] = "{'color':row.item.status =='ordered'?'#1f1dc9f5':row.item.status =='Delivered' ?'green':'red' }" class="checkTxt" *ngIf="row.item.status !='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" *ngIf="row.item.status == 'Delivered'">({{row.item['UserDetails.userName']}})</p>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
|
||||
|
||||
</ng-data-table>
|
||||
</div>
|
||||
|
||||
</nb-card>
|
||||
File diff suppressed because one or more lines are too long
@ -112,17 +112,27 @@ public mixDetails_observable$ = this.mixDetails.asObservable();
|
||||
|
||||
}
|
||||
|
||||
delOrder(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'delOrderCatogary', addParams)
|
||||
|
||||
}
|
||||
|
||||
getProductList(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'getProductList', addParams)
|
||||
|
||||
}
|
||||
|
||||
getProductDropdownList(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'getProductDropdownList', addParams)
|
||||
|
||||
}
|
||||
|
||||
CreateReturn(addParams:any): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'CreateReturn', addParams)
|
||||
|
||||
}
|
||||
|
||||
notification(addParams:any): Observable<any> {
|
||||
Notification(addParams:any): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'sendNotification', addParams)
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import { SummaryDetailsComponent } from './summary-list/summary-details/summary-
|
||||
import { EmailComponent } from './email/email.component';
|
||||
import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
import { ReturnSheetComponent } from './return-sheet/return-sheet.component';
|
||||
import { OrderDGuard } from './_guard/order-d.guard';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: '',
|
||||
@ -59,6 +60,7 @@ const routes: Routes = [{
|
||||
{
|
||||
path: 'order/add',
|
||||
component: OrderFormComponent,
|
||||
canActivate: [OrderDGuard]
|
||||
},{
|
||||
path: 'summary',
|
||||
component:SummaryListComponent
|
||||
|
||||
@ -19,22 +19,16 @@ export class PagesComponent {
|
||||
|
||||
menu = MENU_ITEMS;
|
||||
|
||||
constructor(private router: Router){
|
||||
let role = localStorage.getItem('user_role')
|
||||
console.log(role)
|
||||
constructor(private router: Router){}
|
||||
|
||||
ngOnInit() {
|
||||
const role = localStorage.getItem('user_role');
|
||||
console.log(role);
|
||||
|
||||
if(role == "FRONT-OFFICE"){
|
||||
this.menu = this.menu.filter(arr=>{return arr.title != 'Users'})
|
||||
if (role === 'FRONT-OFFICE') {
|
||||
this.menu = this.menu.filter((item) => item.title !== 'Users');
|
||||
}
|
||||
|
||||
|
||||
console.log(this.menu)
|
||||
|
||||
this.router.navigate(['/pages/dashboard']);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.menu);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
<ng-container nbInputErrorMessage>
|
||||
<div style="color:#7c0e0e" *ngIf="userForm.get('skuId').hasError('required') && userForm.get('description').touched">skuId is required.</div>
|
||||
|
||||
|
||||
<div style="color:#7c0e0e" *ngIf="userForm.get('skuId').errors?.usernameTaken && userForm.get('skuId').dirty">skuId already exists...</div>
|
||||
</ng-container>
|
||||
<nb-card-footer>
|
||||
<button type="button" class="cancel" nbButton status="danger" (click)="cancel()">Cancel</button>
|
||||
|
||||
@ -2,6 +2,9 @@ import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { PageapiService } from '../../pageapi.service';
|
||||
import { NbWindowService ,NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme';
|
||||
import { map } from 'rxjs/internal/operators/map';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from '../../../../environments/environment.prod';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-product-form',
|
||||
@ -10,23 +13,24 @@ import { NbWindowService ,NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme'
|
||||
})
|
||||
export class ProductFormComponent implements OnInit {
|
||||
userForm: FormGroup | any; formData:any =[]
|
||||
constructor(@Inject(NB_WINDOW_CONTEXT) public data: any,public _api:PageapiService,private windowService: NbWindowService, private windowRef: NbWindowRef) {
|
||||
action: any;
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private http: HttpClient,@Inject(NB_WINDOW_CONTEXT) public data: any,public _api:PageapiService,private windowService: NbWindowService, private windowRef: NbWindowRef) {
|
||||
|
||||
console.log(this.data)
|
||||
this.action = this.data.action;
|
||||
console.log(this.action)
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.userForm = new FormGroup({
|
||||
|
||||
let valData = [this.validateUsernameAvailability.bind(this)]
|
||||
|
||||
|
||||
|
||||
this.userForm = new FormGroup({
|
||||
productCategory: new FormControl('', [Validators.required]),
|
||||
productType: new FormControl('', [Validators.required]),
|
||||
productName: new FormControl('', [Validators.required]),
|
||||
description:new FormControl('', [Validators.required]),
|
||||
skuId:new FormControl('', [Validators.required]),
|
||||
skuId:new FormControl('', [Validators.required],valData),
|
||||
|
||||
});
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
@ -35,6 +39,41 @@ export class ProductFormComponent implements OnInit {
|
||||
}
|
||||
this.userForm.patchValue(this.data)
|
||||
}
|
||||
|
||||
validateUsernameAvailability(control: FormControl) {
|
||||
let param ={}
|
||||
return this.http.post<any[]>(this.apiUrl+ "getProducts",param)
|
||||
.pipe(
|
||||
map((response:any) => {
|
||||
console.log('edit',response)
|
||||
let productData
|
||||
if(this.action == 'Add'){
|
||||
console.log('add')
|
||||
productData = response.data
|
||||
}else{
|
||||
console.log('edit',this.data.skuId)
|
||||
let listData = response.data
|
||||
const newArray = listData.filter(item => item.skuId !== this.data.skuId);
|
||||
console.log(newArray)
|
||||
productData = newArray
|
||||
}
|
||||
|
||||
console.log(productData)
|
||||
let response1 = productData
|
||||
let tmp=[];
|
||||
if(response1 instanceof Array){
|
||||
|
||||
productData.forEach(element => {
|
||||
tmp.push(element.skuId)
|
||||
});
|
||||
console.log(tmp,`${control.value}`);
|
||||
return !tmp.includes(`${control.value}`) ? null : { usernameTaken: true };
|
||||
}else{
|
||||
return null
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
cancel(){
|
||||
this.windowService
|
||||
|
||||
@ -138,7 +138,9 @@ export class ProductComponent {
|
||||
width: '500px',
|
||||
height: '300px',
|
||||
}
|
||||
const windowRef: NbWindowRef = this.windowService.open(ProductFormComponent, { title: `New Product`, buttons: buttonsConfig , });
|
||||
let data:any = {action:'Add'}
|
||||
|
||||
const windowRef: NbWindowRef = this.windowService.open(ProductFormComponent, { title: `New Product`, buttons: buttonsConfig ,context: data });
|
||||
|
||||
// Subscribe to the afterClosed event
|
||||
windowRef.onClose.subscribe((data) => {
|
||||
@ -157,7 +159,7 @@ export class ProductComponent {
|
||||
onSaveConfirm(event) {
|
||||
console.log("Edit Event In Console")
|
||||
console.log(event);
|
||||
|
||||
// event = {action:'Edit'}
|
||||
const buttonsConfig: NbWindowControlButtonsConfig = {
|
||||
minimize: this.minimize,
|
||||
maximize: this.maximize,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<nb-card>
|
||||
<nb-card-header>
|
||||
<nb-card style="width: 55rem;height: 30rem;">
|
||||
<!-- <nb-card-header>
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
@ -12,13 +12,13 @@
|
||||
Back
|
||||
</button>
|
||||
|
||||
<!-- <button style=" margin-left: 2rem;"(click)="generatePDF('print')" nbButton status="primary" hero>
|
||||
<button style=" margin-left: 2rem;"(click)="generatePDF('print')" nbButton status="primary" hero>
|
||||
Print
|
||||
</button> -->
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
</nb-card-header> -->
|
||||
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
@ -169,4 +169,3 @@ color: red !important;
|
||||
::ng-deep .md-drppicker.double {
|
||||
width: 640px !important;
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
import { PageapiService } from '../../pageapi.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NB_WINDOW_CONTEXT } from '@nebular/theme';
|
||||
@Component({
|
||||
selector: 'ngx-summary-details',
|
||||
templateUrl: './summary-details.component.html',
|
||||
@ -22,13 +23,14 @@ export class SummaryDetailsComponent implements OnInit {
|
||||
};
|
||||
productlistReturn:any =[];orderId:any=[];cusName:any =[];
|
||||
selectedDateRange:any =[];drivers:any =[];summaryaData:any=[];driverval:any=[];returnSummary:any =[];productlist:any=[];
|
||||
constructor(public _api:PageapiService,private route: ActivatedRoute, private router:Router) {
|
||||
|
||||
this.route.params.subscribe(params => {
|
||||
console.log(params) //log the entire params object
|
||||
console.log(params['orderId']) //log the value of id
|
||||
let orderId = params['orderId']
|
||||
this.orderId = orderId
|
||||
constructor(@Inject(NB_WINDOW_CONTEXT) public data: any,public _api:PageapiService,private route: ActivatedRoute, private router:Router) {
|
||||
console.log(data)
|
||||
|
||||
// this.route.params.subscribe(params => {
|
||||
console.log(data) //log the entire params object
|
||||
console.log(data.orderID) //log the value of id
|
||||
let orderId = data.orderID
|
||||
this.orderId = orderId
|
||||
this._api.getProductListSummary({orderId:orderId}).subscribe(res => {
|
||||
console.log(res)
|
||||
if(res.status == 200){
|
||||
@ -52,7 +54,7 @@ this.orderId = orderId
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@ -67,6 +69,7 @@ this.orderId = orderId
|
||||
|
||||
|
||||
back(){
|
||||
// let data = { 'date' : localStorage.getItem('dDate') , 'id' : localStorage.getItem('dId') }
|
||||
this.router.navigate(['/pages/summary'])
|
||||
}
|
||||
save(){
|
||||
|
||||
@ -26,7 +26,8 @@
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker">
|
||||
<!-- [(ngModel)]="dDate" -->
|
||||
<input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker" >
|
||||
<nb-datepicker #dateTimePicker (dateChange)="onStartDateChanged($event)" ></nb-datepicker>
|
||||
<!-- <input nbInput class="fx-date-range" type="text"
|
||||
ngxDaterangepickerMd
|
||||
@ -43,10 +44,10 @@
|
||||
autocomplete="off"
|
||||
[(ngModel)]="selectedDateRange"
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/> -->
|
||||
<nb-select selected="" style="width: 100% !important;margin-left: 2rem;" >
|
||||
<nb-select selected="" style="width: 100% !important;margin-left: 2rem;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
<!-- [(ngModel)]="dId" -->
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
|
||||
@ -3,12 +3,16 @@ import * as moment from 'moment';
|
||||
import { PageapiService } from '../pageapi.service';
|
||||
import { Router } from '@angular/router';
|
||||
import * as html2pdf from 'html2pdf.js'
|
||||
import { NbDialogService, NbToastrService, NbWindowControlButtonsConfig, NbWindowRef, NbWindowService } from '@nebular/theme';
|
||||
import { SummaryDetailsComponent } from './summary-details/summary-details.component';
|
||||
@Component({
|
||||
selector: 'ngx-summary-list',
|
||||
templateUrl: './summary-list.component.html',
|
||||
styleUrls: ['./summary-list.component.scss']
|
||||
})
|
||||
export class SummaryListComponent implements OnInit {
|
||||
dDate: string | null = this.reduceDate(localStorage.getItem('dDate'));
|
||||
dId: string | null = localStorage.getItem('dId');
|
||||
ranges: any = {
|
||||
'Today': [moment(), moment()],
|
||||
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
@ -21,7 +25,18 @@ export class SummaryListComponent implements OnInit {
|
||||
// ]
|
||||
};selectDate:any =[];driverId:any =[];DateDisplay:any =[];driverName:any =[];
|
||||
selectedDateRange:any =[];drivers:any =[];summaryaData:any=[];driverval:any=[];returnSummary:any =[];
|
||||
constructor(public _api:PageapiService, private router:Router) { }
|
||||
|
||||
minimize = false;
|
||||
maximize = false;
|
||||
fullScreen = true;
|
||||
close = true;
|
||||
constructor(public _api:PageapiService, private router:Router,private windowService: NbWindowService,) {
|
||||
if(localStorage.getItem('dDate'))
|
||||
{
|
||||
this.dDate = this.reduceDate(localStorage.getItem('dDate'));
|
||||
this.dId = localStorage.getItem('dId');
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.selectedDateRange =[];
|
||||
@ -30,6 +45,19 @@ export class SummaryListComponent implements OnInit {
|
||||
this.getDriverlistApi()
|
||||
}
|
||||
|
||||
reduceDate(date){
|
||||
// Create a Date object from the input date string
|
||||
const inputDate = new Date(date);
|
||||
|
||||
// Subtract one day (24 hours) from the input date
|
||||
const newDate = new Date(inputDate.getTime() - 24 * 60 * 60 * 1000);
|
||||
|
||||
// Format the new date as a string
|
||||
const formattedDate = newDate.toString();
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
|
||||
back(){
|
||||
|
||||
@ -131,10 +159,10 @@ console.log(result)
|
||||
|
||||
}
|
||||
|
||||
view(data,name){
|
||||
localStorage.setItem('cusName',name)
|
||||
this.router.navigate(['/pages/summary/'+data])
|
||||
}
|
||||
// view(data,name){
|
||||
// localStorage.setItem('cusName',name)
|
||||
// this.router.navigate(['/pages/summary/'+data])
|
||||
// }
|
||||
|
||||
|
||||
onStartDateChanged(data){
|
||||
@ -156,7 +184,8 @@ console.log(result)
|
||||
// Convert the updated date to a UTC string
|
||||
const updatedUtcDate = utcDate.toISOString();
|
||||
console.log(updatedUtcDate)
|
||||
|
||||
localStorage.setItem('dDate' , updatedUtcDate);
|
||||
localStorage.setItem('dId' , this.driverId);
|
||||
let param ={date:new Date( updatedUtcDate),id:this.driverId}
|
||||
this._api.getDriverSummaryAdminList(param).subscribe(res => {
|
||||
console.log(res)
|
||||
@ -198,6 +227,58 @@ console.log(result)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
view(param,name){
|
||||
|
||||
const buttonsConfig: NbWindowControlButtonsConfig = {
|
||||
minimize: this.minimize,
|
||||
maximize: this.maximize,
|
||||
fullScreen: this.fullScreen,
|
||||
close: this.close,
|
||||
};
|
||||
let config= {
|
||||
hasBackdrop: true,
|
||||
width: '500px',
|
||||
height: '300px',
|
||||
}
|
||||
|
||||
console.log(param,name)
|
||||
localStorage.setItem('cusName',name)
|
||||
let data:any = {orderID:param,title:'Summary Product List'}
|
||||
// let passData = {name:this.selectCustomer,product:results,customerData:this.selectCustomerData}
|
||||
|
||||
const windowRef: NbWindowRef = this.windowService.open(SummaryDetailsComponent,
|
||||
{
|
||||
title: `Summary Product List`,
|
||||
context:data,buttons: buttonsConfig ,
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Subscribe to the afterClosed event
|
||||
windowRef.onClose.subscribe((data) => {
|
||||
})
|
||||
// const dialogRef = this.dialogService.open(SummaryDetailsComponent, {
|
||||
// hasBackdrop: true,
|
||||
// dialogClass: 'custom-dialog-class', // Add your custom CSS class here
|
||||
// context: data
|
||||
// });
|
||||
|
||||
// dialogRef.onClose.subscribe((result) => {
|
||||
// // Execute custom logic when the dialog is closed
|
||||
// console.log(result);
|
||||
// // if(result == 1){
|
||||
// // this.getBranchDetails()
|
||||
// // this.toastrService.success('Branch Added Successfully','Branch');
|
||||
// // console.log('Window closed 123');
|
||||
// // }else if(result == 0){
|
||||
// // this.toastrService.success('Somthing is Wrong...!', 'Add Branch Failed..!');
|
||||
// // }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
download(){
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</ng-container>
|
||||
|
||||
<label for="subject">E-mail:</label>
|
||||
<input formControlName="email" nbInput id="email" type="text" [status]="userForm.get('email').invalid && userForm.get('email').touched? 'danger' : 'basic'">
|
||||
<input formControlName="email" nbInput id="email" type="email" [status]="userForm.get('email').invalid && userForm.get('email').touched? 'danger' : 'basic'">
|
||||
<ng-container nbInputErrorMessage>
|
||||
<div style="color:#7c0e0e" *ngIf="userForm.get('email').hasError('required') && userForm.get('email').touched">Email is required.</div>
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ export class UserFormComponent implements OnInit {
|
||||
mobileNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]),
|
||||
// lastName: new FormControl('', [Validators.required, Validators.maxLength(20)]),
|
||||
email: new FormControl('', [Validators.required, Validators.email,Validators.pattern(
|
||||
'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
|
||||
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/
|
||||
)]),
|
||||
// password: new FormControl('', [Validators.required, Validators.minLength(6)]),
|
||||
password: new FormControl('', [Validators.required,Validators.pattern(
|
||||
|
||||
@ -81,6 +81,7 @@ export class UsersComponent {
|
||||
destroyByClick = true;
|
||||
duration = 2000;
|
||||
hasIcon = true;
|
||||
logUser = JSON.parse(localStorage.getItem('email')).email;
|
||||
admin:any =[];
|
||||
position: NbGlobalPosition = NbGlobalPhysicalPosition.TOP_RIGHT;
|
||||
preventDuplicates = false;
|
||||
@ -195,7 +196,7 @@ export class UsersComponent {
|
||||
if(res.status == 200){
|
||||
|
||||
let passData = res.data
|
||||
let admin = passData.filter(arr=>{return arr.role == 'ADMIN' || arr.role == 'FRONT-OFFICE'})
|
||||
let admin = passData.filter(arr=>{return ( arr.role == 'ADMIN' || arr.role == 'FRONT-OFFICE' ) && arr.email != this.logUser })
|
||||
|
||||
admin.forEach((element:any, index) => {
|
||||
element.index = index +1
|
||||
|
||||
@ -5,5 +5,6 @@
|
||||
*/
|
||||
export const environment = {
|
||||
apiEndpoint:'https://dev.venbait.in/vnms/api/',
|
||||
mailUrl:'',
|
||||
production: true,
|
||||
};
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
// apiEndpoint:'https://dev.venbait.in/vnms/api/',
|
||||
apiEndpoint:'http://localhost:8081/api/',
|
||||
// apiEndpoint:'http://192.168.1.17:8081/api/',
|
||||
|
||||
apiEndpoint:'https://dev.venbait.in/vnms/api/',
|
||||
// apiEndpoint:'http://localhost:8081/api/',
|
||||
mailUrl:'',
|
||||
production: false,
|
||||
};
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2020",
|
||||
"types": ["node"],
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user