@@ -106,7 +120,7 @@
[sortable]="false"
[title]="'Order ID'"
[filterable]="false"
- [width]="4">
+ [width]="3">
@@ -115,19 +129,19 @@
[sortable]="false"
[title]="'Customer'"
[filterable]="false"
- [width]="4">
+ [width]="5">
-
+
- {{row.item['OrderDetails.CusDetails.cusName']}}
- {{row.item['OrderDetails.CusDetails.address_1']}}
- {{row.item['OrderDetails.CusDetails.city']}}
- {{row.item['OrderDetails.CusDetails.pincode']}}
+ {{row.item.cusName}}
+ {{row.item.address_1}}
+ {{row.item.city}}
+ {{row.item.pincode}}
- ph:- {{row.item['OrderDetails.CusDetails.phoneNo']}}
+ ph:- {{row.item.phoneNo}}
diff --git a/src/app/pages/drivery-sheet/drivery-sheet.component.ts b/src/app/pages/drivery-sheet/drivery-sheet.component.ts
index 161dcf9..7ae74eb 100644
--- a/src/app/pages/drivery-sheet/drivery-sheet.component.ts
+++ b/src/app/pages/drivery-sheet/drivery-sheet.component.ts
@@ -20,13 +20,13 @@ export class DriverySheetComponent implements OnInit {
// moment().subtract(1, 'month').endOf('month')
// ]
- };productDeatils:any =[]; DateDisplay:any =[];
+ };productDeatils:any =[]; DateDisplay:any =[];driverName:any =[]; selectDate:any =[]; driverId:any =[];
selectedDateRange:any =[];drivers:any =[];summaryaData:any=[];driverval:any=[];returnSummary:any =[];
constructor(public _api:PageapiService, private router:Router) { }
ngOnInit(): void {
- this.selectedDateRange =[];
- console.log(moment()['_d'])
+ // this.selectedDateRange =[];
+ // console.log(moment()['_d'])
this.getDriverlistApi()
this.DateDisplay = moment()['_d']
@@ -107,67 +107,68 @@ export class DriverySheetComponent implements OnInit {
}
val(data){
- console.log(data.id)
+ console.log(data)
+ this.driverName = data.userName
- let result;
- if(this.selectedDateRange.length != 0){
- result= this.selectedDateRange.endDate['$d']
- }else{
+ let result;
+ // if(this.selectedDateRange.length != 0){
+ // result= this.selectedDateRange.endDate['$d']
+ // }else{
- result = moment()['_d']
- }
+ result = this.selectDate
+ // }
this.DateDisplay = result
-
+ this.driverId = data.id
console.log(result)
- let param ={date:new Date(result),id:data.id}
- this._api.getDriverSheet(param).subscribe(res => {
- console.log(res)
- if(res.status == 200){
+ // let param ={date:new Date(result),id:data.id}
+ // this._api.getDriverSheet(param).subscribe(res => {
+ // console.log(res)
+ // if(res.status == 200){
- console.log(res.data)
+ // console.log(res.data)
- this.summaryaData = res.data
- this.summaryaData.forEach(element => {
- element.name = element['UserDetails.userName']
+ // this.summaryaData = res.data
+ // this.summaryaData.forEach(element => {
+ // element.name = element['UserDetails.userName']
- });
+ // });
- this.mergeOrders( this.summaryaData)
+ // this.mergeOrders( this.summaryaData)
- }else{
- this.summaryaData =[];
- }
- })
+ // }else{
+ // this.summaryaData =[];
+ // }
+ // })
- this._api.getReturnDriverSummaryListadmin(param).subscribe(res => {
- console.log(res)
- if(res.status == 200){
+ // this._api.getReturnDriverSummaryListadmin(param).subscribe(res => {
+ // console.log(res)
+ // if(res.status == 200){
- console.log(res.data)
+ // console.log(res.data)
- this.returnSummary = res.data
+ // this.returnSummary = res.data
- // this.mergeOrders( this.summaryaData)
+ // // this.mergeOrders( this.summaryaData)
- }
- })
+ // }
+ // })
- this._api.getProductDeliverysheet(param).subscribe(res => {
- console.log(res)
- if(res.status == 200){
+ // this._api.getProductDeliverysheet(param).subscribe(res => {
+ // console.log(res)
+ // if(res.status == 200){
- console.log(res.data)
+ // console.log(res.data)
- this.productDeatils = res.data
+ // this.productDeatils = res.data
- // this.mergeOrders( this.summaryaData)
+ // // this.mergeOrders( this.summaryaData)
- }
- })
+ // }
+ // })
@@ -198,7 +199,7 @@ console.log(result)
let order = this.productDeatils.filter(arr=>{return arr.orderId == param})
if(order.length>0){
- console.log(param)
+ //console.log(param)
order.forEach(element => {
@@ -260,5 +261,77 @@ var opt = {
// New Promise-based usage:
html2pdf().from(element).set(opt).save();
}
+
+ generate(){
+
+ console.log(this.selectDate)
+ const utcDate = new Date(this.selectDate[0]);
+
+ // Add one day to the UTC date
+ utcDate.setDate(utcDate.getDate() + 1);
+
+ // Convert the updated date to a UTC string
+ const updatedUtcDate = utcDate.toISOString();
+ console.log(updatedUtcDate)
+
+ let param ={date: updatedUtcDate,id:this.driverId}
+ this._api.getDriverSheet(param).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ console.log(res.data)
+
+ this.summaryaData = res.data
+ this.summaryaData.forEach(element => {
+ element.name = element['UserDetails.userName']
+
+ });
+
+ this.mergeOrders( this.summaryaData)
+
+ }else{
+ this.summaryaData =[];
+ }
+ })
+
+ this._api.getReturnDriverSummaryListadmin(param).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ console.log(res.data)
+
+ this.returnSummary = res.data
+
+
+
+ // this.mergeOrders( this.summaryaData)
+
+ }
+ })
+
+ this._api.getProductDeliverysheet(param).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ console.log(res.data)
+
+ this.productDeatils = res.data
+
+
+
+ // this.mergeOrders( this.summaryaData)
+
+ }
+ })
+
+ }
+ onStartDateChanged(data){
+ this.DateDisplay = data
+ this.selectDate =[];
+ this.selectDate.push(data)
+ //this.selectDate = data
+ console.log(data)
+
+ }
}
diff --git a/src/app/pages/order/add-order/add-order.component.html b/src/app/pages/order/add-order/add-order.component.html
new file mode 100644
index 0000000..07a741e
--- /dev/null
+++ b/src/app/pages/order/add-order/add-order.component.html
@@ -0,0 +1,93 @@
+
+ {{heading}}
+
+
+
+ 0" >
+
+
+
+
+
+ {{user.productName }}({{user.skuId }} )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/pages/order/add-order/add-order.component.scss b/src/app/pages/order/add-order/add-order.component.scss
new file mode 100644
index 0000000..a312e65
--- /dev/null
+++ b/src/app/pages/order/add-order/add-order.component.scss
@@ -0,0 +1,19 @@
+@import '../../../@theme/styles/themes';
+
+@include nb-install-component() {
+ input {
+ width: 100%;
+ }
+
+ .cancel {
+ margin-right: 1rem;
+ }
+}
+.custom-dialog-class {
+ width: 50%; /* Set the desired width here */
+ height: 300px; /* Set the desired height here */
+ }
+ .show-grid{
+ margin-bottom: 2rem;
+ }
+
\ No newline at end of file
diff --git a/src/app/pages/order/add-order/add-order.component.spec.ts b/src/app/pages/order/add-order/add-order.component.spec.ts
new file mode 100644
index 0000000..fc37f59
--- /dev/null
+++ b/src/app/pages/order/add-order/add-order.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AddOrderComponent } from './add-order.component';
+
+describe('AddOrderComponent', () => {
+ let component: AddOrderComponent;
+ let fixture: ComponentFixture ;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ AddOrderComponent ]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(AddOrderComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/order/add-order/add-order.component.ts b/src/app/pages/order/add-order/add-order.component.ts
new file mode 100644
index 0000000..592b4d5
--- /dev/null
+++ b/src/app/pages/order/add-order/add-order.component.ts
@@ -0,0 +1,129 @@
+import { Component, OnInit } from '@angular/core';
+import { NbComponentStatus, NbDialogRef, NbDialogService, NbGlobalPhysicalPosition, NbGlobalPosition, NbToastrService } from '@nebular/theme';
+import { PageapiService } from '../../pageapi.service';
+
+@Component({
+ selector: 'ngx-add-order',
+ templateUrl: './add-order.component.html',
+ styleUrls: ['./add-order.component.scss']
+})
+export class AddOrderComponent implements OnInit {
+ setData:any =[];
+ position: NbGlobalPosition = NbGlobalPhysicalPosition.TOP_RIGHT;
+ preventDuplicates = false;
+ status: NbComponentStatus = 'primary';
+ index = 1;
+ destroyByClick = true;
+ duration = 2000;
+ hasIcon = true;
+
+ heading:any =[];product:any =[]; inputFieldGroups:any = [{id:'', qty: '1', productSpec: '' }]; orderId:any =[];
+ constructor(private toastrService: NbToastrService,private dialogRef: NbDialogRef ,public _api:PageapiService,private dialogService: NbDialogService) {
+
+
+ }
+
+ ngOnInit() {
+ this.heading = "Add Return"
+ console.log('dialogRef', this.dialogRef.componentRef.instance);
+let answer:any = this.dialogRef.componentRef.instance
+ this.getProductlistApi( answer.details)
+ }
+
+
+
+ getProductlistApi(param){
+ let data ={type : param}
+
+ this._api.getProducts(data).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ let passData = res.data
+ let product = passData
+console.log(product)
+ product.forEach((element:any, index) => {
+ element.index = index +1
+ element.qty = 0;
+ element.pId = element.id
+
+ });
+
+ this.product = product
+ // this.productfull = product
+
+ // console.log(data)
+
+ }else{
+ this.product = [];
+ }
+ })
+ }
+
+ addInputFieldGroup() {
+ this.inputFieldGroups.push({id:null, qty: '1', productSpec: '' }); // Add a new input field group to the array
+ //this.childButtonEvent.emit( this.inputFieldGroups);
+ }
+
+ removeInputFieldGroup(index: number) {
+ console.log( this.inputFieldGroups)
+ this.inputFieldGroups.splice(index, 1); // Remove the input field group at the specified index
+ //this.childButtonEvent.emit( this.inputFieldGroups);
+ }
+
+
+ cancel(){
+ this.dialogRef.close();
+ }
+
+ save(){
+
+ let product= this.inputFieldGroups.filter((arr:any)=>{return arr.qty != 0})
+ console.log(product)
+
+ if(product.length>0){
+
+
+ let temp:any =[]
+ this.orderId = localStorage.getItem('orderId')
+ let cus = localStorage.getItem('cusId')
+ let driverId = localStorage.getItem('driverId')
+ product.forEach((element:any) => {
+ temp.push({orderId: this.orderId,productId:element.id,cusId:cus,qty:element.qty,driverId:driverId,returnTime:new Date(),createdBy:driverId,cylinderNo:element.productSpec})
+ });
+
+ console.log(temp)
+ let paramData ={product:temp}
+ this._api.CreateReturn (paramData).subscribe(async res => {
+ if (res.status == 200) {
+console.log(res)
+
+this.dialogRef.close(1);
+ }
+ })
+}else{
+ this.showToast('success', 'Data Changed Successfully', '');
+ this.dialogRef.close();
+}
+ }
+
+
+ private showToast(type: NbComponentStatus, title: string, body: string) {
+ const config = {
+ status: type,
+ destroyByClick: this.destroyByClick,
+ duration: this.duration,
+ hasIcon: this.hasIcon,
+ position: this.position,
+ preventDuplicates: this.preventDuplicates,
+ };
+ const titleContent = title ? ` ${title}` : '';
+
+ this.index += 1;
+ this.toastrService.show(
+ body,
+ `${titleContent}`,
+ config);
+ }
+
+}
diff --git a/src/app/pages/order/order-form/order-form.component.html b/src/app/pages/order/order-form/order-form.component.html
index 2f02c52..d386999 100644
--- a/src/app/pages/order/order-form/order-form.component.html
+++ b/src/app/pages/order/order-form/order-form.component.html
@@ -8,16 +8,18 @@
-
@@ -40,6 +42,25 @@
}}
+
+ Shipping Information
+ 0">
+
+
+
+
+
+
+
+
+
+
+
+
@@ -57,7 +78,30 @@
{{setData.orderId}}
Status
- ({{setData.status}})
+ ({{setData.status}})
+
+
+ Ordered
+ In Progresss
+ Out For Delivery
+
+ Delivered
+ Cancelled
+
+
+
+
+
+
+ {{user.userName }}
+
+
+
+
+
+ Save
+
Reason: {{setData.reason}}
-
-
-
-
- 0">
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -118,7 +131,7 @@
- 0">
+ 0" >
@@ -131,37 +144,225 @@
-
-
-
+
+
+
+
+
+
+
+
+
+ 0" >
+
+
+
+
+
+ {{user.productName }}({{user.skuId }} )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -183,7 +384,7 @@
diff --git a/src/app/pages/order/order-form/order-form.component.ts b/src/app/pages/order/order-form/order-form.component.ts
index ed3bbff..9e03c2b 100644
--- a/src/app/pages/order/order-form/order-form.component.ts
+++ b/src/app/pages/order/order-form/order-form.component.ts
@@ -1,12 +1,14 @@
import { Component, OnInit } from '@angular/core';
import { PageapiService } from '../../pageapi.service';
-import { NbComponentStatus, NbGlobalPhysicalPosition, NbGlobalPosition, NbToastrService, NbWindowControlButtonsConfig, NbWindowRef, NbWindowService } from '@nebular/theme';
+import { NbComponentStatus, NbDialogService, NbGlobalPhysicalPosition, NbGlobalPosition, NbToastrService, NbWindowControlButtonsConfig, NbWindowRef, NbWindowService } from '@nebular/theme';
import { SmartTableData } from '../../../@core/data/smart-table';
import { OrderSummaryFormComponent } from '../order-summary-form/order-summary-form.component';
import { ActivatedRoute, Router } from '@angular/router';
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
+import { log } from 'console';
+import { AddOrderComponent } from '../add-order/add-order.component';
pdfMake.vfs = pdfFonts.pdfMake.vfs;
class Product{
name: string;
@@ -29,7 +31,7 @@ class Invoice{
})
export class OrderFormComponent implements OnInit {
customer:any =[];
- product:any =[];
+ product:any =[];ResultDisplay:any =[];
mixedGas:any =[];productfull:any=[];
selectCustomer:any ="";
items = [
@@ -42,7 +44,7 @@ fieldTitle:any =' New Order'
maximize = false;
fullScreen = true;
close = true;
- formData:any=[]
+ formData:any=[];productlistReturn:any =[];
index = 1;
destroyByClick = true;
duration = 2000;
@@ -50,17 +52,18 @@ fieldTitle:any =' New Order'
setData:any =[];
position: NbGlobalPosition = NbGlobalPhysicalPosition.TOP_RIGHT;
preventDuplicates = false;
- status: NbComponentStatus = 'primary';
- selectCustomerData :any =[];
+ status: NbComponentStatus = 'primary';
+ inputFieldGroups:any = [{id:'', qty: '1', productSpec: '' }];
+ selectCustomerData :any =[];selectStatus:any =[];CancelReason:any =[];selectDriver:any =[];drivers:any =[];
invoice = new Invoice();
- constructor(private route :ActivatedRoute,private router: Router,public _api:PageapiService,private toastrService: NbToastrService,private service: SmartTableData ,private windowService: NbWindowService) {
+ 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. setData = res
-
+ this.selectStatus = res.status
// res.name = res.productName
// res.qty = parseInt(res.qty)
// res.price = this.setData['OrderDetails.CusDetails.cusType']
@@ -92,11 +95,13 @@ fieldTitle:any =' New Order'
});
this.mixedGas = tmp2
console.log(tmp2)
+
}
receiveAutoMsgHandler(p) {
console.log(p)
}
- ngOnInit(): void {
+ ngOnInit() {
+ this.getDriverlistApi()
console.log(this.setData)
if(this.setData != undefined){
@@ -112,6 +117,10 @@ fieldTitle:any =' New Order'
}
}
this.getuserlistApi()
+
+
+
+
}
@@ -132,6 +141,8 @@ fieldTitle:any =' New Order'
console.log(customer)
this.customer = customer
if( Object.keys(this.setData).length != 0){
+ localStorage.setItem('cusId', this.setData['OrderDetails.CusDetails.id'])
+ 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']
@@ -146,6 +157,19 @@ fieldTitle:any =' New Order'
this.getProductlistApi( this.setData['OrderDetails.CusDetails.cusType'])
this.getProductlistApi2( this.setData['OrderDetails.CusDetails.cusType'])
console.log( this.setData['OrderDetails.CusDetails.cusType'])
+
+ localStorage.setItem('orderId',this.setData.orderId)
+
+ this._api.getReturnProductListSummary({orderId:this.setData.orderId}).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ this.productlistReturn = res.data
+
+
+
+ }
+ })
}
}
})
@@ -200,6 +224,8 @@ console.log(product)
let product = passData
this.productfull = product
+
+
// console.log(data)
@@ -260,6 +286,102 @@ console.log(product)
+ let passData = {name:this.selectCustomer,product:results,customerData:this.selectCustomerData}
+
+ const windowRef: NbWindowRef = this.windowService.open(OrderSummaryFormComponent, { title: ` Order Summary (`+this.selectCustomer+`)`, context:passData,buttons: buttonsConfig , });
+
+
+
+ // Subscribe to the afterClosed event
+ windowRef.onClose.subscribe((data) => {
+ // Handle the window closure
+ console.log(data);
+ if(data == 1){
+ this.showToast('success', 'Data Saved Successfully', 'New Order Placed..!');
+ // this.getuserlistApi();
+ setTimeout(() => {
+ this.router.navigate(['../'], { relativeTo: this.route });
+ }, 500);
+ console.log('Window closed 123');
+ }else if(data == 0){
+ this.showToast('warning', 'Somthing is Wrong...!', 'Order Placed Failed..!');
+ }
+ });
+ }else{
+ this.showToast('warning', 'Please Fill Request Fields...!', '');
+ }
+ }
+
+
+ saveNew(){
+
+ console.log(this.selectCustomer,this.inputFieldGroups, this.product)
+
+ this.inputFieldGroups.forEach((element:any) => {
+
+
+ this.product.forEach(e => {
+
+
+if(e.id === element.id){
+ element.name = e.productName
+
+
+}
+});
+
+});
+console.log( this.inputFieldGroups )
+this.invoice.products =[];
+// this.inputFieldGroups.forEach((res:any) => {
+
+
+// res.name = res.name
+// res.qty = res.qty
+// res.price = this.setData['OrderDetails.CusDetails.cusType']
+// this.invoice.additionalDetails = 'https://vnms.in/services/'
+
+// this.invoice.products.push(res)
+
+
+
+
+// })
+
+ let mixProd= this.inputFieldGroups.filter((arr:any)=>{return arr.qty != 0})
+
+
+// if(this.setData != undefined){
+
+
+// if( Object.keys(this.setData).length != 0){
+// product.forEach(element => {
+// element.productSpec = this. setData.productSpec
+
+// });
+// }
+// }
+
+
+ const buttonsConfig: NbWindowControlButtonsConfig = {
+ minimize: this.minimize,
+ maximize: this.maximize,
+ fullScreen: this.fullScreen,
+ close: this.close,
+ };
+ let config= {
+ hasBackdrop: true,
+ width: '500px',
+ height: '300px',
+ }
+
+
+ let results = [ ...this.mixedGas, ...mixProd];
+
+ if(results.length>0){
+
+
+
let passData = {name:this.selectCustomer,product:results,customerData:this.selectCustomerData}
const windowRef: NbWindowRef = this.windowService.open(OrderSummaryFormComponent, { title: ` Order Summary (`+this.selectCustomer+`)`, context:passData,buttons: buttonsConfig , });
@@ -309,6 +431,36 @@ console.log(product)
generatePDF(action = 'open') {
+ 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)
+
+
+
+
+ })
this.invoice.products = this.invoice.products.filter(arr=>{return arr.qty != 0})
let docDefinition = {
content: [
@@ -348,6 +500,10 @@ console.log(product)
{ text: this.invoice.contactNo }
],
[
+ {
+ text: `SALES ORDER`,
+ alignment: 'right'
+ },
{
text: `Date: ${new Date(this.setData.createdAt).toLocaleString()}`,
alignment: 'right'
@@ -384,18 +540,18 @@ console.log(product)
]
}
},
+ // {
+ // text: 'Additional Details',
+ // style: 'sectionHeader'
+ // },
{
- text: 'Additional Details',
- style: 'sectionHeader'
- },
- {
- text: this.invoice.additionalDetails,
+ text: '',
margin: [0, 0 ,0, 15]
},
{
columns: [
- [{ qr: `${this.invoice.customerName}`, fit: '50' }],
- [{ text: 'Signature', alignment: 'right', italics: true}],
+ // [{ qr: `${this.invoice.customerName}`, fit: '50' }],
+ // [{ text: 'Signature', alignment: 'right', italics: true}],
]
},
{
@@ -404,9 +560,9 @@ console.log(product)
},
{
ul: [
- 'Order can be return in max 10 days.',
- 'Warrenty of the product will be subject to the manufacturer terms and conditions.',
- 'This is system generated invoice.',
+ 'Order once placed cannot be changed . Please contact VNMS for any queries.',
+ 'Delivery of the product will be subject to the manufacturer terms and conditions.',
+ 'This is a system generated sales order.',
],
}
],
@@ -421,7 +577,9 @@ console.log(product)
};
if(action==='download'){
- pdfMake.createPdf(docDefinition).download();
+
+ let name= this.selectCustomer+"-"+this.setData.orderId
+ pdfMake.createPdf(docDefinition).download(name);
}else if(action === 'print'){
pdfMake.createPdf(docDefinition).print();
@@ -443,27 +601,44 @@ console.log(product)
if(res.status == 200){
let result = res.data
+
+this.ResultDisplay = result
+console.log(result)
+ this.inputFieldGroups =[];
+
+// setTimeout(() => {
+
+
+result.forEach(element => {
+
+ this.inputFieldGroups.push({id:parseInt(element.productId ) , qty: element.qty, productSpec: element.productSpec , primaryId:element.id})
+
+
+})
+// }, 1000);
+console.log( this.inputFieldGroups);
+
result.forEach(element => {
console.log(element)
if(element.ProductDetails.length>0){
- if(element.ProductDetails[0].productName =="Mixed Gas"){
- console.log("hiiii")
- element.name = element.ProductDetails[0].productName
- element.qty = parseInt(element.qty)
- element.price = this.setData['OrderDetails.CusDetails.cusType']
- this.invoice.products.push(element)
- }
+ // if(element.ProductDetails[0].productName =="Mixed Gas"){
+ // console.log("hiiii")
+ // element.name = element.ProductDetails[0].productName
+ // element.qty = parseInt(element.qty)
+ // element.price = this.setData['OrderDetails.CusDetails.cusType']
+ // this.invoice.products.push(element)
+ // }
}
});
-this.product.forEach(element => {
+// this.product.forEach(element => {
- delete element.id
+// delete element.id
-})
+// })
this.product.forEach(element => {
result.forEach(e => {
@@ -472,19 +647,20 @@ this.product.forEach(element => {
if(element.productName == e.ProductDetails[0].productName ){
//id: 110
element.productId= element.id
- element.id = e.id
+ // element.id = e.id
element.qty = parseInt(e.qty)
- }
+ }
}
});
});
+console.log(this.product)
}
const uniqueArray = this.invoice.products.filter((obj:any, index, self) =>
index === self.findIndex((o:any) => o.id === obj.id)
);
-this.invoice.products = uniqueArray
+//this.invoice.products = uniqueArray
console.log(this.product,this.invoice.products)
})
@@ -496,7 +672,7 @@ this.invoice.products = uniqueArray
res.price = this.setData['OrderDetails.CusDetails.cusType']
this.invoice.additionalDetails = 'https://vnms.in/services/'
- this.invoice.products.push(res)
+ // this.invoice.products.push(res)
@@ -531,4 +707,167 @@ cancelData(){
}
console.log(this.fieldTitle)
}
+
+getDriverlistApi(){
+ let param ={}
+ this._api.getusers(param).subscribe(res => {
+ console.log(res)
+ if(res.status == 200){
+
+ let passData = res.data
+ let driver = passData.filter(arr=>{return arr.role == 'DRIVER'})
+ driver.sort((a: any, b: any) => {
+ return b.id - a.id;
+ });
+ driver.forEach((element:any, index) => {
+ element.index = index +1
+
+ });
+
+
+
+ this.drivers = driver
+ if(this.setData != undefined){
+ if( Object.keys(this.setData).length != 0){
+ this.selectDriver = parseInt(this.setData.driverId)
+ console.log( this.drivers)
+ }}
+ }
+ })
+}
+
+onSubmit2(){
+
+
+
+ console.log( this.selectDriver,this.selectStatus)
+ let tmp=[];
+
+
+
+ if(this.selectStatus == "Out For Delivery"){
+ tmp.push({orderId:this.setData.orderId , driverId:this.selectDriver, status:this.selectStatus })
+ }else if(this.selectStatus == "Cancelled"){
+ tmp.push({orderId:this.setData.orderId , reason:this.CancelReason, status:this.selectStatus })
+ }else{
+ tmp.push({orderId:this.setData.orderId , status:this.selectStatus })
+ }
+
+ if(this.selectStatus == "Delivered"){
+
+this.onCreateConfirm()
+
+ }else{
+
+ let param ={driver:tmp,orderId:this.setData.orderId}
+
+
+
+
+
+
+
+ this._api.CreateOrder (param).subscribe(res => {
+ if (res.status == 200) {
+ console.log(res)
+ this.showToast('success', 'Updated Successfully', '');
+
+ this.selectStatus =[];
+ }else{
+ this.showToast('warning', 'Somthing is Wrong...!', '');
+ }
+ })
+
+ }
+
+
+
+
+// let param ={driver:tmp,orderId:this.setData.orderId}
+
+
+
+
+
+
+
+// this._api.CreateOrder (param).subscribe(res => {
+// if (res.status == 200) {
+// console.log(res)
+// this.showToast('success', 'Data Changed Successfully', '');
+
+// this.selectStatus =[];
+// }else{
+// this.showToast('warning', 'Somthing is Wrong...!', '');
+// }
+// })
+
+}
+
+addInputFieldGroup() {
+ this.inputFieldGroups.push({id:null, qty: '0', productSpec: '' }); // Add a new input field group to the array
+ //this.childButtonEvent.emit( this.inputFieldGroups);
+}
+
+removeInputFieldGroup(index: number) {
+ console.log( this.inputFieldGroups)
+ this.inputFieldGroups.splice(index, 1); // Remove the input field group at the specified index
+ //this.childButtonEvent.emit( this.inputFieldGroups);
+}
+
+
+onCreateConfirm() {
+ let data:any = {details:this.setData['OrderDetails.CusDetails.cusType'],action:'Add',title:'Add Return'}
+ const dialogRef = this.dialogService.open(AddOrderComponent, {
+ 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){
+ console.log( this.selectDriver,this.selectStatus)
+ let tmp=[];
+
+
+
+ if(this.selectStatus == "Out For Delivery"){
+ tmp.push({orderId:this.setData.orderId , driverId:this.selectDriver, status:this.selectStatus })
+ }else if(this.selectStatus == "Cancelled"){
+ tmp.push({orderId:this.setData.orderId , reason:this.CancelReason, status:this.selectStatus })
+ }else{
+ tmp.push({orderId:this.setData.orderId , status:this.selectStatus })
+ }
+
+ let param ={driver:tmp,orderId:this.setData.orderId}
+
+
+
+
+
+
+
+ this._api.CreateOrder (param).subscribe(res => {
+ if (res.status == 200) {
+ console.log(res)
+ this.showToast('success', 'Updated Successfully', '');
+
+ this.selectStatus =[];
+ }else{
+ this.showToast('warning', 'Somthing is Wrong...!', '');
+ }
+ })
+ // this.showToast('success', 'Data Saved Successfully', '');
+ // this.toastrService.success('Entity Added Successfully','Entity');
+ console.log('Window closed 123');
+ }else if(result == 0){
+
+ this.showToast('warning', 'Somthing is Wrong...!', '');
+ // this.toastrService.success('Somthing is Wrong...!', 'Add Entity Failed..!');
+ }
+ });
+
+}
}
diff --git a/src/app/pages/order/order-summary-form/order-summary-form.component.html b/src/app/pages/order/order-summary-form/order-summary-form.component.html
index 4b9f090..cfc9ea8 100644
--- a/src/app/pages/order/order-summary-form/order-summary-form.component.html
+++ b/src/app/pages/order/order-summary-form/order-summary-form.component.html
@@ -31,7 +31,7 @@
- {{ item.productName }}
+ {{ item.name }}
diff --git a/src/app/pages/order/order-summary-form/order-summary-form.component.ts b/src/app/pages/order/order-summary-form/order-summary-form.component.ts
index 559785a..bcfd60d 100644
--- a/src/app/pages/order/order-summary-form/order-summary-form.component.ts
+++ b/src/app/pages/order/order-summary-form/order-summary-form.component.ts
@@ -41,6 +41,18 @@ export class OrderSummaryFormComponent implements OnInit {
console.log(this.data,this.setData)
let cus = this.data.customerData['CusDetails.id']
let role = localStorage.getItem('user_role')
+ this.data.product.forEach(element => {
+ element.productName = element.name
+
+ if(element.hasOwnProperty('primaryId')){
+ element.id = element.primaryId
+ }else{
+ element.pid = element.id
+ element.productId = element.id
+ delete element.id
+
+ }
+});
let param;
if(this.setData != undefined){
if(this.setData.hasOwnProperty('id')){
diff --git a/src/app/pages/order/order.component.html b/src/app/pages/order/order.component.html
index fce8c8e..5b05625 100644
--- a/src/app/pages/order/order.component.html
+++ b/src/app/pages/order/order.component.html
@@ -2,7 +2,7 @@
-
+
@@ -12,7 +12,10 @@
-
+
+
+
-
+
@@ -66,7 +73,8 @@
[selectMode]="'multi'"
[minContentHeight]="350"
[selectMode]="'multi'"
-
+ [selectOnRowClick]="true"
+
[limit]="25"
>
@@ -79,7 +87,14 @@
-
+
+ |
+
+
+ |
+
+
+
@@ -113,7 +128,17 @@
[title]="'Order ID'"
[filterable]="false"
[width]="4">
-
+
+
+
+
+
+ {{row.item.orderId }}
+
+
+
+ |
+
-
+
+
+
+
+
+
+ {{row.item.customer }}
+
+
+
+ |
+
-
+
+
+
+
+
+ {{row.item.address }}
+
+
+
+ |
+
-
+ |
@@ -170,7 +216,7 @@
- |
+ |
{{row.item.status}} ({{row.item['UserDetails.userName']}})
@@ -194,7 +240,7 @@
-->
-
-
- |
-
+ -->
@@ -242,51 +275,60 @@
- | | |