Commit 7c188fa5 by Adarsh K

Forex change

parent 563228d0
......@@ -3759,14 +3759,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -3781,20 +3779,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -3911,8 +3906,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
......@@ -3924,7 +3918,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -3939,7 +3932,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -3947,14 +3939,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -3973,7 +3963,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -4054,8 +4043,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
......@@ -4067,7 +4055,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4189,7 +4176,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -7989,6 +7975,11 @@
"tslib": "^1.9.0"
}
},
"rxjs-compat": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.4.0.tgz",
"integrity": "sha512-eo/O8RS83hJdJukCtA+IF6qnqa8FPOuVo+OPCzgVi+dbTle9KCdNv97IcQO0WwNVik7DJLKmf0F8uwzc0q40vw=="
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
......
......@@ -25,6 +25,7 @@
"ngx-bootstrap": "^3.2.0",
"node-sass": "^4.11.0",
"rxjs": "~6.3.3",
"rxjs-compat": "^6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
......
......@@ -4,7 +4,7 @@ import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: 'checker/currency',
redirectTo: 'start/login',
pathMatch: 'full'
}
];
......
......@@ -2,6 +2,8 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
/* CUSTOM-MODULES */
......@@ -12,6 +14,13 @@ import {DeliveryModule} from './delivery/delivery.module';
import {StartModule} from './start/start.module';
/* Custom Services */
import { AuthService } from './providers/auth.service';
import { AuthGuard } from './providers/auth.guard';
import { WebService } from './providers/web.service';
......@@ -25,9 +34,12 @@ import {StartModule} from './start/start.module';
CheckerModule,
ForexModule,
DeliveryModule,
ReactiveFormsModule,
FormsModule,
HttpClientModule,
StartModule
],
providers: [],
providers: [AuthGuard, AuthService, WebService],
bootstrap: [AppComponent]
})
export class AppModule { }
import { Component, OnInit } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
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-addprovider',
......@@ -7,14 +10,29 @@ import { Router,ActivatedRoute } from '@angular/router';
styleUrls: ['./addprovider.component.scss']
})
export class AddproviderComponent implements OnInit {
providerForm: FormGroup;
mobnumPattern = '^((\\+?)|0)?[0-9]{0,20}$';
emailPattern = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$';
providerSubmit: boolean;
constructor(private router: Router,private route: ActivatedRoute) { }
constructor(
private router: Router,
private route: ActivatedRoute,
public vs: ValidationService,
public service: WebService,
private formBuilder: FormBuilder
) {
this.providerSubmit = false;
}
ngOnInit() {
this.providerForm = this.formBuilder.group({
'name': ['', Validators.compose([Validators.required])],
});
}
goToPage(path,data=null){
console.log(data)
goToPage(path, data = null){
console.log(data);
this.router.navigateByUrl(path,{queryParams:data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......
<div class="login_wrapper">
<div class="container">
<div class="row">
<div class="login_inner">
<img src="assets/images/asset_logo.png">
<hr>
<h6>Change PIN</h6>
<div class="login_inner_content">
<br>
<div class="login_row">
<p>Old PIN</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">
</div>
</div>
<div class="login_row">
<p>New PIN</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">
</div>
</div>
<div class="login_row">
<p>Confirm PIN</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">
</div>
</div>
</div>
</div>
</div>
<div class="login_btn_bay">
<div class="row">
<div class="col-md-6">
<button class="cancel_btn" (click)="goToPage('start/forgot')">Cancel</button>
</div>
<div class="col-md-6">
<button class="login_btn" (click)="goToPage('start/login')">Save</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:3%;
img{
margin-bottom: 20px;
}
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: 3%;
margin: 0 auto;
}
.login_inner_content{
padding-top:35px;
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:5%;
.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 } from '@angular/core';
@Component({
selector: 'app-changepin',
templateUrl: './changepin.component.html',
styleUrls: ['./changepin.component.scss']
})
export class ChangepinComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
......@@ -10,9 +10,11 @@ import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { HomeComponent } from './home/home.component';
import { CurrencyComponent } from './currency/currency.component';
import { ForexproviderComponent } from './forexprovider/forexprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
@NgModule({
declarations: [IndexComponent, AddproviderComponent, EditproviderComponent, ManageproviderComponent, HomeComponent, CurrencyComponent],
declarations: [IndexComponent, AddproviderComponent, EditproviderComponent, ManageproviderComponent, HomeComponent, CurrencyComponent, ForexproviderComponent, ChangepinComponent],
imports: [
CommonModule,
moduleRouting
......
......@@ -12,39 +12,25 @@ 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 { CurrencyComponent } from './currency/currency.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { AuthGuard } from './../providers/auth.guard';
const ModuleRoutes: Routes = [
{
path: 'checker',
component:IndexComponent,
children:[
{
path: "addprovider",
component: AddproviderComponent,
},
{
path: "editprovider",
component: EditproviderComponent
},
{
path: "manageprovider",
component: ManageproviderComponent
},
{
path: "home",
component: HomeComponent
},
{
path: "currency",
component: CurrencyComponent
}
{ path: 'checker', component: IndexComponent, canActivate: [AuthGuard],
children: [
{ path: 'addprovider', component: AddproviderComponent },
{ path: 'editprovider', component: EditproviderComponent },
{ path: 'delivery', component: ManageproviderComponent },
{ path: 'forex', component: ForexproviderComponent },
{ path: 'home', component: HomeComponent },
{ path: 'currency', component: CurrencyComponent },
{ path: 'changepin', component: ChangepinComponent }
]
}
];
......
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>Forex Delivery Service Provider</h4>
</div>
<div class="col-md-6 textRight relative">
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('checker/changepin')">Change PIN</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3>Manage Delivery Service Provider</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Provider Name</th>
<th>Location</th>
<th>CR Manager</th>
<th>CR ID</th>
<th>Contact</th>
<th>Phone</th>
<th>Email ID</th>
<th class="textRight">
<button class="add" (click)="goToPage('checker/addprovider')">+</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn"(click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
</tbody>
</table>
</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: 40px;
.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 } from '@angular/core';
@Component({
selector: 'app-forexprovider',
templateUrl: './forexprovider.component.html',
styleUrls: ['./forexprovider.component.scss']
})
export class ForexproviderComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
......@@ -12,13 +12,13 @@
<div class="forex_wrapper">
<div class="row">
<div class="col-md-6">
<div class="forex_inner">
<div class="forex_inner" (click)="clickForex()">
<img src="assets/images/asset_forex.png">
<h5>Manage Forex Provider</h5>
</div>
</div>
<div class="col-md-6">
<div class="forex_inner">
<div class="forex_inner" (click)="clickDelivery()">
<img src="assets/images/asset_manage.png">
<h5>Manage Delivery Provider</h5>
</div>
......
......@@ -8,13 +8,21 @@ import { Router,ActivatedRoute } from '@angular/router';
})
export class HomeComponent implements OnInit {
constructor(private router: Router,private route: ActivatedRoute) { }
constructor(private router: Router, private route: ActivatedRoute) { }
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;
}
clickForex() {
this.router.navigate(['/checker/forex']);
}
clickDelivery() {
this.router.navigate(['/checker/delivery']);
}
}
......@@ -14,6 +14,7 @@
<h3>Manage Delivery Service Provider</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<div class="message" [innerHTML]="responseMsg" *ngIf="responseMsg!=''"></div>
<table class="table">
<thead>
<tr>
......@@ -29,100 +30,23 @@
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<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 class="textRight">
<button class="edit_btn"(click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('checker/editprovider')"></button>
<button class="delete_btn"></button>
<button class="delete_btn" (click)="deleteClick(provider.users_id)"></button>
</td>
</tr>
</tbody>
</table>
<ng-template #noProvider></ng-template>
</div>
</div>
</div>
......
import { Component, OnInit } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { WebService } from './../../providers/web.service';
import { ValidationService } from './../../providers/validation.service';
@Component({
selector: 'app-manageprovider',
......@@ -7,17 +9,70 @@ import { Router,ActivatedRoute } from '@angular/router';
styleUrls: ['./manageprovider.component.scss']
})
export class ManageproviderComponent implements OnInit {
providerList: any[];
fname: any;
lang = 'ar';
responseMsg: any;
constructor(private router: Router,private route: ActivatedRoute) { }
constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) {
this.responseMsg = '';
}
ngOnInit() {
this.getProvider();
}
getProvider() {
this.fname = 'providers';
const post_data = {'type': 3};
this.service.post_data(this.fname, post_data).subscribe(response => {
console.log(response);
if (response.code === 1) {
this.providerList = response.responseResult;
} else {
this.responseMsg = '<small style="color:red;">' + this.vs.errorCode[this.lang][response.errorCode] + '</smal>';
}
}, (error) => {
this.responseMsg = '<small style="color:red;">' + this.vs.errorCode[this.lang]['ER08'] + '</smal>';
});
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
goToPage(path,data=null){
console.log(data)
this.router.navigateByUrl(path,{queryParams:data});
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
deleteClick(provider_id: any) {
const res = confirm('Do you want to remove this user ?');
if (res === true) {
this.fname = 'provider_delete';
const post_data = {'provider_id': provider_id};
this.service.post_data(this.fname, post_data).subscribe(response => {
console.log(response);
if (response.code === 1) {
this.getProvider();
this.responseMsg = '<small style="color:green;">' + this.vs.errorCode[this.lang]['ER08'] + '</smal>';
} else {
this.responseMsg = '<small style="color:red;">' + this.vs.errorCode[this.lang][response.errorCode] + '</smal>';
}
}, (error) => {
this.responseMsg = '<small style="color:red;">' + this.vs.errorCode[this.lang]['ER08'] + '</smal>';
});
}
const This = this;
setTimeout(function() {
This.responseMsg = '';
}, 3000);
}
changePinClick() {
}
}
......@@ -9,9 +9,10 @@ import { AddproviderComponent } from './addprovider/addprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { TransactionComponent } from './transaction/transaction.component';
@NgModule({
declarations: [IndexComponent, AddproviderComponent, ChangepinComponent, EditproviderComponent, ManageproviderComponent],
declarations: [IndexComponent, AddproviderComponent, ChangepinComponent, EditproviderComponent, ManageproviderComponent, TransactionComponent],
imports: [
CommonModule,
moduleRouting
......
......@@ -13,33 +13,20 @@ import { AddproviderComponent} from './addprovider/addprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { TransactionComponent } from './transaction/transaction.component';
import { AuthGuard } from './../providers/auth.guard';
const ModuleRoutes: Routes = [
{
path: 'delivery',
component:IndexComponent,
children:[
{
path: "addprovider",
component: AddproviderComponent,
},
{
path: "changepin",
component: ChangepinComponent,
},
{
path: "editprovider",
component: EditproviderComponent
},
{
path: "manageprovider",
component: ManageproviderComponent
}
{ path: 'delivery', component: IndexComponent, canActivate: [AuthGuard],
children: [
{ path: 'addprovider', component: AddproviderComponent },
{ path: 'changepin', component: ChangepinComponent },
{ path: 'editprovider', component: EditproviderComponent },
{ path: 'manageprovider', component: ManageproviderComponent},
{path: '', component: TransactionComponent}
]
}
];
......
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>Delivery Transaction List</h4>
</div>
<div class="col-md-6 textRight relative">
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('forex/changepin')">Change PIN</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3>Manage Transaction</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Provider Name</th>
<th>Location</th>
<th>CR Manager</th>
<th>CR ID</th>
<th>Contact</th>
<th>Phone</th>
<th>Email ID</th>
<th class="textRight">
<button class="add" (click)="goToPage('forex/addprovider')">+</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn"(click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
</tbody>
</table>
</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: 40px;
.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 { TransactionComponent } from './transaction.component';
describe('TransactionComponent', () => {
let component: TransactionComponent;
let fixture: ComponentFixture<TransactionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransactionComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TransactionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transaction',
templateUrl: './transaction.component.html',
styleUrls: ['./transaction.component.scss']
})
export class TransactionComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
......@@ -9,10 +9,11 @@ import { AddproviderComponent} from './addprovider/addprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
import { TransactionComponent } from './transaction/transaction.component';
@NgModule({
declarations: [IndexComponent, AddproviderComponent, ChangepinComponent, EditproviderComponent, ManageproviderComponent],
declarations: [IndexComponent, AddproviderComponent, ChangepinComponent, EditproviderComponent, ManageproviderComponent, TransactionComponent],
imports: [
CommonModule,
moduleRouting
......
......@@ -13,33 +13,18 @@ import { AddproviderComponent} from './addprovider/addprovider.component';
import { ChangepinComponent } from './changepin/changepin.component';
import { EditproviderComponent } from './editprovider/editprovider.component';
import { ManageproviderComponent } from './manageprovider/manageprovider.component';
const ModuleRoutes: Routes = [
{
path: 'forex',
component:IndexComponent,
children:[
{
path: "addprovider",
component: AddproviderComponent,
},
{
path: "changepin",
component: ChangepinComponent,
},
{
path: "editprovider",
component: EditproviderComponent
},
{
path: "manageprovider",
component: ManageproviderComponent
}
import { TransactionComponent } from './transaction/transaction.component';
import { AuthGuard } from './../providers/auth.guard';
const ModuleRoutes: Routes = [{
path: 'forex', component: IndexComponent, canActivate: [AuthGuard],
children: [
{path: 'addprovider', component: AddproviderComponent},
{path: 'changepin', component: ChangepinComponent},
{path: 'editprovider', component: EditproviderComponent},
{path: 'manageprovider', component: ManageproviderComponent },
{path: '', component: TransactionComponent }
]
}
];
......
<header class="provider_header">
<div class="row">
<div class="col-md-6">
<h4>Forex Transaction List</h4>
</div>
<div class="col-md-6 textRight relative">
<img src="assets/images/asset_logo1.png">
<span (click)="goToPage('forex/changepin')">Change PIN</span>
</div>
</div>
</header>
<section>
<div class="provider_content">
<h3>Manage Transaction</h3>
<div class="provider_inner_content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Provider Name</th>
<th>Location</th>
<th>CR Manager</th>
<th>CR ID</th>
<th>Contact</th>
<th>Phone</th>
<th>Email ID</th>
<th class="textRight">
<button class="add" (click)="goToPage('forex/addprovider')">+</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn"(click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="textRight">
<button class="edit_btn" (click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr>
</tbody>
</table>
</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: 40px;
.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 { TransactionComponent } from './transaction.component';
describe('TransactionComponent', () => {
let component: TransactionComponent;
let fixture: ComponentFixture<TransactionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransactionComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TransactionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transaction',
templateUrl: './transaction.component.html',
styleUrls: ['./transaction.component.scss']
})
export class TransactionComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { AuthService } from './auth.service';
import {Router} from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class AuthGuard implements CanActivate {
constructor(private auth: AuthService, private myRoute: Router) {
}
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
if (this.auth.isLoggednIn()) {
return true;
} else {
this.myRoute.navigate(['/start/login']);
return false;
}
}
}
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(private myRoute: Router) { }
sendToken(token: string) {
localStorage.setItem('LoggedInUser', token);
}
getToken() {
return localStorage.getItem('userData');
}
isLoggednIn() {
return this.getToken() !== null;
}
logout() {
localStorage.removeItem('userData');
this.myRoute.navigate(['/start/login']);
}
}
import { Injectable } from '@angular/core';
import { observable, Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable({
providedIn: 'root'
})
export class SubjectService {
private loginDetails = new BehaviorSubject<any>(null);
private isLoggined = new BehaviorSubject<any>(null);
sendLoginData(loginData: any) {
this.loginDetails.next(loginData);
}
getLoginData(): Observable<any> {
return this.loginDetails.asObservable();
}
sendisLoggined(isLoggined: any) {
this.isLoggined.next(isLoggined);
}
getisLoggined(): Observable<any> {
return this.isLoggined.asObservable();
}
}
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ValidationService {
errorList: any[];
errorCode: any[];
constructor() {
this.errorList = [];
this.errorCode = [];
this.errorList['ar'] = {
'required': 'هذه الخانة مطلوبه',
'email': 'يرجى إدخال البريد الإلكتروني الصحيح',
'phone': 'يرجى إدخال رقم هاتف صالح',
'password': 'الرجاء إدخال كلمة السر الصحيحة',
'minLength': 'الحد الأدنى لطول الحروف هو',
'maxLength': 'الحد الأقصى لطول الحروف هو',
'min': 'العمر الأدنى تبدأ في',
'max': 'العمر القصوى في نهاية',
'confirm': 'عدم تطابق كلمة المرور'
};
this.errorList['en'] = {
'required': 'This field is required',
'email': 'Please enter a valid email',
'phone': 'Please enter a valid phone number',
'password': 'Please enter a valid password',
'minLength': 'Minimum characters length is',
'maxLength': 'Maximum characters length is',
'min': 'Age min start at ',
'max': 'Age max end at ',
'confirm': 'Password mismatch'
};
this.errorCode['en'] = {
'ER01': 'Authentication Failed',
'ER02': 'Email ID is null or empty',
'ER03': 'Invalid Email ID',
'ER04': 'Password is null or empty',
'ER05': 'Invalid Username / Password',
'ER06': 'Invalid userType',
'ER07': 'No record found',
'ER08': 'Something went wrong',
'ER09': 'Email and Phone are already exists',
'ER10': 'Phone no is null or empty',
'ER11': 'Invalid Phone no',
'ER12': 'Name no is required',
'ER13': 'Location no is required',
'ER14': 'Contact no is required',
'ER15': 'CR Id is required',
'ER16': 'CR Manager is required',
'ER17': 'Provider Id is missing',
'ER18': 'New Password is missing',
'ER19': 'User Id is missing',
'ER20': 'Wrong password',
'ER21': 'Email is already exists',
'ER22': 'Phone is already exists',
'ER23': 'OTP is missing',
'ER24': 'Invalid OTP',
'ER25': 'No Currency found',
'ER26': 'Currency name is missing',
'ER27': 'Currency symbol is missing',
'ER28': 'Currency image Id is missing',
'ER29': 'Currency rate is missing',
'ER30': 'Currency id is missing',
'ER31': 'Amount field is missing',
'ER32': 'SAR amount is missing',
'ER33': 'User information is required',
'ER34': 'User id is missing',
'ER35': 'QR code is required',
'ER36': 'No transactions found',
'ER37': 'Transaction id is missing',
'ER38': 'Driver id is missing',
'ER39': 'Status is required',
'ER40': 'Currency Flag is missing',
'ER41': 'Minimum amount is missing',
'ER42': 'Unknown user found'
};
this.errorCode['ar'] = {
'ER01': 'المصادقة فشلت',
'ER02': 'معرف البريد الإلكتروني فارغ أو فارغ',
'ER03': 'معرف البريد الإلكتروني غير صالح',
'ER04': 'كلمة المرور فارغة أو فارغة',
'ER05': 'اسم المتسخدم / كلمة المرور غير صحيحة',
'ER06': 'نوع المستخدم غير صالح',
'ER07': 'لا يوجد سجلات',
'ER08': 'هناك خطأ ما',
'ER09': 'البريد الإلكتروني والهاتف موجودان بالفعل',
'ER10': 'رقم الهاتف فارغ أو فارغ',
'ER11': 'رقم الهاتف غير صالح',
'ER12': 'الاسم غير مطلوب',
'ER13': 'الموقع لا مطلوب',
'ER14': 'لا الاتصال مطلوب',
'ER15': 'معرف CR مطلوب',
'ER16': 'مطلوب CR مدير',
'ER17': 'معرف الموفر مفقود',
'ER18': 'كلمة المرور الجديدة مفقودة',
'ER19': 'معرف المستخدم مفقود',
'ER20': 'كلمة مرور خاطئة',
'ER21': 'البريد الإلكتروني موجود بالفعل',
'ER22': 'الهاتف موجود بالفعل',
'ER23': 'OTP مفقود',
'ER24': 'غير صالح OTP',
'ER25': 'لا توجد عملة',
'ER26': 'اسم العملة مفقود',
'ER27': 'رمز العملة مفقود',
'ER28': 'رقم تعريف صورة العملة مفقود',
'ER29': 'سعر العملة مفقود',
'ER30': 'معرف العملة مفقود',
'ER31': 'حقل المبلغ مفقود',
'ER32': 'مبلغ SAR مفقود',
'ER33': 'معلومات المستخدم مطلوبة',
'ER34': 'معرف المستخدم مفقود',
'ER35': 'مطلوب رمز الاستجابة السريعة',
'ER36': 'لم يتم العثور على أي معاملات',
'ER37': 'معرف المعاملة مفقود',
'ER38': 'معرف السائق مفقود',
'ER39': 'الحالة مطلوبة',
'ER40': 'علم العملة مفقود',
'ER41': 'الحد الأدنى للمبلغ مفقود',
'ER42': 'تم العثور على مستخدم غير معروف'
};
}
getErrorList() {
return this.errorList;
}
getError(error: any): string {
if (this.errorList.hasOwnProperty(error.code)) { // check whether the error code having our definition
return this.errorList[error.code]; // return our definition
} else {
return error.message;
}
}
}
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { map, catchError } from 'rxjs/operators';
import { apiConfig } from '../../environments/server.config';
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Auth': 'my_key'
})
};
const httplive = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
})
};
@Injectable({
providedIn: 'root'
})
export class WebService {
constructor(private http: HttpClient) {
}
post_data(url: string, data) {
return this.http.post(`${apiConfig + url}`, data).pipe(map((response: any) => response));
}
get_data(url) {
return this.http.get(`${apiConfig + url}`, httpOptions).pipe(map((response: any) => response));
}
setLocalStorageItem(id: string, data: string) {
localStorage.setItem(id, data);
}
getLocalStorageItem(data: string): string {
return localStorage.getItem(data);
}
removeLocalStorageItem(data) {
localStorage.removeItem(data);
localStorage.clear();
}
ObjArray(data: any) {
if (data instanceof Array !== true) {
if (data !== undefined) {
return new Array(data);
} else {
return undefined;
}
} else {
return data;
}
}
}
......@@ -6,27 +6,36 @@
<hr>
<div class="login_inner_content">
<div class="login_row">
<input class="" placeholder="Email Address">
<input type="email" class="" placeholder="Email Address" pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" required #email_id="ngModel" id="email_id" [(ngModel)]="model.email_id">
<div class="md-errors-spacer" [hidden]="email_id.valid || email_id.untouched">
<div class="s_error" *ngIf="email_id.errors && email_id.errors.required">
<div class="s_validation">{{error_msg.required}} </div>
</div>
<div class="s_error" *ngIf="email_id.errors && email_id.errors.pattern">
<div class="s_validation">{{error_msg.email}} </div>
</div>
</div>
<div class="s_error" *ngIf="model.email_id=='' && loginSubmit && email_id.untouched">
<div class="s_validation">{{error_msg.required}} </div>
</div>
</div>
<div class="login_row">
<p>Enter Your 6-Digit PIN</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"> -->
<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 class="s_error" *ngIf="passwordErr">
<div class="s_validation">{{error_msg.password}} </div>
</div>
</div>
<div *ngIf="loginError" class="s_validation">{{loginMsg}}</div>
<div class="login_row">
<button class="login_btn" (click)="goToPage('forex/addprovider')">Login</button>
<button class="login_btn" (click)="loginClick()">Login</button>
</div>
<div class="login_row">
<h6 (click)="goToPage('start/forgot')">Forgot Password</h6>
......
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-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
@ViewChild('focus1') focus1: ElementRef;
@ViewChild('focus2') focus2: ElementRef;
@ViewChild('focus3') focus3: ElementRef;
@ViewChild('focus4') focus4: ElementRef;
@ViewChild('focus5') focus5: ElementRef;
@ViewChild('focus6') focus6: ElementRef;
error_msg: any[];
lang = 'ar';
model: any;
passwordErr: boolean;
password: any;
fname: any;
loginSubmit: boolean;
loginError: boolean;
loginMsg: any;
loginDetails: any;
constructor(
private router: Router,
private route: ActivatedRoute,
public vs: ValidationService,
public service: WebService,
public subjectService: SubjectService
) {
this.error_msg = this.vs.errorList[this.lang];
this.passwordErr = false;
this.loginSubmit = false;
this.loginError = 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']);
} else if (this.loginDetails.user_type === 2) {
this.router.navigate(['forex']);
} else if (this.loginDetails.user_type === 3) {
this.router.navigate(['delivery']);
} else {
}
}
});
constructor(private router: Router,private route: ActivatedRoute) { }
/* 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': ''};
}
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) {
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 = '';
}
}
}
processBack (e: any, el: any) {
console.log(e);
if (e.keyCode === 8) {
e.target.value = '';
el.focus();
}
}
loginClick() {
this.loginSubmit = true;
this.passwordErr = false;
this.loginError = false;
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('');
if (this.model.email_id === '') {
if (pass === '') {
this.passwordErr = true;
}
return false;
}
for (const i in password) {
if (password[i] === '') {
this.passwordErr = true;
return false;
}
}
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 => {
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']);
} else if (responseData.user_type === 2) {
this.router.navigate(['forex']);
} else if (responseData.user_type === 3) {
this.router.navigate(['delivery']);
} else {
this.loginError = true;
this.loginMsg = this.vs.errorCode['ER42'];
}
} else {
this.loginError = true;
this.loginMsg = this.vs.errorCode[this.lang][response.errorCode];
console.log(this.loginMsg);
}
}, (error) => {
this.loginError = true;
this.loginMsg = this.vs.errorCode[this.lang]['ER08'];
console.log(this.loginMsg);
});
}
}
......@@ -5,12 +5,15 @@ import { LoginComponent } from './login/login.component';
import { ForgotComponent } from './forgot/forgot.component';
import { moduleRouting } from './start.routing';
import { NewpinComponent } from './newpin/newpin.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [IndexComponent, LoginComponent, ForgotComponent, NewpinComponent],
imports: [
CommonModule,
moduleRouting
moduleRouting,
ReactiveFormsModule,
FormsModule,
]
})
export class StartModule { }
......@@ -18,12 +18,10 @@ import { NewpinComponent } from './newpin/newpin.component';
const ModuleRoutes: Routes = [
{
path: 'start',
component:IndexComponent,
children:[
component: IndexComponent,
children: [
{
path: "login",
component: LoginComponent,
......@@ -37,7 +35,6 @@ const ModuleRoutes: Routes = [
component: NewpinComponent,
}
]
}
];
......
export const ImageStorage = 'http://forex.nuvento.com/';
export const apiConfig = 'http://localhost:3000/api/';
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