Commit 16bebfd3 by Adarsh K

forex

parent eb7cd9e8
...@@ -6,7 +6,8 @@ const routes: Routes = [ ...@@ -6,7 +6,8 @@ const routes: Routes = [
path: '', path: '',
redirectTo: 'start/login', redirectTo: 'start/login',
pathMatch: 'full' pathMatch: 'full'
} },
// {path: '**', redirectTo: '/start/login'}
]; ];
@NgModule({ @NgModule({
......
...@@ -94,4 +94,8 @@ currencyProcess() { ...@@ -94,4 +94,8 @@ currencyProcess() {
console.log(input); console.log(input);
return input; return input;
} }
cancelClick() {
this.router.navigate(['/checker/currency_list']);
}
} }
...@@ -140,4 +140,8 @@ export class CurrencyEditComponent implements OnInit { ...@@ -140,4 +140,8 @@ export class CurrencyEditComponent implements OnInit {
return ImageStorage + this.image_url; return ImageStorage + this.image_url;
} }
cancelClick() {
this.router.navigate(['/checker/currency_list']);
}
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<header class="provider_header"> <header class="provider_header">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h4>Forex Provider</h4> <h4>Manage Currency</h4>
</div> </div>
<div class="col-md-6 textRight relative"> <div class="col-md-6 textRight relative">
<img src="assets/images/asset_logo1.png"> <img src="assets/images/asset_logo1.png">
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</header> </header>
<section> <section>
<div class="provider_content"> <div class="provider_content">
<h3>Manage Forex Service Provider</h3> <h3>Currency List</h3>
<div class="provider_inner_content"> <div class="provider_inner_content">
<div class="table-responsive"> <div class="table-responsive">
<div class="alert alert-danger alert-dismissible" *ngIf="error"> <div class="alert alert-danger alert-dismissible" *ngIf="error">
...@@ -23,40 +23,34 @@ ...@@ -23,40 +23,34 @@
</div> </div>
<div class="alert alert-success alert-dismissible" *ngIf="success"> <div class="alert alert-success alert-dismissible" *ngIf="success">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Success!</strong> Forex provider removed successfully <strong>Success!</strong> Currency removed successfully
</div> </div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Provider Name</th> <th>Name</th>
<th>Location</th> <th>symbol</th>
<th>CR Manager</th> <th>Rate</th>
<th>CR ID</th> <th>Start from</th>
<th>Contact</th>
<th>Phone</th>
<th>Email ID</th>
<th class="textRight"> <th class="textRight">
<button class="add" (click)="goToPage('checker/provider_forex')">+</button> <button class="add" (click)="goToPage('checker/currency_add')">+</button>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody *ngIf="providerList; else noProvider"> <tbody *ngIf="currencyList; else noCurrency">
<tr *ngFor="let provider of providerList;"> <tr *ngFor="let currency of currencyList;">
<td>{{provider.name | titlecase}}</td> <td>{{currency.name}}</td>
<td>{{provider.location | titlecase}}</td> <td>{{currency.symbol}}</td>
<td>{{provider.cr_manager | titlecase}}</td> <td>{{currency.rate}}</td>
<td>{{provider.cr_id}}</td> <td>{{currency.start_from}}</td>
<td>{{provider.contact | titlecase}}</td>
<td>{{provider.phone}}</td>
<td>{{provider.email_id}}</td>
<td class="textRight"> <td class="textRight">
<button class="edit_btn"(click)="editClick(provider.id)"></button> <button class="edit_btn"(click)="editClick(currency.id)"></button>
<button class="delete_btn" (click)="deleteClick(provider.id)"></button> <button class="delete_btn" (click)="deleteClick(currency.id)"></button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ng-template #noProvider></ng-template> <ng-template #noCurrency></ng-template>
</div> </div>
</div> </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: 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 { Component, OnInit } from '@angular/core'; 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({ @Component({
selector: 'app-currency-list', selector: 'app-currency-list',
...@@ -6,10 +10,92 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +10,92 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./currency-list.component.scss'] styleUrls: ['./currency-list.component.scss']
}) })
export class CurrencyListComponent implements OnInit { export class CurrencyListComponent implements OnInit {
currencyList: any[];
fname: any;
lang = 'ar';
responseMsg: any;
error: boolean;
success: boolean;
loader: boolean;
constructor() { } constructor(private router: Router, private route: ActivatedRoute, public vs: ValidationService, public service: WebService) {
this.responseMsg = '';
this.error = false;
this.success = false;
this.loader = false;
}
ngOnInit() { ngOnInit() {
this.getCurrency();
}
getCurrency() {
this.loader = true;
this.fname = 'currency';
this.service.get_data(this.fname).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.currencyList = 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);
}
reset() {
this.error = false;
this.success = false;
} }
deleteClick(currency_id: any) {
this.reset();
const res = confirm('Do you want to remove this currency ?');
if (res === true) {
this.loader = true;
this.fname = 'currency_delete';
const post_data = {'currency_id': currency_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.getCurrency();
} 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(['checker/currency_edit/' + id]);
}
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
} }
...@@ -17,110 +17,27 @@ ...@@ -17,110 +17,27 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Provider Name</th> <th>User Info</th>
<th>Location</th>
<th>CR Manager</th>
<th>CR ID</th>
<th>Contact</th>
<th>Phone</th> <th>Phone</th>
<th>Email ID</th> <th>Location</th>
<th class="textRight"> <th>Currency</th>
<button class="add" (click)="goToPage('forex/addprovider')">+</button> <th>Amount</th>
</th> <th>Forex Amount</th>
<th>Driver</th>
<th>Status</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody *ngIf="transactionList">
<tr> <tr *ngFor="let tansaction of transactionList">
<td></td> <td>{{getCustomer(tansaction.user_info,'name') | titlecase}}</td>
<td></td> <td>{{getCustomer(tansaction.user_info,'phone') | titlecase}}</td>
<td></td> <td>{{getCustomer(tansaction.user_info,'location') | titlecase}}</td>
<td></td> <td>{{tansaction.currency}}</td>
<td></td> <td>SAR {{tansaction.amount}}</td>
<td></td> <td>{{tansaction.symbol}} {{tansaction.convert_price}}</td>
<td></td> <td>{{getCustomer(tansaction.driver_info,'name') | titlecase}}</td>
<td class="textRight"> <td>{{get_status(tansaction.status)}}</td>
<button class="edit_btn"(click)="goToPage('forex/editprovider')"></button>
<button class="delete_btn"></button>
</td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
......
import { Component, OnInit } from '@angular/core'; 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({ @Component({
selector: 'app-transaction', selector: 'app-transaction',
...@@ -6,10 +9,102 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +9,102 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./transaction.component.scss'] styleUrls: ['./transaction.component.scss']
}) })
export class TransactionComponent implements OnInit { export class TransactionComponent implements OnInit {
transactionList: any[];
fname: any;
lang = 'ar';
responseMsg: any;
error: boolean;
success: boolean;
loader: boolean;
loginDetails: any;
constructor() { } 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.loginDetails = JSON.parse(this.service.getLocalStorageItem('userData'));
console.log(this.loginDetails);
}
ngOnInit() { ngOnInit() {
this.getProvider();
}
getTransaction(id : any) {
this.loader = true;
this.fname = 'transaction_list';
const post_data = {'type': 2, 'user_id': id};
this.service.post_data(this.fname, post_data).subscribe(response => {
this.loader = false;
console.log(response);
if (response.code === 1) {
this.transactionList = response.responseResult.data;
console.log(this.transactionList);
} 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);
}
goToPage(path, data = null) {
console.log(data);
this.router.navigateByUrl(path, {queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
getProvider() {
this.fname = 'get_user_details';
const post_data = {'user_id': this.loginDetails.user_id};
this.service.post_data(this.fname, post_data).subscribe(response => {
if (response.code === 1) {
const data = response.responseResult;
this.getTransaction(data.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'];
});
}
get_status(status: any) {
switch (status) {
case 0:
return 'Cancelled';
break;
case 1:
return 'Requested';
break;
case 2:
return 'Processing';
break;
case 3:
return 'Completed';
break;
default:
break;
}
}
getCustomer(data: any, type: any) {
if (data !== null){
const userData = JSON.parse(data);
return userData[type];
} else {
return '';
}
} }
} }
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