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>
|
||||
</div>
|
||||
</div>
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" (click)="addInputFieldGroup()" *ngIf="inputFieldGroups.length == 0"></nb-action>
|
||||
</div>
|
||||
|
||||
|
||||
@ -159,11 +160,11 @@
|
||||
<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-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 product; index as i; first as isFirst" [value]="user.id
|
||||
">{{user.productName }}({{user.skuId }} )</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>
|
||||
@ -192,10 +193,11 @@
|
||||
<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-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" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
<!-- <button nbButton status="danger" *ngIf="i !=0" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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;
|
||||
@ -60,7 +60,7 @@ fieldTitle:any =' New Order'
|
||||
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) {
|
||||
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);
|
||||
@ -193,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;
|
||||
@ -210,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){
|
||||
@ -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){
|
||||
let data ={type : param}
|
||||
@ -357,7 +391,7 @@ console.log(product)
|
||||
|
||||
this.inputFieldGroups.forEach((element:any) => {
|
||||
|
||||
|
||||
delete element.isNew;
|
||||
this.product.forEach(e => {
|
||||
|
||||
|
||||
@ -403,6 +437,7 @@ this.invoice.products =[];
|
||||
// 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;
|
||||
@ -871,10 +906,27 @@ this.onCreateConfirm()
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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[index].primaryId)
|
||||
this.delArr.push(this.inputFieldGroups[index].primaryId)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user