order status issue fix
This commit is contained in:
parent
e2281ec7ee
commit
b71e5a3904
@ -145,6 +145,7 @@
|
|||||||
<label for="subject" style=" font-weight: 600;"> </label>
|
<label for="subject" style=" font-weight: 600;"> </label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" (click)="addInputFieldGroup()" *ngIf="inputFieldGroups.length == 0"></nb-action>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -159,11 +160,11 @@
|
|||||||
<div class="row show-grid" *ngIf="product.length>0" >
|
<div class="row show-grid" *ngIf="product.length>0" >
|
||||||
<div class="col-6 col-md-3">
|
<div class="col-6 col-md-3">
|
||||||
<div >
|
<div >
|
||||||
<nb-select placeholder="Select Product" [(ngModel)]="fieldGroup.id" style="width: 100% !important;margin-right: 1rem;" >
|
<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> -->
|
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||||
<!-- (click)="onProductSelect(user.id,user.productName)" -->
|
<!-- (click)="onProductSelect(user.id,user.productName)" -->
|
||||||
<nb-option *ngFor="let user of product; index as i; first as isFirst" [value]="user.id
|
<nb-option *ngFor="let user of product; index as i; first as isFirst" [value]="user.id"
|
||||||
">{{user.productName }}({{user.skuId }} )</nb-option>
|
>{{user.productName }}({{user.skuId }} )</nb-option>
|
||||||
|
|
||||||
|
|
||||||
</nb-select>
|
</nb-select>
|
||||||
@ -192,10 +193,11 @@
|
|||||||
<nb-actions size="medium" *ngIf="fieldTitle != 'View Order'">
|
<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="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-action icon="minus-circle-outline" [nbTooltip]="'Remove'" (click)="removeInputFieldGroup(i)"></nb-action>
|
||||||
</nb-actions>
|
</nb-actions>
|
||||||
|
|
||||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
<!-- <button nbButton status="danger" *ngIf="i !=0" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export class OrderFormComponent implements OnInit {
|
|||||||
{ label: 'Item 2', quantity: 0 },
|
{ label: 'Item 2', quantity: 0 },
|
||||||
{ label: 'Item 3', quantity: 0 }
|
{ label: 'Item 3', quantity: 0 }
|
||||||
];
|
];
|
||||||
fieldTitle:any =' New Order'
|
fieldTitle:any ='New Order'
|
||||||
minimize = false;
|
minimize = false;
|
||||||
maximize = false;
|
maximize = false;
|
||||||
fullScreen = true;
|
fullScreen = true;
|
||||||
@ -60,7 +60,7 @@ fieldTitle:any =' New Order'
|
|||||||
delArr:any=[]
|
delArr:any=[]
|
||||||
selectedProductId: number | undefined = null;
|
selectedProductId: number | undefined = null;
|
||||||
addFormBtn: any;
|
addFormBtn: any;
|
||||||
constructor(private dialogService: NbDialogService,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) => {
|
this._api.orderDetails_observable$.subscribe((res) => {
|
||||||
console.log('booked', res);
|
console.log('booked', res);
|
||||||
@ -193,15 +193,33 @@ fieldTitle:any =' New Order'
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProductlistApi(param){
|
getProductlistApi(param){
|
||||||
let data ={type : param}
|
console.log(this.fieldTitle, param)
|
||||||
this.getProductlistApi2( 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 => {
|
this._api.getProducts(data).subscribe(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(res.status == 200){
|
if(res.status == 200){
|
||||||
|
|
||||||
let passData = res.data
|
let passData = res.data
|
||||||
let product = passData
|
let product
|
||||||
console.log(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) => {
|
product.forEach((element:any, index) => {
|
||||||
element.index = index +1
|
element.index = index +1
|
||||||
element.qty = 0;
|
element.qty = 0;
|
||||||
@ -210,6 +228,8 @@ console.log(product)
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.product = product
|
this.product = product
|
||||||
|
|
||||||
|
console.log(this.product)
|
||||||
// this.productfull = product
|
// this.productfull = product
|
||||||
if(this.setData != undefined){
|
if(this.setData != undefined){
|
||||||
if( Object.keys(this.setData).length != 0){
|
if( Object.keys(this.setData).length != 0){
|
||||||
@ -230,6 +250,20 @@ 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){
|
getProductlistApi2(param){
|
||||||
let data ={type : param}
|
let data ={type : param}
|
||||||
@ -357,7 +391,7 @@ console.log(product)
|
|||||||
|
|
||||||
this.inputFieldGroups.forEach((element:any) => {
|
this.inputFieldGroups.forEach((element:any) => {
|
||||||
|
|
||||||
|
delete element.isNew;
|
||||||
this.product.forEach(e => {
|
this.product.forEach(e => {
|
||||||
|
|
||||||
|
|
||||||
@ -403,6 +437,7 @@ this.invoice.products =[];
|
|||||||
// console.log(mixedProductGas)
|
// console.log(mixedProductGas)
|
||||||
|
|
||||||
const filteredItems = this.inputFieldGroups.filter(item => item.name === 'Mixed Gas' && item.productSpec === '');
|
const filteredItems = this.inputFieldGroups.filter(item => item.name === 'Mixed Gas' && item.productSpec === '');
|
||||||
|
console.log(filteredItems)
|
||||||
if (filteredItems.length > 0) {
|
if (filteredItems.length > 0) {
|
||||||
this.showToast('warning', 'Please Fill Mixed Gas Fields...!', '');
|
this.showToast('warning', 'Please Fill Mixed Gas Fields...!', '');
|
||||||
return;
|
return;
|
||||||
@ -871,10 +906,27 @@ this.onCreateConfirm()
|
|||||||
}
|
}
|
||||||
|
|
||||||
addInputFieldGroup() {
|
addInputFieldGroup() {
|
||||||
this.inputFieldGroups.push({id:null, qty: '1', 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);
|
//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) {
|
removeInputFieldGroup(index: number) {
|
||||||
console.log( this.inputFieldGroups[index].primaryId)
|
console.log( this.inputFieldGroups[index].primaryId)
|
||||||
this.delArr.push(this.inputFieldGroups[index].primaryId)
|
this.delArr.push(this.inputFieldGroups[index].primaryId)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user