FE code new changes
This commit is contained in:
parent
21774f682d
commit
5441e4bf17
@ -50,7 +50,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.userName = localStorage.getItem('user_role')
|
||||
|
||||
this.userName = localStorage.getItem('user_name')
|
||||
this.currentTheme = this.themeService.currentTheme;
|
||||
console.log(this.userService)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<h1 id="title" class="title">Forgot Password</h1>
|
||||
<p class="sub-title" *ngIf="resetLink == 0">Enter your email address and we’ll send a link to reset your password</p>
|
||||
<p class="sub-title" *ngIf="resetLink == 0">Enter your email address and we’ll send a OTP to reset your password</p>
|
||||
|
||||
<!-- <nb-alert *ngIf="showMessages.error && errors?.length && !submitted" outline="danger" role="alert">
|
||||
<p class="alert-title"><b>Oh snap!</b></p>
|
||||
@ -36,8 +36,8 @@
|
||||
</div>
|
||||
|
||||
<button nbButton
|
||||
fullWidth
|
||||
status="primary"
|
||||
fullWidth status="success"
|
||||
|
||||
size="large"
|
||||
[disabled]="submitted || !form.get('email').valid"
|
||||
[class.btn-pulse]="submitted" type="submit">
|
||||
|
||||
@ -68,7 +68,7 @@ export class ForgotPasswordComponent implements OnInit {
|
||||
fullScreen: this.fullScreen,
|
||||
close: this.close,
|
||||
};
|
||||
const windowRef: NbWindowRef = this.windowService.open(OtpComponent, { title: `Otp`, context: forgotMail
|
||||
const windowRef: NbWindowRef = this.windowService.open(OtpComponent, { title: `OTP`, context: forgotMail
|
||||
, buttons: buttonsConfig });
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<a class="forgot-password caption-2" routerLink="../request-password" (click)="openForgot()">Forgot Password?</a>
|
||||
</span>
|
||||
</div>
|
||||
<button type="submit" [disabled]="!loginForm.valid" nbButton fullWidth status="success" size="large">Sign in</button>
|
||||
<button type="submit" style=" width: 95%;" [disabled]="!loginForm.valid" nbButton fullWidth status="success" size="large">Sign in</button>
|
||||
</form>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
|
||||
@ -63,6 +63,7 @@ export class LoginComponent implements OnInit {
|
||||
if (res.token !== '') {
|
||||
localStorage.setItem('user_token',res.token);
|
||||
localStorage.setItem('user_role',res.role);
|
||||
localStorage.setItem('user_name',res.UserName);
|
||||
localStorage.setItem('roleId',res.roleId);
|
||||
|
||||
localStorage.setItem('email',JSON.stringify(auth))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<form class="form" [formGroup]="otpform" (ngSubmit)="onSubmit()">
|
||||
|
||||
<label class="text-label" for="text">Enter Your Otp:</label>
|
||||
<label class="text-label" for="text">Enter Your OTP:</label>
|
||||
<input nbInput formControlName="reason" id="text">
|
||||
|
||||
<nb-card-footer>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<form [formGroup]="form" (ngSubmit)="submit()" aria-labelledby="title">
|
||||
<div class="form-group">
|
||||
<nb-form-field>
|
||||
<label class="label">Password</label>
|
||||
<label class="label">New Password</label>
|
||||
<div class="input-with-icon">
|
||||
<input [type]="getInputType(1)" nbInput formControlName="password" placeholder="Password">
|
||||
<nb-icon class="eyeIcon" style="margin-left: -2rem;" [icon]="showPassword ? 'eye-outline' : 'eye-off-2-outline'"
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<nb-form-field>
|
||||
<label class="label">Password</label>
|
||||
<label class="label">Confirm Password</label>
|
||||
<div class="input-with-icon">
|
||||
<input [type]="getInputType(2)" nbInput formControlName="confirm_password" placeholder="Password">
|
||||
<nb-icon class="eyeIcon" style="margin-left: -2rem;" [icon]="showPassword2 ? 'eye-outline' : 'eye-off-2-outline'"
|
||||
@ -63,10 +63,10 @@
|
||||
<div class="caption status-danger" *ngIf="form.get('confirm_password')?.invalid && (form.get('confirm_password')?.dirty || form.get('confirm_password')?.touched) && form.get('confirm_password')?.errors?.required">
|
||||
Password is required!
|
||||
</div>
|
||||
<div class="caption status-danger" *ngIf="!form.get('confirm_password')?.errors?.required">
|
||||
<!-- <div class="caption status-danger" *ngIf="!form.get('confirm_password')?.errors?.required">
|
||||
Password length must be greater than or equal to 8 and password must contain one or more uppercase , lowercase , numeric and special characters
|
||||
</div>
|
||||
<div class="caption status-danger" *ngIf="form.get('confirm_password').value != form.get('confirm_password').value">
|
||||
</div> -->
|
||||
<div class="caption status-danger" *ngIf="form.get('password').value != form.get('confirm_password').value">
|
||||
Password does not match the confirm password.
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@ -25,12 +25,15 @@
|
||||
</nb-form-field>
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<nb-form-field *ngIf="heading != 'Edit Customer'">
|
||||
<nb-form-field >
|
||||
<label for="subject">Password:</label>
|
||||
<input formControlName="password" nbInput id="password" type="text" [status]="userForm.get('password').invalid && userForm.get('password').touched? 'danger' : 'basic'">
|
||||
|
||||
<ng-container nbInputErrorMessage>
|
||||
|
||||
<div style="color:#7c0e0e;font-size:small" *ngIf="!userForm.get('password')?.errors?.required && (userForm.get('password')?.errors?.pattern)">
|
||||
Password length must be greater than or equal to 8
|
||||
</div>
|
||||
|
||||
<!-- <div style="color:#7c0e0e" *ngIf="!userForm.get('password')?.errors?.required">
|
||||
Password length must be greater than or equal to 8 and password must contain one or more uppercase , lowercase , numeric and special characters
|
||||
@ -116,7 +119,7 @@
|
||||
</div>
|
||||
<nb-card-footer>
|
||||
<button class="cancel" nbButton status="danger" type="button" (click)="cancel()">Cancel</button>
|
||||
<button nbButton status="success" type="submit">Submit</button>
|
||||
<button nbButton status="success" [disabled]="!userForm.valid" type="submit">Submit</button>
|
||||
</nb-card-footer>
|
||||
</form>
|
||||
</nb-card-body>
|
||||
|
||||
@ -42,7 +42,7 @@ export class CustomerFormComponent implements OnInit {
|
||||
password: new FormControl('', [Validators.required,Validators.pattern(
|
||||
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$'
|
||||
)]),
|
||||
address_1: new FormControl('', [Validators.required,Validators.maxLength(100)]),
|
||||
address_1: new FormControl('', [Validators.required]),
|
||||
state: new FormControl('', [Validators.required]),
|
||||
city: new FormControl('', [Validators.required]),
|
||||
pincode: new FormControl('', [Validators.required]),
|
||||
@ -55,6 +55,7 @@ export class CustomerFormComponent implements OnInit {
|
||||
this.data.pincode = this.data['CusDetails.pincode']
|
||||
this.data.cusType = this.data['CusDetails.cusType']
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
delete this.data.password
|
||||
this.userForm.controls['password'].clearValidators();
|
||||
this.userForm.controls['password'].updateValueAndValidity();
|
||||
}
|
||||
@ -91,6 +92,8 @@ export class CustomerFormComponent implements OnInit {
|
||||
|
||||
if(this.data.hasOwnProperty('customerId')){
|
||||
cus.id = this.data.customerId
|
||||
}else{
|
||||
|
||||
}
|
||||
console.log(cus)
|
||||
|
||||
@ -100,7 +103,10 @@ export class CustomerFormComponent implements OnInit {
|
||||
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
this.formData.append('password', tmp.password);
|
||||
if((tmp.password != "")){
|
||||
this.formData.append('password', tmp.password);
|
||||
}
|
||||
|
||||
this.formData.append('role', 'CUSTOMER');
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
|
||||
|
||||
@ -138,8 +138,9 @@
|
||||
<span class="check" (click)="onDeleteConfirm(row.item)">
|
||||
<i class="nb-trash" ></i>
|
||||
</span> -->
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
<nb-icon icon="refresh-outline" title="Reset Password" style="margin-left: 1rem;" (click)="resetPassword(row.item)"></nb-icon>
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem; text-align: center;
|
||||
width: 100%;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
@ -147,9 +147,9 @@ export class CustomerComponent {
|
||||
console.log(res)
|
||||
this.getuserlistApi();
|
||||
if(event.isActive == 1){
|
||||
this.showToast('success', 'Data Removed Successfully', 'Active Customer Data Completed..!');
|
||||
this.showToast('success', 'Active Customer Data Completed..!', '');
|
||||
}else{
|
||||
this.showToast('success', 'Data Removed Successfully', 'Inactive Customer Data Completed..!');
|
||||
this.showToast('success', 'Inactive Customer Data Completed..!', '');
|
||||
}
|
||||
|
||||
//this.showToast('success', 'Data Removed Successfully', 'Removed User Data Completed..!');
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div> <nb-icon icon="pie-chart-outline"></nb-icon> Dashboard</div>
|
||||
<div> <nb-icon icon="pie-chart-outline"></nb-icon> Dashboard (Last 7 Days)</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<nb-card>
|
||||
<nb-card-header style=" background-color: #0fb90482;">
|
||||
<nb-icon icon="done-all-outline"></nb-icon> Orders
|
||||
<nb-icon icon="done-all-outline"></nb-icon> Pending Orders
|
||||
</nb-card-header>
|
||||
<nb-card-body>
|
||||
<div class="row">
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
Please enter a valid email address
|
||||
</div>
|
||||
</ng-container>
|
||||
<label *ngIf="!data.hasOwnProperty('id')" for="subject">Password:</label>
|
||||
<input *ngIf="!data.hasOwnProperty('id')" formControlName="password" nbInput id="password" type="text" [status]="userForm.get('password').invalid && userForm.get('password').touched? 'danger' : 'basic'">
|
||||
<label for="subject">Password:</label>
|
||||
<input formControlName="password" nbInput id="password" type="text" [status]="userForm.get('password').invalid && userForm.get('password').touched? 'danger' : 'basic'">
|
||||
<ng-container nbInputErrorMessage>
|
||||
|
||||
|
||||
<!-- <div style="color:#7c0e0e" *ngIf="!userForm.get('password')?.errors?.required">
|
||||
Password length must be greater than or equal to 8 and password must contain one or more uppercase , lowercase , numeric and special characters
|
||||
</div> -->
|
||||
<div style="color:#7c0e0e" *ngIf="!userForm.get('password')?.errors?.required && (userForm.get('password')?.errors?.pattern)">
|
||||
Password length must be greater than or equal to 8
|
||||
</div>
|
||||
<div style="color:#7c0e0e" *ngIf="userForm.get('password')?.invalid && (userForm.get('password')?.dirty || userForm.get('password')?.touched) && userForm.get('password')?.errors?.required">
|
||||
Password is required
|
||||
</div>
|
||||
|
||||
@ -32,10 +32,13 @@ export class DriverFormComponent implements OnInit {
|
||||
'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
|
||||
)]),
|
||||
// password: new FormControl('', [Validators.required, Validators.minLength(6)]),
|
||||
password: new FormControl('', [Validators.required]),
|
||||
password: new FormControl('', [Validators.required,Validators.pattern(
|
||||
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$'
|
||||
)]),
|
||||
|
||||
});
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
delete this.data.password
|
||||
this.userForm.controls['password'].clearValidators();
|
||||
this.userForm.controls['password'].updateValueAndValidity();
|
||||
}
|
||||
@ -55,13 +58,23 @@ export class DriverFormComponent implements OnInit {
|
||||
this.formData= new FormData();
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
this.formData.append('id', this.data.id);
|
||||
|
||||
}
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
this.formData.append('password', tmp.password);
|
||||
this.formData.append('role', 'DRIVER');
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
if(tmp.password != ""){
|
||||
this.formData.append('password', tmp.password);
|
||||
}
|
||||
|
||||
this.formData.append('role', 'DRIVER');
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
} else{
|
||||
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
this.formData.append('password', tmp.password);
|
||||
this.formData.append('role', 'DRIVER');
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
}
|
||||
|
||||
|
||||
this._api.addUserFormDetails (this.formData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
|
||||
@ -144,8 +144,9 @@
|
||||
</span>
|
||||
<span class="check" (click)="onDeleteConfirm(row.item)">
|
||||
<i class="nb-trash" ></i> -->
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
<nb-icon icon="refresh-outline" title="Reset Password" style="margin-left: 1rem;" (click)="resetPassword(row.item)"></nb-icon>
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem; text-align: center;
|
||||
width: 100%;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
<!-- <nb-icon icon="refresh-outline" title="Reset Password" style="margin-left: 1rem;" (click)="resetPassword(row.item)"></nb-icon> -->
|
||||
<!-- </span> -->
|
||||
</div>
|
||||
|
||||
|
||||
@ -105,9 +105,9 @@ export class DriverComponent {
|
||||
console.log(res)
|
||||
this.getuserlistApi();
|
||||
if(event.isActive == 1){
|
||||
this.showToast('success', 'Data Removed Successfully', 'Active Driver Data Completed..!');
|
||||
this.showToast('success', 'Active Driver Data Completed..!', '');
|
||||
}else{
|
||||
this.showToast('success', 'Data Removed Successfully', 'Inactive Driver Data Completed..!');
|
||||
this.showToast('success', 'Inactive Driver Data Completed..!', '');
|
||||
}
|
||||
//this.showToast('success', 'Data Removed Successfully', 'Removed Driver Data Completed..!');
|
||||
}else{
|
||||
|
||||
@ -24,8 +24,11 @@
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-4">
|
||||
<div> <input nbInput class="fx-date-range" type="text"
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker">
|
||||
<nb-datepicker #dateTimePicker (dateChange)="onStartDateChanged($event)" ></nb-datepicker>
|
||||
<!-- <input nbInput class="fx-date-range" type="text"
|
||||
ngxDaterangepickerMd
|
||||
[locale]="{applyLabel: 'okay', format: 'DD/MM/YY'}"
|
||||
[drops]="'down'"
|
||||
@ -39,34 +42,45 @@
|
||||
[showCancel]="true"
|
||||
autocomplete="off"
|
||||
[(ngModel)]="selectedDateRange"
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/></div>
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/> -->
|
||||
<nb-select selected="" style="width: 100% !important;margin-left: 2rem;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<button (click)="generate()" nbButton status="primary" style="margin-left: 2rem;" hero>
|
||||
generate
|
||||
</button>
|
||||
|
||||
<button (click)="download()" nbButton nbTooltip="Download" nbTooltipPlacement="top" style="margin-left: 2rem;" status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div >
|
||||
<nb-select selected="" style="width: 100% !important;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div >
|
||||
|
||||
<button (click)="download()" nbButton status="success" hero>
|
||||
|
||||
<!-- <button (click)="download()" nbButton status="success" hero>
|
||||
Download
|
||||
</button>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
|
||||
<h5 *ngIf="summaryaData.length==0 && driverName.length>0" style="text-align: center;">No Data Found For Selected Driver</h5>
|
||||
<div id="table" style="text-align: center;margin-bottom: 1rem;">
|
||||
<nb-card-header *ngIf="summaryaData.length>0" style="text-align: center;"><img src="assets/images/VN_Medical_Logo.png" alt="vnms" width="120" height="50" style="padding-right: 1rem;"> </nb-card-header>
|
||||
|
||||
@ -74,7 +88,7 @@
|
||||
|
||||
<div class="row show-grid" style=" margin-top: 2rem;">
|
||||
<div class="col-md-4">
|
||||
<div> https://vnms.in/services/</div>
|
||||
<div> Driver Name: {{driverName}}</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div style="text-align: center;"> Delivery Sheet</div>
|
||||
@ -106,7 +120,7 @@
|
||||
[sortable]="false"
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
[width]="3">
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
@ -115,19 +129,19 @@
|
||||
[sortable]="false"
|
||||
[title]="'Customer'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
[width]="5">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div style="display: flex; align-items: center;text-align: center;">
|
||||
<div style=" text-align: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item['OrderDetails.CusDetails.cusName']}} <br />
|
||||
{{row.item['OrderDetails.CusDetails.address_1']}} <br />
|
||||
{{row.item['OrderDetails.CusDetails.city']}} <br />
|
||||
{{row.item['OrderDetails.CusDetails.pincode']}} <br />
|
||||
{{row.item.cusName}} <br />
|
||||
{{row.item.address_1}} <br />
|
||||
{{row.item.city}} <br />
|
||||
{{row.item.pincode}} <br />
|
||||
|
||||
ph:- {{row.item['OrderDetails.CusDetails.phoneNo']}}
|
||||
ph:- {{row.item.phoneNo}}
|
||||
|
||||
|
||||
</span>
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
93
src/app/pages/order/add-order/add-order.component.html
Normal file
93
src/app/pages/order/add-order/add-order.component.html
Normal file
@ -0,0 +1,93 @@
|
||||
<nb-card>
|
||||
<nb-card-header>{{heading}}</nb-card-header>
|
||||
<nb-card-body>
|
||||
<div class="row show-grid" *ngIf="product.length>0" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">Product</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">Qty</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">Cylinder No</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div *ngFor="let fieldGroup of inputFieldGroups; let i = index">
|
||||
<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-option value="">Select Drivers</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>
|
||||
<!-- <label for="subject" style=" font-weight: 600;">Mixed Gas {{i+1}}:</label> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<!-- <label for="subject" style=" font-weight: 600;">{{ fieldGroup.qty }}</label> -->
|
||||
<input nbInput style="width: 50%;" [(ngModel)]="fieldGroup.qty" type="number">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
|
||||
<!-- <label for="subject" style=" font-weight: 600;">({{ fieldGroup.productSpec }})</label> -->
|
||||
<input nbInput style=" width: 100%;" [(ngModel)]="fieldGroup.productSpec" placeholder="Cylinder No" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<nb-actions size="medium" >
|
||||
<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-actions>
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<nb-card-footer>
|
||||
<button class="cancel" nbButton status="danger" type="button" (click)="cancel()">Cancel</button>
|
||||
<button nbButton status="success" (click)="save()" type="submit">Submit</button>
|
||||
</nb-card-footer>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
|
||||
19
src/app/pages/order/add-order/add-order.component.scss
Normal file
19
src/app/pages/order/add-order/add-order.component.scss
Normal file
@ -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;
|
||||
}
|
||||
|
||||
23
src/app/pages/order/add-order/add-order.component.spec.ts
Normal file
23
src/app/pages/order/add-order/add-order.component.spec.ts
Normal file
@ -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<AddOrderComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AddOrderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AddOrderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
129
src/app/pages/order/add-order/add-order.component.ts
Normal file
129
src/app/pages/order/add-order/add-order.component.ts
Normal file
@ -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<AddOrderComponent> ,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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,16 +8,18 @@
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div style="text-align: end;">
|
||||
<button (click)="back()" nbButton status="success" hero>
|
||||
Back
|
||||
<button nbTooltip="Back" nbTooltipPlacement="top" (click)="back()" nbButton status="warning" hero>
|
||||
<nb-icon icon="corner-down-left-outline"></nb-icon>
|
||||
|
||||
|
||||
</button>
|
||||
|
||||
<button *ngIf="setData.status =='ordered' && fieldTitle != 'Edit Order'" style=" margin-left: 2rem;" (click)="edit()" nbButton status="primary" hero>
|
||||
Edit
|
||||
<button nbTooltip="Edit" nbTooltipPlacement="top" *ngIf=" fieldTitle != 'Edit Order'" style=" margin-left: 2rem;" (click)="edit()" nbButton status="primary" hero>
|
||||
<nb-icon icon="edit-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<button style=" margin-left: 2rem;"(click)="generatePDF('print')" nbButton status="primary" hero>
|
||||
Print
|
||||
<button nbTooltip="Download" nbTooltipPlacement="top" style=" margin-left: 2rem;"(click)="generatePDF('download')" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,6 +42,25 @@
|
||||
}}</nb-option>
|
||||
|
||||
</nb-select>
|
||||
<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>
|
||||
<label for="subject" style=" font-weight: 500;">{{selectCustomerData['CusDetails.address_1']}} , {{selectCustomerData['CusDetails.city']}},<br />Contact No-({{selectCustomerData['CusDetails.phoneNo']}}) </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;"></label>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <input type="text" nbInput fullWidth placeholder="Project">-->
|
||||
</div>
|
||||
</div>
|
||||
@ -57,7 +78,30 @@
|
||||
|
||||
<p> {{setData.orderId}} </p> <br />
|
||||
<div style="font-size: larger;font-weight: 600;"> Status</div>
|
||||
<p style="text-transform: capitalize;" [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}}) </p>
|
||||
<nb-select selected="" *ngIf="fieldTitle != 'View Order' " 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>
|
||||
<nb-option value="In Progress" >In Progresss</nb-option>
|
||||
<nb-option value="Out For Delivery" >Out For Delivery</nb-option>
|
||||
|
||||
<nb-option value="Delivered" >Delivered</nb-option>
|
||||
<nb-option value="Cancelled" >Cancelled</nb-option>
|
||||
|
||||
</nb-select>
|
||||
|
||||
<nb-select selected="" placeholder="Select Drivers" *ngIf="fieldTitle != 'View Order' && selectStatus == 'Out For Delivery'" [(ngModel)]="selectDriver" style="width: 57% !important;margin-right: 1rem;margin-top: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && selectStatus == 'Cancelled'" [(ngModel)]="CancelReason" placeholder="Reason" style=" margin-right: 2%;margin-top: 1rem;" id="text"> <br />
|
||||
<button *ngIf="fieldTitle != 'View Order' " (click)="onSubmit2()" style="margin-top: 1rem;" type="submit" nbButton status="success" hero>
|
||||
Save
|
||||
</button>
|
||||
<span *ngIf="setData.status =='Cancelled'">Reason: {{setData.reason}} </span>
|
||||
<!-- <nb-select selected="DRIVER" >
|
||||
<nb-option value="DRIVER">DRIVER</nb-option>
|
||||
@ -67,41 +111,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div style="font-size: larger;"> Shipping Information</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <div style=" text-align: end;">
|
||||
<button (click)="back()" nbButton status="success" hero>
|
||||
Back
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<div class="row show-grid" *ngIf="product.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 500;">{{selectCustomerData['CusDetails.address_1']}} , {{selectCustomerData['CusDetails.city']}},Contact No-({{selectCustomerData['CusDetails.phoneNo']}}) </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;width: 30%;">Qty:</label>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<!-- <div>
|
||||
<label for="subject" style=" font-weight: 600;"></label>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
@ -118,7 +131,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
<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>
|
||||
<label for="subject" style=" font-weight: 600;">Products: ( <span style="color:#ba0404">{{selectCustomerData['CusDetails.cusType'] ||setData['OrderDetails.CusDetails.cusType'] }}</span>)</label>
|
||||
@ -131,37 +144,225 @@
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
<label for="subject" style=" font-weight: 600;"></label>
|
||||
<label for="subject" style=" font-weight: 600;"> </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of product; index as j">
|
||||
|
||||
<div class="row show-grid">
|
||||
|
||||
<div *ngFor="let fieldGroup of inputFieldGroups; let i = index">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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-option value="">Select Drivers</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>
|
||||
<!-- <label for="subject" style=" font-weight: 600;">Mixed Gas {{i+1}}:</label> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">{{ fieldGroup.qty }}</label>
|
||||
<input nbInput style="width: 50%;" *ngIf="fieldTitle != 'View Order'" [(ngModel)]="fieldGroup.qty" type="number">
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">({{ fieldGroup.productSpec }})</label>
|
||||
<input nbInput *ngIf="fieldTitle != 'View Order' && fieldGroup.id == 6" style=" width: 100%;" [(ngModel)]="fieldGroup.productSpec" placeholder="eg:- N2:CO2:O2 - 50:30:20" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<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-actions>
|
||||
<!-- <button nbButton status="success" (click)="addInputFieldGroup()" style="margin-right: 1rem;"> Add </button> -->
|
||||
<!-- <button nbButton status="danger" (click)="removeInputFieldGroup(i)">Remove</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of ResultDisplay; index as j">
|
||||
|
||||
<div class="row show-grid" *ngIf="fieldTitle == 'View Order'">
|
||||
<div class="col-6 col-md-3">
|
||||
<div *ngIf=" item.productName != 'Mixed Gas'">
|
||||
<label for="subject" style=" font-weight: 600;">{{ item.productName }}</label>
|
||||
<!-- <nb-checkbox [(ngModel)]="item.checked">{{ item.productName }}</nb-checkbox> -->
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.ProductDetails[0].productName }} <br />({{item.ProductDetails[0].skuId}} ) <br />
|
||||
<span *ngIf="item.productSpec != null " >{{ item.productSpec }}</span>
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div *ngIf=" item.productName != 'Mixed Gas'">
|
||||
<label for="subject" *ngIf="fieldTitle == 'View Order'" style=" font-weight: 600;">{{ item.qty }}</label>
|
||||
<input nbInput type="number" *ngIf="fieldTitle != 'View Order'" min="0" style="width: 50%;" [(ngModel)]="item.qty">
|
||||
<div >
|
||||
<label for="subject" *ngIf="item.qty != 0 " style=" font-weight: 600;">{{ item.qty }}</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div *ngIf=" item.productName != 'Mixed Gas'">
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<div >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ngx-mixed-form (childButtonEvent)="receivedMessageHandler($event)"
|
||||
(onInitEvent)="receiveAutoMsgHandler($event)" *ngIf="item.productName == 'Mixed Gas'"></ngx-mixed-form>
|
||||
<!-- <ngx-mixed-form (childButtonEvent)="receivedMessageHandler($event)"
|
||||
(onInitEvent)="receiveAutoMsgHandler($event)" *ngIf="item.productName == 'Mixed Gas'"></ngx-mixed-form> -->
|
||||
</div>
|
||||
<nb-card-header>
|
||||
|
||||
<hr>
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-md-6">
|
||||
<div style="font-size: larger; color: #182ea1;"> Return Information</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <div style=" text-align: end;">
|
||||
<button (click)="back()" nbButton status="success" hero>
|
||||
Back
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
|
||||
<div >
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="productlistReturn.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Product Name</span></label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><span>Qty</span></label> <br>
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;"><h6></h6></label>
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></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> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngFor="let dataVal of productlistReturn; let i = index" >
|
||||
<div *ngIf="productlistReturn.length>0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;">#</label>
|
||||
<label for="subject" style=" font-weight: 600;margin-left: 1rem;">{{dataVal.ProductDetails[0]. productName}}</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">{{dataVal.qty}}</label> <br>
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;">Cylinder No: {{dataVal.cylinderNo}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<!-- <nb-icon icon="eye-outline" style="color: green;" ></nb-icon> -->
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></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> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<nb-card-footer>
|
||||
@ -183,7 +384,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div *ngIf="fieldTitle != 'View Order'">
|
||||
<button nbButton status="success" (click)="save()" style="margin-right: 10px;" type="submit" >Submit</button>
|
||||
<button nbButton status="success" (click)="saveNew()" style="margin-right: 10px;" type="submit" >Submit</button>
|
||||
<button type="button" class="cancel" nbButton status="danger" (click)="cancelData()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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..!');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
{{ item.productName }}
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
|
||||
@ -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')){
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<nb-card-header>
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-2">
|
||||
<div> <nb-icon icon="shopping-bag-outline"></nb-icon> Order Management</div>
|
||||
|
||||
</div>
|
||||
@ -12,7 +12,10 @@
|
||||
<!-- <button (click)="Assign()" nbButton status="primary" hero>
|
||||
Assign Driver
|
||||
</button> -->
|
||||
<input nbInput class="fx-date-range" type="text"
|
||||
<input nbInput placeholder="Pick Date Range" [nbDatepicker]="formpicker">
|
||||
<nb-rangepicker #formpicker (rangeChange)="manipulateDate($event)"[startDate]="defaultStartDate" [endDate]="defaultEndDate"></nb-rangepicker>
|
||||
|
||||
<!-- <input nbInput class="fx-date-range" type="text"
|
||||
ngxDaterangepickerMd
|
||||
[locale]="{applyLabel: 'okay', format: 'MM/DD/YY'}"
|
||||
[drops]="'down'"
|
||||
@ -24,11 +27,11 @@
|
||||
[showCancel]="true"
|
||||
autocomplete="off"
|
||||
[(ngModel)]="selectedDateRange"
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/>
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<div style=" text-align: end;">
|
||||
<!-- <button (click)="Assign()" nbButton status="primary" hero>
|
||||
Assign Driver
|
||||
@ -38,14 +41,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div style=" text-align: end;">
|
||||
<!-- <button (click)="Assign()" nbButton status="primary" hero>
|
||||
Assign Driver
|
||||
</button> -->
|
||||
<button (click)="onCreateConfirm()" nbButton status="primary" hero>
|
||||
Add Order
|
||||
<div class="col-md-4">
|
||||
<div style=" text-align: end;">
|
||||
<button (click)="refresh()" nbTooltip="Refresh" nbTooltipPlacement="top" nbButton status="warning" hero>
|
||||
<nb-icon icon="flip-outline"></nb-icon>
|
||||
</button>
|
||||
<button style=" margin-left: 1rem;" nbButton nbTooltip="Add Order" nbTooltipPlacement="top" (click)="onCreateConfirm()" nbButton status="primary" hero>
|
||||
<nb-icon icon="plus-circle-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
<button style=" margin-left: 1rem;" nbButton nbTooltip="Download" nbTooltipPlacement="top" (click)="download()" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,7 +73,8 @@
|
||||
[selectMode]="'multi'"
|
||||
[minContentHeight]="350"
|
||||
[selectMode]="'multi'"
|
||||
|
||||
[selectOnRowClick]="true"
|
||||
|
||||
[limit]="25"
|
||||
>
|
||||
|
||||
@ -79,7 +87,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<ng-template #ngDataTableHeader let-column="column" >
|
||||
<tr ><th class="center" style=" font-size: large; text-align: -webkit-center;"> <div style="text-align: center;">
|
||||
|
||||
<nb-checkbox (change)="onCheckboxChange($event)" status="primary" ></nb-checkbox>
|
||||
</div></th></tr>
|
||||
<!-- <tr ><th class="center" style="text-align: -webkit-center;" >{{tableTitle.Y4_st_type_name}}</th></tr> -->
|
||||
|
||||
</ng-template>
|
||||
|
||||
|
||||
|
||||
@ -113,7 +128,17 @@
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.orderId }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'customer'"
|
||||
@ -121,7 +146,18 @@
|
||||
[title]="'Customer Name'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.customer }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'address'"
|
||||
@ -129,7 +165,17 @@
|
||||
[title]="'Address'"
|
||||
[filterable]="false"
|
||||
[width]="6">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
{{row.item.address }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'orderDate'"
|
||||
@ -139,7 +185,7 @@
|
||||
[width]="4">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<span class="checkTxt" >
|
||||
@ -170,7 +216,7 @@
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<td (click)="onViewConfirm(row.item)">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span [ngStyle] = "{'color':row.item.status =='Out For Delivery'?'blue':'' }" class="checkTxt" *ngIf="row.item.status =='Out For Delivery'" >
|
||||
{{row.item.status}} <p class="checkTxt" >({{row.item['UserDetails.userName']}})</p>
|
||||
@ -194,7 +240,7 @@
|
||||
</ng-data-table-column> -->
|
||||
|
||||
|
||||
<ng-data-table-column
|
||||
<!-- <ng-data-table-column
|
||||
[field]="'role'"
|
||||
[sortable]="false"
|
||||
[title]="'view'"
|
||||
@ -211,30 +257,17 @@
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<!-- <div class="align-center" style="display: flex; align-items: center;">
|
||||
<span *ngIf="row.item.status !='Out For Delivery' && row.item.status !='Cancelled'" class="check" (click)="viewData(row.item)">
|
||||
<i class="nb-list" ></i>
|
||||
</span>
|
||||
|
||||
<span *ngIf="row.item.status !='Out For Delivery' && row.item.status !='Cancelled'" class="check" (click)="onSaveConfirm(row.item)">
|
||||
<i class="nb-edit" ></i>
|
||||
</span>
|
||||
|
||||
<span *ngIf="row.item.status !='Out For Delivery' && row.item.status !='Cancelled'" class="check" (click)="onDeleteConfirm(row.item)">
|
||||
<i class="nb-trash" ></i>
|
||||
</span>
|
||||
</div> -->
|
||||
<div style="align-items: center;">
|
||||
|
||||
<div style="align-items: center;text-align: center;">
|
||||
<nb-icon icon="eye-outline" title="View" style="color: green;" (click)="onViewConfirm(row.item)"></nb-icon>
|
||||
<!-- <nb-icon icon="edit-outline" *ngIf="row.item.status =='ordered'" style="margin-left: 1rem;" (click)="onSaveConfirm(row.item)"></nb-icon> -->
|
||||
<nb-icon icon="close-square-outline" title="Cancel" *ngIf="row.item.status !='Cancelled'" style="margin-left: 1rem;color: red;" (click)="onDeleteConfirm(row.item)"></nb-icon>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
</ng-data-table-column>
|
||||
</ng-data-table-column> -->
|
||||
|
||||
</ng-data-table>
|
||||
|
||||
@ -242,51 +275,60 @@
|
||||
|
||||
|
||||
<nb-card-footer>
|
||||
<form class="form" [formGroup]="driverForm" (ngSubmit)="onSubmit()">
|
||||
<!-- <form class="form" [formGroup]="driverForm" (ngSubmit)="onSubmit()"> -->
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-2">
|
||||
<div style="text-align: center;">
|
||||
|
||||
<nb-checkbox [(ngModel)]="isChecked" (click)="selectall()" status="primary" >Select All</nb-checkbox>
|
||||
<nb-checkbox (change)="onCheckboxChange($event)" status="primary" >Select All</nb-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-4">
|
||||
<div>
|
||||
|
||||
<nb-select selected="" placeholder="Change Status" clearable style="width: 100% !important;" [(ngModel)]="selectStatus" >
|
||||
<!-- <nb-option value="">Change Status</nb-option> -->
|
||||
<nb-option value="ordered" >Ordered</nb-option>
|
||||
<nb-option value="In Progress" >In Progresss</nb-option>
|
||||
<nb-option value="Out For Delivery" >Out For Delivery</nb-option>
|
||||
|
||||
<!-- <nb-option value="Delivered" >Delivered</nb-option> -->
|
||||
<nb-option value="Cancelled" >Cancelled</nb-option>
|
||||
|
||||
</nb-select>
|
||||
<!-- <label for="subject">Drivers:</label> <br /> -->
|
||||
<nb-select selected="" formControlName="driver" style="width: 100% !important;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-md-3">
|
||||
<div >
|
||||
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="col-md-5">
|
||||
<div >
|
||||
<nb-select selected="" placeholder="Select Drivers" *ngIf="selectStatus == 'Out For Delivery'" [(ngModel)]="selectDriver" style="width: 100% !important;margin-right: 1rem;" >
|
||||
<!-- <nb-option value="">Select Drivers</nb-option> -->
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="checkType(user)" [value]="user.id
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div >
|
||||
<button [disabled]="!driverForm.valid" type="submit" nbButton status="primary" hero>
|
||||
Assign Orders
|
||||
<input nbInput *ngIf="selectStatus == 'Cancelled'" [(ngModel)]="CancelReason" placeholder="Reason" style=" margin-right: 2%;" id="text">
|
||||
<button (click)="onSubmit2()" type="submit" nbButton status="primary" hero>
|
||||
Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-5">
|
||||
<!-- <div class="col-md-5">
|
||||
<div style="text-align: end;">
|
||||
<nb-select selected="" style="width: 100% !important;" >
|
||||
<nb-option value="">Change Status</nb-option>
|
||||
|
||||
<nb-option value="In Progress" (click)="onSubmit2()" >In Progresss</nb-option>
|
||||
|
||||
|
||||
|
||||
</nb-select>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</form>
|
||||
<!-- </form> -->
|
||||
</nb-card-footer>
|
||||
|
||||
</nb-card>
|
||||
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@ public mixDetails_observable$ = this.mixDetails.asObservable();
|
||||
}
|
||||
getDriverSheet(param): Observable<any> {
|
||||
//console.log(params.email)
|
||||
return this._http.post<any>(this.apiUrl + "getDriverSheet",param)
|
||||
return this._http.post<any>(this.apiUrl + "getDriverSheetAdmin",param)
|
||||
|
||||
}
|
||||
|
||||
@ -57,7 +57,11 @@ public mixDetails_observable$ = this.mixDetails.asObservable();
|
||||
return this._http.post<any>(this.apiUrl + "getProductDeliverysheet",param)
|
||||
|
||||
}
|
||||
|
||||
getProductReturnsheet(param): Observable<any> {
|
||||
//console.log(params.email)
|
||||
return this._http.post<any>(this.apiUrl + "getProductReturnsheet",param)
|
||||
|
||||
}
|
||||
|
||||
|
||||
getProductListSummary(param): Observable<any> {
|
||||
@ -112,7 +116,10 @@ public mixDetails_observable$ = this.mixDetails.asObservable();
|
||||
return this._http.post(this.apiUrl + 'getProductList', addParams)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CreateReturn(addParams:any): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'CreateReturn', addParams)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,10 @@ export const MENU_ITEMS: NbMenuItem[] = [
|
||||
title: 'Delivery Sheet',
|
||||
link: '/pages/delivery-sheet',
|
||||
},
|
||||
{
|
||||
title: 'Return Sheet',
|
||||
link: '/pages/return-sheet',
|
||||
},
|
||||
|
||||
],
|
||||
// link: '/pages/order',
|
||||
@ -69,22 +73,22 @@ export const MENU_ITEMS: NbMenuItem[] = [
|
||||
home: true,
|
||||
},
|
||||
|
||||
{
|
||||
title: 'FEATURES',
|
||||
group: true,
|
||||
},
|
||||
{
|
||||
title: 'Email',
|
||||
icon: 'email-outline',
|
||||
link: '/pages/email',
|
||||
home: true,
|
||||
},
|
||||
{
|
||||
title: 'Settings',
|
||||
icon: 'settings-2-outline',
|
||||
link: '/pages/profile',
|
||||
home: true,
|
||||
},
|
||||
// {
|
||||
// title: 'FEATURES',
|
||||
// group: true,
|
||||
// },
|
||||
// {
|
||||
// title: 'Email',
|
||||
// icon: 'email-outline',
|
||||
// link: '/pages/email',
|
||||
// home: true,
|
||||
// },
|
||||
// {
|
||||
// title: 'Settings',
|
||||
// icon: 'settings-2-outline',
|
||||
// link: '/pages/profile',
|
||||
// home: true,
|
||||
// },
|
||||
// {
|
||||
// title: 'Auth',
|
||||
// icon: 'lock-outline',
|
||||
|
||||
@ -15,6 +15,7 @@ import { SummaryListComponent } from './summary-list/summary-list.component';
|
||||
import { SummaryDetailsComponent } from './summary-list/summary-details/summary-details.component';
|
||||
import { EmailComponent } from './email/email.component';
|
||||
import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
import { ReturnSheetComponent } from './return-sheet/return-sheet.component';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: '',
|
||||
@ -70,6 +71,11 @@ const routes: Routes = [{
|
||||
path: 'delivery-sheet',
|
||||
component:DriverySheetComponent
|
||||
|
||||
},{
|
||||
|
||||
path: 'return-sheet',
|
||||
component:ReturnSheetComponent
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { NgModule,NO_ERRORS_SCHEMA ,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { NbDialogModule, NbListModule, NbMenuModule, NbToggleModule } from '@nebular/theme';
|
||||
import { NbDialogModule, NbListModule, NbMenuModule, NbToggleModule, NbTooltipModule } from '@nebular/theme';
|
||||
|
||||
import { ThemeModule } from '../@theme/theme.module';
|
||||
import { PagesComponent } from './pages.component';
|
||||
@ -48,6 +48,8 @@ import { SummaryListComponent } from './summary-list/summary-list.component';
|
||||
import { SummaryDetailsComponent } from './summary-list/summary-details/summary-details.component';
|
||||
import { EmailComponent } from './email/email.component';
|
||||
import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
import { AddOrderComponent } from './order/add-order/add-order.component';
|
||||
import { ReturnSheetComponent } from './return-sheet/return-sheet.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
PagesRoutingModule,
|
||||
@ -62,7 +64,7 @@ import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
NbUserModule,
|
||||
NbCheckboxModule,
|
||||
NbRadioModule,
|
||||
NbDatepickerModule,
|
||||
NbTooltipModule,
|
||||
FormsModule, ReactiveFormsModule,
|
||||
NbSelectModule,
|
||||
NbIconModule,
|
||||
@ -71,7 +73,7 @@ import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
NbTreeGridModule,
|
||||
NbIconModule,
|
||||
NbInputModule,
|
||||
ThemeModule,
|
||||
ThemeModule, NbDatepickerModule.forRoot(),
|
||||
NbListModule,NbToggleModule,
|
||||
NbDialogModule.forChild(), DataTableModule.forRoot(), NgxDaterangepickerMd.forRoot(),
|
||||
Ng2SmartTableModule,
|
||||
@ -94,7 +96,7 @@ import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
|
||||
AssignFormComponent,
|
||||
ProfileComponent,
|
||||
MixedFormComponent,
|
||||
AuthComponent,ForgotPasswordComponent, OtpComponent,ResetPasswordComponent, ViewDetailsComponent, SummaryListComponent, SummaryDetailsComponent, EmailComponent, DriverySheetComponent,
|
||||
AuthComponent,ForgotPasswordComponent, OtpComponent,ResetPasswordComponent, ViewDetailsComponent, SummaryListComponent, SummaryDetailsComponent, EmailComponent, DriverySheetComponent, AddOrderComponent, ReturnSheetComponent,
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA,NO_ERRORS_SCHEMA],
|
||||
})
|
||||
|
||||
319
src/app/pages/return-sheet/return-sheet.component.html
Normal file
319
src/app/pages/return-sheet/return-sheet.component.html
Normal file
@ -0,0 +1,319 @@
|
||||
<nb-card>
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div> Return Sheet</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div style="text-align: end;">
|
||||
|
||||
|
||||
<!-- <button style=" margin-left: 2rem;"(click)="generatePDF('print')" nbButton status="primary" hero>
|
||||
Print
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-header>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker">
|
||||
<nb-datepicker #dateTimePicker (dateChange)="onStartDateChanged($event)" ></nb-datepicker>
|
||||
<!-- <input nbInput class="fx-date-range" type="text"
|
||||
ngxDaterangepickerMd
|
||||
[locale]="{applyLabel: 'okay', format: 'DD/MM/YY'}"
|
||||
[drops]="'down'"
|
||||
[opens]="'right'"
|
||||
[ranges]="ranges"
|
||||
[autoApply]="true"
|
||||
[singleDatePicker]="true"
|
||||
[showCustomRangeLabel]="false"
|
||||
[alwaysShowCalendars]="true"
|
||||
[keepCalendarOpeningWithRange]="false"
|
||||
[showCancel]="true"
|
||||
autocomplete="off"
|
||||
[(ngModel)]="selectedDateRange"
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/> -->
|
||||
|
||||
<nb-select selected="" style="width: 100% !important;margin-left: 2rem;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
<button (click)="generate()" style="margin-left: 2rem;" nbButton status="primary" hero>
|
||||
generate
|
||||
</button>
|
||||
<button (click)="download()" nbButton nbButton nbTooltip="Download" nbTooltipPlacement="top" style="margin-left: 2rem;" status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div >
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
|
||||
<h5 *ngIf="returnSummary.length==0 && driverName.length>0" style="text-align: center;">No Data Found For Selected Driver</h5>
|
||||
<div id="table" style="text-align: center;margin-bottom: 1rem;">
|
||||
<nb-card-header *ngIf="returnSummary.length>0" style="text-align: center;"><img src="assets/images/VN_Medical_Logo.png" alt="vnms" width="120" height="50" style="padding-right: 1rem;"> </nb-card-header>
|
||||
|
||||
<nb-card-header *ngIf="returnSummary.length>0" style="text-align: center;margin-top: 2rem;">
|
||||
|
||||
<div class="row show-grid" style=" margin-top: 2rem;">
|
||||
<div class="col-md-4">
|
||||
<div> Driver Name: {{driverName}}</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div style="text-align: center;"> Return Sheet</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div>
|
||||
Date :{{DateDisplay | date :'dd/MM/yy'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nb-card-header>
|
||||
<!-- <h5 *ngIf="summaryaData.length>0" >Delivery Sheet</h5>
|
||||
<h5 *ngIf="summaryaData.length>0" > </h5> -->
|
||||
<ng-data-table *ngIf="returnSummary.length>0"
|
||||
[id]="'i'"
|
||||
[items]=returnSummary
|
||||
[minContentWidth]="500"
|
||||
[pageable]="false"
|
||||
[showColumnSelector]="false"
|
||||
[showHeader]="false"
|
||||
[selectMode]="'multi'"
|
||||
[minContentHeight]="350"
|
||||
[limit]="50"
|
||||
>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'orderId'"
|
||||
[sortable]="false"
|
||||
[title]="'Order ID'"
|
||||
[filterable]="false"
|
||||
[width]="3">
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'userName'"
|
||||
[sortable]="false"
|
||||
[title]="'Customer'"
|
||||
[filterable]="false"
|
||||
[width]="5">
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div style="display: flex; align-items: center;">
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr >
|
||||
<td style=" border-top: 0rem solid #ddd;"> <a style=" font-size: initial;" >{{customer(row.item.orderId) }}</a></td>
|
||||
<!-- <td>{{ product.price }}</td>
|
||||
<td>{{ product.quantity }}</td> -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <span class="checkTxt" >
|
||||
{{filterData(row.item.orderId)}}
|
||||
|
||||
|
||||
|
||||
</span> -->
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'email'"
|
||||
[sortable]="false"
|
||||
[title]="'Product'"
|
||||
[filterable]="false"
|
||||
[width]="6">
|
||||
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div style="display: flex; align-items: center;">
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let product of filterData(row.item.orderId)">
|
||||
<td style=" border-top: 0rem solid #ddd;"> <a style=" font-size: initial;" >{{ product }}</a></td>
|
||||
<!-- <td>{{ product.price }}</td>
|
||||
<td>{{ product.quantity }}</td> -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <span class="checkTxt" >
|
||||
{{filterData(row.item.orderId)}}
|
||||
|
||||
|
||||
|
||||
</span> -->
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
<ng-data-table-column
|
||||
[field]="'total_qty'"
|
||||
[sortable]="false"
|
||||
[title]="'Qty'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div style="display: flex; align-items: center;">
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-12" *ngFor="let product of filterDataqty(row.item.orderId)">
|
||||
<h5>{{ product }}</h5>
|
||||
</div>
|
||||
</div> -->
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let product of filterDataqty(row.item.orderId)">
|
||||
<td style=" border-top: 0rem solid #ddd;"> <a style=" font-size: initial;" >{{ product }}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <span class="checkTxt" >
|
||||
{{filterData(row.item.orderId)}}
|
||||
|
||||
|
||||
|
||||
</span> -->
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
|
||||
<ng-data-table-column
|
||||
[field]="'total_qty'"
|
||||
[sortable]="false"
|
||||
[title]="'Cylinder No'"
|
||||
[filterable]="false"
|
||||
[width]="4">
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div style="display: flex; align-items: center;">
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-12" *ngFor="let product of filterDataqty(row.item.orderId)">
|
||||
<h5>{{ product }}</h5>
|
||||
</div>
|
||||
</div> -->
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let product of filterDataNo(row.item.orderId)">
|
||||
<td style=" border-top: 0rem solid #ddd;"> <a style=" font-size: initial;" >{{ product }}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <span class="checkTxt" >
|
||||
{{filterData(row.item.orderId)}}
|
||||
|
||||
|
||||
|
||||
</span> -->
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</ng-template>
|
||||
|
||||
</ng-data-table-column>
|
||||
|
||||
|
||||
|
||||
</ng-data-table>
|
||||
</div>
|
||||
|
||||
|
||||
<nb-card-footer>
|
||||
<div class="row show-grid" >
|
||||
<div class="col-6 col-md-3">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<!-- <button nbButton status="success" (click)="save()" style="margin-right: 10px;" type="submit" >Submit</button>
|
||||
<button type="button" class="cancel" nbButton status="danger" (click)="back()">Cancel</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</nb-card-footer>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
176
src/app/pages/return-sheet/return-sheet.component.scss
Normal file
176
src/app/pages/return-sheet/return-sheet.component.scss
Normal file
@ -0,0 +1,176 @@
|
||||
|
||||
td ,input[type="checkbox"] {
|
||||
font-size: 1px !important;
|
||||
}
|
||||
|
||||
.highlight-cell {
|
||||
background-color: yellow;
|
||||
/* Add any other styling properties as desired */
|
||||
}
|
||||
|
||||
::ng-deep .ng2-smart-action-multiple-select{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
::ng-deep .ng2-smart-action-multiple-select > input{
|
||||
width:15px;
|
||||
height:15px;
|
||||
display: unset;
|
||||
}
|
||||
|
||||
::ng-deep .desired-value-row{
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.align-left{
|
||||
text-align: left !important;
|
||||
}
|
||||
.align-center{
|
||||
text-align: center !important;
|
||||
}
|
||||
.align-right{
|
||||
text-align: right !important;
|
||||
}
|
||||
::ng-deep :not(.dark-theme) .ng-data-table-container .ng-data-table tbody > tr.row-even td {
|
||||
background: white;
|
||||
//padding: 10px;
|
||||
font-family: var(--smart-table-font-family);
|
||||
font-size: var(--smart-table-font-size);
|
||||
font-weight: var(--smart-table-font-weight);
|
||||
line-height: var(--smart-table-line-height);
|
||||
color: var(--smart-table-fg);
|
||||
}
|
||||
::ng-deep :not(.dark-theme) .ng-data-table-container .ng-data-table thead > tr .ng-data-table-column-header .ng-data-table-column-header-label:first-child {
|
||||
font-size: 18px;
|
||||
padding: 10px;
|
||||
color: #1e6bb8;
|
||||
text-decoration: none;
|
||||
font-family: var(--smart-table-header-font-family);
|
||||
font-size: var(--smart-table-header-font-size);
|
||||
font-weight: var(--smart-table-header-font-weight);
|
||||
line-height: var(--smart-table-header-line-height);
|
||||
}
|
||||
::ng-deep :not(.dark-theme) .ng-data-table-container .ng-data-table tbody > tr.row-odd td {
|
||||
// padding: 10px;
|
||||
font-family: var(--smart-table-font-family);
|
||||
font-size: var(--smart-table-font-size);
|
||||
font-weight: var(--smart-table-font-weight);
|
||||
line-height: var(--smart-table-line-height);
|
||||
color: var(--smart-table-fg);
|
||||
}
|
||||
::ng-deep :not(.dark-theme) .ng-data-table-container .ng-data-table-content-container .ng-data-table-content {
|
||||
min-height: 100px !important;
|
||||
font-size: 18px;
|
||||
}
|
||||
::ng-deep :not(.dark-theme) .ng-data-table-container .ng-data-table thead > tr:last-child th {
|
||||
|
||||
background-color:#fff; font-family: var(--smart-table-font-family);
|
||||
font-size: var(--smart-table-font-size);
|
||||
font-weight: var(--smart-table-font-weight);
|
||||
line-height: var(--smart-table-line-height);
|
||||
color: var(--smart-table-fg);
|
||||
|
||||
}
|
||||
tr{
|
||||
color: white;
|
||||
background-color:#fff;
|
||||
}
|
||||
th{
|
||||
color: white;
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
/* Create two equal columns that sits next to each other */
|
||||
.column {
|
||||
flex: 50%;
|
||||
// padding: 10px;
|
||||
// height: 300px; /* Should be removed. Only for demonstration */
|
||||
}
|
||||
::ng-deep .mat-select-value{
|
||||
color: white!important; }
|
||||
.column1 {
|
||||
width: 210px;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
padding: 30px;
|
||||
//height: 300px; /* Should be removed. Only for demonstration */
|
||||
}
|
||||
|
||||
|
||||
.add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.75rem !important;
|
||||
padding: var(--smart-table-filter-padding);
|
||||
border-color: var(--smart-table-add-button-border-color);
|
||||
background-color: var(--smart-table-add-button-background-color);
|
||||
color: var(--smart-table-add-button-text-color);
|
||||
border-radius: 0.375rem;
|
||||
|
||||
font-family: var(--smart-table-header-font-family);
|
||||
font-size: var(--smart-table-header-font-size);
|
||||
font-weight: var(--smart-table-header-font-weight);
|
||||
line-height: var(--smart-table-header-line-height);
|
||||
}
|
||||
span{
|
||||
|
||||
color: #000;
|
||||
}
|
||||
|
||||
span:hover{
|
||||
|
||||
color: #1e6bb8;
|
||||
}
|
||||
a[disabled="disabled"] {
|
||||
pointer-events: none;
|
||||
}
|
||||
.check{
|
||||
display: flex; align-items: center; text-decoration: none;
|
||||
height: 100%; width: 100%; font-size: 2rem!important;
|
||||
}
|
||||
|
||||
.checkTxt{
|
||||
//background: white;
|
||||
// padding: 10px;
|
||||
font-family: var(--smart-table-font-family);
|
||||
font-size: var(--smart-table-font-size);
|
||||
font-weight: var(--smart-table-font-weight);
|
||||
line-height: var(--smart-table-line-height);
|
||||
color: var(--smart-table-fg);
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
|
||||
::ng-deep .md-drppicker .btn, .md-drppicker .btn:focus, .md-drppicker .btn:hover {
|
||||
background-color: #4caf50 !important;
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
::ng-deep .md-drppicker .btn.btn-default{
|
||||
color: #000 !important;
|
||||
background-color: #dcdcdc !important;
|
||||
}
|
||||
|
||||
::ng-deep .md-drppicker td.active{
|
||||
background-color: #1f7f6f !important;
|
||||
}
|
||||
::ng-deep .md-drppicker .ranges ul li button.active {
|
||||
background-color: #1f7f6f !important;
|
||||
}
|
||||
::ng-deep .md-drppicker.double {
|
||||
width: 640px !important;
|
||||
}
|
||||
|
||||
h5{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
23
src/app/pages/return-sheet/return-sheet.component.spec.ts
Normal file
23
src/app/pages/return-sheet/return-sheet.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ReturnSheetComponent } from './return-sheet.component';
|
||||
|
||||
describe('ReturnSheetComponent', () => {
|
||||
let component: ReturnSheetComponent;
|
||||
let fixture: ComponentFixture<ReturnSheetComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ReturnSheetComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ReturnSheetComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
396
src/app/pages/return-sheet/return-sheet.component.ts
Normal file
396
src/app/pages/return-sheet/return-sheet.component.ts
Normal file
@ -0,0 +1,396 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import * as html2pdf from 'html2pdf.js'
|
||||
import * as moment from 'moment';
|
||||
import { PageapiService } from '../pageapi.service';
|
||||
import { Router } from '@angular/router';
|
||||
@Component({
|
||||
selector: 'ngx-return-sheet',
|
||||
templateUrl: './return-sheet.component.html',
|
||||
styleUrls: ['./return-sheet.component.scss']
|
||||
})
|
||||
export class ReturnSheetComponent implements OnInit {
|
||||
|
||||
ranges: any = {
|
||||
'Today': [moment(), moment()],
|
||||
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
// 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
// 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
// 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
// 'Last Month': [
|
||||
// moment().subtract(1, 'month').startOf('month'),
|
||||
// moment().subtract(1, 'month').endOf('month')
|
||||
// ]
|
||||
|
||||
};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.getDriverlistApi()
|
||||
this.DateDisplay = moment()['_d']
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
back(){
|
||||
|
||||
}
|
||||
save(){
|
||||
|
||||
}
|
||||
|
||||
generatePDF(data){
|
||||
|
||||
|
||||
}
|
||||
dateWiseFilter(){
|
||||
console.log(this.selectedDateRange,this.driverval)
|
||||
if(this.selectedDateRange.length!=0){
|
||||
|
||||
|
||||
|
||||
}
|
||||
//this.getDriverSummaryAdminList(result)
|
||||
|
||||
}
|
||||
|
||||
mergeOrders(orderItems: any[]) {
|
||||
this.summaryaData = orderItems.reduce((acc, curr) => {
|
||||
const existingOrder = acc.find((order) => order.orderId === curr.orderId);
|
||||
if (existingOrder) {
|
||||
existingOrder.total_qty += curr.total_qty;
|
||||
} else {
|
||||
acc.push(curr);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
getDriverlistApi(){
|
||||
// console.log(this.selectedDateRange)
|
||||
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
|
||||
// console.log(data)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
getDriverSummaryAdminList(date){
|
||||
let param ={date:new Date(date)}
|
||||
this._api.getDriverSummaryAdminList(param).subscribe(res => {
|
||||
console.log(res)
|
||||
if(res.status == 200){
|
||||
|
||||
console.log(res.data)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
val(data){
|
||||
console.log(data)
|
||||
this.driverName = data.userName
|
||||
|
||||
let result;
|
||||
// if(this.selectedDateRange.length != 0){
|
||||
// result= this.selectedDateRange.endDate['$d']
|
||||
// }else{
|
||||
|
||||
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){
|
||||
|
||||
// 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)
|
||||
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
returnCount(data){
|
||||
let result = this.returnSummary.filter(arr=>{return arr.orderId == data})
|
||||
console.log(result)
|
||||
if(result.length>0){
|
||||
|
||||
return result[0].total_amount
|
||||
}else{
|
||||
return '-'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
view(data){
|
||||
this.router.navigate(['/pages/summary/'+data])
|
||||
}
|
||||
|
||||
|
||||
filterData(param){
|
||||
|
||||
let tmp=[];
|
||||
let order = this.productDeatils.filter(arr=>{return arr.orderId == param})
|
||||
if(order.length>0){
|
||||
|
||||
//console.log(param)
|
||||
|
||||
|
||||
order.forEach(element => {
|
||||
|
||||
if(element.ProductDetails.length>0){
|
||||
|
||||
tmp.push(element.ProductDetails[0].productName)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
//console.log(tmp)
|
||||
return tmp
|
||||
}else{
|
||||
return tmp
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
customer(param){
|
||||
|
||||
let tmp=[];
|
||||
let order = this.productDeatils.filter(arr=>{return arr.orderId == param})
|
||||
if(order.length>0){
|
||||
|
||||
//console.log(param)
|
||||
|
||||
|
||||
order.forEach(element => {
|
||||
|
||||
if(element.CusDetails.length>0){
|
||||
|
||||
tmp.push(element.CusDetails[0].cusName)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
//console.log(tmp)
|
||||
return tmp[0]
|
||||
}else{
|
||||
return tmp
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
filterDataqty(param){
|
||||
|
||||
let tmp=[];
|
||||
let order = this.productDeatils.filter(arr=>{return arr.orderId == param})
|
||||
if(order.length>0){
|
||||
|
||||
console.log(param)
|
||||
|
||||
|
||||
order.forEach(element => {
|
||||
|
||||
if(element.ProductDetails.length>0){
|
||||
|
||||
tmp.push(element.qty)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
//console.log(tmp)
|
||||
return tmp
|
||||
}else{
|
||||
return tmp
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
filterDataNo(param){
|
||||
|
||||
let tmp=[];
|
||||
let order = this.productDeatils.filter(arr=>{return arr.orderId == param})
|
||||
if(order.length>0){
|
||||
|
||||
console.log(param)
|
||||
|
||||
|
||||
order.forEach(element => {
|
||||
|
||||
if(element.ProductDetails.length>0){
|
||||
|
||||
tmp.push(element.cylinderNo)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
//console.log(tmp)
|
||||
return tmp
|
||||
}else{
|
||||
return tmp
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
download(){
|
||||
var element = document.getElementById('table');
|
||||
var opt = {
|
||||
margin: 1,
|
||||
filename: 'sheet.pdf',
|
||||
image: { type: 'jpg', quality: 0.98 },
|
||||
html2canvas: { scale: 2 },
|
||||
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
||||
};
|
||||
|
||||
// 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.getProductReturnsheet(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)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,8 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div style="text-align: end;">
|
||||
|
||||
CUSTOMER NAME:<h4>{{cusName}}</h4>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -293,7 +294,7 @@
|
||||
<div class="col-6 col-md-4">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"> </label>
|
||||
<label for="subject" style=" font-weight: 600;">Cylinder No: {{dataVal.cylinderNo}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ export class SummaryDetailsComponent implements OnInit {
|
||||
// moment().subtract(1, 'month').endOf('month')
|
||||
// ]
|
||||
};
|
||||
productlistReturn:any =[];orderId:any=[];
|
||||
productlistReturn:any =[];orderId:any=[];cusName:any =[];
|
||||
selectedDateRange:any =[];drivers:any =[];summaryaData:any=[];driverval:any=[];returnSummary:any =[];productlist:any=[];
|
||||
constructor(public _api:PageapiService,private route: ActivatedRoute, private router:Router) {
|
||||
|
||||
@ -57,6 +57,8 @@ this.orderId = orderId
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.cusName = localStorage.getItem('cusName')
|
||||
this.selectedDateRange =[];
|
||||
console.log(moment()['_d'])
|
||||
|
||||
|
||||
@ -24,8 +24,11 @@
|
||||
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-md-6">
|
||||
<div> <input nbInput class="fx-date-range" type="text"
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker">
|
||||
<nb-datepicker #dateTimePicker (dateChange)="onStartDateChanged($event)" ></nb-datepicker>
|
||||
<!-- <input nbInput class="fx-date-range" type="text"
|
||||
ngxDaterangepickerMd
|
||||
[locale]="{applyLabel: 'okay', format: 'DD/MM/YY'}"
|
||||
[drops]="'down'"
|
||||
@ -39,25 +42,52 @@
|
||||
[showCancel]="true"
|
||||
autocomplete="off"
|
||||
[(ngModel)]="selectedDateRange"
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/></div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div style="text-align: end;">
|
||||
<nb-select selected="" style="width: 100% !important;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
name="daterange" placeholder="Fliter Date Wise" (change)="dateWiseFilter()"/> -->
|
||||
<nb-select selected="" style="width: 100% !important;margin-left: 2rem;" >
|
||||
<nb-option value="">Select Drivers</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
<nb-option *ngFor="let user of drivers; index as i; first as isFirst " (click)="val(user)" [value]="user.id
|
||||
">{{user.userName }}</nb-option>
|
||||
|
||||
|
||||
</nb-select>
|
||||
</div>
|
||||
</nb-select>
|
||||
|
||||
<button style=" margin-left: 2rem;" (click)="generate()" nbButton status="primary" hero>
|
||||
generate
|
||||
</button>
|
||||
|
||||
<button style=" margin-left: 2rem;"(click)="download()"nbButton nbTooltip="Download" nbTooltipPlacement="top" nbButton status="success" hero>
|
||||
<nb-icon icon="download-outline"></nb-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
|
||||
|
||||
<div id="table" style="text-align: center;">
|
||||
<nb-card-header *ngIf="summaryaData.length>0" style="text-align: center;"><img src="assets/images/VN_Medical_Logo.png" alt="vnms" width="120" height="50" style="padding-right: 1rem;"> </nb-card-header>
|
||||
|
||||
<nb-card-header *ngIf="summaryaData.length>0" style="text-align: center;margin-top: 2rem;">
|
||||
|
||||
<div class="row show-grid" style=" margin-top: 2rem;">
|
||||
<div class="col-md-4">
|
||||
<div> Driver Name: {{driverName}}</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div style="text-align: center;"> Delivery Summary</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div>
|
||||
Date :{{DateDisplay | date :'dd/MM/yy'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nb-card-header>
|
||||
<div >
|
||||
<div>
|
||||
|
||||
@ -66,7 +96,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="row show-grid" *ngIf="selectedDateRange.length!=0">
|
||||
<div class="row show-grid" *ngIf="summaryaData.length>0">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
@ -74,6 +104,14 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;"><h6>Customer</h6></label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
@ -84,7 +122,7 @@
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"><h6>Empty Pick up</h6></label>
|
||||
@ -92,28 +130,21 @@
|
||||
</div>
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;"><h6>View</h6></label>
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></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> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;"><h6>View</h6></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 *ngIf="summaryaData.length==0" style="text-align: center;margin: 2rem;"> No Data Available ...!</h5>
|
||||
<div *ngFor="let dataVal of summaryaData; let i = index" >
|
||||
<div *ngIf="selectedDateRange.length!=0">
|
||||
<div *ngIf="summaryaData.length>0">
|
||||
|
||||
|
||||
|
||||
@ -123,49 +154,54 @@
|
||||
<div class="row show-grid">
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
<label for="subject" style=" font-weight: 600;">#</label>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;margin-left: 1rem;">({{dataVal.orderId}})</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
|
||||
<label for="subject" style=" font-weight: 600;margin-left: 1rem;">{{dataVal.cusName}}</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<div>
|
||||
|
||||
<label for="subject" style=" font-weight: 600;">{{dataVal.total_qty}}</label> <br>
|
||||
<label for="subject" style=" font-weight: 600;">{{dataVal. total_amount}}</label> <br>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <input nbInput type="number" min="0" [(ngModel)]="item.qty"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="col-6 col-md-2">
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<label for="subject" style=" font-weight: 600;">{{returnCount(dataVal.orderId)}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div >
|
||||
|
||||
<nb-icon icon="eye-outline" style="color: green;" (click)="view(dataVal.orderId)" ></nb-icon>
|
||||
<!-- <nb-actions size="medium" >
|
||||
<nb-action icon="plus-circle-outline" class="custom-action-icon" [nbTooltip]="'Add'" ></nb-action>
|
||||
|
||||
<nb-action icon="minus-circle-outline" [nbTooltip]="'Remove'" ></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> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<!-- <input nbInput type="text" [(ngModel)]="item.productSpec"> -->
|
||||
<nb-icon icon="eye-outline" style="color: green;" (click)="view(dataVal.orderId,dataVal.cusName)" ></nb-icon>
|
||||
<!-- <label for="subject" style=" font-weight: 600;">{{returnCount(dataVal.orderId)}}</label> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<nb-card-footer>
|
||||
<div class="row show-grid" >
|
||||
<div class="col-6 col-md-3">
|
||||
|
||||
@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
import { PageapiService } from '../pageapi.service';
|
||||
import { Router } from '@angular/router';
|
||||
import * as html2pdf from 'html2pdf.js'
|
||||
@Component({
|
||||
selector: 'ngx-summary-list',
|
||||
templateUrl: './summary-list.component.html',
|
||||
@ -18,7 +19,7 @@ export class SummaryListComponent implements OnInit {
|
||||
// moment().subtract(1, 'month').startOf('month'),
|
||||
// moment().subtract(1, 'month').endOf('month')
|
||||
// ]
|
||||
};
|
||||
};selectDate:any =[];driverId:any =[];DateDisplay:any =[];driverName:any =[];
|
||||
selectedDateRange:any =[];drivers:any =[];summaryaData:any=[];driverval:any=[];returnSummary:any =[];
|
||||
constructor(public _api:PageapiService, private router:Router) { }
|
||||
|
||||
@ -104,7 +105,7 @@ export class SummaryListComponent implements OnInit {
|
||||
|
||||
val(data){
|
||||
console.log(data.id)
|
||||
|
||||
this.driverName = data.userName
|
||||
let result;
|
||||
if(this.selectedDateRange.length != 0){
|
||||
result= this.selectedDateRange.endDate['$d']
|
||||
@ -112,41 +113,8 @@ export class SummaryListComponent implements OnInit {
|
||||
|
||||
result = moment()['_d']
|
||||
}
|
||||
|
||||
console.log(result)
|
||||
let param ={date:new Date(result),id:data.id}
|
||||
this._api.getDriverSummaryAdminList(param).subscribe(res => {
|
||||
console.log(res)
|
||||
if(res.status == 200){
|
||||
this. driverId = data.id
|
||||
|
||||
console.log(res.data)
|
||||
|
||||
this.summaryaData = res.data
|
||||
this.summaryaData.forEach(element => {
|
||||
element.name = element['UserDetails.userName']
|
||||
|
||||
});
|
||||
|
||||
this.mergeOrders( 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)
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -163,8 +131,87 @@ console.log(result)
|
||||
|
||||
}
|
||||
|
||||
view(data){
|
||||
view(data,name){
|
||||
localStorage.setItem('cusName',name)
|
||||
this.router.navigate(['/pages/summary/'+data])
|
||||
}
|
||||
|
||||
|
||||
onStartDateChanged(data){
|
||||
this.DateDisplay = data
|
||||
this.selectDate =[];
|
||||
this.selectDate.push(data)
|
||||
//this.selectDate = data
|
||||
console.log(data)
|
||||
|
||||
|
||||
}
|
||||
generate(){
|
||||
|
||||
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:new Date( updatedUtcDate),id:this.driverId}
|
||||
this._api.getDriverSummaryAdminList(param).subscribe(res => {
|
||||
console.log(res)
|
||||
if(res.status == 200){
|
||||
|
||||
console.log(res.data)
|
||||
|
||||
this.summaryaData = res.data
|
||||
if( this.summaryaData.length>0){
|
||||
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)
|
||||
|
||||
}else{
|
||||
this.returnSummary =[];
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
download(){
|
||||
var element = document.getElementById('table');
|
||||
var opt = {
|
||||
margin: 1,
|
||||
filename: 'sheet.pdf',
|
||||
image: { type: 'jpg', quality: 0.98 },
|
||||
html2canvas: { scale: 2 },
|
||||
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
||||
};
|
||||
|
||||
// New Promise-based usage:
|
||||
html2pdf().from(element).set(opt).save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
Please enter a valid email address
|
||||
</div>
|
||||
</ng-container>
|
||||
<label *ngIf="!data.hasOwnProperty('id')" for="subject">Password:</label>
|
||||
<input *ngIf="!data.hasOwnProperty('id')" formControlName="password" nbInput id="password" type="text" [status]="userForm.get('password').invalid && userForm.get('password').touched? 'danger' : 'basic'">
|
||||
<label for="subject">Password:</label>
|
||||
<input formControlName="password" nbInput id="password" type="text" [status]="userForm.get('password').invalid && userForm.get('password').touched? 'danger' : 'basic'">
|
||||
<ng-container nbInputErrorMessage>
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ export class UserFormComponent implements OnInit {
|
||||
|
||||
});
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
delete this.data.password
|
||||
this.userForm.controls['password'].clearValidators();
|
||||
this.userForm.controls['password'].updateValueAndValidity();
|
||||
}
|
||||
@ -57,13 +58,22 @@ export class UserFormComponent implements OnInit {
|
||||
this.formData= new FormData();
|
||||
if(this.data.hasOwnProperty('id')){
|
||||
this.formData.append('id', this.data.id);
|
||||
|
||||
}
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
this.formData.append('password', tmp.password);
|
||||
if(tmp.password != ""){
|
||||
this.formData.append('password', tmp.password);
|
||||
}
|
||||
|
||||
this.formData.append('role', tmp.role);
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
} else{
|
||||
this.formData.append('userName',tmp.userName)
|
||||
this.formData.append('email', tmp.email);
|
||||
this.formData.append('password', tmp.password);
|
||||
this.formData.append('role', tmp.role);
|
||||
this.formData.append('mobileNo', tmp.mobileNo);
|
||||
}
|
||||
|
||||
|
||||
this._api.addUserFormDetails (this.formData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
|
||||
@ -130,15 +130,16 @@
|
||||
|
||||
<ng-template #ngDataTableCell let-row="row">
|
||||
<td >
|
||||
<div class="align-center" style="display: flex; align-items: center;">
|
||||
<div class="align-center" style="display: flex; align-items: center;text-align: center;">
|
||||
<!-- <span class="check" (click)="onSaveConfirm(row.item)">
|
||||
<i class="nb-edit" ></i>
|
||||
</span> -->
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
<nb-icon icon="edit-outline" title="Edit" style="margin-left: 1rem; text-align: center;
|
||||
width: 100%;" (click)="onSaveConfirm(row.item)"></nb-icon>
|
||||
<!-- <span class="check" (click)="onDeleteConfirm(row.item)">
|
||||
<i class="nb-trash" ></i>
|
||||
</span> -->
|
||||
<nb-icon icon="refresh-outline" title="Reset Password" style="margin-left: 1rem;" (click)="resetPassword(row.item)"></nb-icon>
|
||||
<!-- <nb-icon icon="refresh-outline" title="Reset Password" style="margin-left: 1rem;" (click)="resetPassword(row.item)"></nb-icon> -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@ -110,9 +110,9 @@ export class UsersComponent {
|
||||
console.log(res)
|
||||
this.getuserlistApi();
|
||||
if(event.isActive == 1){
|
||||
this.showToast('success', 'Data Removed Successfully', 'Active User Data Completed..!');
|
||||
this.showToast('success', 'Active User Data Completed..!', '');
|
||||
}else{
|
||||
this.showToast('success', 'Data Removed Successfully', 'Inactive User Data Completed..!');
|
||||
this.showToast('success', 'Inactive User Data Completed..!', '');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
//apiEndpoint:'https://dev.venbait.in/vnms/api/',
|
||||
apiEndpoint:'http://192.168.1.29:8081/api/',
|
||||
apiEndpoint:'https://dev.venbait.in/vnms/api/',
|
||||
// apiEndpoint:'http://192.168.1.17:8081/api/',
|
||||
mailUrl:'',
|
||||
production: false,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user