1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/resources/views/payments/payment.blade.php

327 lines
12 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
@extends('public.header')
2015-11-09 20:24:22 +01:00
@section('head')
@parent
2015-11-29 21:13:50 +01:00
@if ($accountGateway->getPublishableStripeKey())
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script type="text/javascript">
Stripe.setPublishableKey('{{ $accountGateway->getPublishableStripeKey() }}');
$(function() {
$('.payment-form').submit(function(event) {
var $form = $(this);
// Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true);
2016-03-03 20:39:15 +01:00
var data = {
name: $('#first_name').val() + ' ' + $('#last_name').val(),
address_line1: $('#address1').val(),
address_line2: $('#address2').val(),
address_city: $('#city').val(),
address_state: $('#state').val(),
address_zip: $('#postal_code').val(),
address_country: $("#country_id option:selected").text(),
number: $('#card_number').val(),
cvc: $('#cvv').val(),
exp_month: $('#expiration_month').val(),
exp_year: $('#expiration_year').val()
};
Stripe.card.createToken(data, stripeResponseHandler);
2015-11-29 21:13:50 +01:00
// Prevent the form from submitting with the default action
return false;
});
});
function stripeResponseHandler(status, response) {
var $form = $('.payment-form');
if (response.error) {
// Show the errors on the form
var error = response.error.message;
$form.find('button').prop('disabled', false);
$('#js-error-message').html(error).fadeIn();
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken"/>').val(token));
// and submit
$form.get(0).submit();
}
};
</script>
@else
<script type="text/javascript">
$(function() {
$('.payment-form').submit(function(event) {
var $form = $(this);
// Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true);
return true;
});
});
</script>
@endif
2016-03-03 20:39:15 +01:00
2015-11-09 20:24:22 +01:00
@stop
2015-03-16 22:45:25 +01:00
@section('content')
2015-11-29 21:13:50 +01:00
@include('payments.payment_css')
2015-03-16 22:45:25 +01:00
2015-11-09 15:53:18 +01:00
{!! Former::vertical_open($url)
->autocomplete('on')
2015-11-29 21:13:50 +01:00
->addClass('payment-form')
2015-11-09 15:53:18 +01:00
->rules(array(
'first_name' => 'required',
2016-03-03 20:39:15 +01:00
'last_name' => 'required',
2015-11-09 15:53:18 +01:00
'card_number' => 'required',
'expiration_month' => 'required',
'expiration_year' => 'required',
'cvv' => 'required',
'address1' => 'required',
'city' => 'required',
'state' => 'required',
'postal_code' => 'required',
'country_id' => 'required',
'phone' => 'required',
'email' => 'required|email'
)) !!}
2015-03-16 22:45:25 +01:00
@if ($client)
{{ Former::populate($client) }}
{{ Former::populateField('first_name', $contact->first_name) }}
{{ Former::populateField('last_name', $contact->last_name) }}
2015-04-28 22:13:52 +02:00
@if (!$client->country_id && $client->account->country_id)
2016-03-03 20:39:15 +01:00
{{ Former::populateField('country_id', $client->account->country_id) }}
2015-04-28 22:13:52 +02:00
@endif
2015-03-16 22:45:25 +01:00
@endif
<div class="container">
<p>&nbsp;</p>
2015-11-29 21:13:50 +01:00
<div id="js-error-message" style="display:none" class="alert alert-danger"></div>
2015-03-16 22:45:25 +01:00
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-7">
<header>
@if ($client)
2015-04-02 15:06:16 +02:00
<h2>{{ $client->getDisplayName() }}</h2>
2016-01-21 23:29:10 +01:00
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, true) }}</em></span></h3>
2015-03-16 22:45:25 +01:00
@elseif ($paymentTitle)
2016-03-03 20:39:15 +01:00
<h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2>
2015-03-16 22:45:25 +01:00
@endif
2016-03-03 20:39:15 +01:00
</header>
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-5">
@if (Request::secure() || Utils::isNinjaDev())
<div class="secure">
<h3>{{ trans('texts.secure_payment') }}</h3>
2016-03-03 20:39:15 +01:00
<div>{{ trans('texts.256_encryption') }}</div>
2015-03-16 22:45:25 +01:00
</div>
@endif
</div>
</div>
<p>&nbsp;<br/>&nbsp;</p>
<div>
<h3>{{ trans('texts.contact_information') }}</h3>
<div class="row">
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('first_name')
->placeholder(trans('texts.first_name'))
->autocomplete('given-name')
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('last_name')
->placeholder(trans('texts.last_name'))
->autocomplete('family-name')
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
</div>
@if (isset($paymentTitle))
<div class="row">
<div class="col-md-12">
2015-11-09 15:53:18 +01:00
{!! Former::text('email')
->placeholder(trans('texts.email'))
->autocomplete('email')
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
</div>
@endif
<p>&nbsp;<br/>&nbsp;</p>
2015-07-12 21:43:45 +02:00
@if ($showAddress)
2015-03-16 22:45:25 +01:00
<h3>{{ trans('texts.billing_address') }} &nbsp;<span class="help">{{ trans('texts.payment_footer1') }}</span></h3>
<div class="row">
2015-04-28 22:13:52 +02:00
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('address1')
->autocomplete('address-line1')
->placeholder(trans('texts.address1'))
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('address2')
->autocomplete('address-line2')
->placeholder(trans('texts.address2'))
->label('') !!}
</div>
2015-04-28 22:13:52 +02:00
</div>
<div class="row">
2015-03-16 22:45:25 +01:00
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('city')
->autocomplete('address-level2')
->placeholder(trans('texts.city'))
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('state')
->autocomplete('address-level1')
->placeholder(trans('texts.state'))
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
2015-04-28 22:13:52 +02:00
</div>
<div class="row">
2015-03-16 22:45:25 +01:00
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::text('postal_code')
->autocomplete('postal-code')
->placeholder(trans('texts.postal_code'))
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
2015-04-28 22:13:52 +02:00
<div class="col-md-6">
2015-11-09 15:53:18 +01:00
{!! Former::select('country_id')
->placeholder(trans('texts.country_id'))
->fromQuery($countries, 'name', 'id')
->addGroupClass('country-select')
->label('') !!}
2015-04-28 22:13:52 +02:00
</div>
2015-03-16 22:45:25 +01:00
</div>
<p>&nbsp;<br/>&nbsp;</p>
2015-07-12 21:43:45 +02:00
@endif
2015-03-16 22:45:25 +01:00
<h3>{{ trans('texts.billing_method') }}</h3>
<div class="row">
<div class="col-md-9">
2015-11-29 21:13:50 +01:00
{!! Former::text($accountGateway->getPublishableStripeKey() ? '' : 'card_number')
->id('card_number')
2015-11-09 15:53:18 +01:00
->placeholder(trans('texts.card_number'))
->autocomplete('cc-number')
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-3">
2015-11-29 21:13:50 +01:00
{!! Former::text($accountGateway->getPublishableStripeKey() ? '' : 'cvv')
->id('cvv')
2015-11-09 15:53:18 +01:00
->placeholder(trans('texts.cvv'))
->autocomplete('off')
->label('') !!}
2015-03-16 22:45:25 +01:00
</div>
</div>
<div class="row">
<div class="col-md-6">
2015-11-29 21:13:50 +01:00
{!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_month')
->id('expiration_month')
2015-11-09 15:53:18 +01:00
->autocomplete('cc-exp-month')
->placeholder(trans('texts.expiration_month'))
->addOption('01 - January', '1')
->addOption('02 - February', '2')
->addOption('03 - March', '3')
->addOption('04 - April', '4')
->addOption('05 - May', '5')
->addOption('06 - June', '6')
->addOption('07 - July', '7')
->addOption('08 - August', '8')
->addOption('09 - September', '9')
->addOption('10 - October', '10')
->addOption('11 - November', '11')
->addOption('12 - December', '12')->label('')
!!}
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-6">
2015-11-29 21:13:50 +01:00
{!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_year')
->id('expiration_year')
2015-11-09 15:53:18 +01:00
->autocomplete('cc-exp-year')
->placeholder(trans('texts.expiration_year'))
->addOption('2016', '2016')
->addOption('2017', '2017')
->addOption('2018', '2018')
->addOption('2019', '2019')
->addOption('2020', '2020')
->addOption('2021', '2021')
->addOption('2022', '2022')
->addOption('2023', '2023')
->addOption('2024', '2024')
2016-01-28 13:04:55 +01:00
->addOption('2025', '2025')
->addOption('2026', '2026')->label('')
2015-11-09 15:53:18 +01:00
!!}
2015-03-16 22:45:25 +01:00
</div>
</div>
<div class="row" style="padding-top:18px">
<div class="col-md-5">
2015-11-29 21:13:50 +01:00
@if ($client && $account->showTokenCheckbox())
2015-03-16 22:45:25 +01:00
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
2015-04-15 18:35:41 +02:00
<span class="help-block" style="font-size:15px">{!! trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}</span>
2015-11-29 21:13:50 +01:00
@endif
2016-03-03 20:39:15 +01:00
</div>
2015-03-16 22:45:25 +01:00
2015-11-29 21:13:50 +01:00
<div class="col-md-7">
@if (isset($acceptedCreditCardTypes))
2015-03-16 22:45:25 +01:00
<div class="pull-right">
@foreach ($acceptedCreditCardTypes as $card)
<img src="{{ $card['source'] }}" alt="{{ $card['alt'] }}" style="width: 70px; display: inline; margin-right: 6px;"/>
@endforeach
</div>
@endif
</div>
</div>
2016-03-03 20:39:15 +01:00
2015-03-16 22:45:25 +01:00
<p>&nbsp;<br/>&nbsp;</p>
2016-01-28 15:07:03 +01:00
<center>
{!! Button::success(strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, true) ))
->submit()
->large() !!}
</center>
2015-03-16 22:45:25 +01:00
</div>
</div>
2016-03-03 20:39:15 +01:00
</div>
2015-03-16 22:45:25 +01:00
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
2015-04-02 15:06:16 +02:00
{!! Former::close() !!}
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
2016-03-03 20:39:15 +01:00
2015-03-16 22:45:25 +01:00
$(function() {
$('select').change(function() {
$(this).css({color:'#444444'});
});
2015-04-28 22:13:52 +02:00
$('#country_id').combobox();
2015-11-01 19:21:11 +01:00
$('#first_name').focus();
2015-03-16 22:45:25 +01:00
});
</script>
@stop