Commit 445f50bf by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !13
parents 17e36f87 dca8457d
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: 'start/login',
pathMatch: 'full'
},
{
path: '404',
redirectTo: 'start/invalid',
pathMatch: 'full'
}
// {path: '**', redirectTo: '/start/login'}
const routes: Routes = [{
path: '',
redirectTo: 'start/login',
pathMatch: 'full'
},
{
path: '404',
redirectTo: 'start/invalid',
pathMatch: 'full'
}
];
@NgModule({
......
......@@ -10,11 +10,11 @@ import {TranslateHttpLoader} from '@ngx-translate/http-loader';
/* CUSTOM-MODULES */
import {CheckerModule} from './checker/checker.module';
import {makerModule} from './maker/maker.module';
import {ForexModule} from './forex/forex.module';
import {DeliveryModule} from './delivery/delivery.module';
import {StartModule} from './start/start.module';
import {checkerModule} from './checker/checker.module';
/* Custom Services */
......@@ -36,13 +36,14 @@ export function HttpLoaderFactory(http: HttpClient) {
imports: [
BrowserModule,
AppRoutingModule,
CheckerModule,
makerModule,
ForexModule,
DeliveryModule,
ReactiveFormsModule,
FormsModule,
HttpClientModule,
StartModule,
checkerModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { moduleRouting } from './checker.routing';
import { checkerRouting } from './checker.routing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule} from '@ngx-translate/core';
//IMPORTED-PAGE-COMPONENTS
import { IndexComponent } from './index/index.component';
import { AddproviderComponent} from './addprovider/addprovider.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { HomeComponent } from './home/home.component';
import { ForexproviderComponent } from './forexprovider/forexprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { CurrencyAddComponent } from './currency-add/currency-add.component';
import { AddforexComponent } from './addforex/addforex.component';
import { EditforexComponent } from './editforex/editforex.component';
import { CurrencyEditComponent } from './currency-edit/currency-edit.component';
import { CurrencyListComponent } from './currency-list/currency-list.component';
@NgModule({
// tslint:disable-next-line:max-line-length
declarations: [IndexComponent, AddproviderComponent, EditproviderComponent, ManageproviderComponent, HomeComponent, ForexproviderComponent, ChangepinComponent, CurrencyAddComponent, AddforexComponent, EditforexComponent, CurrencyEditComponent, CurrencyListComponent],
declarations: [IndexComponent, ManageproviderComponent, HomeComponent, ForexproviderComponent, ChangepinComponent],
imports: [
CommonModule,
moduleRouting,
checkerRouting,
FormsModule,
ReactiveFormsModule,
TranslateModule
]
})
export class CheckerModule { }
export class checkerModule { }
......@@ -11,38 +11,24 @@ import { RoleGuard } from './../providers/role-guard.service';
//IMPORTED-PAGE-COMPONENTS
import { IndexComponent } from './index/index.component';
import { AddproviderComponent} from './addprovider/addprovider.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { ForexproviderComponent } from './forexprovider/forexprovider.component';
import { HomeComponent } from './home/home.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { CurrencyAddComponent } from './currency-add/currency-add.component';
import { AuthGuard } from './../providers/auth.guard';
import { AddforexComponent } from './addforex/addforex.component';
import { EditforexComponent } from './editforex/editforex.component';
import { CurrencyEditComponent } from './currency-edit/currency-edit.component';
import { CurrencyListComponent } from './currency-list/currency-list.component';
const ModuleRoutes: Routes = [
const checkerRoutes: Routes = [
{ path: 'checker', component: IndexComponent, canActivate: [AuthGuard],
children: [
{ path: 'provider_delivery', component: AddproviderComponent },
{ path: 'delivery_edit/:id', component: EditproviderComponent },
{ path: 'delivery', component: ManageproviderComponent },
{ path: 'forex', component: ForexproviderComponent },
{ path: 'provider_forex', component: AddforexComponent },
{ path: 'forex_edit/:id', component: EditforexComponent },
{ path: 'home', component: HomeComponent },
{ path: 'changepin', component: ChangepinComponent },
{ path: 'currency_add', component: CurrencyAddComponent},
{ path: 'currency_edit/:id', component: CurrencyEditComponent},
{ path: 'currency_list', component: CurrencyListComponent}
], data: {role: 1}
{ path: 'changepin', component: ChangepinComponent }
], data: {role: 5}
}
];
export const moduleRouting: ModuleWithProviders = RouterModule.forChild(ModuleRoutes)
export const checkerRouting: ModuleWithProviders = RouterModule.forChild(checkerRoutes)
......@@ -30,7 +30,12 @@
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</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>
......@@ -41,9 +46,7 @@
<th> {{'forexprovider.Contact Name' | translate}}</th>
<th> {{'forexprovider.Phone' | translate}}</th>
<th> {{'forexprovider.Email ID' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('checker/provider_forex')">+</button>
</th>
<th> {{'forexprovider.Action' | translate}}</th>
</tr>
</thead>
<tbody *ngIf="providerList; else noProvider">
......@@ -55,15 +58,103 @@
<td>{{provider.contact | titlecase}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td class="textRight pl0 pr0">
<button class="edit_btn"(click)="editClick(provider.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button>
<td *ngIf="provider.status != 0">{{get_status(provider.status)}}</td>
<td class="textRight pl0 pr0" *ngIf="provider.status == 0">
<button class="edit_btn" data-toggle="modal" data-target="#forexapproved" (click)="providerDetails(provider.id)"></button>
</td>
</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>
</div>
</section>
\ No newline at end of file
</section>
<div class="modal" id="forexapproved" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="max-width: 700px !important;">
<div class="modal-content">
<div class="forex_modal_wrapper">
<div class="forex_modal_header">
<h5 class="floatLeft">Forex Provider Approve</h5>
<button type="button" class="close floatRight" data-dismiss="modal">&times;</button>
<div class="clear"></div>
</div>
<div class="forex_inner_wrapper" *ngIf="provider">
<div class="row">
<div class="col">
<div class="row">
<div class="col">Provider Name:</div>
<div class="col">{{provider.name}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">Location:</div>
<div class="col">{{provider.location}}</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">CR ID:</div>
<div class="col">{{provider.cr_id}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">CR Manager:</div>
<div class="col">{{provider.cr_manager}}</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">Email ID:</div>
<div class="col">{{provider.email_id}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">Phone:</div>
<div class="col">{{provider.phone}}</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">Delivery Provider:</div>
<div class="col">{{deli_provider}}</div>
</div>
</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">
<button class="okay_btn" data-dismiss="modal" (click)="providerState(2, provider.users_id)">Reject</button>
<button class="cancel_btn" data-dismiss="modal" (click)="providerState(1, provider.users_id)">Approve</button>
</div>
</div>
</div>
</div>
</div>
......@@ -203,4 +203,8 @@
}
}
.forex_modal_content{
background: #fff;
}
\ No newline at end of file
......@@ -16,30 +16,50 @@ export class ForexproviderComponent implements OnInit {
error: boolean;
success: boolean;
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 = 'providers';
const post_data = {'type': 2};
this.fname = 'all_providers';
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;
......@@ -57,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 ?');
......@@ -70,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];
......@@ -87,7 +111,7 @@ export class ForexproviderComponent implements OnInit {
}
editClick(id: number) {
this.router.navigate(['checker/forex_edit/' + id]);
this.router.navigate(['maker/forex_edit/' + id]);
}
goToPage(path, data = null) {
......@@ -96,8 +120,96 @@ 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();
}
get_status(status: number) {
let state = '';
switch (status) {
case 0:
state = 'Pending';
break;
case 1:
state = 'Approved';
break;
case 2:
state = 'Reject';
break;
default:
break;
}
return state;
}
providerDetails(id: any) {
this.loader = true;
this.fname = 'providers_details';
const post_data = {'provider_id': id};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
this.getProvider_name(this.provider.deli_provider_id);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
getProvider_name(id: number) {
this.fname = 'provider_name';
const post_data = {'provider_id': id};
this.service.post_data(this.fname, post_data).subscribe(response => {
console.log(response);
if (response.code === 1) {
const resData = response.responseResult;
this.deli_provider = resData.name;
console.log(this.deli_provider);
} else {
}
}, (error) => {
});
}
providerState(state: number, id: number) {
this.loader = true;
this.fname = 'provider_approve';
const post_data = {'user_id': id, 'status': state};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
this.getProvider(this.page_number);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
}
......@@ -4,9 +4,9 @@
<h4>{{'home.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/currency_list')">
<!-- <button class="logout" (click)="goToPage('maker/currency_list')">
<img src="assets/images/asset_currency.png">
{{'home.Currency' | translate}}</button>
{{'home.Currency' | translate}}</button> -->
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'home.Logout' | translate}}</button>
......
......@@ -30,7 +30,11 @@
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</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>
......@@ -41,9 +45,7 @@
<th> {{'manageprovider.Contact Name' | translate}}</th>
<th> {{'manageprovider.Phone' | translate}}</th>
<th> {{'manageprovider.Email ID' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('checker/provider_delivery')">+</button>
</th>
<th> {{'forexprovider.Action' | translate}}</th>
</tr>
</thead>
<tbody *ngIf="providerList; else noProvider">
......@@ -55,15 +57,86 @@
<td>{{provider.contact | titlecase}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td class="textRight pl0 pr0">
<button class="edit_btn"(click)="editClick(provider.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button>
<td *ngIf="provider.status != 0">{{get_status(provider.status)}}</td>
<td class="textRight pl0 pr0" *ngIf="provider.status == 0">
<button class="edit_btn" data-toggle="modal" data-target="#forexapproved" (click)="providerDetails(provider.id)"></button>
</td>
</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>
</div>
</section>
\ No newline at end of file
</section>
<div class="modal" id="forexapproved" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="max-width: 700px !important;">
<div class="modal-content">
<div class="forex_modal_wrapper">
<div class="forex_modal_header">
<h5 class="floatLeft">Forex Provider Approve</h5>
<button type="button" class="close floatRight" data-dismiss="modal">&times;</button>
<div class="clear"></div>
</div>
<div class="forex_inner_wrapper" *ngIf="provider">
<div class="row">
<div class="col">
<div class="row">
<div class="col">Provider Name:</div>
<div class="col">{{provider.name}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">Location:</div>
<div class="col">{{provider.location}}</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">CR ID:</div>
<div class="col">{{provider.cr_id}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">CR Manager:</div>
<div class="col">{{provider.cr_manager}}</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">Email ID:</div>
<div class="col">{{provider.email_id}}</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">Phone:</div>
<div class="col">{{provider.phone}}</div>
</div>
</div>
</div>
</div>
<div class="forex_modal_footer_btn_bay textRight">
<button class="okay_btn" data-dismiss="modal" (click)="providerState(2, provider.users_id)">Reject</button>
<button class="cancel_btn" data-dismiss="modal" (click)="providerState(1, provider.users_id)">Approve</button>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -16,30 +16,49 @@ export class ManageproviderComponent implements OnInit {
error: boolean;
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 = 'providers';
const post_data = {'type': 3};
this.fname = 'all_providers';
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;
......@@ -52,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});
......@@ -76,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];
......@@ -93,11 +116,83 @@ export class ManageproviderComponent implements OnInit {
}
editClick(id: number) {
this.router.navigate(['checker/delivery_edit/' + id]);
this.router.navigate(['maker/delivery_edit/' + id]);
}
logout() {
this.service.logout();
}
get_status(status: number) {
let state = '';
switch (status) {
case 0:
state = 'Pending';
break;
case 1:
state = 'Approved';
break;
case 2:
state = 'Reject';
break;
default:
break;
}
return state;
}
onSearchChange(text: string) {
this.searchtxt = text;
this.getProvider(1);
}
providerState(state: number, id: number) {
this.loader = true;
this.fname = 'provider_approve';
const post_data = {'user_id': id, 'status': state};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
this.getProvider(this.page_number);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
providerDetails(id: any) {
this.loader = true;
this.fname = 'providers_details';
const post_data = {'provider_id': id};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
}
......@@ -22,11 +22,11 @@
<section>
<div class="provider_content">
<h3> {{'adddriver.Edit Driver' | translate}}</h3>
<h3> {{'adddriver.Add Delivery Driver' | translate}}</h3>
<div class="provider_inner_content">
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong> {{'adddriver.Success!' | translate}}</strong> {{'adddriver.Provider created successfully' | translate}}
<strong> {{'adddriver.Success!' | translate}}</strong> {{'adddriver.Driver created successfully' | translate}}
</div>
<div class="alert alert-danger alert-dismissible" *ngIf="error">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
......@@ -37,7 +37,7 @@
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.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,7 +55,7 @@
</div>
</div>
<div class="col">
<div class="provider_data_content">
<!--div class="provider_data_content">
<p> {{'adddriver.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>
......@@ -63,14 +63,22 @@
<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 class="provider_data_content">
<p> {{'adddriver.Postal Code' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="postal" tabindex="2">
</div>
<div class="s_error" *ngIf="!providerForm.controls['postal'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['postal'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Location' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="location">
<input class="provider_input" placeholder="" type="text" formControlName="location" tabindex="3">
</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>
......@@ -79,22 +87,22 @@
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.National ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="cr_id">
<input class="provider_input" placeholder="" type="text" formControlName="national_id" tabindex="4">
</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>
<div class="s_error" *ngIf="!providerForm.controls['national_id'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['national_id'].hasError('required')">{{error_msg.required}} </div>
</div>
<div class="s_error" *ngIf="!providerForm.controls['cr_id'].valid && providerForm.controls['cr_id'].touched">
<div class="s_validation" *ngIf="providerForm.controls['cr_id'].hasError('pattern')">{{error_msg.crId}}</div>
<div class="s_error" *ngIf="!providerForm.controls['national_id'].valid && providerForm.controls['national_id'].touched">
<div class="s_validation" *ngIf="providerForm.controls['national_id'].hasError('pattern')">{{error_msg.national_id}}</div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Manager ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="cr_manager">
<input class="provider_input" placeholder="" type="text" formControlName="manager_id" tabindex="5">
</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 class="s_error" *ngIf="!providerForm.controls['manager_id'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['manager_id'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
</div>
......@@ -113,7 +121,7 @@
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.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>
......@@ -130,7 +138,7 @@
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.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>
......@@ -143,6 +151,41 @@
<div class="col"></div>
</div>
<hr/>
<h6>Forex Amount Manage</h6><br/>
<div class="row">
<!-- <div class="col">
<div class="provider_data_content">
<p>Contact</p>
<input class="provider_input" placeholder="" type="text" formControlName="contact">
</div>
<div class="s_error" *ngIf="!providerForm.controls['contact'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('required')">{{error_msg.required}} </div>
</div>
</div> -->
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Maximum Amount' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="max_amount" tabindex="8">
</div>
<div class="s_error" *ngIf="!providerForm.controls['max_amount'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['max_amount'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Maximum Limit' | translate}}</p>
<input class="provider_input" placeholder="" type="mail" formControlName="max_limit" tabindex="9">
</div>
<div class="s_error" *ngIf="!providerForm.controls['max_limit'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['max_limit'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col"></div>
</div>
<!-- <div class="row">
<div class="col">
<div class="provider_data_content">
......@@ -178,7 +221,7 @@
<!-- <div class="row">
<div class="col">
<div class="add_provider_btn_bay p0">
<button class="edit_btn floatRight" (click)="goToPage('checker/editprovider')">Edit</button>
<button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button>
<div class="clear"></div>
</div>
</div>
......
......@@ -45,13 +45,16 @@ export class AddDriverComponent implements OnInit {
this.getProfile();
this.providerForm = this.formBuilder.group({
'name': ['', Validators.compose([Validators.required])],
'cr_manager': ['', Validators.compose([Validators.required])],
'cr_id': ['', Validators.compose([Validators.required, Validators.pattern(this.crId)])],
'postal': ['', Validators.compose([Validators.required])],
'manager_id': ['', Validators.compose([Validators.required])],
'national_id': ['', Validators.compose([Validators.required, Validators.pattern(this.crId)])],
'location': ['', Validators.compose([Validators.required])],
'email_id': ['', Validators.compose([Validators.required, Validators.maxLength(50), Validators.pattern(this.emailPattern)])],
// tslint:disable-next-line:max-line-length
'phone': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(15), Validators.pattern(this.mobnumPattern)])],
'type': [4],
'max_amount': ['', Validators.compose([Validators.required])],
'max_limit': ['', Validators.compose([Validators.required])],
'deli_provider_id': ['', Validators.compose([Validators.required])],
'password': [''],
});
......@@ -75,7 +78,7 @@ export class AddDriverComponent implements OnInit {
if (this.providerForm.valid) {
this.loader = true;
const providerObj = this.providerForm.value;
this.funcName = 'provider_create';
this.funcName = 'driver_create';
this.service.post_data(this.funcName, providerObj).subscribe(response => {
this.loader = false;
console.log(response);
......
......@@ -14,7 +14,7 @@
<img src="assets/images/asset_logout.png">
{{'editdriver.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')"> {{'editdriver.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')"> {{'editdriver.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -47,22 +47,32 @@
<div class="s_validation" *ngIf="providerForm.controls['location'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Postal Code' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="postal">
</div>
<div class="s_error" *ngIf="!providerForm.controls['postal'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['postal'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content" *ngIf="provider">
<p> {{'editdriver.National ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" disabled [value]="provider.cr_id">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="provider_data_content" *ngIf="provider">
<p> {{'editdriver.National ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" disabled [value]="provider.national_id">
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'editdriver.Manager ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="cr_manager">
<input class="provider_input" placeholder="" type="text" formControlName="manager_id">
</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 class="s_error" *ngIf="!providerForm.controls['manager_id'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['manager_id'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
......@@ -81,7 +91,9 @@
<div class="s_error" *ngIf="!providerForm.controls['phone'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['phone'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="provider_data_content">
<p> {{'editdriver.Email id' | translate}}</p>
......@@ -95,7 +107,44 @@
<div class="s_validation" *ngIf="providerForm.controls['email_id'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col"></div>
<div class="col"></div>
</div>
<hr/>
<h6>Forex Amount Manage</h6><br/>
<div class="row">
<!-- <div class="col">
<div class="provider_data_content">
<p>Contact</p>
<input class="provider_input" placeholder="" type="text" formControlName="contact">
</div>
<div class="s_error" *ngIf="!providerForm.controls['contact'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('required')">{{error_msg.required}} </div>
</div>
</div> -->
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Maximum Amount' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="max_amount">
</div>
<div class="s_error" *ngIf="!providerForm.controls['max_amount'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['max_amount'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'adddriver.Maximum Limit' | translate}}</p>
<input class="provider_input" placeholder="" type="mail" formControlName="max_limit">
</div>
<div class="s_error" *ngIf="!providerForm.controls['max_limit'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['max_limit'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col">
......
......@@ -48,32 +48,39 @@ export class EditDriverComponent implements OnInit {
this.getProvider(id);
console.log(id);
this.providerForm = this.formBuilder.group({
'cr_manager': ['', Validators.compose([Validators.required])],
'manager_id': ['', Validators.compose([Validators.required])],
'location': ['', Validators.compose([Validators.required])],
'email_id': ['', Validators.compose([Validators.required, Validators.maxLength(50), Validators.pattern(this.emailPattern)])],
// tslint:disable-next-line:max-line-length
'phone': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(15), Validators.pattern(this.mobnumPattern)])],
'type': [4],
'provider_id': [id],
'driver_id': [id],
'national_id': [''],
'postal': ['', Validators.compose([Validators.required])],
'max_amount': ['', Validators.compose([Validators.required])],
'max_limit': ['', Validators.compose([Validators.required])],
'deli_provider_id': ['', Validators.compose([Validators.required])]
});
}
getProvider(id: any) {
this.loader = true;
this.funcName = 'providers_details';
const post_data = {'provider_id': id};
this.funcName = 'driver_details';
const post_data = {'driver_id': id};
this.service.post_data(this.funcName, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
this.providerForm.patchValue({
cr_manager: this.provider.cr_manager,
contact: this.provider.contact,
manager_id: this.provider.manager_id,
postal: this.provider.postal,
location: this.provider.location,
email_id: this.provider.email_id,
phone: this.provider.phone
phone: this.provider.phone,
max_amount: this.provider.max_amount,
max_limit: this.provider.max_limit,
national_id: this.provider.national_id
});
} else {
this.error = true;
......@@ -109,7 +116,7 @@ export class EditDriverComponent implements OnInit {
if (this.providerForm.valid) {
this.loader = true;
const providerObj = this.providerForm.value;
this.funcName = 'provider_edit';
this.funcName = 'driver_edit';
this.service.post_data(this.funcName, providerObj).subscribe(response => {
this.loader = false;
console.log(response);
......
......@@ -14,7 +14,7 @@
<img src="assets/images/asset_logout.png">
{{'listdriver.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')"> {{'listdriver.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')"> {{'listdriver.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -36,10 +36,13 @@
<tr>
<th> {{'listdriver.Provider Name' | translate}}</th>
<th> {{'listdriver.Location' | translate}}</th>
<th> {{'listdriver.Postal Code' | translate}}</th>
<th> {{'listdriver.Manager ID' | translate}}</th>
<th> {{'listdriver.National ID' | translate}}</th>
<th> {{'listdriver.Phone' | translate}}</th>
<th> {{'listdriver.Email ID' | translate}}</th>
<th> {{'listdriver.Max Amount' | translate}}</th>
<th> {{'listdriver.Max Limit' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('delivery/driveradd')">+</button>
</th>
......@@ -49,10 +52,13 @@
<tr *ngFor="let provider of providerList;">
<td>{{provider.name | titlecase}}</td>
<td>{{provider.location | titlecase}}</td>
<td>{{provider.cr_manager | titlecase}}</td>
<td>{{provider.cr_id}}</td>
<td>{{provider.postal}}</td>
<td>{{provider.manager_id | titlecase}}</td>
<td>{{provider.national_id}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td>{{provider.max_amount}}</td>
<td>{{provider.max_limit}}</td>
<td class="textRight pl0 pr0">
<button class="edit_btn"(click)="editClick(provider.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button>
......
......@@ -37,30 +37,35 @@
<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>
<th> {{'transaction.Date' | translate}}</th>
<th> {{'transaction.Driver' | translate}}</th>
<th> {{'transaction.Status' | translate}}</th>
<th class="textRight"></th>
<th class="textRight"> {{'forexprovider.Action' | translate}}</th>
</tr>
</thead>
<tbody *ngIf="transactionList">
<tr *ngFor="let tansaction of transactionList; let i = index">
<td>{{getCustomer(tansaction.user_info,'name') | titlecase}}</td>
<td>{{getCustomer(tansaction.user_info,'phone') | titlecase}}</td>
<td>{{getCustomer(tansaction.user_info,'location') | titlecase}}</td>
<td>{{getCustomer(tansaction.user_info,'FirstName')}}</td>
<td>{{getCustomer(tansaction.provider,'name')}}</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>{{getCustomer(tansaction.driver_info,'name') | titlecase}}</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 || 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 !=3 && tansaction.status !=0"></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>
......@@ -93,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>
......@@ -106,15 +111,17 @@
<div class="row" *ngIf="driverList">
<div class="col-md-12">
<p> {{'transaction.Driver' | translate}}</p>
<select class="provider_input" (change)="selectDriver($event.target.value)">
<option disabled hidden> {{'transaction.Assign Driver' | translate}}</option>
<select class="provider_input" (change)="selectDriver($event.target.value)" #driver>
<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>
......
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';
@Component({
selector: 'app-transaction',
templateUrl: './transaction.component.html',
......@@ -24,6 +25,7 @@ export class TransactionComponent implements OnInit {
driverStatus: boolean;
driverId: any;
assignError: boolean;
@ViewChild('driver') driver: ElementRef;
constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) {
this.responseMsg = '';
......@@ -40,10 +42,10 @@ export class TransactionComponent implements OnInit {
this.getProvider();
}
providerDriver(provider_id: any) {
providerDriver(amount: any, postal: any) {
this.loader = true;
this.fname = 'get_drivers';
const post_data = {'provider_id': provider_id};
this.fname = 'get_available_drivers';
const post_data = {'provider_id': this.userDetails.id, 'amount': amount, 'postal': postal};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
......@@ -99,7 +101,7 @@ export class TransactionComponent implements OnInit {
if (response.code === 1) {
this.userDetails = response.responseResult;
this.getTransaction(this.userDetails.id, 1);
this.providerDriver(this.userDetails.id);
// this.providerDriver(this.userDetails.id);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
......@@ -119,10 +121,16 @@ export class TransactionComponent implements OnInit {
return 'Requested';
break;
case 2:
return 'Processing';
return 'Assigned to Driver';
break;
case 3:
return 'Completed';
return 'Delivered to Driver';
break;
case 4:
return 'Delivered to Customer';
break;
case 5:
return 'Refund';
break;
default:
break;
......@@ -144,6 +152,9 @@ 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(this.selectedData);
}
......@@ -175,6 +186,7 @@ export class TransactionComponent implements OnInit {
setTimeout(function() {
This.responseMsg = '';
}, 3000);
this.driver.nativeElement.value = '';
}
logout() {
......
......@@ -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">&times;</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">&times;</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>
......
......@@ -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;
......
......@@ -12,11 +12,11 @@ import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { TransactionComponent } from './transaction/transaction.component';
import { CurrencyComponent } from './currency/currency.component';
import { ServiceComponent } from './service/service.component';
@NgModule({
// tslint:disable-next-line:max-line-length
declarations: [IndexComponent, ChangepinComponent, EditproviderComponent, TransactionComponent, CurrencyComponent],
declarations: [IndexComponent, ChangepinComponent, EditproviderComponent, TransactionComponent, CurrencyComponent, ServiceComponent],
imports: [
CommonModule,
moduleRouting,
......
......@@ -12,6 +12,7 @@ import { IndexComponent } from './index/index.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { TransactionComponent } from './transaction/transaction.component';
import { ServiceComponent } from './service/service.component';
import { CurrencyComponent } from './currency/currency.component';
import { AuthGuard } from './../providers/auth.guard';
......@@ -21,6 +22,7 @@ const ModuleRoutes: Routes = [{
{path: 'changepin', component: ChangepinComponent},
{path: 'editprovider', component: EditproviderComponent},
{path: 'currency', component: CurrencyComponent },
{path: 'config', component: ServiceComponent },
{path: '', component: TransactionComponent }
], data: {role: 2}
}
......
<div class="custom_loader_wrapper" *ngIf="loader">
<div class="custom_loader_ring"></div>
</div>
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>{{'service.Configuration' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('forex/home')">
<img src="assets/images/asset_home.png">
{{'service.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'service.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('forex/changepin')">{{'service.Change PIN' | translate}}</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3> {{'service.Service Charge Management' | translate}}</h3>
<div class="provider_inner_content">
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<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">&times;</a>
<strong> {{'service.Warning!' | translate}}</strong> {{responseError}}
</div>
<form [formGroup]="configForm" (ngSubmit)="configProcess()" autocomplete="off">
<div class="row">
<div class="col">
<div class="provider_data_content">
<p> {{'service.Tax' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="tax">
</div>
<div class="s_error" *ngIf="!configForm.controls['tax'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['tax'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'service.Hand Delivery' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="hand">
</div>
<div class="s_error" *ngIf="!configForm.controls['hand'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['hand'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'service.Airport Delivery' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="airport">
</div>
<div class="s_error" *ngIf="!configForm.controls['airport'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['airport'].hasError('required')">{{error_msg.required}} </div>
</div>
<div class="s_error" *ngIf="!configForm.controls['airport'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['airport'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="provider_data_content">
<p> {{'service.Cancellation Time' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="cancel_time">
</div>
<div class="s_error" *ngIf="!configForm.controls['cancel_time'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['cancel_time'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'service.Waiting Time' | translate}}</p>
<input class="provider_input" placeholder="" type="number" formControlName="waiting_time">
</div>
<div class="s_error" *ngIf="!configForm.controls['waiting_time'].valid && configSubmit">
<div class="s_validation" *ngIf="configForm.controls['waiting_time'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col"></div>
</div>
<!-- <div class="row">
<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">
<div class="add_provider_btn_bay">
<button class="save_btn floatRight"> {{'service.Save' | translate}}</button>
<button class="cancel_btn floatRight" (click)="cancelClick()"> {{'service.Cancel' | translate}}</button>
<div class="clear"></div>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ServiceComponent } from './service.component';
describe('ServiceComponent', () => {
let component: ServiceComponent;
let fixture: ComponentFixture<ServiceComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ServiceComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ServiceComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } 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';
import { ImageStorage } from '../../../environments/server.config';
@Component({
selector: 'app-service',
templateUrl: './service.component.html',
styleUrls: ['./service.component.scss']
})
export class ServiceComponent implements OnInit {
configForm: FormGroup;
numeric = '^[0-9]*$';
configSubmit: boolean;
lang = 'en';
error_msg: any[];
funcName: any;
loader: boolean;
responseError: any;
error: boolean;
success: boolean;
file: File;
config: any;
image_url: any;
loginDetails: any;
userDetails: any;
constructor(private router: Router,
private route: ActivatedRoute,
public vs: ValidationService,
public service: WebService,
private formBuilder: FormBuilder
) {
this.loader = false;
this.error = false;
this.success = false;
this.configSubmit = false;
this.error_msg = this.vs.errorList[this.lang];
this.loginDetails = JSON.parse(this.service.getLocalStorageItem('userData'));
}
ngOnInit() {
this.configForm = this.formBuilder.group({
'tax': ['', Validators.compose([Validators.required, Validators.pattern('^[0-9]*$')])],
'hand': ['', Validators.compose([Validators.required, Validators.pattern('^[0-9]*$')])],
'provider_id': [''],
'airport': ['', Validators.compose([Validators.required, Validators.pattern('^[0-9]*$')])],
'cancel_time': ['', Validators.compose([Validators.required, Validators.pattern('^[0-9]*$')])],
'waiting_time': ['', Validators.compose([Validators.required, Validators.pattern('^[0-9]*$')])],
'type': [0]
});
this.getProvider();
}
getProvider() {
this.funcName = 'get_user_details';
const post_data = {'user_id': this.loginDetails.user_id};
this.service.post_data(this.funcName, post_data).subscribe(response => {
if (response.code === 1) {
this.userDetails = response.responseResult;
this.getConfig(this.userDetails.id);
this.configForm.patchValue({'provider_id': this.userDetails.id});
// this.providerDriver(this.userDetails.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'];
});
}
configProcess() {
const This = this;
this.error = false;
this.success = false;
console.log(this.configForm.value);
this.configSubmit = true;
if (this.configForm.valid) {
this.loader = true;
const post_data = this.configForm.value;
this.funcName = 'config_save';
this.service.post_data(this.funcName, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.success = true;
this.configSubmit = false;
this.configForm.patchValue({'type': 0});
} 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');
}
getConfig(id) {
this.loader = true;
this.funcName = 'config_details';
const post_data = {'provider_id': id};
this.service.post_data(this.funcName, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.config = response.responseResult;
this.configForm.patchValue({
tax: this.config.tax,
hand: this.config.hand,
airport: this.config.airport,
cancel_time: this.config.cancel_time,
waiting_time: this.config.waiting_time
});
} else {
// this.error = true;
this.configForm.patchValue({'type': 1});
// this.responseError = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseError = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseError = '';
}, 3000);
}
getImage() {
return ImageStorage + this.image_url;
}
cancelClick() {
this.router.navigate(['/forex']);
}
logout() {
this.service.logout();
}
goToPage(path: any, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
......@@ -7,6 +7,9 @@
<h4>{{'transaction.Forex Transaction List' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('forex/config')">
<img src="assets/images/asset_settings.png">
{{'transaction.Config' | translate}}</button>
<button class="logout" (click)="goToPage('forex/currency')">
<img src="assets/images/asset_currency.png">
{{'transaction.Currency' | translate}}</button>
......@@ -37,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>
......@@ -50,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>
......
......@@ -89,10 +89,16 @@ export class TransactionComponent implements OnInit {
return 'Requested';
break;
case 2:
return 'Processing';
return 'Assigned to Driver';
break;
case 3:
return 'Completed';
return 'Delivered to Driver';
break;
case 4:
return 'Delivered to Customer';
break;
case 5:
return 'Refund';
break;
default:
break;
......
......@@ -8,7 +8,7 @@
<h4> {{'addforex.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'addforex.Home' | translate}}
</button>
......@@ -38,7 +38,7 @@
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.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>
......@@ -56,7 +56,7 @@
</div>
</div>
<div class="col">
<div class="provider_data_content">
<!-- <div class="provider_data_content">
<p> {{'addforex.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,21 @@
<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 class="provider_data_content">
<p> {{'addforex.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>
<div class="row">
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.CR ID' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="cr_id">
<input class="provider_input" placeholder="" type="text" 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,32 +90,33 @@
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.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 class="col">
<div class="provider_data_content">
<p> {{'addforex.Contact Name' | translate}}</p>
<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>
</div>
<div class="s_error" *ngIf="!providerForm.controls['contact'].valid && providerSubmit">
<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> {{'addforex.Contact Name' | translate}}</p>
<input class="provider_input" placeholder="" type="text" formControlName="contact">
</div>
<div class="s_error" *ngIf="!providerForm.controls['contact'].valid">
<div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('pattern')">{{error_msg.pattern}}</div>
</div>
<div class="s_error" *ngIf="!providerForm.controls['contact'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['contact'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.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>
......@@ -134,7 +133,7 @@
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.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>
......@@ -144,13 +143,34 @@
<div class="s_validation" *ngIf="providerForm.controls['email_id'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.Delivery Provider' | translate}}</p>
<select class="provider_input" formControlName="deli_provider_id" tabindex="8">
<option disabled hidden> {{'addforex.Status' | translate}}</option>
<option *ngFor="let provider of providerList" [value]="provider.id">{{provider.name}}</option>
</select>
</div>
<div class="s_error" *ngIf="!providerForm.controls['deli_provider_id'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['deli_provider_id'].hasError('required')">{{error_msg.required}} </div>
</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 class="provider_data_content">
<p> {{'addforex.Status' | translate}}</p>
<select class="provider_input" formControlName="online_status">
<select class="provider_input" formControlName="online_status" tabindex="9">
<option disabled hidden>{{'addforex.Status' | translate}}</option>
<option value="1">Online</option>
<option value="0">Offline</option>
......@@ -161,18 +181,7 @@
</div>
</div>
<div class="col">
<div class="provider_data_content">
<p> {{'addforex.Delivery Provider' | translate}}</p>
<select class="provider_input" formControlName="deli_provider_id">
<option disabled hidden> {{'addforex.Status' | translate}}</option>
<option *ngFor="let provider of providerList" [value]="provider.id">{{provider.name}}</option>
</select>
</div>
<div class="s_error" *ngIf="!providerForm.controls['deli_provider_id'].valid && providerSubmit">
<div class="s_validation" *ngIf="providerForm.controls['deli_provider_id'].hasError('required')">{{error_msg.required}} </div>
</div>
</div>
<div class="col"></div>
</div>
......@@ -181,7 +190,7 @@
<!-- <div class="row">
<div class="col">
<div class="add_provider_btn_bay p0">
<button class="edit_btn floatRight" (click)="goToPage('checker/editprovider')">Edit</button>
<button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button>
<div class="clear"></div>
</div>
</div>
......
......@@ -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': [''],
});
}
......@@ -103,7 +104,7 @@ export class AddforexComponent implements OnInit {
}
cancelClick() {
this.router.navigate(['/checker/forex']);
this.router.navigate(['/maker/forex']);
}
getProvider() {
......
......@@ -8,7 +8,7 @@
<h4> {{'addprovider.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'addprovider.Home' | translate}}</button>
......@@ -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,11 +142,17 @@
<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">
<div class="add_provider_btn_bay p0">
<button class="edit_btn floatRight" (click)="goToPage('checker/editprovider')">Edit</button>
<button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button>
<div class="clear"></div>
</div>
</div>
......
......@@ -98,7 +98,7 @@ export class AddproviderComponent implements OnInit {
}
cancelClick() {
this.router.navigate(['/checker/delivery']);
this.router.navigate(['/maker/delivery']);
}
logout() {
......
<div class="login_wrapper">
<div class="container">
<div class="row">
<div class="login_inner">
<img src="assets/images/asset_logo.png">
<hr>
<h6> {{'changepin.Change PIN' | translate}}</h6>
<div class="login_inner_content">
<br>
<div class="login_row">
<p> {{'changepin.Old PIN' | translate}}</p>
<div class="login_pin">
<input class="log_pin" type="password" maxlength="1" #old1 (keyup)="processKeyUp($event, old2)">
<input class="log_pin" type="password" maxlength="1" #old2 (keydown.backspace)="processBack($event, old1)" (keyup)="processKeyUp($event, old3)">
<input class="log_pin" type="password" maxlength="1" #old3 (keydown.backspace)="processBack($event, old2)" (keyup)="processKeyUp($event, old4)">
<input class="log_pin" type="password" maxlength="1" #old4 (keydown.backspace)="processBack($event, old3)" (keyup)="processKeyUp($event, old5)">
<input class="log_pin" type="password" maxlength="1" #old5 (keydown.backspace)="processBack($event, old4)" (keyup)="processKeyUp($event, old6)">
<input class="log_pin m0" type="password" maxlength="1" #old6 (keydown.backspace)="processBack($event, old5)">
</div>
<div class="s_error" *ngIf="passwordErr">
<div class="s_validation">{{error_msg.password}} </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>
<div class="alert alert-danger alert-dismissible" *ngIf="resetError">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{'changepin.Warning!' | translate}} </strong> {{resetMsg}}
</div>
<div class="alert alert-success alert-dismissible" *ngIf="!resetError && !error && loginSubmit">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong> {{'changepin.Success!' | translate}}</strong> {{'changepin.Password Updated Successfully' | translate}}
</div>
<div class="login_btn_bay">
<div class="row">
<div class="col-md-6">
<button class="cancel_btn" (click)="cancelClick()"> {{'changepin.Cancel' | translate}}</button>
</div>
<div class="col-md-6">
<button class="login_btn" (click)="saveClick()"> {{'changepin.Save' | translate}}</button>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
.login_wrapper{
width:100%;
.login_inner{
text-align: center;
width:100%;
padding-top:1%;
img{
margin-bottom:0px;
width:150px;
}
hr{
border:5px solid #f69d1b;
width: 65%;
margin: 0 auto;
}
h6{
border-bottom: 2px solid #b6b6b6;
padding-bottom: 10px;
font-weight: 600;
width: 65%;
padding-top: 2%;
margin: 0 auto;
}
.login_inner_content{
padding-top:10px;
width:325px;
margin: 0 auto;
.login_row{
margin-bottom:0px;
input{
width:100%;
height:50px;
border:none;
font-weight: 600;
font-size: 18px;
border-bottom: 2px solid #636363;
&::placeholder{
color: #454545;
font-weight: 600;
}
&:focus{
outline: none;
}
}
p{
font-weight: 600;
font-size: 18px;
color: #454545;
text-align: left;
margin:0px;
}
.login_pin{
width:100%;
text-align: left;
padding-top: 15px;
padding-bottom: 10%;
.log_pin{
border:1px solid #d8d8d8;
display: inline-block;
width:30px;
border-radius:8px;
color: #cc3d3f;
font-size: 60px !important;
height: 60px;
text-align: center;
margin-right:8.5%;
&::placeholder{
color: #cc3d3f;
font-size:40px !important;
}
}
}
}
}
}
.login_btn_bay{
width: 65%;
margin: 0 auto;
padding-top:2%;
.login_btn{
background: #cd3d3d;
color: #fff;
border-radius:10px;
height:40px;
border:none;
width: 100%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
.cancel_btn{
background: #1a5c7c;
color: #fff;
border-radius:10px;
height:40px;
border:none;
width: 100%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangepinComponent } from './changepin.component';
describe('ChangepinComponent', () => {
let component: ChangepinComponent;
let fixture: ComponentFixture<ChangepinComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChangepinComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ChangepinComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
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';
import {Location} from '@angular/common';
@Component({
selector: 'app-changepin',
templateUrl: './changepin.component.html',
styleUrls: ['./changepin.component.scss']
})
export class ChangepinComponent implements OnInit {
@ViewChild('old1') old1: ElementRef;
@ViewChild('old2') old2: ElementRef;
@ViewChild('old3') old3: ElementRef;
@ViewChild('old4') old4: ElementRef;
@ViewChild('old5') old5: ElementRef;
@ViewChild('old6') old6: ElementRef;
@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;
constructor(
private router: Router,
private route: ActivatedRoute,
public vs: ValidationService,
public service: WebService,
public subjectService: SubjectService,
public location: Location
) {
this.loginDetails = JSON.parse(this.service.getLocalStorageItem('userData'));
this.error = false;
this.passwordErr = false;
this.newpasswordErr = false;
this.confpasswordErr = false;
this.notMatchErr = false;
this.error_msg = this.vs.errorList[this.lang];
}
ngOnInit() {
}
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 = [];
password[0] = this.old1.nativeElement.value;
password[1] = this.old2.nativeElement.value;
password[2] = this.old3.nativeElement.value;
password[3] = this.old4.nativeElement.value;
password[4] = this.old5.nativeElement.value;
password[5] = this.old6.nativeElement.value;
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 oldpass = password.join('');
const newpass = newpassword.join('');
const confirmpass = confirm.join('');
if (oldpass === '') {
this.passwordErr = true;
this.error = true;
} else {
for (const i in password) {
if (password[i] === '') {
this.passwordErr = true;
this.error = true;
}
}
}
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;
}
}
this.fname = 'reset_pin';
const post_data = {'user_id': this.loginDetails.user_id, 'password': oldpass, 'new_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();
} 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 = '';
this.old1.nativeElement.value = '';
this.old2.nativeElement.value = '';
this.old3.nativeElement.value = '';
this.old4.nativeElement.value = '';
this.old5.nativeElement.value = '';
this.old6.nativeElement.value = '';
}
cancelClick() {
this.location.back();
}
}
......@@ -8,7 +8,7 @@
<h4> {{'currencyadd.Currency Management' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'currencyadd.Home' | translate}}</button>
<button class="logout" (click)="logout()">
......@@ -91,7 +91,7 @@
<!-- <div class="row">
<div class="col">
<div class="add_provider_btn_bay p0">
<button class="edit_btn floatRight" (click)="goToPage('checker/editprovider')">Edit</button>
<button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button>
<div class="clear"></div>
</div>
</div>
......
......@@ -96,7 +96,7 @@ currencyProcess() {
}
cancelClick() {
this.router.navigate(['/checker/currency_list']);
this.router.navigate(['/maker/currency_list']);
}
goToPage(path: any, data = null) {
......
......@@ -8,14 +8,14 @@
<h4>{{'currencyedit.Currency Management' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'currencyedit.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'currencyedit.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('delivery/changepin')">{{'currencyedit.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')">{{'currencyedit.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -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">
......@@ -92,7 +92,7 @@
<!-- <div class="row">
<div class="col">
<div class="add_provider_btn_bay p0">
<button class="edit_btn floatRight" (click)="goToPage('checker/editprovider')">Edit</button>
<button class="edit_btn floatRight" (click)="goToPage('maker/editprovider')">Edit</button>
<div class="clear"></div>
</div>
</div>
......
.provider_header{
background: #1a5c7c;
padding: 4px;
h4{
margin:0px;
color: #fff;
padding: 20px;
font-weight: 400;
font-size:20px;
}
span{
position: absolute;
bottom:-30px;
right:15px;
font-size: 14px;
cursor: pointer;
z-index: 999;
}
}
.provider_content{
width:100%;
position: relative;
h3{
margin:0px;
padding:0px;
border-bottom: 1px solid #494949;
color: #464646;
font-size: 20px;
font-weight: 400;
padding: 15px;
}
.provider_inner_content{
width:100%;
padding-top: 40px;
padding-left: 20px;
padding-right: 20px;
.row{
padding-bottom: 30px;
.provider_data_content{
width:90%;
margin:0 auto;
p{
color: #464646;
margin:0px;
padding-bottom: 10px;
font-weight: 500;
}
.provider_input{
border:1px solid #b4b4b4;
height:40px;
padding-left: 10px;
padding-right: 10px;
width: 100%;
&:focus{
outline: none;
}
}
img{
display: inline-block;
width: 40px;
height: 40px;
border-radius: 50%;
border:2px solid #b4b4b4;
object-fit: cover;
margin-right: 10px;
}
.provider_choose_btn{
width:150px;
display: inline-block;
background: #1a5c7c;
position: relative;
color: #fff;
height:40px;
border-radius: 20px;
text-align: center;
padding:8px;
input{
position: absolute;
top:0px;
bottom:0px;
left:0px;
right:0px;
border: 1px solid #b4b4b4;
opacity: 0;
}
}
// .provider_choose_btn{
// width: 130px;
// background: #1a5c7c;
// color: #fff;
// position: relative;
// height: 40px;
// text-align: center;
// padding: 7px;
// border-radius: 20px;
// cursor: pointer;
// input{
// position: absolute;
// top:0px;
// left:0px;
// right:0px;
// bottom: 0px;
// opacity: 0;
// }
// }
.provider_pin{
border:1px solid #b4b4b4;
height:40px;
width: calc(100% - 90%);
margin-right: calc(100% - 92%);
text-align: center;
display: inline-block;
border-radius: 10px;
&:focus{
outline: none;
}
}
}
.edit_btn{
background: #d9d9d9;
color: #1a5d7a;
border-radius:20px;
height:40px;
padding-left: 4%;
padding-right:4%;
font-weight: 500;
margin:1%;
border:none;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
.add_provider_btn_bay{
width:100%;
padding-top:5%;
text-align: right;
.save_btn{
background: #cd3d3d;
color: #fff;
border-radius:20px;
height:40px;
border:none;
padding-left:4%;
padding-right:4%;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
.cancel_btn{
background: #1a5c7c;
color: #fff;
border-radius:20px;
height:40px;
padding-left:4%;
padding-right:4%;
border:none;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
}
}
\ No newline at end of file
......@@ -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,6 +118,7 @@ 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,
......@@ -141,17 +147,17 @@ export class CurrencyEditComponent implements OnInit {
}
cancelClick() {
this.router.navigate(['/checker/currency_list']);
this.router.navigate(['/maker/currency_list']);
}
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
logout() {
this.service.logout();
}
logout() {
this.service.logout();
}
goToPage(path: any, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
......@@ -7,14 +7,14 @@
<h4> {{'currencylist.Manage Currency' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'currencylist.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'currencylist.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')"> {{'currencylist.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')"> {{'currencylist.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -40,7 +40,7 @@
<th> {{'currencylist.Forex Multiple' | translate}}</th>
<th>{{'currencylist.Flag' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('checker/currency_add')">+</button>
<button class="add" (click)="goToPage('maker/currency_add')">+</button>
</th>
</tr>
</thead>
......
......@@ -88,7 +88,7 @@ export class CurrencyListComponent implements OnInit {
}
editClick(id: number) {
this.router.navigate(['checker/currency_edit/' + id]);
this.router.navigate(['maker/currency_edit/' + id]);
}
goToPage(path, data = null) {
......
......@@ -7,14 +7,14 @@
<h4> {{'editforex.Forex Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'editforex.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'editforex.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')"> {{'editforex.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')"> {{'editforex.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -141,9 +141,30 @@
</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">
<button class="save_btn floatRight"> {{'editforex.Save' | translate}}</button>
<button class="save_btn floatRight" *ngIf="provider.status!=2"> {{'editforex.Save' | translate}}</button>
<button class="save_btn floatRight" *ngIf="provider.status==2"> {{'editforex.Request For Approve' | translate}}</button>
<button class="cancel_btn floatRight" (click)="cancelClick()"> {{'editforex.Cancel' | translate}}</button>
<div class="clear"></div>
</div>
......
......@@ -54,9 +54,12 @@ export class EditforexComponent implements OnInit {
// tslint:disable-next-line:max-line-length
'phone': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(15), Validators.pattern(this.mobnumPattern)])],
'type': [2],
'users_id': [''],
'provider_id': [id],
'online_status': ['', Validators.compose([Validators.required])],
'deli_provider_id': ['', Validators.compose([Validators.required])],
'merchant_id': ['', Validators.compose([Validators.required])],
'status': [''],
});
}
......@@ -92,6 +95,7 @@ export class EditforexComponent implements OnInit {
console.log(response);
if (response.code === 1) {
this.provider = response.responseResult;
console.log(this.provider);
this.providerForm.patchValue({
cr_manager: this.provider.cr_manager,
contact: this.provider.contact,
......@@ -100,6 +104,9 @@ export class EditforexComponent implements OnInit {
phone: this.provider.phone,
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 {
this.error = true;
......@@ -117,7 +124,7 @@ export class EditforexComponent implements OnInit {
}
cancelClick() {
this.router.navigate(['/checker/forex']);
this.router.navigate(['/maker/forex']);
}
editProcess() {
......@@ -136,6 +143,7 @@ export class EditforexComponent implements OnInit {
if (response.code === 1) {
this.success = true;
this.providerSubmit = false;
this.getProvider(providerObj.provider_id);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
......
......@@ -7,14 +7,14 @@
<h4> {{'editprovider.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('checker/home')">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'editprovider.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'editprovider.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')"> {{'editprovider.Change PIN' | translate}}</span>
<span (click)="goToPage('maker/changepin')"> {{'editprovider.Change PIN' | translate}}</span>
</div>
</div>
</header>
......@@ -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">&times;</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">&times;</a>
......@@ -127,9 +127,10 @@
</div> -->
</div>
<div class="row">
<div class="col">
<div class="col" *ngIf="provider">
<div class="add_provider_btn_bay">
<button class="save_btn floatRight"> {{'editprovider.Save' | translate}}</button>
<button class="save_btn floatRight" *ngIf="provider.status!=2"> {{'editforex.Save' | translate}}</button>
<button class="save_btn floatRight" *ngIf="provider.status==2"> {{'editforex.Request For Approve' | translate}}</button>
<button class="cancel_btn floatRight" (click)="cancelClick()"> {{'editprovider.Cancel' | translate}}</button>
<div class="clear"></div>
</div>
......
......@@ -52,7 +52,9 @@ export class EditproviderComponent implements OnInit {
// tslint:disable-next-line:max-line-length
'phone': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(15), Validators.pattern(this.mobnumPattern)])],
'type': [3],
'provider_id': [id]
'users_id': [''],
'provider_id': [id],
'status': [''],
});
}
......@@ -70,7 +72,9 @@ export class EditproviderComponent implements OnInit {
contact: this.provider.contact,
location: this.provider.location,
email_id: this.provider.email_id,
phone: this.provider.phone
phone: this.provider.phone,
status: this.provider.status,
users_id: this.provider.users_id
});
} else {
this.error = true;
......@@ -94,7 +98,7 @@ export class EditproviderComponent implements OnInit {
}
cancelClick() {
this.router.navigate(['/checker/delivery']);
this.router.navigate(['/maker/delivery']);
}
editProcess() {
......@@ -113,6 +117,7 @@ export class EditproviderComponent implements OnInit {
if (response.code === 1) {
this.success = true;
this.providerSubmit = false;
this.getProvider(providerObj.provider_id);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
......@@ -121,10 +126,24 @@ export class EditproviderComponent implements OnInit {
this.error = false;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
} else {
this.getErrors(this.providerForm);
}
console.log('tested');
}
getErrors(FormAttr) {
Object.keys(FormAttr.controls).forEach(key => {
console.log(key);
const controlErrors: ValidationErrors = FormAttr.get(key).errors;
if (controlErrors != null) {
Object.keys(controlErrors).forEach(keyError => {
console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]);
});
}
});
}
logout() {
this.service.logout();
}
......
<div class="custom_loader_wrapper" *ngIf="loader">
<div class="custom_loader_ring"></div>
</div>
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>{{'forexprovider.Forex Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'forexprovider.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'forexprovider.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('maker/changepin')"> {{'forexprovider.Change PIN' | translate}}</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3>{{'forexprovider.Manage Forex Provider' | translate}}</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<div class="alert alert-danger alert-dismissible" *ngIf="error">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong> {{'forexprovider.Warning!' | translate}}</strong> {{responseMsg}}
</div>
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</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>
<tr>
<th> {{'forexprovider.Provider Name' | translate}}</th>
<th> {{'forexprovider.Location' | translate}}</th>
<th> {{'forexprovider.CR Manager' | translate}}</th>
<th> {{'forexprovider.CR ID' | translate}}</th>
<th> {{'forexprovider.Contact Name' | translate}}</th>
<th> {{'forexprovider.Phone' | translate}}</th>
<th> {{'forexprovider.Email ID' | translate}}</th>
<th> {{'forexprovider.Status' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('maker/provider_forex')">+</button>
</th>
</tr>
</thead>
<tbody *ngIf="providerList; else noProvider">
<tr *ngFor="let provider of providerList;">
<td>{{provider.name | titlecase}}</td>
<td>{{provider.location | titlecase}}</td>
<td>{{provider.cr_manager | titlecase}}</td>
<td>{{provider.cr_id}}</td>
<td>{{provider.contact | titlecase}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td>{{get_status(provider.status)}}</td>
<td class="textRight pl0 pr0">
<button class="edit_btn"(click)="editClick(provider.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button>
</td>
</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>
</div>
</section>
\ No newline at end of file
.provider_header{
background: #1a5c7c;
padding: 4px;
h4{
margin:0px;
color: #fff;
padding: 20px;
font-weight: 400;
font-size:20px;
}
span{
position: absolute;
bottom:-30px;
right:15px;
font-size: 14px;
cursor: pointer;
z-index: 999;
}
}
.provider_content{
width:100%;
position: relative;
h3{
margin:0px;
padding:0px;
border-bottom: 1px solid #494949;
color: #464646;
font-size: 20px;
font-weight: 400;
padding: 15px;
}
.provider_inner_content{
width:100%;
padding-top: 40px;
padding-left: 20px;
padding-right: 20px;
.row{
padding-bottom: 30px;
.provider_data_content{
width:90%;
margin:0 auto;
.edit_delivery{
color: #195c77;
text-decoration: underline;
cursor: pointer;
font-weight: 500;
position: relative;
top:30px;
}
p{
color: #464646;
margin:0px;
padding-bottom: 10px;
font-weight: 500;
}
.provider_input{
border:1px solid #b4b4b4;
height:40px;
padding-left: 10px;
padding-right: 10px;
width: 100%;
&:focus{
outline: none;
}
}
.provider_pin{
border:1px solid #b4b4b4;
height:40px;
width: calc(100% - 90%);
margin-right: calc(100% - 92%);
text-align: center;
display: inline-block;
border-radius: 10px;
&:focus{
outline: none;
}
}
}
.edit_btn{
background: #d9d9d9;
color: #1a5d7a;
border-radius:20px;
height:40px;
padding-left: 4%;
padding-right:4%;
font-weight: 500;
margin:1%;
border:none;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
.add_provider_btn_bay{
width:100%;
padding-top:5%;
text-align: right;
.save_btn{
background: #cd3d3d;
color: #fff;
border-radius:20px;
height:40px;
border:none;
padding-left:4%;
padding-right:4%;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
.cancel_btn{
background: #1a5c7c;
color: #fff;
border-radius:20px;
height:40px;
padding-left:4%;
padding-right:4%;
border:none;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
table{
thead{
background: #1ca8cb;
tr{
th{
color: #fff;
padding-left: 25px;
font-weight: 500;
.add{
width:30px;
height:30px;
background: #1a5b77;
color: #fff;
border:1px solid #fff;
border-radius: 50%;
font-size: 18px;
cursor: pointer;
&:focus{
outline: none;
}
}
}
}
}
tbody{
tr{
border-bottom: 2px solid #fff;
td{
.edit_btn{
width:25px;
height:25px;
border:none;
background:url('/assets/images/asset_edit.png');
background-position: center;
background-size: 18px;
background-repeat: no-repeat;
margin: 2px;
&:focus{
outline:none;
}
}
.delete_btn{
width:25px;
height:25px;
border:none;
background:url('/assets/images/asset_delete.png');
background-position: center;
background-size: 20px;
background-repeat: no-repeat;
margin: 2px;
&:focus{
outline:none;
}
}
}
&:nth-child(even) {background: #f3f3f3}
&:nth-child(odd) {background: #f9f9f9}
}
}
}
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ForexproviderComponent } from './forexprovider.component';
describe('ForexproviderComponent', () => {
let component: ForexproviderComponent;
let fixture: ComponentFixture<ForexproviderComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ForexproviderComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ForexproviderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
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';
@Component({
selector: 'app-forexprovider',
templateUrl: './forexprovider.component.html',
styleUrls: ['./forexprovider.component.scss']
})
export class ForexproviderComponent implements OnInit {
providerList: any[];
fname: any;
lang = 'en';
responseMsg: any;
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(1);
}
getProvider(page_number: number) {
this.page_number = page_number;
this.loader = true;
this.fname = 'all_providers';
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.data;
this.meta = response.responseResult.meta;
console.log(this.meta);
} else {
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;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
reset() {
this.error = false;
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 ?');
if (res === true) {
this.loader = true;
this.fname = 'provider_delete';
const post_data = {'provider_id': provider_id};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.success = true;
console.log(this.success);
this.getProvider(this.page_number);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
}
/* const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000); */
}
editClick(id: number) {
this.router.navigate(['maker/forex_edit/' + id]);
}
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
logout() {
this.service.logout();
}
get_status(status: number) {
let state = '';
switch (status) {
case 0:
state = 'Pending';
break;
case 1:
state = 'Approved';
break;
case 2:
state = 'Reject';
break;
default:
break;
}
return state;
}
}
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>{{'home.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('maker/currency_list')">
<img src="assets/images/asset_currency.png">
{{'home.Currency' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'home.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
</div>
</div>
</header>
<section>
<div class="forex_wrapper">
<div class="row">
<div class="col-md-6">
<div class="forex_inner" (click)="clickForex()">
<img src="assets/images/asset_forex.png">
<h5>{{'home.Manage Forex Provider' | translate}}</h5>
</div>
</div>
<div class="col-md-6">
<div class="forex_inner" (click)="clickDelivery()">
<img src="assets/images/asset_manage.png">
<h5> {{'home.Manage Delivery Provider' | translate}}</h5>
</div>
</div>
</div>
</div>
</section>
.provider_header{
background: #1a5c7c;
padding: 4px;
h4{
margin:0px;
color: #fff;
padding: 20px;
font-weight: 400;
font-size:20px;
}
span{
position: absolute;
bottom:-30px;
right:15px;
font-size: 14px;
cursor: pointer;
z-index: 999;
}
}
.forex_wrapper{
.forex_inner{
cursor: pointer;
text-align: center;
height: calc(100vh - 100px);
padding-top: 35%;
h5{
color: #464646;
font-weight: 500;
}
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
import { WebService } from './../../providers/web.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
constructor(private router: Router, private route: ActivatedRoute, public service: WebService) { }
ngOnInit() {
}
goToPage(path: any, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
clickForex() {
this.router.navigate(['/maker/forex']);
}
clickDelivery() {
this.router.navigate(['/maker/delivery']);
}
logout() {
this.service.logout();
}
}
<div class="delivery_provider_content">
<router-outlet></router-outlet>
</div>
.delivery_provider_content{
width:80%;
margin:0 auto;
position: relative;
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IndexComponent } from './index.component';
describe('IndexComponent', () => {
let component: IndexComponent;
let fixture: ComponentFixture<IndexComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ IndexComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(IndexComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-index',
templateUrl: './index.component.html',
styleUrls: ['./index.component.scss']
})
export class IndexComponent implements OnInit {
constructor(private router: Router,private route: ActivatedRoute) { }
ngOnInit() {
}
goToPage(path,data=null){
console.log(data)
this.router.navigateByUrl(path,{queryParams:data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { moduleRouting } from './maker.routing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule} from '@ngx-translate/core';
//IMPORTED-PAGE-COMPONENTS
import { IndexComponent } from './index/index.component';
import { AddproviderComponent} from './addprovider/addprovider.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { HomeComponent } from './home/home.component';
import { ForexproviderComponent } from './forexprovider/forexprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { CurrencyAddComponent } from './currency-add/currency-add.component';
import { AddforexComponent } from './addforex/addforex.component';
import { EditforexComponent } from './editforex/editforex.component';
import { CurrencyEditComponent } from './currency-edit/currency-edit.component';
import { CurrencyListComponent } from './currency-list/currency-list.component';
@NgModule({
// tslint:disable-next-line:max-line-length
declarations: [IndexComponent, AddproviderComponent, EditproviderComponent, ManageproviderComponent, HomeComponent, ForexproviderComponent, ChangepinComponent, CurrencyAddComponent, AddforexComponent, EditforexComponent, CurrencyEditComponent, CurrencyListComponent],
imports: [
CommonModule,
moduleRouting,
FormsModule,
ReactiveFormsModule,
TranslateModule
]
})
export class makerModule { }
// COMMON-ANGULAR-MODULES
import { ModuleWithProviders } from '@angular/core';
// ROUTING
import { Routes, RouterModule } from '@angular/router';
import { RoleGuard } from './../providers/role-guard.service';
//IMPORTED-PAGE-COMPONENTS
import { IndexComponent } from './index/index.component';
import { AddproviderComponent} from './addprovider/addprovider.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { ForexproviderComponent } from './forexprovider/forexprovider.component';
import { HomeComponent } from './home/home.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { CurrencyAddComponent } from './currency-add/currency-add.component';
import { AuthGuard } from './../providers/auth.guard';
import { AddforexComponent } from './addforex/addforex.component';
import { EditforexComponent } from './editforex/editforex.component';
import { CurrencyEditComponent } from './currency-edit/currency-edit.component';
import { CurrencyListComponent } from './currency-list/currency-list.component';
const ModuleRoutes: Routes = [
{ path: 'maker', component: IndexComponent, canActivate: [AuthGuard],
children: [
{ path: 'provider_delivery', component: AddproviderComponent },
{ path: 'delivery_edit/:id', component: EditproviderComponent },
{ path: 'delivery', component: ManageproviderComponent },
{ path: 'forex', component: ForexproviderComponent },
{ path: 'provider_forex', component: AddforexComponent },
{ path: 'forex_edit/:id', component: EditforexComponent },
{ path: 'home', component: HomeComponent },
{ path: 'changepin', component: ChangepinComponent },
{ path: 'currency_add', component: CurrencyAddComponent},
{ path: 'currency_edit/:id', component: CurrencyEditComponent},
{ path: 'currency_list', component: CurrencyListComponent}
], data: {role: 1}
}
];
export const moduleRouting: ModuleWithProviders = RouterModule.forChild(ModuleRoutes)
<div class="custom_loader_wrapper" *ngIf="loader">
<div class="custom_loader_ring"></div>
</div>
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4> {{'manageprovider.Forex Delivery Service Provider' | translate}}</h4>
</div>
<div class="col-md-6 textRight relative">
<button class="logout" (click)="goToPage('maker/home')">
<img src="assets/images/asset_home.png">
{{'manageprovider.Home' | translate}}</button>
<button class="logout" (click)="logout()">
<img src="assets/images/asset_logout.png">
{{'manageprovider.Logout' | translate}}</button>
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('maker/changepin')"> {{'manageprovider.Change PIN' | translate}}</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3> {{'manageprovider.Manage Delivery Service Provider' | translate}}</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<div class="alert alert-danger alert-dismissible" *ngIf="error">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong> {{'manageprovider.Warning!' | translate}}</strong> {{responseMsg}}
</div>
<div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong> {{'manageprovider.Success!' | translate}}</strong>{{'manageprovider.Delivery provider removed successfully' | translate}}
</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>
<th>{{'manageprovider.Provider Name' | translate}}</th>
<th> {{'manageprovider.Location' | translate}}</th>
<th> {{'manageprovider.CR Manager' | translate}}</th>
<th> {{'manageprovider.CR ID' | translate}}</th>
<th> {{'manageprovider.Contact Name' | translate}}</th>
<th> {{'manageprovider.Phone' | translate}}</th>
<th> {{'manageprovider.Email ID' | translate}}</th>
<th> {{'forexprovider.Status' | translate}}</th>
<th class="textRight">
<button class="add" (click)="goToPage('maker/provider_delivery')">+</button>
</th>
</tr>
</thead>
<tbody *ngIf="providerList; else noProvider">
<tr *ngFor="let provider of providerList;">
<td>{{provider.name | titlecase}}</td>
<td>{{provider.location | titlecase}}</td>
<td>{{provider.cr_manager | titlecase}}</td>
<td>{{provider.cr_id}}</td>
<td>{{provider.contact | titlecase}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td>{{get_status(provider.status)}}</td>
<td class="textRight pl0 pr0">
<button class="edit_btn"(click)="editClick(provider.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button>
</td>
</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>
</div>
</section>
\ No newline at end of file
.provider_header{
background: #1a5c7c;
padding: 4px;
h4{
margin:0px;
color: #fff;
padding: 20px;
font-weight: 400;
font-size:20px;
}
span{
position: absolute;
bottom:-30px;
right:15px;
font-size: 14px;
cursor: pointer;
z-index: 999;
}
}
.provider_content{
width:100%;
position: relative;
h3{
margin:0px;
padding:0px;
border-bottom: 1px solid #494949;
color: #464646;
font-size: 20px;
font-weight: 400;
padding: 15px;
}
.provider_inner_content{
width:100%;
padding-top: 40px;
padding-left: 20px;
padding-right: 20px;
.row{
padding-bottom: 30px;
.provider_data_content{
width:90%;
margin:0 auto;
.edit_delivery{
color: #195c77;
text-decoration: underline;
cursor: pointer;
font-weight: 500;
position: relative;
top:30px;
}
p{
color: #464646;
margin:0px;
padding-bottom: 10px;
font-weight: 500;
}
.provider_input{
border:1px solid #b4b4b4;
height:40px;
padding-left: 10px;
padding-right: 10px;
width: 100%;
&:focus{
outline: none;
}
}
.provider_pin{
border:1px solid #b4b4b4;
height:40px;
width: calc(100% - 90%);
margin-right: calc(100% - 92%);
text-align: center;
display: inline-block;
border-radius: 10px;
&:focus{
outline: none;
}
}
}
.edit_btn{
background: #d9d9d9;
color: #1a5d7a;
border-radius:20px;
height:40px;
padding-left: 4%;
padding-right:4%;
font-weight: 500;
margin:1%;
border:none;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
.add_provider_btn_bay{
width:100%;
padding-top:5%;
text-align: right;
.save_btn{
background: #cd3d3d;
color: #fff;
border-radius:20px;
height:40px;
border:none;
padding-left:4%;
padding-right:4%;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
.cancel_btn{
background: #1a5c7c;
color: #fff;
border-radius:20px;
height:40px;
padding-left:4%;
padding-right:4%;
border:none;
margin:1%;
&:hover{
outline: none;
}
&:focus{
outline:none;
}
}
}
table{
thead{
background: #1ca8cb;
tr{
th{
color: #fff;
padding-left: 25px;
font-weight: 500;
.add{
width:30px;
height:30px;
background: #1a5b77;
color: #fff;
border:1px solid #fff;
border-radius: 50%;
font-size: 18px;
cursor: pointer;
&:focus{
outline: none;
}
}
}
}
}
tbody{
tr{
border-bottom: 2px solid #fff;
td{
.edit_btn{
width:25px;
height:25px;
border:none;
background:url('/assets/images/asset_edit.png');
background-position: center;
background-size: 18px;
background-repeat: no-repeat;
margin: 2px;
&:focus{
outline:none;
}
}
.delete_btn{
width:25px;
height:25px;
border:none;
background:url('/assets/images/asset_delete.png');
background-position: center;
background-size: 20px;
background-repeat: no-repeat;
margin: 2px;
&:focus{
outline:none;
}
}
}
&:nth-child(even) {background: #f3f3f3}
&:nth-child(odd) {background: #f9f9f9}
}
}
}
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ManageproviderComponent } from './manageprovider.component';
describe('ManageproviderComponent', () => {
let component: ManageproviderComponent;
let fixture: ComponentFixture<ManageproviderComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ManageproviderComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ManageproviderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { WebService } from './../../providers/web.service';
import { ValidationService } from './../../providers/validation.service';
@Component({
selector: 'app-manageprovider',
templateUrl: './manageprovider.component.html',
styleUrls: ['./manageprovider.component.scss']
})
export class ManageproviderComponent implements OnInit {
providerList: any[];
fname: any;
lang = 'en';
responseMsg: any;
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(1);
}
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, '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.data;
this.meta = response.responseResult.meta;
} else {
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;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
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;
}
deleteClick(provider_id: any) {
this.reset();
const res = confirm('Do you want to remove this user ?');
if (res === true) {
this.loader = true;
this.fname = 'provider_delete';
const post_data = {'provider_id': provider_id};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.success = true;
console.log(this.success);
this.getProvider(this.page_number);
} else {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang][response.errorCode];
}
}, (error) => {
this.error = true;
this.responseMsg = this.vs.errorCode[this.lang]['ER08'];
});
}
/* const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000); */
}
editClick(id: number) {
this.router.navigate(['maker/delivery_edit/' + id]);
}
logout() {
this.service.logout();
}
get_status(status: number) {
let state = '';
switch (status) {
case 0:
state = 'Pending';
break;
case 1:
state = 'Approved';
break;
case 2:
state = 'Reject';
break;
default:
break;
}
return state;
}
}
......@@ -34,7 +34,8 @@ export class ValidationService {
'max': 'Age max end at ',
'confirm': 'Password mismatch',
'pattern': 'Invalid Pattern',
'crId': 'Invalid CR ID'
'crId': 'Invalid CR ID',
'national_id': 'Invalid National ID'
};
this.errorCode['en'] = {
......
......@@ -8,11 +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)="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 class="login_btn_bay">
<div class="row">
......
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'];
});
}
}
<div class="custom_loader_wrapper" *ngIf="loader">
<div class="custom_loader_ring"></div>
</div>
<div class="login_wrapper">
<div class="container">
<div class="row">
......@@ -32,7 +35,7 @@
</div>
<div class="s_error" *ngIf="passwordErr">
<div class="s_validation">{{error_msg.password}} </div>
</div>
</div>
</div>
<div *ngIf="loginError" class="alert alert-danger" role="alert">
{{loginMsg}}
......
......@@ -31,9 +31,8 @@ export class LoginComponent implements OnInit {
loginError: boolean;
loginMsg: any;
loginDetails: any;
loader: boolean;
val = 0;
constructor(
private router: Router,
private route: ActivatedRoute,
......@@ -41,20 +40,18 @@ 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'));
if (this.loginDetails) {
if (this.loginDetails.user_type === 1) {
this.router.navigate(['checker/home']);
this.router.navigate(['maker/home']);
} else if (this.loginDetails.user_type === 2) {
this.router.navigate(['forex']);
} else if (this.loginDetails.user_type === 3) {
......@@ -63,21 +60,11 @@ 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() {
this.model = {'email_id': '', 'password': ''};
this.language.nativeElement.value = this.lang === 'ar'?1:0;
// this.language.nativeElement.value = this.lang === 'ar' ? 1 : 0;
}
goToPage(path: any, data = null) {
......@@ -135,20 +122,25 @@ 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;
this.service.setLocalStorageItem('userData', JSON.stringify(response.responseResult));
this.subjectService.sendLoginData('logged_in');
if (responseData.user_type === 1) {
this.router.navigate(['checker/home']);
this.router.navigate(['maker/home']);
} else if (responseData.user_type === 2) {
this.router.navigate(['forex']);
} else if (responseData.user_type === 3) {
this.router.navigate(['delivery']);
} else if (responseData.user_type === 5) {
this.router.navigate(['checker/home']);
} else {
this.loginError = true;
this.loginMsg = this.vs.errorCode['ER42'];
......
......@@ -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>
......
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 = '';
}
}
......@@ -28,7 +28,7 @@ const ModuleRoutes: Routes = [
component: ForgotComponent,
},
{
path: "newpin",
path: "newpin/:id",
component: NewpinComponent,
},
{
......
......@@ -136,7 +136,8 @@
"Edit Forex Provider":"Edit Forex Provider",
"Warning!":"Warning!",
"Success!":"Success!",
"editforex.Provider updated successfully.":"editforex.Provider updated successfully.",
"Provider updated successfully":"editforex.Provider updated successfully",
"Request For Approve": "Request For Approval",
"Provider Name":"Provider Name",
"Location":"Location",
"CR ID":"CR ID",
......@@ -172,7 +173,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",
......@@ -189,7 +191,9 @@
"CR ID":"CR ID",
"Contact Name":"Contact Name",
"Phone":"Phone",
"Email ID":"Email ID"
"Status": "Status",
"Email ID":"Email ID",
"Action": "Action"
},
"home":{
"Forex Delivery Service Provider":"Forex Delivery Service Provider",
......@@ -221,10 +225,10 @@
"Home":"Home",
"Logout":"Logout",
"Change PIN":"Change PIN",
"Edit Driver":"Edit Driver",
"Add Delivery Driver":"Add Delivery Driver",
"Warning!":"Warning!",
"Success!":"Success!",
"Provider created successfully.":"Provider created successfully.",
"Driver created successfully":"Driver created successfully",
"Provider Name":"Driver Name",
"Pin":"Pin",
"Location":"Location",
......@@ -234,7 +238,10 @@
"Email id":"Email id",
"Save":"Save",
"Cancel":"Cancel",
"Confirm Pin":"Confirm Pin"
"Confirm Pin":"Confirm Pin",
"Postal Code": "Postal Code",
"Maximum Amount": "Maximum Amount",
"Maximum Limit": "Maximum Limit"
},
"editdriver":{
"Forex Delivery Driver":"Forex Delivery Driver",
......@@ -268,7 +275,10 @@
"National ID":"National ID",
"Manager ID":"Manager ID",
"Phone":"Phone",
"Email ID":"Email ID"
"Email ID":"Email ID",
"Postal Code": "Postal Code",
"Max Amount": "Max Amount",
"Max Limit": "Max Limit"
},
"currency":{
"Forex Currency Rate":"Forex Currency Rate",
......@@ -298,7 +308,7 @@
"Warning":"Warning",
"Success":"Success",
"Forex provider removed successfully":"Forex provider removed successfully",
"User Info":"User Info",
"User Info":"User name",
"Phone":"Phone",
"Location":"Location",
"Amount":"Amount",
......@@ -308,7 +318,22 @@
"Assign Driver":"Assign Driver",
"User":"User",
"Assign":"Assign",
"Cancel":"Cancel"
"Cancel":"Cancel",
"Provider": "Provider",
"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"
}
}
......@@ -8,9 +8,10 @@
},
"forgot":{
"Forgot your PIN": "Forgot your PIN",
"Email Address": "Email Address",
"SEND ME THE LINK": "SEND ME THE LINK",
"VERIFY OTP":"VERIFY OTP"
"Phone Number (96655XXXXXXX)": "Phone Number (96655XXXXXXX)",
"SEND OTP": "SEND OTP",
"Verify OTP": "Verify OTP",
"Resend": "Resend"
},
"invalid":{
"Access Denied": "Access Denied",
......@@ -20,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",
......@@ -108,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"
},
......@@ -136,7 +138,7 @@
"Edit Forex Provider":"Edit Forex Provider",
"Warning!":"Warning!",
"Success!":"Success!",
"editforex.Provider updated successfully.":"editforex.Provider updated successfully.",
"Provider updated successfully":"Forex Provider updated successfully",
"Provider Name":"Provider Name",
"Location":"Location",
"CR ID":"CR ID",
......@@ -149,6 +151,7 @@
"Offline":"Offline",
"Delivery Provider":"Delivery Provider",
"Save":"Save",
"Request For Approve": "Request For Approval",
"Cancel":"Cancel"
},
"editprovider":{
......@@ -158,9 +161,9 @@
"Logout":"Logout",
"Change PIN":"Change PIN",
"Edit Delivery Service Provider":"Edit Delivery Service Provider",
"Warning!":"Warning!",
"Success!":"Success!",
"Provider updated successfully.":"Provider updated successfully.",
"Warning":"Warning",
"Success":"Success",
"Provider updated successfully":"Provider updated successfully",
"Provider Name":"Provider Name",
"Location":"Location",
"CR ID":"CR ID",
......@@ -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",
......@@ -189,7 +193,9 @@
"CR ID":"CR ID",
"Contact Name":"Contact Name",
"Phone":"Phone",
"Email ID":"Email ID"
"Status": "Status",
"Email ID":"Email ID",
"Action": "Action"
},
"home":{
"Forex Delivery Service Provider":"Forex Delivery Service Provider",
......@@ -214,17 +220,18 @@
"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",
"Home":"Home",
"Logout":"Logout",
"Change PIN":"Change PIN",
"Edit Driver":"Edit Driver",
"Add Delivery Driver":"Add Delivery Driver",
"Warning!":"Warning!",
"Success!":"Success!",
"Provider created successfully.":"Provider created successfully.",
"Driver created successfully":"Driver created successfully",
"Provider Name":"Driver Name",
"Pin":"Pin",
"Location":"Location",
......@@ -234,7 +241,10 @@
"Email id":"Email id",
"Save":"Save",
"Cancel":"Cancel",
"Confirm Pin":"Confirm Pin"
"Confirm Pin":"Confirm Pin",
"Postal Code": "Postal Code",
"Maximum Amount": "Maximum Amount",
"Maximum Limit": "Maximum Limit"
},
"editdriver":{
"Forex Delivery Driver":"Forex Delivery Driver",
......@@ -263,12 +273,15 @@
"Forex provider removed successfully":"Forex provider removed successfully",
"Warning!":"Warning!",
"Success!":"Success!",
"Provider Name":"Provider Name",
"Provider Name":"Driver Name",
"Location":"Location",
"National ID":"National ID",
"Manager ID":"Manager ID",
"Phone":"Phone",
"Email ID":"Email ID"
"Email ID":"Email ID",
"Postal Code": "Postal Code",
"Max Amount": "Max Amount",
"Max Limit": "Max Limit"
},
"currency":{
"Forex Currency Rate":"Forex Currency Rate",
......@@ -298,7 +311,7 @@
"Warning":"Warning",
"Success":"Success",
"Forex provider removed successfully":"Forex provider removed successfully",
"User Info":"User Info",
"Customer":"Customer",
"Phone":"Phone",
"Location":"Location",
"Amount":"Amount",
......@@ -308,7 +321,27 @@
"Assign Driver":"Assign Driver",
"User":"User",
"Assign":"Assign",
"Cancel":"Cancel"
"Cancel":"Cancel",
"Provider": "Provider",
"Config": "Config",
"Pincode": "Pincode",
"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",
"Cancel": "Cancel",
"Success": "Success",
"Home": "Home",
"Logout": "Logout"
}
}
export const ImageStorage = 'http://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 ImageStorage = 'https://forex.nuvento.com/';
export const ImageStorage = 'http://localhost:3000/';
export const apiConfig = 'http://localhost:3000/api/';
// export const apiConfig = 'https://forex.nuvento.com/api/';
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment