bug issue fix

This commit is contained in:
Surendiran 2023-09-04 18:32:54 +05:30
parent 4d5ae99c73
commit 2db9789559
11 changed files with 17716 additions and 11011 deletions

28606
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,8 @@
<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> <ng-container nbInputErrorMessage>
<div style="color:#7c0e0e" *ngIf="userForm.get('pincode').hasError('required') && userForm.get('pincode').touched">Pincode is required.</div> <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> </nb-form-field>
</div> </div>
<div class="col-md-4 col-sm-12"> <div class="col-md-4 col-sm-12">

View File

@ -45,7 +45,10 @@ export class CustomerFormComponent implements OnInit {
address_1: new FormControl('', [Validators.required]), address_1: new FormControl('', [Validators.required]),
state: new FormControl('', [Validators.required]), state: new FormControl('', [Validators.required]),
city: 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]), cusType: new FormControl('', [Validators.required]),
}); });

View File

@ -3,7 +3,7 @@
<div class="row show-grid"> <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> <nb-icon icon="people-outline"></nb-icon> Customer Management</div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-md-3">
<div style=" text-align: end;"> <div style=" text-align: end;">
<!-- <button (click)="Assign()" nbButton status="primary" hero> <!-- <button (click)="Assign()" nbButton status="primary" hero>
Assign Driver Assign Driver

View File

@ -56,7 +56,7 @@
<div> <div>
<!-- <label for="subject" style=" font-weight: 600;">{{ fieldGroup.qty }}</label> --> <!-- <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>
</div> </div>

View File

@ -29,7 +29,7 @@
<nb-card-body> <nb-card-body>
<div class="row show-grid"> <div class="row show-grid">
<div class="col-6 col-md-4"> <div class="col-6 col-md-5">
<div> <div>
<label for="exampleInputEmail1" class="label">Customer</label> <br /> <label for="exampleInputEmail1" class="label">Customer</label> <br />
<span *ngIf="fieldTitle == 'View Order'">{{selectCustomer}}</span> <span *ngIf="fieldTitle == 'View Order'">{{selectCustomer}}</span>
@ -45,26 +45,26 @@
<hr> <hr>
<div style="font-size: larger;margin-top: 1rem;;margin-bottom: 1rem;"> Shipping Information</div> <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="row show-grid" *ngIf="product.length>0">
<div class="col-6 col-md-3"> <div class="col-6 col-md-4">
<div> <div>
<label for="subject" style=" font-weight: 500;">{{selectCustomerData['CusDetails.address_1']}} , {{selectCustomerData['CusDetails.city']}},<br />Contact No-({{selectCustomerData['CusDetails.phoneNo']}}) </label> <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> </div>
<div class="col-6 col-md-2"> <!-- <div class="col-6 col-md-1">
<!-- <div> <div>
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label> <label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
</div> --> </div>
</div> </div>
<div class="col-6 col-md-4"> <div class="col-6 col-md-4">
<!-- <div> <div>
<label for="subject" style=" font-weight: 600;"></label> <label for="subject" style=" font-weight: 600;"></label>
</div>
</div> --> </div> -->
</div>
</div> </div>
<!-- <input type="text" nbInput fullWidth placeholder="Project">--> <!-- <input type="text" nbInput fullWidth placeholder="Project">-->
</div> </div>
</div> </div>
<div class="col-6 col-md-4"> <div class="col-6 col-md-3">
<div> <div>
<!-- <nb-select selected="DRIVER" > <!-- <nb-select selected="DRIVER" >
<nb-option value="DRIVER">DRIVER</nb-option> <nb-option value="DRIVER">DRIVER</nb-option>
@ -78,7 +78,7 @@
<p> {{setData.orderId}} </p> <br /> <p> {{setData.orderId}} </p> <br />
<div style="font-size: larger;font-weight: 600;"> Status</div> <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> <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-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="">Change Status</nb-option> -->
<nb-option value="ordered" >Ordered</nb-option> <nb-option value="ordered" >Ordered</nb-option>

View File

@ -691,22 +691,23 @@ edit(){
this.fieldTitle = 'View Order' this.fieldTitle = 'View Order'
}else{ }else{
this.fieldTitle = 'Edit Order' this.fieldTitle = 'Edit Order'
this._api.orderDetails.next( this. setData) this._api.orderDetails.next( this.setData)
} }
console.log(this.fieldTitle) console.log(this.fieldTitle)
} }
cancelData(){ cancelData(){
localStorage.setItem('viewOrder','1') this.router.navigate(['../'], { relativeTo: this.route });
let result = localStorage.getItem('viewOrder') // localStorage.setItem('viewOrder','1')
if(result == '1'){ // let result = localStorage.getItem('viewOrder')
this.fieldTitle = 'View Order' // if(result == '1'){
this._api.orderDetails.next( this. setData) // this.fieldTitle = 'View Order'
}else{ // this._api.orderDetails.next( this.setData)
this.fieldTitle = 'Edit Order' // }else{
} // this.fieldTitle = 'Edit Order'
console.log(this.fieldTitle) // }
// console.log(this.fieldTitle)
} }
getDriverlistApi(){ getDriverlistApi(){
@ -829,7 +830,7 @@ this.onCreateConfirm()
} }
addInputFieldGroup() { addInputFieldGroup() {
this.inputFieldGroups.push({id:null, qty: '0', productSpec: '' }); // Add a new input field group to the array this.inputFieldGroups.push({id:null, qty: '1', productSpec: '' }); // Add a new input field group to the array
//this.childButtonEvent.emit( this.inputFieldGroups); //this.childButtonEvent.emit( this.inputFieldGroups);
} }
@ -894,4 +895,5 @@ onCreateConfirm() {
}); });
} }
} }

View File

@ -224,7 +224,7 @@
</span> </span>
<span [ngStyle] = "{'color':row.item.status =='ordered'?'#1f1dc9f5':row.item.status =='Delivered' ?'green':'red' }" class="checkTxt" *ngIf="row.item.status !='Out For Delivery'" > <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}} {{row.item.status}} <p class="checkTxt" *ngIf="row.item.status == 'Delivered'">({{row.item['UserDetails.userName']}})</p>
</span> </span>
</div> </div>

View File

@ -46,7 +46,7 @@
<ng-container nbInputErrorMessage> <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').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> </ng-container>
<nb-card-footer> <nb-card-footer>
<button type="button" class="cancel" nbButton status="danger" (click)="cancel()">Cancel</button> <button type="button" class="cancel" nbButton status="danger" (click)="cancel()">Cancel</button>

View File

@ -2,6 +2,9 @@ import { Component, Inject, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { PageapiService } from '../../pageapi.service'; import { PageapiService } from '../../pageapi.service';
import { NbWindowService ,NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme'; 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({ @Component({
selector: 'ngx-product-form', selector: 'ngx-product-form',
@ -10,23 +13,24 @@ import { NbWindowService ,NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme'
}) })
export class ProductFormComponent implements OnInit { export class ProductFormComponent implements OnInit {
userForm: FormGroup | any; formData:any =[] 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) console.log(this.data)
this.action = this.data.action;
console.log(this.action)
} }
ngOnInit(): void { ngOnInit(): void {
let valData = [this.validateUsernameAvailability.bind(this)]
this.userForm = new FormGroup({
this.userForm = new FormGroup({
productCategory: new FormControl('', [Validators.required]), productCategory: new FormControl('', [Validators.required]),
productType: new FormControl('', [Validators.required]), productType: new FormControl('', [Validators.required]),
productName: new FormControl('', [Validators.required]), productName: new FormControl('', [Validators.required]),
description: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')){ if(this.data.hasOwnProperty('id')){
@ -35,6 +39,41 @@ export class ProductFormComponent implements OnInit {
} }
this.userForm.patchValue(this.data) 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(){ cancel(){
this.windowService this.windowService

View File

@ -138,7 +138,9 @@ export class ProductComponent {
width: '500px', width: '500px',
height: '300px', 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 // Subscribe to the afterClosed event
windowRef.onClose.subscribe((data) => { windowRef.onClose.subscribe((data) => {
@ -157,7 +159,7 @@ export class ProductComponent {
onSaveConfirm(event) { onSaveConfirm(event) {
console.log("Edit Event In Console") console.log("Edit Event In Console")
console.log(event); console.log(event);
// event = {action:'Edit'}
const buttonsConfig: NbWindowControlButtonsConfig = { const buttonsConfig: NbWindowControlButtonsConfig = {
minimize: this.minimize, minimize: this.minimize,
maximize: this.maximize, maximize: this.maximize,