Skip to content

Commit

Permalink
Version 2
Browse files Browse the repository at this point in the history
Updates styles, created icons. Added new info (current rate, direct
conversion)
  • Loading branch information
kkhenriquez committed Apr 22, 2017
1 parent 27550c6 commit 9a92776
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 34 deletions.
14 changes: 12 additions & 2 deletions app/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ angular.module('paypalConverter.convert', [])
];
var rate = 0;
var paypal_comission = 0.9456;
var paypal_conv_comission = 0.9624;
var paypal_conv_comission = null;
var multicaja_comission = 10;
var multicaja_conv_comission = 0.9755;
convertService.getConversionRates().then(function(response) {
Expand All @@ -29,21 +29,31 @@ angular.module('paypalConverter.convert', [])
alert("Some error ocurred");
});

// $scope.showRates = function() {
// $scope.
// }

//$scope.cad_rate = 1 / ($scope.data.rates.CAD);

$scope.showConverted = function(value, currency) {
var usd_clp = $scope.data.rates.CLP;
switch (currency.name) {
case 'CAD':
rate = 1 / ($scope.data.rates.CAD);
paypal_conv_comission = 0.9617;
break;
case 'USD':
rate = 1;
paypal_conv_comission = 1;
break;
default:
rate = 1;
}
$scope.direct = value * rate * usd_clp;
$scope.total = ((value * paypal_comission * rate * paypal_conv_comission) - multicaja_comission) * usd_clp * multicaja_conv_comission;
$scope.message = "Your converted amount is ";
$scop
$scope.direct_message = "* Direct conversion is ";

}

}]);
Binary file added app/converter_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/css/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 28 additions & 13 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Paypal Converter</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="converter_icon.png" type="image/x-icon" />
<link rel="apple-touch-icon" href="converter_icon.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="[email protected]"/>
<link href="https://fonts.googleapis.com/css?family=Mukta+Vaani:300,400" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Muli:300,400" rel="stylesheet">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css css/styles.min.css -->
<link rel="stylesheet" href="css/normalize.css">
Expand All @@ -32,29 +36,40 @@
<h1 class="lead">Welcome to the paypal converter</h1>

<form class="form-inline converter-form" name="myForm">
<div class="row">
<div class="col-xs-12">
<div class="form-group converter-form__input">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<div class="converter-form__input">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<div class="input-group converter-form__input--amount">
<div class="input-group-addon">$</div>
<input type="text" class="form-control" id="exampleInputAmount" placeholder="Amount" ng-model="input.amount" ng-required=true ng-pattern="/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/">
</div>
<div class="input-group">
<select class="form-control" name="input.currency" ng-model="input.currency" id="input.currency" ng-init="input.currency = options[0]" ng-options="option.name for option in options track by option.id">
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<select class="form-control" name="input.currency" ng-model="input.currency" id="input.currency" ng-init="input.currency = options[0]" ng-options="option.name for option in options track by option.id">
</select>
</div>
</div>
<button type="submit" class="btn btn-primary converter-form__submit" ng-click="showConverted(input.amount,input.currency)" ng-disabled="myForm.$invalid">Convert</button>
</form>

<div class="result">{{message}}{{total | currency}}</div>
<div class="info">
<div class="info__result">{{message}}{{total | currency}}</div>
<div class="info__rates">
<p>Today's Rates:</p>
<ul class="info__rates-list">
<li>1 CAD -> {{ 1 / data.rates.CAD | number: 2}} USD</li>
<li>1 USD -> {{ data.rates.CLP | number: 2}} CLP</li>
</ul>
</div>
<div class="info__direct-rate">
<p>{{direct_message}} {{direct | currency}}</p>
</div>
</div>

</main>


<footer>Crafted by Kevin.</footer>
<footer>Crafted by <a href="http://kkhenriquez.github.io/home" target="_blank">Kevin.</a></footer>

<!-- build:js js/main.min.js -->
<script src="components/angular/angular.min.js"></script>
Expand Down
Loading

0 comments on commit 9a92776

Please sign in to comment.