1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Fixes for payment methods datatables

This commit is contained in:
David Bomba 2019-09-25 12:41:45 +10:00
parent 46602a21c5
commit 89330e6e34
3 changed files with 39 additions and 17 deletions

View File

@ -2,19 +2,19 @@
@section('credit_card')
{!! Former::framework('TwitterBootstrap4'); !!}
{!! Former::framework('TwitterBootstrap4'); !!}
{!! Former::horizontal_open()
->id('server_response')
->route('client.payment_methods.store')
->method('POST'); !!}
{!! Former::horizontal_open()
->id('server_response')
->route('client.payment_methods.store')
->method('POST'); !!}
{!! Former::hidden('company_gateway_id')->value($gateway->gateway_id) !!}
{!! Former::hidden('gateway_type_id')->value(1) !!}
{!! Former::hidden('gateway_response')->id('gateway_response') !!}
{!! Former::hidden('is_default')->id('is_default') !!}
{!! Former::hidden('company_gateway_id')->value($gateway->gateway_id) !!}
{!! Former::hidden('gateway_type_id')->value(1) !!}
{!! Former::hidden('gateway_response')->id('gateway_response') !!}
{!! Former::hidden('is_default')->id('is_default') !!}
{!! Former::close() !!}
{!! Former::close() !!}
<div class="py-md-5 ninja stripe">

View File

@ -61,18 +61,14 @@
var cardButton = document.getElementById('card-button');
var clientSecret = cardButton.dataset.secret;
@if($token)
cardButton.addEventListener('click', function(ev) {
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {
billing_details: {name: cardholderName.value}
}
clientSecret, {
payment_method: {{$token->token}},
}
).then(function(result) {
if (result.error) {
// Display error.message in your UI.
// console.log(result.error);
// console.log(result.error.message);
$("#card-errors").empty();
$("#card-errors").append("<b>" + result.error.message + "</b>");
@ -85,7 +81,29 @@
}
});
});
@else
cardButton.addEventListener('click', function(ev) {
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {
billing_details: {name: cardholderName.value}
}
}
).then(function(result) {
if (result.error) {
$("#card-errors").empty();
$("#card-errors").append("<b>" + result.error.message + "</b>");
$("#card-button").removeAttr("disabled");
} else {
// The setup has succeeded. Display a success message.
console.log(result);
postResult(result);
}
});
});
@endif
$("#card-button").attr("disabled", true);
$('#cardholder-name').on('input',function(e){

View File

@ -69,6 +69,10 @@ $(function() {
loadingRecords: "{{ trans('texts.loading') }}",
zeroRecords: "{{ trans('texts.no_records_found') }}"
},
ajax: {
url: '{!! route('client.payment_methods.index') !!}'
},
columns: [
{data: 'created_at', name: 'created_at', title: '{{ctrans('texts.created_at')}}', visible: true},