diff --git a/src/app/checker/forexprovider/forexprovider.component.html b/src/app/checker/forexprovider/forexprovider.component.html index 4d97bb1..c7c1c14 100644 --- a/src/app/checker/forexprovider/forexprovider.component.html +++ b/src/app/checker/forexprovider/forexprovider.component.html @@ -30,7 +30,12 @@ <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong> {{'forexprovider.Success!' | translate}}</strong> {{'forexprovider.Forex provider removed successfully' | translate}} - </div> + </div> + + <div class="row"> + <div class="col"></div> + <div class="col" style="text-align: right"><input type="text" placeholder="{{'manageprovider.Search...' | translate}}" (input)="onSearchChange($event.target.value)" /></div> + </div> <table class="table"> <thead> <tr> @@ -60,6 +65,13 @@ </tr> </tbody> </table> + + <div class="forex_pagination" *ngIf="meta"> + <ul> + <li *ngFor="let i of getNumber(meta.total_pages); let j = index" [ngClass]="{'activeClass': meta.current_page == j+1}" (click)="getProvider(j+1)">{{j+1}}</li> + </ul> + + </div> <ng-template #noProvider></ng-template> </div> </div> @@ -130,7 +142,12 @@ <div class="col">{{deli_provider}}</div> </div> </div> - <div class="col"></div> + <div class="col"> + <div class="row"> + <div class="col">Merchant ID:</div> + <div class="col">{{provider.merchant_id}}</div> + </div> + </div> </div> </div> <div class="forex_modal_footer_btn_bay textRight"> diff --git a/src/app/checker/forexprovider/forexprovider.component.ts b/src/app/checker/forexprovider/forexprovider.component.ts index b6953d1..e73f4d0 100644 --- a/src/app/checker/forexprovider/forexprovider.component.ts +++ b/src/app/checker/forexprovider/forexprovider.component.ts @@ -18,30 +18,48 @@ export class ForexproviderComponent implements OnInit { loader: boolean; provider: any; deli_provider: any; + page_number: any; + meta: any; + searchtxt: any; constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) { this.responseMsg = ''; this.error = false; this.success = false; this.loader = false; + this.searchtxt = ''; } ngOnInit() { - this.getProvider(); + this.getProvider(1); } - getProvider() { + getProvider(page_number: number) { + this.page_number = page_number; this.loader = true; this.fname = 'all_providers'; - const post_data = {'type': 2}; + const post_data = {'type': 2, 'page': page_number, 'searchtxt': this.searchtxt}; this.service.post_data(this.fname, post_data).subscribe(response => { this.loader = false; console.log(response); if (response.code === 1) { - this.providerList = response.responseResult; + this.providerList = response.responseResult.data; + this.meta = response.responseResult.meta; } else { - this.error = true; - this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + if (response.errorCode === 'ER36') { + this.page_number = this.page_number - 1; + if (this.page_number >= 1) { + this.getProvider(this.page_number); + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } } }, (error) => { this.error = true; @@ -59,6 +77,10 @@ export class ForexproviderComponent implements OnInit { this.success = false; } + getNumber(num) { + return new Array(num); + } + deleteClick(provider_id: any) { this.reset(); const res = confirm('Do you want to remove this user ?'); @@ -72,7 +94,7 @@ export class ForexproviderComponent implements OnInit { if (response.code === 1) { this.success = true; console.log(this.success); - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; @@ -98,6 +120,11 @@ export class ForexproviderComponent implements OnInit { document.body.scrollTop = document.documentElement.scrollTop = 0; } + onSearchChange(text: string) { + this.searchtxt = text; + this.getProvider(1); + } + logout() { this.service.logout(); } @@ -169,7 +196,7 @@ export class ForexproviderComponent implements OnInit { console.log(response); if (response.code === 1) { this.provider = response.responseResult; - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; diff --git a/src/app/checker/manageprovider/manageprovider.component.html b/src/app/checker/manageprovider/manageprovider.component.html index 5b78903..6031bdc 100644 --- a/src/app/checker/manageprovider/manageprovider.component.html +++ b/src/app/checker/manageprovider/manageprovider.component.html @@ -30,7 +30,11 @@ <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong> {{'manageprovider.Success!' | translate}}</strong>{{'manageprovider.Delivery provider removed successfully' | translate}} - </div> + </div> + <div class="row"> + <div class="col"></div> + <div class="col" style="text-align: right"><input type="text" placeholder="{{'manageprovider.Search...' | translate}}" (input)="onSearchChange($event.target.value)" /></div> + </div> <table class="table"> <thead> <tr> @@ -60,6 +64,11 @@ </tr> </tbody> </table> + <div class="forex_pagination" *ngIf="meta"> + <ul> + <li *ngFor="let i of getNumber(meta.total_pages); let j = index" [ngClass]="{'activeClass': meta.current_page == j+1}" (click)="getProvider(j+1)">{{j+1}}</li> + </ul> + </div> <ng-template #noProvider></ng-template> </div> </div> diff --git a/src/app/checker/manageprovider/manageprovider.component.ts b/src/app/checker/manageprovider/manageprovider.component.ts index 8356d2b..b7ca889 100644 --- a/src/app/checker/manageprovider/manageprovider.component.ts +++ b/src/app/checker/manageprovider/manageprovider.component.ts @@ -17,30 +17,48 @@ export class ManageproviderComponent implements OnInit { success: boolean; loader: boolean; provider: any; + page_number: any; + meta: any; + searchtxt: any; constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) { this.responseMsg = ''; this.error = false; this.success = false; this.loader = false; + this.searchtxt = ''; } ngOnInit() { - this.getProvider(); + this.getProvider(1); } - getProvider() { + getProvider(page_number: number) { + this.page_number = page_number; this.loader = true; this.fname = 'all_providers'; - const post_data = {'type': 3}; + const post_data = {'type': 3, 'page': page_number, 'searchtxt': this.searchtxt}; this.service.post_data(this.fname, post_data).subscribe(response => { this.loader = false; console.log(response); if (response.code === 1) { - this.providerList = response.responseResult; + this.providerList = response.responseResult.data; + this.meta = response.responseResult.meta; } else { - this.error = true; - this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + if (response.errorCode === 'ER36') { + this.page_number = this.page_number - 1; + if (this.page_number >= 1) { + this.getProvider(this.page_number); + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } } }, (error) => { this.error = true; @@ -53,6 +71,10 @@ export class ManageproviderComponent implements OnInit { }, 3000); } + getNumber(num) { + return new Array(num); + } + goToPage(path, data = null) { console.log(data); this.router.navigateByUrl(path, {queryParams: data}); @@ -77,7 +99,7 @@ export class ManageproviderComponent implements OnInit { if (response.code === 1) { this.success = true; console.log(this.success); - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; @@ -119,6 +141,11 @@ export class ManageproviderComponent implements OnInit { return state; } + onSearchChange(text: string) { + this.searchtxt = text; + this.getProvider(1); + } + providerState(state: number, id: number) { this.loader = true; this.fname = 'provider_approve'; @@ -128,7 +155,7 @@ export class ManageproviderComponent implements OnInit { console.log(response); if (response.code === 1) { this.provider = response.responseResult; - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; diff --git a/src/app/delivery/transaction/transaction.component.html b/src/app/delivery/transaction/transaction.component.html index bf1f2b9..6d768d0 100644 --- a/src/app/delivery/transaction/transaction.component.html +++ b/src/app/delivery/transaction/transaction.component.html @@ -37,10 +37,11 @@ <table class="table"> <thead> <tr> - <th> {{'transaction.User Info' | translate}}</th> + <th> {{'transaction.Customer' | translate}}</th> <th> {{'transaction.Provider' | translate}}</th> <th> {{'transaction.Phone' | translate}}</th> <th> {{'transaction.Location' | translate}}</th> + <th> {{'transaction.Pincode' | translate}}</th> <th> {{'transaction.Currency' | translate}}</th> <th> {{'transaction.Amount' | translate}}</th> <th>{{'transaction.Forex Amount' | translate}}</th> @@ -52,18 +53,19 @@ </thead> <tbody *ngIf="transactionList"> <tr *ngFor="let tansaction of transactionList; let i = index"> - <td>{{getCustomer(tansaction.user_info,'name')}}</td> + <td>{{getCustomer(tansaction.user_info,'FirstName')}}</td> <td>{{getCustomer(tansaction.provider,'name')}}</td> - <td>{{getCustomer(tansaction.user_info,'phone')}}</td> - <td>{{getCustomer(tansaction.user_info,'location')}}</td> + <td>{{getCustomer(tansaction.user_info,'MobileNumber')}}</td> + <td>{{getCustomer(tansaction.user_info,'City')}}</td> + <td>{{getCustomer(tansaction.user_info,'Pincode')}}</td> <td>{{tansaction.currency}}</td> <td>SAR {{tansaction.amount}}</td> <td>{{tansaction.symbol + tansaction.convert_price}}</td> <td>{{tansaction.book_date}}</td> <td *ngIf="tansaction.driver_info">{{getCustomer(tansaction.driver_info,'name')}}</td> - <td *ngIf="!tansaction.driver_info"><span style="color: blue" data-toggle="modal" data-target="#edit" (click)="assignClick(i)" *ngIf="tansaction.status == 1">Assign</span></td> + <td *ngIf="!tansaction.driver_info"><span style="color: blue" data-toggle="modal" data-target="#edit" (click)="assignClick(i)" *ngIf="tansaction.status == 1 || tansaction.status == 2">Assign</span></td> <td>{{get_status(tansaction.status)}}</td> - <td><button class="edit_btn" data-toggle="modal" data-target="#edit" (click)="assignClick(i)" *ngIf="tansaction.status ==1"></button></td> + <td><button class="edit_btn" data-toggle="modal" data-target="#edit" (click)="assignClick(i)" *ngIf="tansaction.status ==1 || tansaction.status == 2"></button></td> </tr> </tbody> </table> @@ -96,11 +98,11 @@ <div class="forex_inner_wrapper" *ngIf="selectedData"> <div class="row"> <div class="col"><p> {{'transaction.User' | translate}}</p></div> - <div class="col"><p>{{getCustomer(selectedData.user_info,'name') | titlecase}}</p></div> + <div class="col"><p>{{getCustomer(selectedData.user_info,'FirstName')}} {{getCustomer(selectedData.user_info,'LastName')}}</p></div> </div> <div class="row"> <div class="col"><p> {{'transaction.Location' | translate}}</p></div> - <div class="col"><p>{{getCustomer(selectedData.user_info,'location')}}</p></div> + <div class="col"><p>{{getCustomer(selectedData.user_info,'City')}}</p></div> </div> <div class="row"> <div class="col"><p> {{'transaction.Amount' | translate}}</p></div> @@ -110,14 +112,16 @@ <div class="col-md-12"> <p> {{'transaction.Driver' | translate}}</p> <select class="provider_input" (change)="selectDriver($event.target.value)" #driver> - <option disabled hidden value=""> {{'transaction.Assign Driver' | translate}}</option> + <option disabled hidden value="" *ngIf="driverList.length === 0" selected="selected"> {{'transaction.No Drivers available currently!' | translate}}</option> + <option disabled hidden value="" *ngIf="driverList.length > 0" selected="selected"> {{'transaction.Assign Driver' | translate}}</option> <option *ngFor="let provider of driverList" [value]="provider.id">{{provider.name}}</option> + </select> </div> </div> </div> <div class="forex_modal_footer_btn_bay textRight"> - <button class="okay_btn" (click)="driverAssign()" [disabled]="driverStatus" data-dismiss="modal"> {{'transaction.Assign' | translate}}</button> + <button *ngIf="driverList && driverList.length > 0" class="okay_btn" (click)="driverAssign()" [disabled]="driverStatus" data-dismiss="modal"> {{'transaction.Assign' | translate}}</button> <button class="cancel_btn" data-dismiss="modal"> {{'transaction.Cancel' | translate}}</button> </div> </div> diff --git a/src/app/delivery/transaction/transaction.component.ts b/src/app/delivery/transaction/transaction.component.ts index 1dd5d05..3014f49 100644 --- a/src/app/delivery/transaction/transaction.component.ts +++ b/src/app/delivery/transaction/transaction.component.ts @@ -121,12 +121,15 @@ export class TransactionComponent implements OnInit { return 'Requested'; break; case 2: - return 'Delivered to Driver'; + return 'Assigned to Driver'; break; case 3: - return 'Delivered to Customer'; + return 'Delivered to Driver'; break; case 4: + return 'Delivered to Customer'; + break; + case 5: return 'Refund'; break; default: @@ -150,8 +153,8 @@ export class TransactionComponent implements OnInit { assignClick(index: any) { this.selectedData = this.transactionList[index]; const user_info = JSON.parse(this.selectedData.user_info); - console.log(user_info.PinCode); - this.providerDriver(this.selectedData.convert_price, user_info.PinCode); + console.log(user_info.Pincode); + this.providerDriver(this.selectedData.convert_price, user_info.Pincode); console.log(this.selectedData); } diff --git a/src/app/forex/editprovider/editprovider.component.html b/src/app/forex/editprovider/editprovider.component.html index dc0b71d..140badb 100644 --- a/src/app/forex/editprovider/editprovider.component.html +++ b/src/app/forex/editprovider/editprovider.component.html @@ -24,7 +24,7 @@ <div class="provider_inner_content"> <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> - <strong>{{'editprovider.Success' | translate}}!</strong> {{'editprovider.Provider updated successfully' | translate}}. + <strong>{{'editprovider.Success' | translate}}!</strong> {{'editprovider.Provider updated successfully' | translate}} </div> <div class="alert alert-danger alert-dismissible" *ngIf="error"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> @@ -141,6 +141,26 @@ </div> --> </div> <div class="row"> + <div class="col"> + <div class="provider_data_content"> + <p>{{'editprovider.Merchant ID' | translate}}</p> + <input class="provider_input" placeholder="" type="text" formControlName="merchant_id"> + </div> + <div class="s_error" *ngIf="!providerForm.controls['merchant_id'].valid && providerSubmit"> + <div class="s_validation" *ngIf="providerForm.controls['merchant_id'].hasError('required')">{{error_msg.required}} </div> + </div> + </div> + <div class="col"></div> + + <div class="col"></div> + <!-- <div class="col"> + <div class="provider_data_content"> + <p></p> + <div class="edit_delivery">Edit Delivery Driver</div> + </div> + </div> --> + </div> + <div class="row"> <div class="col"> <div class="add_provider_btn_bay"> <button class="save_btn floatRight">{{'editprovider.Save' | translate}}</button> diff --git a/src/app/forex/editprovider/editprovider.component.ts b/src/app/forex/editprovider/editprovider.component.ts index b1f5d5e..783d97e 100644 --- a/src/app/forex/editprovider/editprovider.component.ts +++ b/src/app/forex/editprovider/editprovider.component.ts @@ -55,6 +55,7 @@ export class EditproviderComponent implements OnInit { 'provider_id': [], 'online_status': ['', Validators.compose([Validators.required])], 'deli_provider_id': ['', Validators.compose([Validators.required])], + 'merchant_id': ['', Validators.compose([Validators.required])] }); } @@ -128,6 +129,7 @@ export class EditproviderComponent implements OnInit { phone: this.provider.phone, online_status: this.provider.online_status, deli_provider_id: this.provider.deli_provider_id, + merchant_id: this.provider.merchant_id }); } else { this.error = true; diff --git a/src/app/forex/service/service.component.html b/src/app/forex/service/service.component.html index b9b50d9..db8d8e2 100644 --- a/src/app/forex/service/service.component.html +++ b/src/app/forex/service/service.component.html @@ -8,7 +8,7 @@ <h4>{{'service.Configuration' | translate}}</h4> </div> <div class="col-md-6 textRight relative"> - <button class="logout" (click)="goToPage('maker/home')"> + <button class="logout" (click)="goToPage('forex/home')"> <img src="assets/images/asset_home.png"> {{'service.Home' | translate}}</button> <button class="logout" (click)="logout()"> @@ -26,7 +26,7 @@ <div class="provider_inner_content"> <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> - <strong> {{'service.Success!' | translate}}</strong> {{'service.Configuration saved successfully' | translate}} + <strong> {{'service.Success' | translate}}!</strong> {{'service.Configuration saved successfully' | translate}} </div> <div class="alert alert-danger alert-dismissible" *ngIf="error"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> diff --git a/src/app/forex/service/service.component.ts b/src/app/forex/service/service.component.ts index 216cba0..01b616d 100644 --- a/src/app/forex/service/service.component.ts +++ b/src/app/forex/service/service.component.ts @@ -120,9 +120,9 @@ export class ServiceComponent implements OnInit { waiting_time: this.config.waiting_time }); } else { - this.error = true; + // this.error = true; this.configForm.patchValue({'type': 1}); - this.responseError = this.vs.errorCode[this.lang][response.errorCode]; + // this.responseError = this.vs.errorCode[this.lang][response.errorCode]; } }, (error) => { this.error = true; @@ -147,4 +147,10 @@ export class ServiceComponent implements OnInit { this.service.logout(); } + goToPage(path: any, data = null) { + console.log(data); + this.router.navigateByUrl(path, {queryParams: data}); + document.body.scrollTop = document.documentElement.scrollTop = 0; + } + } diff --git a/src/app/forex/transaction/transaction.component.html b/src/app/forex/transaction/transaction.component.html index d00bac3..d371be2 100644 --- a/src/app/forex/transaction/transaction.component.html +++ b/src/app/forex/transaction/transaction.component.html @@ -40,7 +40,7 @@ <table class="table"> <thead> <tr> - <th>{{'transaction.User Info' | translate}}</th> + <th>{{'transaction.Customer' | translate}}</th> <th>{{'transaction.Date' | translate}}</th> <th>{{'transaction.Phone' | translate}}</th> <th>{{'transaction.Location' | translate}}</th> @@ -53,10 +53,10 @@ </thead> <tbody *ngIf="transactionList"> <tr *ngFor="let tansaction of transactionList"> - <td>{{getCustomer(tansaction.user_info,'name') | titlecase}}</td> + <td>{{getCustomer(tansaction.user_info,'FirstName') | titlecase}}</td> <td>{{tansaction.book_date}}</td> - <td>{{getCustomer(tansaction.user_info,'phone') | titlecase}}</td> - <td>{{getCustomer(tansaction.user_info,'location') | titlecase}}</td> + <td>{{getCustomer(tansaction.user_info,'MobileNumber') | titlecase}}</td> + <td>{{getCustomer(tansaction.user_info,'City') | titlecase}}</td> <td>{{tansaction.currency}}</td> <td>SAR {{tansaction.amount}}</td> <td>{{tansaction.symbol + tansaction.convert_price}}</td> diff --git a/src/app/forex/transaction/transaction.component.ts b/src/app/forex/transaction/transaction.component.ts index 1851a1e..471ff9c 100644 --- a/src/app/forex/transaction/transaction.component.ts +++ b/src/app/forex/transaction/transaction.component.ts @@ -89,12 +89,15 @@ export class TransactionComponent implements OnInit { return 'Requested'; break; case 2: - return 'Delivered to Driver'; + return 'Assigned to Driver'; break; case 3: - return 'Delivered to Customer'; + return 'Delivered to Driver'; break; case 4: + return 'Delivered to Customer'; + break; + case 5: return 'Refund'; break; default: diff --git a/src/app/maker/addforex/addforex.component.html b/src/app/maker/addforex/addforex.component.html index 663c82a..22151b5 100644 --- a/src/app/maker/addforex/addforex.component.html +++ b/src/app/maker/addforex/addforex.component.html @@ -159,6 +159,15 @@ <div class="row"> <div class="col"> + <div class="provider_data_content"> + <p>{{'editprovider.Merchant ID' | translate}}</p> + <input class="provider_input" placeholder="" type="text" formControlName="merchant_id"> + </div> + <div class="s_error" *ngIf="!providerForm.controls['merchant_id'].valid && providerSubmit"> + <div class="s_validation" *ngIf="providerForm.controls['merchant_id'].hasError('required')">{{error_msg.required}} </div> + </div> + </div> + <div class="col"> <div class="provider_data_content"> <p> {{'addforex.Status' | translate}}</p> <select class="provider_input" formControlName="online_status" tabindex="9"> @@ -172,7 +181,7 @@ </div> </div> - <div class="col"></div> + <div class="col"></div> </div> diff --git a/src/app/maker/addforex/addforex.component.ts b/src/app/maker/addforex/addforex.component.ts index b7aa81d..cb61e59 100644 --- a/src/app/maker/addforex/addforex.component.ts +++ b/src/app/maker/addforex/addforex.component.ts @@ -53,6 +53,7 @@ export class AddforexComponent implements OnInit { 'type': [2], 'online_status': ['', Validators.compose([Validators.required])], 'deli_provider_id': ['', Validators.compose([Validators.required])], + 'merchant_id': ['', Validators.compose([Validators.required])], 'password': [''], }); } diff --git a/src/app/maker/addprovider/addprovider.component.html b/src/app/maker/addprovider/addprovider.component.html index 8e72111..8ad97c2 100644 --- a/src/app/maker/addprovider/addprovider.component.html +++ b/src/app/maker/addprovider/addprovider.component.html @@ -38,7 +38,7 @@ <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.Provider Name' | translate}}</p> - <input class="provider_input" placeholder="" type="text" formControlName="name"> + <input class="provider_input" placeholder="" type="text" formControlName="name" tabindex="1"> </div> <div class="s_error" *ngIf="!providerForm.controls['name'].valid && providerSubmit"> <div class="s_validation" *ngIf="providerForm.controls['name'].hasError('required')">{{error_msg.required}} </div> @@ -55,8 +55,8 @@ <input class="provider_pin m0" placeholder="" type="password" maxlength="1" value="0" readonly> </div> </div> - <div class="col"> - <!-- <div class="provider_data_content"> + <!--<div class="col"> + <div class="provider_data_content"> <p> {{'addprovider.Confirm Pin' | translate}}</p> <input class="provider_pin" placeholder="" type="password" maxlength="1" value="0" readonly> <input class="provider_pin" placeholder="" type="password" maxlength="1" value="0" readonly> @@ -64,23 +64,23 @@ <input class="provider_pin" placeholder="" type="password" maxlength="1" value="0" readonly> <input class="provider_pin" placeholder="" type="password" maxlength="1" value="0" readonly> <input class="provider_pin m0" placeholder="" type="password" maxlength="1" value="0" readonly> - </div> --> - </div> - </div> - <div class="row"> - <div class="col"> + </div> + </div>--> + <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.Location' | translate}}</p> - <input class="provider_input" placeholder="" type="text" formControlName="location"> + <input class="provider_input" placeholder="" type="text" formControlName="location" tabindex="2"> </div> <div class="s_error" *ngIf="!providerForm.controls['location'].valid && providerSubmit"> <div class="s_validation" *ngIf="providerForm.controls['location'].hasError('required')">{{error_msg.required}} </div> </div> </div> + </div> + <div class="row"> <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.CR ID' | translate}}</p> - <input class="provider_input" placeholder="" type="number" formControlName="cr_id"> + <input class="provider_input" placeholder="" type="number" formControlName="cr_id" tabindex="3"> </div> <div class="s_error" *ngIf="!providerForm.controls['cr_id'].valid && providerSubmit"> <div class="s_validation" *ngIf="providerForm.controls['cr_id'].hasError('required')">{{error_msg.required}} </div> @@ -92,18 +92,16 @@ <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.CR Manager' | translate}}</p> - <input class="provider_input" placeholder="" type="text" formControlName="cr_manager"> + <input class="provider_input" placeholder="" type="text" formControlName="cr_manager" tabindex="4"> </div> <div class="s_error" *ngIf="!providerForm.controls['cr_manager'].valid && providerSubmit"> <div class="s_validation" *ngIf="providerForm.controls['cr_manager'].hasError('required')">{{error_msg.required}} </div> </div> </div> - </div> - <div class="row"> - <div class="col"> + <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.Contact Name' | translate}}</p> - <input class="provider_input" placeholder="" type="text" formControlName="contact"> + <input class="provider_input" placeholder="" type="text" formControlName="contact" tabindex="5"> </div> <div class="s_error" *ngIf="!providerForm.controls['contact'].valid"> <div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('pattern')">{{error_msg.pattern}}</div> @@ -112,10 +110,13 @@ <div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('required')">{{error_msg.required}} </div> </div> </div> + </div> + <div class="row"> + <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.Phone' | translate}}</p> - <input class="provider_input" placeholder="" type="number" formControlName="phone"> + <input class="provider_input" placeholder="" type="number" formControlName="phone" tabindex="6"> </div> <div class="s_error" *ngIf="!providerForm.controls['phone'].valid && providerForm.controls['phone'].touched"> <div class="s_validation" *ngIf="providerForm.controls['phone'].hasError('pattern')">{{error_msg.phone}}</div> @@ -131,7 +132,7 @@ <div class="col"> <div class="provider_data_content"> <p> {{'addprovider.Email id' | translate}}</p> - <input class="provider_input" placeholder="" type="mail" formControlName="email_id"> + <input class="provider_input" placeholder="" type="mail" formControlName="email_id" tabindex="7"> </div> <div class="s_error" *ngIf="!providerForm.controls['email_id'].valid && providerForm.controls['email_id'].touched"> <div class="s_validation" *ngIf="providerForm.controls['email_id'].hasError('pattern')">{{error_msg.email}} </div> @@ -141,6 +142,12 @@ <div class="s_validation" *ngIf="providerForm.controls['email_id'].hasError('required')">{{error_msg.required}} </div> </div> </div> + <div class="col"> + <!-- <div class="add_provider_btn_bay p0"> + <button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button> + <div class="clear"></div> + </div> --> + </div> </div> <!-- <div class="row"> <div class="col"> diff --git a/src/app/maker/currency-edit/currency-edit.component.html b/src/app/maker/currency-edit/currency-edit.component.html index 03a5740..9a56229 100644 --- a/src/app/maker/currency-edit/currency-edit.component.html +++ b/src/app/maker/currency-edit/currency-edit.component.html @@ -80,7 +80,7 @@ <div class="col"> <div class="provider_data_content"> - <p> {{'currencyedit.Forex Amount Start From' | translate}}</p> + <p> {{'currencyedit.Forex Multiple' | translate}}</p> <input class="provider_input" placeholder="" type="number" formControlName="start_from"> </div> <div class="s_error" *ngIf="!currencyForm.controls['start_from'].valid && currencySubmit"> diff --git a/src/app/maker/currency-edit/currency-edit.component.ts b/src/app/maker/currency-edit/currency-edit.component.ts index efe7c5e..02f4128 100644 --- a/src/app/maker/currency-edit/currency-edit.component.ts +++ b/src/app/maker/currency-edit/currency-edit.component.ts @@ -25,6 +25,7 @@ export class CurrencyEditComponent implements OnInit { file: File; currency: any; image_url: any; + curr_id: any; constructor(private router: Router, private route: ActivatedRoute, @@ -43,6 +44,7 @@ export class CurrencyEditComponent implements OnInit { const parm = decodeURIComponent(this.route.snapshot.params['id']); // tslint:disable-next-line:radix const id = parseInt(parm); + this.curr_id = id; this.getCurrency(id); this.currencyForm = this.formBuilder.group({ 'name': ['', Validators.compose([Validators.required])], @@ -76,8 +78,10 @@ export class CurrencyEditComponent implements OnInit { this.loader = false; console.log(response); if (response.code === 1) { + console.log(post_data); this.success = true; this.currencySubmit = false; + this.getCurrency(this.curr_id); } else { this.error = true; this.responseError = this.vs.errorCode[this.lang][response.errorCode]; @@ -92,7 +96,7 @@ export class CurrencyEditComponent implements OnInit { prepareSave(formHasImage): any { const input = new FormData(); - if(this.file) { + if (this.file) { input.append('flag', this.file); } input.append('name', formHasImage.name); @@ -105,6 +109,7 @@ export class CurrencyEditComponent implements OnInit { } getCurrency(id) { + console.log(id); this.loader = true; this.funcName = 'currency_details'; const post_data = {'currency_id': id}; @@ -113,13 +118,14 @@ export class CurrencyEditComponent implements OnInit { console.log(response); if (response.code === 1) { this.currency = response.responseResult; + console.log(this.currency); this.image_url = this.currency.flag; this.currencyForm.patchValue({ name: this.currency.name, symbol: this.currency.symbol, rate: this.currency.rate, start_from: this.currency.start_from, - flag: this.currency.flag + flag: '' }); } else { this.error = true; @@ -148,4 +154,10 @@ export class CurrencyEditComponent implements OnInit { this.service.logout(); } + goToPage(path: any, data = null) { + console.log(data); + this.router.navigateByUrl(path, {queryParams: data}); + document.body.scrollTop = document.documentElement.scrollTop = 0; + } + } diff --git a/src/app/maker/editforex/editforex.component.html b/src/app/maker/editforex/editforex.component.html index 5e599dd..9dfc590 100644 --- a/src/app/maker/editforex/editforex.component.html +++ b/src/app/maker/editforex/editforex.component.html @@ -140,6 +140,26 @@ </div> </div> --> </div> + <div class="row"> + <div class="col"> + <div class="provider_data_content"> + <p>{{'editprovider.Merchant ID' | translate}}</p> + <input class="provider_input" placeholder="" type="text" formControlName="merchant_id"> + </div> + <div class="s_error" *ngIf="!providerForm.controls['merchant_id'].valid && providerSubmit"> + <div class="s_validation" *ngIf="providerForm.controls['merchant_id'].hasError('required')">{{error_msg.required}} </div> + </div> + </div> + <div class="col"></div> + + <div class="col"></div> + <!-- <div class="col"> + <div class="provider_data_content"> + <p></p> + <div class="edit_delivery">Edit Delivery Driver</div> + </div> + </div> --> + </div> <div class="row" *ngIf="provider"> <div class="col"> <div class="add_provider_btn_bay"> diff --git a/src/app/maker/editforex/editforex.component.ts b/src/app/maker/editforex/editforex.component.ts index bd5f019..34334ee 100644 --- a/src/app/maker/editforex/editforex.component.ts +++ b/src/app/maker/editforex/editforex.component.ts @@ -58,6 +58,7 @@ export class EditforexComponent implements OnInit { 'provider_id': [id], 'online_status': ['', Validators.compose([Validators.required])], 'deli_provider_id': ['', Validators.compose([Validators.required])], + 'merchant_id': ['', Validators.compose([Validators.required])], 'status': [''], }); } @@ -104,6 +105,7 @@ export class EditforexComponent implements OnInit { online_status: this.provider.online_status, deli_provider_id: this.provider.deli_provider_id, status: this.provider.status, + merchant_id: this.provider.merchant_id, users_id: this.provider.users_id }); } else { diff --git a/src/app/maker/editprovider/editprovider.component.html b/src/app/maker/editprovider/editprovider.component.html index 1ddbc1a..e2ac587 100644 --- a/src/app/maker/editprovider/editprovider.component.html +++ b/src/app/maker/editprovider/editprovider.component.html @@ -24,7 +24,7 @@ <div class="provider_inner_content"> <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> - <strong> {{'editprovider.Success!' | translate}}</strong> {{'editprovider.Provider updated successfully' | translate}} + <strong> {{'editprovider.Success' | translate}}</strong> {{'editprovider.Provider updated successfully' | translate}} </div> <div class="alert alert-danger alert-dismissible" *ngIf="error"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> diff --git a/src/app/maker/forexprovider/forexprovider.component.html b/src/app/maker/forexprovider/forexprovider.component.html index 222ad32..0b08160 100644 --- a/src/app/maker/forexprovider/forexprovider.component.html +++ b/src/app/maker/forexprovider/forexprovider.component.html @@ -30,6 +30,10 @@ <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong> {{'forexprovider.Success!' | translate}}</strong> {{'forexprovider.Forex provider removed successfully' | translate}} + </div> + <div class="row"> + <div class="col"></div> + <div class="col" style="text-align: right"><input type="text" placeholder="{{'manageprovider.Search...' | translate}}" (input)="onSearchChange($event.target.value)" /></div> </div> <table class="table"> <thead> @@ -64,6 +68,12 @@ </tr> </tbody> </table> + <div class="forex_pagination" *ngIf="meta"> + <ul> + <li *ngFor="let i of getNumber(meta.total_pages); let j = index" [ngClass]="{'activeClass': meta.current_page == j+1}" (click)="getProvider(j+1)">{{j+1}}</li> + </ul> + + </div> <ng-template #noProvider></ng-template> </div> </div> diff --git a/src/app/maker/forexprovider/forexprovider.component.ts b/src/app/maker/forexprovider/forexprovider.component.ts index 30e155b..d9ecce4 100644 --- a/src/app/maker/forexprovider/forexprovider.component.ts +++ b/src/app/maker/forexprovider/forexprovider.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { WebService } from './../../providers/web.service'; import { ValidationService } from './../../providers/validation.service'; @@ -16,30 +16,51 @@ export class ForexproviderComponent implements OnInit { error: boolean; success: boolean; loader: boolean; + meta: any; + page_number: any; + searchtxt: any; + @ViewChild('search') search: ElementRef; constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) { this.responseMsg = ''; this.error = false; this.success = false; this.loader = false; + this.page_number = 1; + this.searchtxt = ''; } ngOnInit() { - this.getProvider(); + this.getProvider(1); } - getProvider() { + getProvider(page_number: number) { + this.page_number = page_number; this.loader = true; this.fname = 'all_providers'; - const post_data = {'type': 2}; + const post_data = {'type': 2, 'page': page_number, 'searchtxt': this.searchtxt}; this.service.post_data(this.fname, post_data).subscribe(response => { this.loader = false; console.log(response); if (response.code === 1) { - this.providerList = response.responseResult; + this.providerList = response.responseResult.data; + this.meta = response.responseResult.meta; + console.log(this.meta); } else { - this.error = true; - this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + if (response.errorCode === 'ER36') { + this.page_number = this.page_number - 1; + if (this.page_number >= 1) { + this.getProvider(this.page_number); + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } } }, (error) => { this.error = true; @@ -57,6 +78,15 @@ export class ForexproviderComponent implements OnInit { this.success = false; } + getNumber(num) { + return new Array(num); + } + + onSearchChange(text: string) { + this.searchtxt = text; + this.getProvider(1); + } + deleteClick(provider_id: any) { this.reset(); const res = confirm('Do you want to remove this user ?'); @@ -70,7 +100,7 @@ export class ForexproviderComponent implements OnInit { if (response.code === 1) { this.success = true; console.log(this.success); - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; diff --git a/src/app/maker/manageprovider/manageprovider.component.html b/src/app/maker/manageprovider/manageprovider.component.html index f51ca3c..2d20161 100644 --- a/src/app/maker/manageprovider/manageprovider.component.html +++ b/src/app/maker/manageprovider/manageprovider.component.html @@ -30,7 +30,11 @@ <div class="alert alert-success alert-dismissible" *ngIf="success"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong> {{'manageprovider.Success!' | translate}}</strong>{{'manageprovider.Delivery provider removed successfully' | translate}} - </div> + </div> + <div class="row"> + <div class="col"></div> + <div class="col" style="text-align: right"><input type="text" (input)="onSearchChange($event.target.value)" placeholder="{{'manageprovider.Search...' | translate}}" /></div> + </div> <table class="table"> <thead> <tr> @@ -63,7 +67,12 @@ </td> </tr> </tbody> - </table> + </table> + <div class="forex_pagination" *ngIf="meta"> + <ul> + <li *ngFor="let i of getNumber(meta.total_pages); let j = index" [ngClass]="{'activeClass': meta.current_page == j+1}" (click)="getProvider(j+1)">{{j+1}}</li> + </ul> + </div> <ng-template #noProvider></ng-template> </div> </div> diff --git a/src/app/maker/manageprovider/manageprovider.component.ts b/src/app/maker/manageprovider/manageprovider.component.ts index 7a1b799..eb09ecd 100644 --- a/src/app/maker/manageprovider/manageprovider.component.ts +++ b/src/app/maker/manageprovider/manageprovider.component.ts @@ -16,30 +16,50 @@ export class ManageproviderComponent implements OnInit { error: boolean; success: boolean; loader: boolean; + page_number: any; + meta: any; + searchtxt: any; constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) { this.responseMsg = ''; this.error = false; this.success = false; this.loader = false; + this.page_number = 1; + this.searchtxt = ''; } ngOnInit() { - this.getProvider(); + this.getProvider(1); } - getProvider() { + getProvider(page_number: number) { + console.log(page_number); + this.page_number = page_number; this.loader = true; this.fname = 'all_providers'; - const post_data = {'type': 3}; + const post_data = {'type': 3, 'page': page_number, 'searchtxt': this.searchtxt}; this.service.post_data(this.fname, post_data).subscribe(response => { this.loader = false; console.log(response); if (response.code === 1) { - this.providerList = response.responseResult; + this.providerList = response.responseResult.data; + this.meta = response.responseResult.meta; } else { - this.error = true; - this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + if (response.errorCode === 'ER36') { + this.page_number = this.page_number - 1; + if (this.page_number >= 1) { + this.getProvider(this.page_number); + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } + } else { + this.error = true; + this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; + this.providerList = []; + } } }, (error) => { this.error = true; @@ -58,6 +78,15 @@ export class ManageproviderComponent implements OnInit { document.body.scrollTop = document.documentElement.scrollTop = 0; } + onSearchChange(text: string) { + this.searchtxt = text; + this.getProvider(1); + } + + getNumber(num) { + return new Array(num); + } + reset() { this.error = false; this.success = false; @@ -76,7 +105,7 @@ export class ManageproviderComponent implements OnInit { if (response.code === 1) { this.success = true; console.log(this.success); - this.getProvider(); + this.getProvider(this.page_number); } else { this.error = true; this.responseMsg = this.vs.errorCode[this.lang][response.errorCode]; diff --git a/src/app/start/forgot/forgot.component.html b/src/app/start/forgot/forgot.component.html index f10bdbc..5c15af5 100644 --- a/src/app/start/forgot/forgot.component.html +++ b/src/app/start/forgot/forgot.component.html @@ -8,14 +8,42 @@ {{'forgot.Forgot your PIN' | translate}} </h6> <div class="login_inner_content"> + <form [formGroup]="forgotForm" autocomplete="off"> <br> <div class="login_row"> - <input class="" placeholder=" {{'forgot.Email Address' | translate}}"> + <input class="" placeholder=" {{'forgot.Phone Number (96655XXXXXXX)' | translate}}" formControlName="phone"> + <div class="s_error" *ngIf="!forgotForm.controls['phone'].valid && forgotSubmit"> + <div class="s_validation" *ngIf="forgotForm.controls['phone'].hasError('required')">{{error_msg.required}} </div> + </div> + <div class="s_error" *ngIf="!forgotForm.controls['phone'].valid && forgotForm.controls['phone'].touched"> + <div class="s_validation" *ngIf="forgotForm.controls['phone'].hasError('pattern')">{{error_msg.phone}}</div> + </div> + <div class="s_error" *ngIf="!forgotForm.controls['phone'].valid && forgotForm.controls['phone'].touched && !forgotForm.controls['phone'].hasError('pattern')"> + + <div class="s_validation" *ngIf="forgotForm.controls['phone'].hasError('maxlength')">{{error_msg.maxLength}} 11</div> + <div class="s_validation" *ngIf="forgotForm.controls['phone'].hasError('minlength')">{{error_msg.minLength}} 9</div> + </div> </div> + <div class="login_row" *ngIf="success"> + <div class="login_pin"> + <input class="log_pin" type="password" maxlength="1" #focus1 (keyup)="processKeyUp($event, focus2)"> + <input class="log_pin" type="password" maxlength="1" #focus2 (keydown.backspace)="processBack($event, focus1)" (keyup)="processKeyUp($event, focus3)"> + <input class="log_pin" type="password" maxlength="1" #focus3 (keydown.backspace)="processBack($event, focus2)" (keyup)="processKeyUp($event, focus4)"> + <input class="log_pin" type="password" maxlength="1" #focus4 (keydown.backspace)="processBack($event, focus3)" (keyup)="processKeyUp($event, focus5)"> + <input class="log_pin" type="password" maxlength="1" #focus5 (keydown.backspace)="processBack($event, focus4)" (keyup)="processKeyUp($event, focus6)"> + <input class="log_pin m0" type="password" maxlength="1" #focus6 (keydown.backspace)="processBack($event, focus5)"> + </div> + </div> + <div *ngIf="error" class="s_validation">{{responseError}}</div> <div class="login_row"> - <button class="login_btn" (click)="goToPage('start/newpin')">{{'forgot.SEND ME THE LINK' | translate}}</button> + <button class="login_btn" (click)="reqOtp()" *ngIf="!success">{{'forgot.SEND OTP' | translate}}</button> + <div class="row"> + <div class="col"><button class="login_btn" (click)="verifyOtp()" *ngIf="success">{{'forgot.Verify OTP' | translate}}</button></div> + <div class="col"><button class="login_btn" (click)="reqOtp()" *ngIf="success">{{'forgot.Resend' | translate}}</button></div> + </div> </div> + </form> </div> </div> </div> diff --git a/src/app/start/forgot/forgot.component.ts b/src/app/start/forgot/forgot.component.ts index 28a37af..25eac9b 100644 --- a/src/app/start/forgot/forgot.component.ts +++ b/src/app/start/forgot/forgot.component.ts @@ -1,5 +1,8 @@ -import { Component, OnInit } from '@angular/core'; -import { Router,ActivatedRoute } from '@angular/router'; +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { WebService } from './../../providers/web.service'; +import { ValidationService } from './../../providers/validation.service'; +import { FormControl, FormGroup, FormBuilder, Validators, ValidationErrors } from '@angular/forms'; @Component({ selector: 'app-forgot', @@ -8,15 +11,155 @@ import { Router,ActivatedRoute } from '@angular/router'; }) export class ForgotComponent implements OnInit { - constructor(private router: Router,private route: ActivatedRoute) { } + forgotForm: FormGroup; + mobnumPattern = '^((\\+?)|0)?[0-9]{9,11}$'; + forgotSubmit: boolean; + lang = 'en'; + error_msg: any[]; + funcName: any; + loader: boolean; + responseError: any; + error: boolean; + success: boolean; + otpErr: boolean; + otpError: boolean; + forgotMsg: any; + @ViewChild('focus1') focus1: ElementRef; + @ViewChild('focus2') focus2: ElementRef; + @ViewChild('focus3') focus3: ElementRef; + @ViewChild('focus4') focus4: ElementRef; + @ViewChild('focus5') focus5: ElementRef; + @ViewChild('focus6') focus6: ElementRef; + + constructor( + private router: Router, + private route: ActivatedRoute, + public vs: ValidationService, + public service: WebService, + private formBuilder: FormBuilder + ) { + this.otpErr = false; + this.otpError = false; + this.error_msg = this.vs.errorList[this.lang]; + } ngOnInit() { + this.forgotForm = this.formBuilder.group({ + // tslint:disable-next-line:max-line-length + 'phone': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(15), Validators.pattern(this.mobnumPattern)])], + }); } - goToPage(path,data=null){ - console.log(data) - this.router.navigateByUrl(path,{queryParams:data}); + goToPage(path: any, data = null){ + console.log(data); + this.router.navigateByUrl(path, {queryParams:data}); document.body.scrollTop = document.documentElement.scrollTop = 0; } + reqOtp() { + const This = this; + this.error = false; + this.success = false; + this.forgotSubmit = true; + if (this.forgotForm.valid) { + this.loader = true; + const providerObj = this.forgotForm.value; + this.funcName = 'send_otp'; + this.service.post_data(this.funcName, providerObj).subscribe(response => { + this.loader = false; + console.log(response); + if (response.code === 1) { + this.success = true; + this.forgotSubmit = false; + this.reset(); + } else { + this.error = true; + this.responseError = this.vs.errorCode[this.lang][response.errorCode]; + } + }, (error) => { + this.error = false; + this.responseError = this.vs.errorCode[this.lang]['ER08']; + }); + } + console.log('tested'); + } + + + processKeyUp(e: any, el: any) { + console.log(e.keyCode); + if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) { + el.focus(); + } else { + if (e.keyCode !== 8) { + e.target.value = ''; + } + } + } + + reset() { + if (this.focus1) { + this.focus1.nativeElement.value = ''; + this.focus2.nativeElement.value = ''; + this.focus3.nativeElement.value = ''; + this.focus4.nativeElement.value = ''; + this.focus5.nativeElement.value = ''; + this.focus6.nativeElement.value = ''; + } + } + + + + processBack (e: any, el: any) { + console.log(e); + if (e.keyCode === 8) { + e.target.value = ''; + el.focus(); + } + } + + verifyOtp() { + const password = []; + password[0] = this.focus1.nativeElement.value; + password[1] = this.focus2.nativeElement.value; + password[2] = this.focus3.nativeElement.value; + password[3] = this.focus4.nativeElement.value; + password[4] = this.focus5.nativeElement.value; + password[5] = this.focus6.nativeElement.value; + + const pass = password.join(''); + const phone = this.forgotForm.value['phone']; + + if (phone === '') { + if (pass === '') { + this.otpErr = true; + } + return false; + } + for (const i in password) { + if (password[i] === '') { + this.otpErr = true; + return false; + } + } + + this.loader = true; + + this.funcName = 'otp_verify'; + const post_data = {'phone': phone, 'otp': pass}; + this.service.post_data(this.funcName, post_data).subscribe(response => { + this.loader = false; + console.log(response); + if (response.code === 1) { + const responseData = response.responseResult; + this.router.navigate(['start/newpin/' + responseData.user_id]); + } else { + this.error = true; + this.responseError = this.vs.errorCode[this.lang][response.errorCode]; + } + }, (error) => { + this.error = true; + this.responseError = this.vs.errorCode[this.lang]['ER08']; + }); + } + } diff --git a/src/app/start/login/login.component.html b/src/app/start/login/login.component.html index 767b70d..b5515fe 100644 --- a/src/app/start/login/login.component.html +++ b/src/app/start/login/login.component.html @@ -1,3 +1,6 @@ +<div class="custom_loader_wrapper" *ngIf="loader"> + <div class="custom_loader_ring"></div> +</div> <div class="login_wrapper"> <div class="container"> <div class="row"> diff --git a/src/app/start/login/login.component.ts b/src/app/start/login/login.component.ts index 4697fed..5f4d9d8 100644 --- a/src/app/start/login/login.component.ts +++ b/src/app/start/login/login.component.ts @@ -31,6 +31,7 @@ export class LoginComponent implements OnInit { loginError: boolean; loginMsg: any; loginDetails: any; + loader: boolean; val = 0; constructor( private router: Router, @@ -39,14 +40,12 @@ export class LoginComponent implements OnInit { public service: WebService, public subjectService: SubjectService, ) { - //this.language.nativeElement.value = this.service.getLocalStorageItem('lang'); - - //this.lang = this.service.getLocalStorageItem('lang'); this.error_msg = this.vs.errorList[this.lang]; console.log(this.error_msg); this.passwordErr = false; this.loginSubmit = false; this.loginError = false; + this.loader = false; this.subjectService.getLoginData().subscribe(loginData => { this.loginDetails = JSON.parse(this.service.getLocalStorageItem('userData')); @@ -61,16 +60,6 @@ export class LoginComponent implements OnInit { } } }); - - - /* this.subjectService.getisLoggined().subscribe(isLoggined => { - console.log(isLoggined); - if (isLoggined != null) { - if (isLoggined === 'not_loggedIn') { - this.router.navigate(['/start/login']); - } - } - }); */ } ngOnInit() { @@ -133,9 +122,12 @@ export class LoginComponent implements OnInit { } } + this.loader = true; + this.fname = 'admin_login'; const post_data = {'email_id': this.model.email_id, 'password': pass}; this.service.post_data(this.fname, post_data).subscribe(response => { + this.loader = false; console.log(response); if (response.code === 1) { const responseData = response.responseResult; diff --git a/src/app/start/newpin/newpin.component.html b/src/app/start/newpin/newpin.component.html index a8e092b..c559bbb 100644 --- a/src/app/start/newpin/newpin.component.html +++ b/src/app/start/newpin/newpin.component.html @@ -8,50 +8,48 @@ <div class="login_inner_content"> <br> - <div class="login_row"> - <p>{{'newpin.New PIN' | translate}}</p> - <div class="login_pin"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin m0" type="password" maxlength="1" value="0"> - <!-- <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> --> - </div> - </div> - <div class="login_row"> - <p> {{'newpin.Confirm PIN' | translate}}</p> - <div class="login_pin"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin" type="password" maxlength="1" value="0"> - <input class="log_pin m0" type="password" maxlength="1" value="0"> - <!-- <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> - <input class="log_pin" placeholder="*" type="password" maxlength="1"> --> - </div> - </div> - </div> + <div class="login_row"> + <p>{{'changepin.New PIN' | translate}}</p> + <div class="login_pin"> + <input class="log_pin" type="password" maxlength="1" #new1 (keyup)="processKeyUp($event, new2)"> + <input class="log_pin" type="password" maxlength="1" #new2 (keydown.backspace)="processBack($event, new1)" (keyup)="processKeyUp($event, new3)"> + <input class="log_pin" type="password" maxlength="1" #new3 (keydown.backspace)="processBack($event, new2)" (keyup)="processKeyUp($event, new4)"> + <input class="log_pin" type="password" maxlength="1" #new4 (keydown.backspace)="processBack($event, new3)" (keyup)="processKeyUp($event, new5)"> + <input class="log_pin" type="password" maxlength="1" #new5 (keydown.backspace)="processBack($event, new4)" (keyup)="processKeyUp($event, new6)"> + <input class="log_pin m0" type="password" maxlength="1" #new6 (keydown.backspace)="processBack($event, new5)"> + </div> + </div> + <div class="s_error" *ngIf="newpasswordErr"> + <div class="s_validation">{{error_msg.password}} </div> + </div> + <div class="login_row"> + <p> {{'changepin.Confirm PIN' | translate}}</p> + <div class="login_pin"> + <input class="log_pin" type="password" maxlength="1" #conf1 (keyup)="processKeyUp($event, conf2)"> + <input class="log_pin" type="password" maxlength="1" #conf2 (keydown.backspace)="processBack($event, conf1)" (keyup)="processKeyUp($event, conf3)"> + <input class="log_pin" type="password" maxlength="1" #conf3 (keydown.backspace)="processBack($event, conf2)" (keyup)="processKeyUp($event, conf4)"> + <input class="log_pin" type="password" maxlength="1" #conf4 (keydown.backspace)="processBack($event, conf3)" (keyup)="processKeyUp($event, conf5)"> + <input class="log_pin" type="password" maxlength="1" #conf5 (keydown.backspace)="processBack($event, conf4)" (keyup)="processKeyUp($event, conf6)"> + <input class="log_pin m0" type="password" maxlength="1" #conf6 (keydown.backspace)="processBack($event, conf5)"> + </div> + </div> + <div class="s_error" *ngIf="confpasswordErr"> + <div class="s_validation">{{error_msg.password}} </div> + </div> + <div class="s_error" *ngIf="notMatchErr"> + <div class="s_validation">{{error_msg.confirm}} </div> + </div> </div> </div> + <div *ngIf="success" class="s_validation">{{'newpin.Password Reset Successfully' | translate}}</div> <div class="login_btn_bay"> <div class="row"> + <div class="col-md-6"> - <button class="cancel_btn" (click)="goToPage('start/forgot')">{{'newpin.Cancel' | translate}}</button> + <button class="cancel_btn" (click)="goToPage('start/login')">{{'newpin.Cancel' | translate}}</button> </div> <div class="col-md-6"> - <button class="login_btn" (click)="goToPage('start/login')"> {{'newpin.Save' | translate}}</button> + <button class="login_btn" (click)="saveClick()"> {{'newpin.Save' | translate}}</button> </div> </div> </div> diff --git a/src/app/start/newpin/newpin.component.ts b/src/app/start/newpin/newpin.component.ts index 8c5b3c8..16e7301 100644 --- a/src/app/start/newpin/newpin.component.ts +++ b/src/app/start/newpin/newpin.component.ts @@ -1,5 +1,8 @@ -import { Component, OnInit } from '@angular/core'; -import { Router,ActivatedRoute } from '@angular/router'; +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { ValidationService } from './../../providers/validation.service'; +import { SubjectService } from './../../providers/subject.service'; +import { WebService } from './../../providers/web.service'; @Component({ selector: 'app-newpin', @@ -8,15 +11,194 @@ import { Router,ActivatedRoute } from '@angular/router'; }) export class NewpinComponent implements OnInit { - constructor(private router: Router,private route: ActivatedRoute) { } + @ViewChild('new1') new1: ElementRef; + @ViewChild('new2') new2: ElementRef; + @ViewChild('new3') new3: ElementRef; + @ViewChild('new4') new4: ElementRef; + @ViewChild('new5') new5: ElementRef; + @ViewChild('new6') new6: ElementRef; + + @ViewChild('conf1') conf1: ElementRef; + @ViewChild('conf2') conf2: ElementRef; + @ViewChild('conf3') conf3: ElementRef; + @ViewChild('conf4') conf4: ElementRef; + @ViewChild('conf5') conf5: ElementRef; + @ViewChild('conf6') conf6: ElementRef; + + error_msg: any[]; + lang = 'en'; + model: any; + passwordErr: boolean; + newpasswordErr: boolean; + confpasswordErr: boolean; + notMatchErr: boolean; + password: any; + fname: any; + loginSubmit: boolean; + resetError: boolean; + resetMsg: any; + loginDetails: any; + error: boolean; + user_id: any; + success: boolean; + + constructor( + private router: Router, + private route: ActivatedRoute, + public vs: ValidationService, + public service: WebService, + public subjectService: SubjectService + ) { + this.error = false; + this.passwordErr = false; + this.newpasswordErr = false; + this.confpasswordErr = false; + this.notMatchErr = false; + this.error_msg = this.vs.errorList[this.lang]; + this.user_id = decodeURIComponent(this.route.snapshot.params['id']); + console.log(this.user_id); + this.success = false; + } ngOnInit() { } - goToPage(path,data=null){ - console.log(data) - this.router.navigateByUrl(path,{queryParams:data}); + goToPage(path: any, data = null){ + console.log(data); + this.router.navigateByUrl(path, {queryParams:data}); document.body.scrollTop = document.documentElement.scrollTop = 0; } + processKeyUp(e: any, el: any) { + el.value = ''; + console.log(e); + if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) { + e.target.value = e.key; + el.focus(); + } else { + if (e.keyCode !== 8) { + e.target.value = ''; + } + } + } + + processBack (e: any, el: any) { + if (e.keyCode === 8) { + e.target.value = ''; + el.focus(); + } + } + + saveClick() { + + this.loginSubmit = true; + this.passwordErr = false; + this.newpasswordErr = false; + this.confpasswordErr = false; + this.notMatchErr = false; + this.resetError = false; + this.error = false; + const password = []; + const newpassword = []; + const confirm = []; + const This = this; + this.success = false; + + newpassword[0] = this.new1.nativeElement.value; + newpassword[1] = this.new2.nativeElement.value; + newpassword[2] = this.new3.nativeElement.value; + newpassword[3] = this.new4.nativeElement.value; + newpassword[4] = this.new5.nativeElement.value; + newpassword[5] = this.new6.nativeElement.value; + + + confirm[0] = this.conf1.nativeElement.value; + confirm[1] = this.conf2.nativeElement.value; + confirm[2] = this.conf3.nativeElement.value; + confirm[3] = this.conf4.nativeElement.value; + confirm[4] = this.conf5.nativeElement.value; + confirm[5] = this.conf6.nativeElement.value; + + + const newpass = newpassword.join(''); + const confirmpass = confirm.join(''); + + if (newpass === '') { + this.newpasswordErr = true; + this.error = true; + } else { + for (const i in newpassword) { + if (newpassword[i] === '') { + this.newpasswordErr = true; + this.error = true; + } + } + } + + if (confirmpass === '') { + this.confpasswordErr = true; + this.error = true; + } else { + for (const i in confirm) { + if (confirm[i] === '') { + this.confpasswordErr = true; + this.error = true; + } + } + } + + console.log(this.error); + + + + if (this.error === false) { + if (newpass !== confirmpass) { + this.notMatchErr = true; + this.error = true; + } + } + + if (this.error === true) { + return false; + } + + this.fname = 'confirm_pin'; + const post_data = {'user_id': this.user_id, 'password': newpass}; + this.service.post_data(this.fname, post_data).subscribe(response => { + console.log(response); + if (response.code === 1) { + const responseData = response.responseResult; + this.reset(); + this.success = true; + setTimeout(function(){ + This.router.navigate(['start/login/']); + }, 2000); + } else { + this.resetError = true; + this.resetMsg = this.vs.errorCode[this.lang][response.errorCode]; + console.log(this.resetMsg); + } + }, (error) => { + this.resetError = true; + this.resetMsg = this.vs.errorCode[this.lang]['ER08']; + console.log(this.resetMsg); + }); + } + + reset() { + this.conf1.nativeElement.value = ''; + this.conf2.nativeElement.value = ''; + this.conf3.nativeElement.value = ''; + this.conf4.nativeElement.value = ''; + this.conf5.nativeElement.value = ''; + this.conf6.nativeElement.value = ''; + + this.new1.nativeElement.value = ''; + this.new2.nativeElement.value = ''; + this.new3.nativeElement.value = ''; + this.new4.nativeElement.value = ''; + this.new5.nativeElement.value = ''; + this.new6.nativeElement.value = ''; + } + } diff --git a/src/app/start/start.routing.ts b/src/app/start/start.routing.ts index 9b22475..5ddc55d 100644 --- a/src/app/start/start.routing.ts +++ b/src/app/start/start.routing.ts @@ -28,7 +28,7 @@ const ModuleRoutes: Routes = [ component: ForgotComponent, }, { - path: "newpin", + path: "newpin/:id", component: NewpinComponent, }, { diff --git a/src/assets/i18n/ar.json b/src/assets/i18n/ar.json index aefc37e..b265e6c 100644 --- a/src/assets/i18n/ar.json +++ b/src/assets/i18n/ar.json @@ -172,7 +172,8 @@ "Cancel":"Cancel", "Forex Provider":"Forex Provider", "Status":"Status", - "Delivery Provider":"Delivery Provider" + "Delivery Provider":"Delivery Provider", + "Merchant ID": "Merchant ID" }, "forexprovider":{ "Forex Provider":"Forex Provider", @@ -318,7 +319,20 @@ "Assign":"Assign", "Cancel":"Cancel", "Provider": "Provider", - "Config": "Config" + "Config": "Config", + "No Drivers available currently!":"No Drivers available currently!" + }, + "service": { + "Configuration":"Configuration", + "Service Charge Management": "Service Charge Management", + "Change PIN": "Change PIN", + "Configuration saved successfully": "Configuration saved successfully", + "Waiting Time":"Waiting Time", + "Cancellation Time":"Cancellation Time", + "Airport Delivery":"Airport Delivery", + "Hand Delivery":"Hand Delivery", + "Tax":"Tax", + "Save":"Save" } } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 9ee54d0..22ade18 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -8,8 +8,10 @@ }, "forgot":{ "Forgot your PIN": "Forgot your PIN", - "Email Address": "Email Address", - "SEND ME THE LINK": "SEND ME THE LINK" + "Phone Number (96655XXXXXXX)": "Phone Number (96655XXXXXXX)", + "SEND OTP": "SEND OTP", + "Verify OTP": "Verify OTP", + "Resend": "Resend" }, "invalid":{ "Access Denied": "Access Denied", @@ -19,7 +21,8 @@ "New PIN": "New PIN", "Confirm PIN": "Confirm PIN", "Cancel": "Cancel", - "Save": "Save" + "Save": "Save", + "Password Reset Successfully": "Password Reset Successfully" }, "addforex":{ "Forex Delivery Service Provider" :"Forex Provider", @@ -107,7 +110,7 @@ "Flag":"Flag", "Choose Flag":"Choose Flag", "Rate":"Rate", - "Forex Amount Start From":"Forex Amount Start From", + "Forex Multiple":"Forex Multiple", "Cancel":"Cancel", "Save":"Save" }, @@ -158,8 +161,8 @@ "Logout":"Logout", "Change PIN":"Change PIN", "Edit Delivery Service Provider":"Edit Delivery Service Provider", - "Warning!":"Warning!", - "Success!":"Success!", + "Warning":"Warning", + "Success":"Success", "Provider updated successfully":"Provider updated successfully", "Provider Name":"Provider Name", "Location":"Location", @@ -172,7 +175,8 @@ "Cancel":"Cancel", "Forex Provider":"Forex Provider", "Status":"Status", - "Delivery Provider":"Delivery Provider" + "Delivery Provider":"Delivery Provider", + "Merchant ID": "Merchant ID" }, "forexprovider":{ "Forex Provider":"Forex Provider", @@ -216,7 +220,8 @@ "CR ID":"CR ID", "Contact Name":"Contact Name", "Phone":"Phone", - "Email ID":"Email ID" + "Email ID":"Email ID", + "Search...": "Search..." }, "adddriver":{ "Driver Management":"Driver Management", @@ -306,7 +311,7 @@ "Warning":"Warning", "Success":"Success", "Forex provider removed successfully":"Forex provider removed successfully", - "User Info":"User name", + "Customer":"Customer", "Phone":"Phone", "Location":"Location", "Amount":"Amount", @@ -318,7 +323,9 @@ "Assign":"Assign", "Cancel":"Cancel", "Provider": "Provider", - "Config": "Config" + "Config": "Config", + "Pincode": "Pincode", + "No Drivers available currently!":"No Drivers available currently!" }, "service": { "Configuration":"Configuration", @@ -330,7 +337,11 @@ "Airport Delivery":"Airport Delivery", "Hand Delivery":"Hand Delivery", "Tax":"Tax", - "Save":"Save" + "Save":"Save", + "Cancel": "Cancel", + "Success": "Success", + "Home": "Home", + "Logout": "Logout" } } diff --git a/src/assets/images/loader.gif b/src/assets/images/loader.gif new file mode 100644 index 0000000..f4948f5 Binary files /dev/null and b/src/assets/images/loader.gif differ diff --git a/src/environments/server.config.ts b/src/environments/server.config.ts index 7afa105..4399f59 100644 --- a/src/environments/server.config.ts +++ b/src/environments/server.config.ts @@ -1,4 +1,4 @@ -export const ImageStorage = 'http://forex.nuvento.com/'; -// export const ImageStorage = 'http://localhost:3000/'; +// export const ImageStorage = 'https://forex.nuvento.com/'; + export const ImageStorage = 'http://localhost:3000/'; export const apiConfig = 'http://localhost:3000/api/'; -// export const apiConfig = 'http://forex.nuvento.com/api/'; +// export const apiConfig = 'https://forex.nuvento.com/api/'; diff --git a/src/styles.scss b/src/styles.scss index 50ffdf7..2ffbe92 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -631,8 +631,13 @@ section.module.parallax { display: inline-block; width: 100px; height: 100px; + background: url("./assets/images/loader.gif"); + background-position: center; + background-repeat: no-repeat; + background-size: 90px; + } - .custom_loader_ring:after { +/* .custom_loader_ring:after { content: " "; display: block; width: 100px; @@ -650,7 +655,7 @@ section.module.parallax { 100% { transform: rotate(360deg); } - } + } */ .logout{ background: transparent;