Gift interface added

This commit is contained in:
adam.harbas@a-net.ba
2016-01-11 16:03:53 +01:00
parent 391b912eb2
commit 794cc2ec69
9 changed files with 103 additions and 27 deletions

View File

@@ -24,6 +24,7 @@ var CheckoutPage = React.createClass({
amount={CartStore.getAmount()}
deliveryCost={CartStore.getDeliveryCost(false)}
disabled={!this.state.isDeliveryDestinationValid}
cashOnDeliveryDisabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')}
onCashClick={this._onOrderClick}
/>
</div>
@@ -35,10 +36,10 @@ var CheckoutPage = React.createClass({
<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') {
<PikpaylButton amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} disabled={!this.state.isDeliveryDestinationValid} deliveryDestination={this.state.deliveryDestination}/>
<PikpayButton amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} disabled={!this.state.isDeliveryDestinationValid} deliveryDestination={this.state.deliveryDestination}/>
} else {
last_used_payment = (
<CashOnDeliveryButton onCashClick={this._onOrderClick} disabled={!this.state.isDeliveryDestinationValid}/>
<CashOnDeliveryButton onCashClick={this._onOrderClick} disabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')}/>
);
}
@@ -48,7 +49,7 @@ var CheckoutPage = React.createClass({
<div className="checkout-page center">
<div className="form-horizontal checkout_form_margin">
<fieldset>
<legend>Dostava</legend>
<legend>Podaci o naručiocu</legend>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="name">Prezime i Ime</label>
@@ -112,17 +113,73 @@ var CheckoutPage = React.createClass({
Ukupno: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} />
</span>
</div>
<br />
<div className="checkbox">
<label><input type="checkbox" name="gift" value={this.state.deliveryDestination.get('gift')} onChange={this._onFieldChange} />Poklon</label>
</div>
</div>
</div>
<div className="payment-select-container">
{choosePayment}
</div>
</fieldset>
</div>
<fieldset className={this.state.deliveryDestination.get('gift') ? 'shown' : 'hidden'}>
<legend>Podaci o dostavi</legend>
<div className="form-group ">
</div>
<label className="col-md-4 control-label" htmlFor="name">Prezime i Ime</label>
<div className="col-md-4">
<RibicaFormError componentName="name" errorMessagesObject={this.state.deliveryDestinationErrors} />
<input id="name" name="name" type="text" placeholder="Prezime Ime" className="form-control input-md" required="" value="" onChange={this._onFieldChange} />
<span className="help-block">ime osobe koja prima pošiljku</span>
</div>
</div>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="name">Adresa</label>
<div className="col-md-4">
<RibicaFormError componentName="address" errorMessagesObject={this.state.deliveryDestinationErrors} />
<input id="address" name="address" type="text" placeholder="Ulica i broj" className="form-control input-md" required="" value="" onChange={this._onFieldChange} />
<span className="help-block">adresa na koju će roba biti isporučena</span>
</div>
</div>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="place">Mjesto</label>
<div className="col-md-4">
<RibicaFormError componentName="place" errorMessagesObject={this.state.deliveryDestinationErrors} />
<select id="place" name="place" className="form-control" value={this.state.deliveryDestination.get('place')} onChange={this._onFieldChange} >
{supportedPlaceOptions}
</select>
</div>
</div>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="phone">Telefon</label>
<div className="col-md-4">
<RibicaFormError componentName="phone" errorMessagesObject={this.state.deliveryDestinationErrors} />
<div className="input-group">
<span className="input-group-addon">+387 </span>
<input id="phone" name="phone" className="form-control" placeholder="061 222 333" type="text" required="" value="" onChange={this._onFieldChange} />
</div>
<p className="help-block">broj mobitela - mora biti sa jedne od mreža u BiH</p>
</div>
</div>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="email">E - mail</label>
<div className="col-md-4">
<RibicaFormError componentName="email" errorMessagesObject={this.state.deliveryDestinationErrors} />
<input id="email" name="email" type="text" placeholder="ime@nekimail.com" className="form-control input-md" required="" value="" onChange={this._onFieldChange} />
<span className="help-block">E - mail adresa na koju će vam biti poslano obavještenje o narudžbi</span>
</div>
</div>
</fieldset>
<div className="payment-select-container">
{choosePayment}
</div>
</div>
</div>
);
if(CartStore.isAddressColapsed()) {
@@ -173,7 +230,15 @@ var CheckoutPage = React.createClass({
},
_onFieldChange: function (event) {
CartActions.changeDeliveryDestinationProperty(event.target.name, event.target.value);
if(event.target.name === "gift") {
CartActions.changeDeliveryDestinationProperty(event.target.name, $(event.target).is(':checked'));
} else {
CartActions.changeDeliveryDestinationProperty(event.target.name, event.target.value);
}
},
_onFieldRecipientChange: function(event) {
CartActions.changeRecipientDestinationProperty(event.target.name, event.target.value);
},
_onOrderClick: function (event) {

View File

@@ -11,7 +11,7 @@ var CashOnDeliveryButton = require('./cashOnDeliveryButton');
var PaymentSelect = React.createClass({
render: function() {
var cashOnDeliveryBtn = ( <CashOnDeliveryButton onCashClick={this.props.onCashClick} disabled={this.props.disabled}/> );
var cashOnDeliveryBtn = ( <CashOnDeliveryButton onCashClick={this.props.onCashClick} disabled={this.props.cashOnDeliveryDisabled}/> );
var pikpayBtn = ( <PikpaylButton amount={this.props.amount} deliveryCost={this.props.deliveryCost} disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination}/> );
var paypalBtn = ( <PaypalButton disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination} amount={this.props.amount} deliveryCost={this.props.deliveryCost} /> );

View File

@@ -2694,14 +2694,11 @@ var addNItems = function(item, count) {
var changeDeliveryDestinationProperty = function(property, value) {
_deliveryDestination.set(property, value);
console.log(_deliveryDestination);
if (property === 'place') {
fetchPlace();
}
validateDeliveryDestinationForm();
console.log(_deliveryDestination);
validateDeliveryDestinationForm();
};