Skip to content

Commit

Permalink
Disable save button after click
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Sep 17, 2018
1 parent 0306877 commit b8087bf
Show file tree
Hide file tree
Showing 45 changed files with 71 additions and 48 deletions.
6 changes: 6 additions & 0 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ $(document).ready(function () {
$(".input-group-recurring #recurring_frequency").select2();
$('.input-group-recurring #recurring_frequency').trigger('change');
}

$('.form-loading-button').submit(function( event ) {
$('.button-submit').button('loading');

return true;
});
});

function confirmDelete(form_id, title, message, button_cancel, button_delete) {
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en-GB/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
'color' => 'Colour',
'save' => 'Save',
'cancel' => 'Cancel',
'loading' => 'Loading...',
'from' => 'From',
'to' => 'To',
'print' => 'Print',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/permissions/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'auth/permissions', 'role' => 'form']) !!}
{!! Form::open(['url' => 'auth/permissions', 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('display_name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/auth/permissions/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{!! Form::model($permission, [
'method' => 'PATCH',
'url' => ['auth/permissions', $permission->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/roles/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'auth/roles', 'role' => 'form']) !!}
{!! Form::open(['url' => 'auth/roles', 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('display_name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/auth/roles/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{!! Form::model($role, [
'method' => 'PATCH',
'url' => ['auth/roles', $role->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/users/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'auth/users', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'auth/users', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/auth/users/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'method' => 'PATCH',
'files' => true,
'url' => ['auth/users', $user->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/banking/accounts/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'banking/accounts', 'role' => 'form']) !!}
{!! Form::open(['url' => 'banking/accounts', 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/banking/accounts/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{!! Form::model($account, [
'method' => 'PATCH',
'url' => ['banking/accounts', $account->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/banking/transfers/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'banking/transfers', 'role' => 'form']) !!}
{!! Form::open(['url' => 'banking/transfers', 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::selectGroup('from_account_id', trans('transfers.from_account'), 'university', $accounts) }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/banking/transfers/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{!! Form::model($transfer, [
'method' => 'PATCH',
'url' => ['banking/transfers', $transfer->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/common/companies/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'common/companies', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'common/companies', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="box-body">
{{ Form::textGroup('company_name', trans('general.name'), 'id-card-o') }}

Expand Down
3 changes: 2 additions & 1 deletion resources/views/common/companies/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'method' => 'PATCH',
'url' => ['common/companies', $company->id],
'files' => true,
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/common/import/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@section('content')
<div class="box box-success">
{!! Form::open(['url' => $path . '/import', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => $path . '/import', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
<div class="col-md-12">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/common/items/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['route' => 'items.store', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['route' => 'items.store', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/common/items/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'method' => 'PATCH',
'files' => true,
'route' => ['items.update', $item->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
3 changes: 2 additions & 1 deletion resources/views/customers/profile/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'method' => 'PATCH',
'files' => true,
'url' => ['customers/profile/update'],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/expenses/bills/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'expenses/bills', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'expenses/bills', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
@stack('vendor_id_input_start')
Expand Down
2 changes: 1 addition & 1 deletion resources/views/expenses/bills/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::model($bill, ['method' => 'PATCH', 'files' => true, 'url' => ['expenses/bills', $bill->id], 'role' => 'form']) !!}
{!! Form::model($bill, ['method' => 'PATCH', 'files' => true, 'url' => ['expenses/bills', $bill->id], 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors) }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/expenses/payments/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'expenses/payments', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'expenses/payments', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('paid_at', trans('general.date'), 'calendar',['id' => 'paid_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy-mm-dd\'', 'data-mask' => '', 'autocomplete' => 'off'], Date::now()->toDateString()) }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/expenses/payments/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
'method' => 'PATCH',
'files' => true,
'url' => ['expenses/payments', $payment->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/expenses/vendors/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'expenses/vendors', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'expenses/vendors', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/expenses/vendors/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'method' => 'PATCH',
'files' => true,
'url' => ['expenses/vendors', $vendor->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/incomes/customers/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'incomes/customers', 'role' => 'form']) !!}
{!! Form::open(['url' => 'incomes/customers', 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/incomes/customers/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{!! Form::model($customer, [
'method' => 'PATCH',
'url' => ['incomes/customers', $customer->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/incomes/invoices/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'incomes/invoices', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'incomes/invoices', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
@stack('customer_id_input_start')
Expand Down
2 changes: 1 addition & 1 deletion resources/views/incomes/invoices/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::model($invoice, ['method' => 'PATCH', 'files' => true, 'url' => ['incomes/invoices', $invoice->id], 'role' => 'form']) !!}
{!! Form::model($invoice, ['method' => 'PATCH', 'files' => true, 'url' => ['incomes/invoices', $invoice->id], 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::selectGroup('customer_id', trans_choice('general.customers', 1), 'user', $customers, config('general.customers')) }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/incomes/revenues/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'incomes/revenues', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'incomes/revenues', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
{{ Form::textGroup('paid_at', trans('general.date'), 'calendar',['id' => 'paid_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy-mm-dd\'', 'data-mask' => '', 'autocomplete' => 'off'], Date::now()->toDateString()) }}
Expand Down
3 changes: 2 additions & 1 deletion resources/views/incomes/revenues/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
'method' => 'PATCH',
'files' => true,
'url' => ['incomes/revenues', $revenue->id],
'role' => 'form'
'role' => 'form',
'class' => 'form-loading-button'
]) !!}

<div class="box-body">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/bills/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="modal-body">
<div class="modal-message"></div>
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form']) !!}
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="row">
{{ Form::textGroup('paid_at', trans('general.date'), 'calendar',['id' => 'paid_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy-mm-dd\'', 'data-mask' => '', 'autocomplete' => 'off'], Date::now()->toDateString()) }}

Expand Down Expand Up @@ -38,7 +38,7 @@
</div>
<div class="modal-footer">
<div class="pull-left">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/categories/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.categories', 1)]) }}</h4>
</div>
<div class="modal-body">
{!! Form::open(['id' => 'form-create-category', 'role' => 'form']) !!}
{!! Form::open(['id' => 'form-create-category', 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="row">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}

Expand All @@ -27,7 +27,7 @@
</div>
<div class="modal-footer">
<div class="pull-left">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-category', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-category', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/customers/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.customers', 1)]) }}</h4>
</div>
<div class="modal-body">
{!! Form::open(['id' => 'form-create-customer', 'role' => 'form']) !!}
{!! Form::open(['id' => 'form-create-customer', 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="row">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}

Expand All @@ -23,7 +23,7 @@
</div>
<div class="modal-footer">
<div class="pull-left">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-customer', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-customer', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/invoices/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="modal-body">
<div class="modal-message"></div>
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form']) !!}
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="row">
{{ Form::textGroup('paid_at', trans('general.date'), 'calendar',['id' => 'paid_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy-mm-dd\'', 'data-mask' => '', 'autocomplete' => 'off'], Date::now()->toDateString()) }}

Expand Down Expand Up @@ -38,7 +38,7 @@
</div>
<div class="modal-footer">
<div class="pull-left">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/vendors/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.vendors', 1)]) }}</h4>
</div>
<div class="modal-body">
{!! Form::open(['id' => 'form-create-vendor', 'role' => 'form']) !!}
{!! Form::open(['id' => 'form-create-vendor', 'role' => 'form', 'class' => 'form-loading-button']) !!}
<div class="row">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}

Expand All @@ -23,7 +23,7 @@
</div>
<div class="modal-footer">
<div class="pull-left">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-vendor', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-vendor', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/modules/token/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@section('content')
<div class="box box-success">
{!! Form::open(['url' => 'apps/token', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'apps/token', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}

<div class="box-body">
<div class="col-md-12">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/form/save_buttons.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="{{ $col }}">
<div class="form-group no-margin">
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'submit', 'class' => 'btn btn-success']) !!}
{!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'submit', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
<a href="{{ url($cancel) }}" class="btn btn-default"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</a>
</div>
</div>
Expand Down

0 comments on commit b8087bf

Please sign in to comment.