Skip to content

Commit

Permalink
arrumei o form no safari
Browse files Browse the repository at this point in the history
  • Loading branch information
jrogatis committed Apr 26, 2017
1 parent 70ce39e commit 553fd58
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"no-octal-escape": 0, //disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
"no-octal": 0, //disallow use of octal literals
"no-param-reassign": 0, //disallow reassignment of function parameters
"no-process-env": 1, //disallow use of process.env
"no-process-env": 0, //disallow use of process.env
"no-proto": 2, //disallow usage of __proto__ property
"no-redeclare": 2, //disallow declaring the same variable more than once
"no-return-assign": 2, //disallow use of assignment in return statement
Expand Down
27 changes: 16 additions & 11 deletions client/components/checkout/checkout-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const angular = require('angular');
const angularPayments = require('angular-payments');
const ngMessages = require('angular-messages');
const ngAnimate = require('angular-animate');
const ngMaterial = require('angular-material');

export class CheckoutComponent {
$mdDialog;
Expand Down Expand Up @@ -82,6 +83,7 @@ export class CheckoutComponent {
}
}
};

this.$http = $http;
this.$scope = $scope;
this.$mdDialog = $mdDialog;
Expand All @@ -90,12 +92,11 @@ export class CheckoutComponent {
this.showSend = false;
this.showNext = true;
this.showPrevious = false;

}

nextStep() {
console.log(this.donationForm.donor);
if(this.$scope.step === 1 && this.donationForm.paymentInfo.amount > 0) {
if (this.$scope.step === 1 && this.donationForm.paymentInfo.amount > 0) {
this.$scope.step++;
} else if (
this.$scope.step === 2
Expand All @@ -115,7 +116,7 @@ export class CheckoutComponent {
this.showNext = false;
}
if (this.$scope.step === 4) {
this.$scope.step--;;
this.$scope.step--;
};
};

Expand All @@ -125,23 +126,26 @@ export class CheckoutComponent {
if (this.$scope.step === 0) {
this.$scope.step = 1;
};
if (this.$scope.step > 0 &&this.$scope.step < 3) {
if (this.$scope.step > 0 && this.$scope.step < 3) {
this.showNext = true;
}
if (this.$scope.step === 1) {
this.showPrevious = false;
}
};

changeInitialValue() {
if(this.donationForm.checked) {
if (this.donationForm.initialValue > 0) {
this.donationForm.paymentInfo.amount = Math.trunc(this.donationForm.initialValue * 110) / 100;
changeInitialValue(initialValue) {
const donationForm = this.donationForm;
this.donationForm.initialValue = initialValue;
if (donationForm.checked) {
if (donationForm.initialValue > 0) {
donationForm.paymentInfo.amount = Math.trunc(donationForm.initialValue * 110) / 100;
} else {
this.donationForm.paymentInfo.amount = 0;
donationForm.paymentInfo.amount = 0;
}
} else {
this.donationForm.paymentInfo.amount = this.donationForm.initialValue;
console.log( this.donationForm);
this.donationForm.paymentInfo.amount = initialValue;
}
}

Expand Down Expand Up @@ -184,7 +188,7 @@ const DialogController = ($scope, $mdDialog, $inject) => {
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
};

DialogController.$inject = ['$scope', '$mdDialog'];

Expand All @@ -194,6 +198,7 @@ export default angular.module('directives.checkoutForm', [
'ui.bootstrap',
ngMessages,
ngAnimate,
ngMaterial
])
.component('checkoutForm', {
template: require('./checkout-form.pug'),
Expand Down
35 changes: 18 additions & 17 deletions client/components/checkout/checkout-form.pug
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
div#form(layout="column")
div#checkoutComponent(layout="column")
h2#doe(layout-align="center") Ajude aqui!
br
div(layout="column" flex="100")
//- criar a funcao que vai pegar o form e jogar no server
form#checkoutForm(
name="checkoutForm"
layout="column" ng-submit="$ctrl.addTransaction($event)"
name="$ctrl.donationForm"
layout="column"
ng-submit="$ctrl.addTransaction($event)"
ng-switch="step"
)
div#values.formStep.active.formStep.limitStep(layout="column" flex="100" display="block" ng-switch-when="1")
div#values.formStep.active.formStep.limitStep(layout="column" flex="100" ng-switch-when="1")
div#initial
md-input-container.md-block(
ng-class="{ 'md-input-invalid': $ctrl.donationForm.initialValue.$error }"
)
p Error: {{ $ctrl.donationForm.initialValue.$error }}
md-input-container
label Valor
input#valor(
type="text" ng-model="$ctrl.donationForm.initialValue"
placeholder="Valor" ui-money-mask=2
ng-change="$ctrl.changeInitialValue()"
name="initialValue"
ng-model="initialValue"
type="text"
ui-money-mask=2
ng-change="$ctrl.changeInitialValue(initialValue)"
ng-focus="$event.target.select()"
min="0.01" required
)
div(
ng-messages="$ctrl.donationForm.initialValue.$error"
)
div(ng-message="min")
p Por favor insira um valor.
div(ng-messages="$ctrl.donationForm.initialValue.$error")
div(ng-message="min") Por favor insira um valor.
div(ng-message="required") Por favor insira um valor.
div#chkBox(layout="row" layout-align="start stretch")
input(
name="doacao_doebem"
id="doacao_doebem"
type="checkbox" value="" ng-model="$ctrl.donationForm.checked"
type="checkbox" value="" ng-model="donationForm.checked"
ng-change="$ctrl.changeInitialValue()"
)
label#labelChkbox(for="doacao_doebem") Adicione 10% para a doebem?
h2 Total: R$ {{$ctrl.donationForm.paymentInfo.amount}}
h2 Total: R$ {{ $ctrl.donationForm.amount}}
div#info.formStep(layout="column" flex="30" display="none" ng-switch-when="2")
md-input-container.md-block.containerForm(flex-gt-sm)
input(placeholder = "Nome" ng-model="$ctrl.donationForm.donor.name" required)
Expand Down
96 changes: 50 additions & 46 deletions client/components/checkout/checkout-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,65 @@
background-position: 98% 50%;
}

#form {
div#checkoutComponent {
position: fixed;
top: 30%;
right: 5%;
padding: 10px 10px 10px 10px;
border-width: 4px;
border-style: double;
border-color: #234282;
border: 3px double black;
background-color: white;
min-width: 250px;
max-width: 250px;
display: block;
h2#doe {
text-align: center;
}
div#initial {
input#valor {
font-size: 2em;
}
}
md-input-container.containerForm {
margin-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
height: 52px;
}
md-icon {
width: 49px;
}
.ng-invalid {
border-color: #f00;
}
#chkBox {
#labelChkbox {
padding: 0 0 0 5px;
font-weight: bold;
form#checkoutForm {
display: block;
div#values {
div#initial {
input#valor {
font-size: 2em;
}
}
md-input-container.containerForm {
margin-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
height: 52px;
}
md-icon {
width: 49px;
}
#chkBox {
#labelChkbox {
padding: 0 0 0 5px;
font-weight: bold;
}
}
}
}

#controls{
.checkoutFormStepChange {
background-color:#234282;
border-color: #234282;
color: white;
border-style: solid;
margin-bottom: 3px;
vertical-align: center;
&:hover {
border-color: black;
color: black;
#controls {
.checkoutFormStepChange {
background-color: #234282;
border-color: #234282;
color: white;
border-style: solid;
margin-bottom: 3px;
vertical-align: center;
&:hover {
border-color: black;
color: black;
}
}
}
}
#formSubmit {
vertical-align: center;
#checkoutFormSubmit {
background-color: #234282 !important;
&:hover {
color: #234282 !important;
background-color: white !important;
#formSubmit {
vertical-align: center;
#checkoutFormSubmit {
background-color: #234282 !important;
&:hover {
color: #234282 !important;
background-color: white !important;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"angular-cookies": "~1.6.4",
"angular-i18n": "^1.6.4",
"angular-input-masks": "^2.5.0",
"angular-jk-carousel": "^0.5.0",
"angular-jk-carousel": "^0.1.9",
"angular-material": "^1.1.4",
"angular-messages": "^1.6.4",
"angular-payments": "^1.0.7",
Expand Down
10 changes: 0 additions & 10 deletions server/api/busca-cep/busca-cep.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* GET /api/busca-cep/:id -> index
*/
'use strict';
import jsonpatch from 'fast-json-patch';
import requestify from 'requestify';

function respondWithResult(res, statusCode) {
Expand All @@ -16,17 +15,8 @@ function respondWithResult(res, statusCode) {
};
}


// Gets a cep
export function show(req, res) {
var options = {
host: 'apps.widenet.com.br',
port: 80,
path: `/busca-cep/api/cep/${req.params.id}.json`
};
console.log(req.params.id);

requestify.get(`http://apps.widenet.com.br/busca-cep/api/cep/${req.params.id}.json`)
//.then(res => response.getBody)
.then(respondWithResult(res, res.code));
}
4 changes: 2 additions & 2 deletions server/api/imageGallery/imageGallery.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.signing = function(req, res) {
.toDate(); //15 minutes

var s3Policy = {
expiration: expiration,
expiration,
conditions: [{
bucket: 'doebem'
},
Expand Down Expand Up @@ -64,7 +64,7 @@ exports.signing = function(req, res) {
AWSAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
acl: readType,
policy: base64Policy,
signature: signature,
signature,
'Content-Type': request.type,
success_action_status: 201
}
Expand Down
11 changes: 1 addition & 10 deletions server/api/ong/ong.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,7 @@ export function show(req, res) {
.then(respondWithResult(res))
.catch(err => {
handleError(err);
});
// return Ong.findById(req.params.id).exec()
// .then(handleEntityNotFound(res))
// .then(respondWithResult(res))
// .catch(err => {
// Ong.findOne({slug: req.params.id}).exec()
// .then(handleEntityNotFound(res))
// .then(respondWithResult(res))
// .catch(handleError(err));
// });
});
}

// Creates a new Ong in the DB
Expand Down
2 changes: 1 addition & 1 deletion server/api/ong/ong.socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function register(socket) {
var event = events[i];
var listener = createListener(`ong:${event}`, socket);

ThingEvents.on(event, listener);
OngEvents.on(event, listener);
socket.on('disconnect', removeListener(event, listener));
}
}
Expand Down
40 changes: 0 additions & 40 deletions server/api/paymentTransaction/paymentTransaction.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,46 +151,6 @@ const authRequestCielo = (res, body) => entity => {
}
};


const teste2 = {
MerchantOrderId: '58f985c628c61683ff675ab2',
Customer: {
Name: 'MARLI R GOLDENBERG'
},
Payment: {
Type: 'Credicard',
Amount: 10000000,
Installments: 1,
Credicard:
{
CardNumber: '5545630022015791',
ExpirationDate: '12/2020',
Brand: 'Master'
}
}
};

const teste = {
MerchantOrderId: '2014111703',
Customer: {
Name: 'Comprador crédito simples'
},
Payment: {
Type: 'CreditCard',
Amount: 15700,
Installments: 1,
SoftDescriptor: '123456789ABCD',
CreditCard: {
CardNumber: '1234123412341231',
Holder: 'Teste Holder',
ExpirationDate: '12/2030',
SecurityCode: '123',
Brand: 'Visa'
}
}
};

console.log('order: ', order, 'teste: ', teste);
return requestify.request('https://apisandbox.cieloecommerce.cielo.com.br/1/sales/', {
method: 'POST',
body: order,
Expand Down
Loading

0 comments on commit 553fd58

Please sign in to comment.