Merge branch 'master' of bitbucket.org:venbainformationtechnology/vnms_admin_fe

This commit is contained in:
bitbucket 2023-09-04 18:34:18 +05:30
commit df28b04cfe
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'">
<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">

View File

@ -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]),
});

View File

@ -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

View File

@ -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>

View File

@ -29,7 +29,7 @@
<nb-card-body>
<div class="row show-grid">
<div class="col-6 col-md-4">
<div class="col-6 col-md-5">
<div>
<label for="exampleInputEmail1" class="label">Customer</label> <br />
<span *ngIf="fieldTitle == 'View Order'">{{selectCustomer}}</span>
@ -45,26 +45,26 @@
<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 class="col-6 col-md-4">
<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 class="col-6 col-md-2">
<!-- <div>
<!-- <div class="col-6 col-md-1">
<div>
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
</div> -->
</div>
</div>
<div class="col-6 col-md-4">
<!-- <div>
<div>
<label for="subject" style=" font-weight: 600;"></label>
</div>
</div> -->
</div>
</div>
<!-- <input type="text" nbInput fullWidth placeholder="Project">-->
</div>
</div>
<div class="col-6 col-md-4">
<div class="col-6 col-md-3">
<div>
<!-- <nb-select selected="DRIVER" >
<nb-option value="DRIVER">DRIVER</nb-option>
@ -78,7 +78,7 @@
<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>
<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>

View File

@ -704,22 +704,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(){
@ -842,7 +843,7 @@ this.onCreateConfirm()
}
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);
}
@ -908,4 +909,5 @@ onCreateConfirm() {
});
}
}

View File

@ -224,7 +224,7 @@
</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}}
{{row.item.status}} <p class="checkTxt" *ngIf="row.item.status == 'Delivered'">({{row.item['UserDetails.userName']}})</p>
</span>
</div>

View File

@ -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>

View File

@ -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

View File

@ -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,