Last used button added
This commit is contained in:
@@ -8,25 +8,33 @@ var React = require('react'),
|
||||
CartTotal = require('./cartTotal'),
|
||||
LinkBanner = require('../linkBanner/linkBanner'),
|
||||
PaymentSelect = require('../payment/paymentSelect'),
|
||||
RibicaFormError = require('../shared/ribicaFormError');
|
||||
RibicaFormError = require('../shared/ribicaFormError'),
|
||||
PaypalButton = require('../payment/paypalButton');
|
||||
|
||||
|
||||
var Router = require('react-router');
|
||||
|
||||
|
||||
var CheckoutPage = React.createClass({
|
||||
|
||||
render: function() {
|
||||
|
||||
var choosePayment = (
|
||||
<div className="payment-btn">
|
||||
<PaymentSelect deliveryDestination={this.state.deliveryDestination} amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} />
|
||||
<PaymentSelect onSubmitPaypal={this._handleOnSubmitPaypal} deliveryDestination={this.state.deliveryDestination} amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} />
|
||||
</div>
|
||||
);
|
||||
|
||||
var last_used_payment = (
|
||||
<button id="order" name="order" className="mybutton" disabled={!this.state.isDeliveryDestinationValid} onClick={this._onOrderClick}>Završi narudžbu</button>
|
||||
);
|
||||
var last_used_payment;
|
||||
if(this.state.deliveryDestination.get('payment_method') == 'paypal' || true) {
|
||||
last_used_payment = (
|
||||
<PaypalButton disabled={!this.state.isDeliveryDestinationValid} onSubmitPaypal={this._handleOnSubmitPaypal} deliveryDestination={this.state.deliveryDestination} amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} />
|
||||
);
|
||||
} else if(this.state.deliveryDestination.get('payment_method') == 'pikpay') {
|
||||
|
||||
} else {
|
||||
last_used_payment = (
|
||||
<button id="order" name="order" className="mybutton" disabled={!this.state.isDeliveryDestinationValid} onClick={this._onOrderClick}>Završi narudžbu</button>
|
||||
);
|
||||
}
|
||||
|
||||
var supportedPlaceOptions = CartStore.getSupportedPlaces().map ( function (p) { return (<option value={p.code}>{p.placeLabel}</option>)});
|
||||
|
||||
@@ -129,9 +137,7 @@ var CheckoutPage = React.createClass({
|
||||
Ukupno: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} />
|
||||
|
||||
</p>
|
||||
<p>
|
||||
{last_used_payment} ili <button className="btn btn-default" onClick={this._onUncolapseClick}>Promijeni adresu</button>
|
||||
</p>
|
||||
<div className="center">{last_used_payment}</div> ili <button className="btn btn-default" onClick={this._onUncolapseClick}>Promijeni adresu</button>
|
||||
<div className="form-group">
|
||||
<label className="col-md-4 control-label" htmlFor="order"></label>
|
||||
<div className="col-md-8">
|
||||
@@ -175,6 +181,11 @@ var CheckoutPage = React.createClass({
|
||||
CartActions.setAddressColapsed(false);
|
||||
},
|
||||
|
||||
_handleOnSubmitPaypal: function(event) {
|
||||
CartActions.changeDeliveryDestinationProperty('payment_method', 'paypal');
|
||||
return false;
|
||||
},
|
||||
|
||||
getInitialState: function () {
|
||||
return CartStore.getWholeCartState();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ var PaypalButton = React.createClass({
|
||||
var cancel_return_url = root + "/odgodjeno";
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<div>
|
||||
<form onSubmit={this.props.onSubmitPaypal} action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_xclick" />
|
||||
<input type="hidden" name="business" value={Globals.PaypalId} />
|
||||
<input type="hidden" name="lc" value="BA" />
|
||||
|
||||
@@ -14,9 +14,9 @@ var DeliveryDestination = Backbone.Model.extend({
|
||||
},
|
||||
|
||||
url: Globals.ApiUrl + '/cart/delivery_destination',
|
||||
defaults: {
|
||||
defaults: {
|
||||
count: 0
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = DeliveryDestination;
|
||||
module.exports = DeliveryDestination;
|
||||
|
||||
Reference in New Issue
Block a user