v2 first commit
This commit is contained in:
@ -1,187 +1,45 @@
|
||||
<div class="modal fade add-payment-{{ $rand }}" id="modal-add-payment" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<div class="modal-body">
|
||||
{!! Form::open([
|
||||
'url' => 'modals/bills/' . $bill->id . '/transactions',
|
||||
'id' => 'transaction',
|
||||
'@submit.prevent' => 'onSubmit',
|
||||
'@keydown' => 'transaction_form.errors.clear($event.target.name)',
|
||||
'files' => true,
|
||||
'role' => 'form',
|
||||
'class' => 'form-loading-button',
|
||||
'novalidate' => true
|
||||
]) !!}
|
||||
<div class="row">
|
||||
<base-alert type="warning" v-if="typeof transaction_form.response !== 'undefined' && transaction_form.response.error" v-html="transaction_form.response.message"></base-alert>
|
||||
|
||||
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.payments', 1)]) }}</h4>
|
||||
</div>
|
||||
{{ Form::dateGroup('paid_at', trans('general.date'), 'calendar', ['id' => 'paid_at', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'v-model' => 'transaction_form.paid_at', 'v-error' => 'payment.errors.get("paid_at")', 'v-error-message' => 'payment.errors.get("paid_at")'], Date::now()->toDateString()) }}
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="modal-message"></div>
|
||||
{{ Form::moneyGroup('amount', trans('general.amount'), 'money-bill-alt', ['required' => 'required', 'autofocus' => 'autofocus', 'v-model' => 'transaction_form.amount', 'v-error' => 'payment.errors.get("amount")', 'v-error-message' => 'payment.errors.get("amount")', 'currency' => $currency], $bill->grand_total) }}
|
||||
|
||||
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
{{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('default.account'), ['required' => 'required', 'v-model' => 'transaction_form.account_id', 'v-error' => 'payment.errors.get("account_id")', 'v-error-message' => 'payment.errors.get("account_id")', 'change' => 'onChangePaymentAccount']) }}
|
||||
|
||||
<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()) }}
|
||||
|
||||
{{ Form::textGroup('amount', trans('general.amount'), 'money', ['required' => 'required', 'autofocus' => 'autofocus'], $bill->grand_total) }}
|
||||
|
||||
{{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('general.default_account')) }}
|
||||
|
||||
@stack('currency_code_input_start')
|
||||
<div class="form-group col-md-6 required">
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$bill->currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $bill->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_start')
|
||||
<div class="form-group col-md-6 required">
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$bill->currency_code], ['v-model' => 'transaction_form.currency', 'v-error' => 'payment.errors.get("currency")', 'v-error-message' => 'payment.errors.get("currency")','id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||
|
||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
||||
|
||||
{{ Form::textGroup('reference', trans('general.reference'), 'file-text-o',[]) }}
|
||||
|
||||
{!! Form::hidden('bill_id', $bill->id, ['id' => 'bill_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
{{ Form::textareaGroup('description', trans('general.description'), '', null, ['rows' => '3', 'v-model' => 'transaction_form.description', 'v-error' => 'payment.errors.get("description")', 'v-error-message' => 'payment.errors.get("description")']) }}
|
||||
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left">
|
||||
{!! Form::button('<span class="fa fa-save"></span> ' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('default.payment_method'), ['required' => 'requied', 'v-model' => 'transaction_form.payment_method', 'v-error' => 'payment.errors.get("payment_method")', 'v-error-message' => 'payment.errors.get("payment_method")']) }}
|
||||
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> {{ trans('general.cancel') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::textGroup('reference', trans('general.reference'), 'fa fa-file', ['v-model' => 'transaction_form.reference', 'v-error' => 'payment.errors.get("reference")', 'v-error-message' => 'payment.errors.get("reference")']) }}
|
||||
|
||||
{!! Form::hidden('bill_id', $bill->id, ['id' => 'bill_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('category_id', $bill->category->id, ['id' => 'category_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('currency_code', $bill->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('currency_rate', $bill->currency_rate, ['id' => 'currency_rate', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
|
||||
{!! Form::hidden('type', 'expense') !!}
|
||||
</div>
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').focus();
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment').modal('show');
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #amount").maskMoney({
|
||||
thousands : '{{ $currency->thousands_separator }}',
|
||||
decimal : '{{ $currency->decimal_mark }}',
|
||||
precision : {{ $currency->precision }},
|
||||
allowZero : true,
|
||||
@if($currency->symbol_first)
|
||||
prefix : '{{ $currency->symbol }}'
|
||||
@else
|
||||
suffix : '{{ $currency->symbol }}'
|
||||
@endif
|
||||
});
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').trigger('focusout');
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #paid_at').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
todayBtn: 'linked',
|
||||
weekStart: 1,
|
||||
autoclose: true,
|
||||
language: '{{ language()->getShortCode() }}'
|
||||
});
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #account_id").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)]) }}"
|
||||
});
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #payment_method").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '.add-payment-{{ $rand }}#modal-add-payment #account_id', function (e) {
|
||||
$.ajax({
|
||||
url: '{{ url("banking/accounts/currency") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: 'account_id=' + $(this).val(),
|
||||
success: function(data) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency').val(data.currency_name);
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency_code').val(data.currency_code);
|
||||
|
||||
amount = $('.add-payment-{{ $rand }}#modal-add-payment #amount').maskMoney('unmasked')[0];
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #amount").maskMoney({
|
||||
thousands : data.thousands_separator,
|
||||
decimal : data.decimal_mark,
|
||||
precision : data.precision,
|
||||
allowZero : true,
|
||||
prefix : (data.symbol_first) ? data.symbol : '',
|
||||
suffix : (data.symbol_first) ? '' : data.symbol
|
||||
});
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').val(amount);
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.add-payment-{{ $rand }} #button-add-payment', function (e) {
|
||||
$('.add-payment-{{ $rand }} .help-block').remove();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("modals/bills/" . $bill->id . "/payment") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $(".add-payment-{{ $rand }} #form-add-payment").serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
beforeSend: function() {
|
||||
$('.add-payment-{{ $rand }} #button-add-payment').button('loading');
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-content').append('<div id="loading" class="text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>');
|
||||
},
|
||||
complete: function() {
|
||||
$('.add-payment-{{ $rand }} #button-add-payment').button('reset');
|
||||
$('.add-payment-{{ $rand }} #loading').remove();
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['error']) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-message').append('<div class="alert alert-danger">' + json['message'] + '</div>');
|
||||
$('.add-payment-{{ $rand }} div.alert-danger').delay(3000).fadeOut(350);
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-message').before('<div class="alert alert-success">' + json['message'] + '</div>');
|
||||
$('.add-payment-{{ $rand }} div.alert-success').delay(3000).fadeOut(350);
|
||||
|
||||
setTimeout(function(){
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment").modal('hide');
|
||||
|
||||
location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.paid_at) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #paid_at').parent().after('<p class="help-block">' + errors.paid_at + '</p>');
|
||||
}
|
||||
|
||||
if (errors.amount) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').parent().after('<p class="help-block">' + errors.amount + '</p>');
|
||||
}
|
||||
|
||||
if (errors.account_id) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #account_id').parent().after('<p class="help-block">' + errors.account_id + '</p>');
|
||||
}
|
||||
|
||||
if (errors.currency_code) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency_code').parent().after('<p class="help-block">' + errors.currency_code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.category_id) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #category_id').parent().after('<p class="help-block">' + errors.category_id + '</p>');
|
||||
}
|
||||
|
||||
if (errors.payment_method) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #payment_method').parent().after('<p class="help-block">' + errors.payment_method + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="modal fade create-category-{{ $rand }}" id="modal-create-category" style="display: none;">
|
||||
<div class="modal fade create-category-{{ $rand }} d-none" id="modal-create-category">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -12,14 +12,14 @@
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
|
||||
@stack('color_input_start')
|
||||
<div class="form-group col-md-6 required {{ $errors->has('color') ? 'has-error' : ''}}">
|
||||
{!! Form::label('color', trans('general.color'), ['class' => 'control-label']) !!}
|
||||
<div id="category-color-picker" class="input-group colorpicker-component">
|
||||
<div class="input-group-addon"><i></i></div>
|
||||
{!! Form::text('color', '#00a65a', ['id' => 'color', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
<div class="form-group col-md-6 required {{ $errors->has('color') ? 'has-error' : ''}}">
|
||||
{!! Form::label('color', trans('general.color'), ['class' => 'control-label']) !!}
|
||||
<div id="category-color-picker" class="input-group colorpicker-component">
|
||||
<div class="input-group-addon"><i></i></div>
|
||||
{!! Form::text('color', '#00a65a', ['id' => 'color', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
{!! $errors->first('color', '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
{!! $errors->first('color', '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
@stack('color_input_end')
|
||||
|
||||
{!! Form::hidden('type', $type, []) !!}
|
||||
@ -48,7 +48,7 @@
|
||||
});
|
||||
|
||||
$(document).on('click', '.create-category-{{ $rand }} #button-create-category', function (e) {
|
||||
$('.create-category-{{ $rand }}#modal-create-category .modal-header').before('<span id="span-loading" style="position: absolute; height: 100%; width: 100%; z-index: 99; background: #6da252; opacity: 0.4;"><i class="fa fa-spinner fa-spin" style="font-size: 10em !important;margin-left: 35%;margin-top: 8%;"></i></span>');
|
||||
$('.create-category-{{ $rand }}#modal-create-category .modal-header').before('<span id="span-loading" style="position: absolute; height: 100%; width: 100%; z-index: 99; background: #6da252; opacity: 0.4;"><i class="fa fa-spinner fa-spin" style="font-size: 10em !important; margin-left: 35%;margin-top: 8%;"></i></span>');
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("modals/categories") }}',
|
||||
|
@ -1,102 +1,21 @@
|
||||
<div class="modal fade create-customer-{{ $rand }}" id="modal-create-customer" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.customers', 1)]) }}</h4>
|
||||
</div>
|
||||
{!! Form::open([
|
||||
'id' => 'form-create-customer',
|
||||
'@submit.prevent' => 'onSubmit',
|
||||
'@keydown' => 'form.errors.clear($event.target.name)',
|
||||
'role' => 'form',
|
||||
'class' => 'form-loading-button'
|
||||
]) !!}
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
|
||||
<div class="modal-body">
|
||||
{!! Form::open(['id' => 'form-create-customer', 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
|
||||
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
|
||||
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
|
||||
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('default.currency')) }}
|
||||
|
||||
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
{{ Form::textareaGroup('address', trans('general.address')) }}
|
||||
|
||||
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('general.default_currency')) }}
|
||||
|
||||
{{ Form::textareaGroup('address', trans('general.address')) }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left">
|
||||
{!! Form::button('<span class="fa fa-save"></span> ' . 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> {{ trans('general.cancel') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.create-customer-{{ $rand }}#modal-create-customer').modal('show');
|
||||
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer #currency_code").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.create-customer-{{ $rand }} #button-create-customer', function (e) {
|
||||
$('.create-customer-{{ $rand }}#modal-create-customer .modal-header').before('<span id="span-loading" style="position: absolute; height: 100%; width: 100%; z-index: 99; background: #6da252; opacity: 0.4;"><i class="fa fa-spinner fa-spin" style="font-size: 16em !important;margin-left: 35%;margin-top: 8%;"></i></span>');
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("modals/customers") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $(".create-customer-{{ $rand }} #form-create-customer").serialize(),
|
||||
beforeSend: function () {
|
||||
$('.create-customer-{{ $rand }} #button-create-customer').button('loading');
|
||||
|
||||
$(".create-customer-{{ $rand }} .form-group").removeClass("has-error");
|
||||
$(".create-customer-{{ $rand }} .help-block").remove();
|
||||
},
|
||||
complete: function() {
|
||||
$('.create-customer-{{ $rand }} #button-create-customer').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
var data = json['data'];
|
||||
|
||||
$('.create-customer-{{ $rand }} #span-loading').remove();
|
||||
|
||||
$('.create-customer-{{ $rand }}#modal-create-customer').modal('hide');
|
||||
|
||||
$('#customer_id').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('#customer_id').trigger('change');
|
||||
$('#customer_id').select2('refresh');
|
||||
|
||||
@if ($customer_selector)
|
||||
$('{{ $customer_selector }}').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('{{ $customer_selector }}').trigger('change');
|
||||
$('{{ $customer_selector }}').select2('refresh');
|
||||
@endif
|
||||
},
|
||||
error: function(error, textStatus, errorThrown) {
|
||||
$('.create-customer-{{ $rand }} #span-loading').remove();
|
||||
|
||||
if (error.responseJSON.name) {
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer input[name='name']").parent().parent().addClass('has-error');
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer input[name='name']").parent().after('<p class="help-block">' + error.responseJSON.name + '</p>');
|
||||
}
|
||||
|
||||
if (error.responseJSON.email) {
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer input[name='email']").parent().parent().addClass('has-error');
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer input[name='email']").parent().after('<p class="help-block">' + error.responseJSON.email + '</p>');
|
||||
}
|
||||
|
||||
if (error.responseJSON.currency_code) {
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer select[name='currency_code']").parent().parent().addClass('has-error');
|
||||
$(".create-customer-{{ $rand }}#modal-create-customer select[name='currency_code']").parent().after('<p class="help-block">' + error.responseJSON.currency_code + '</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{!! Form::close() !!}
|
||||
|
@ -1,188 +1,45 @@
|
||||
<div class="modal fade add-payment-{{ $rand }}" id="modal-add-payment" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<div class="modal-body">
|
||||
{!! Form::open([
|
||||
'url' => 'modals/invoices/' . $invoice->id . '/transactions',
|
||||
'id' => 'transaction',
|
||||
'@submit.prevent' => 'onSubmit',
|
||||
'@keydown' => 'transaction_form.errors.clear($event.target.name)',
|
||||
'files' => true,
|
||||
'role' => 'form',
|
||||
'class' => 'form-loading-button',
|
||||
'novalidate' => true
|
||||
]) !!}
|
||||
<div class="row">
|
||||
<base-alert type="warning" v-if="typeof transaction_form.response !== 'undefined' && transaction_form.response.error" v-html="transaction_form.response.message"></base-alert>
|
||||
|
||||
<h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.payments', 1)]) }}</h4>
|
||||
</div>
|
||||
{{ Form::dateGroup('paid_at', trans('general.date'), 'calendar', ['id' => 'paid_at', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'v-model' => 'transaction_form.paid_at', 'v-error' => 'payment.errors.get("paid_at")', 'v-error-message' => 'payment.errors.get("paid_at")'], Date::now()->toDateString()) }}
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="modal-message"></div>
|
||||
{!! Form::open(['id' => 'form-add-payment', 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
{{ Form::moneyGroup('amount', trans('general.amount'), 'money-bill-alt', ['required' => 'required', 'autofocus' => 'autofocus', 'v-model' => 'transaction_form.amount', 'v-error' => 'payment.errors.get("amount")', 'v-error-message' => 'payment.errors.get("amount")', 'currency' => $currency], $invoice->grand_total) }}
|
||||
|
||||
<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()) }}
|
||||
{{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('default.account'), ['required' => 'required', 'v-model' => 'transaction_form.account_id', 'v-error' => 'payment.errors.get("account_id")', 'v-error-message' => 'payment.errors.get("account_id")', 'change' => 'onChangePaymentAccount']) }}
|
||||
|
||||
{{ Form::textGroup('amount', trans('general.amount'), 'money', ['required' => 'required', 'autofocus' => 'autofocus'], $invoice->grand_total) }}
|
||||
|
||||
{{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('general.default_account')) }}
|
||||
|
||||
@stack('currency_code_input_start')
|
||||
<div class="form-group col-md-6 required">
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$invoice->currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $invoice->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_start')
|
||||
<div class="form-group col-md-6 required">
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$invoice->currency_code], ['v-model' => 'transaction_form.currency', 'v-error' => 'payment.errors.get("currency")', 'v-error-message' => 'payment.errors.get("currency")','id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||
|
||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
||||
|
||||
{{ Form::textGroup('reference', trans('general.reference'), 'file-text-o',[]) }}
|
||||
|
||||
{!! Form::hidden('invoice_id', $invoice->id, ['id' => 'invoice_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
{{ Form::textareaGroup('description', trans('general.description'), '', null, ['rows' => '3', 'v-model' => 'transaction_form.description', 'v-error' => 'payment.errors.get("description")', 'v-error-message' => 'payment.errors.get("description")']) }}
|
||||
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left">
|
||||
{!! Form::button('<span class="fa fa-save"></span> ' . trans('general.save'), ['type' => 'button', 'id' =>'button-add-payment', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('default.payment_method'), ['required' => 'requied', 'v-model' => 'transaction_form.payment_method', 'v-error' => 'payment.errors.get("payment_method")', 'v-error-message' => 'payment.errors.get("payment_method")']) }}
|
||||
|
||||
<a href="{{ url('apps/categories/payment-gateway') }}" class="btn btn-default"><span class="fa fa-money"></span> {{ trans('invoices.accept_payments') }}</a>
|
||||
{{ Form::textGroup('reference', trans('general.reference'), 'fa fa-file', ['v-model' => 'transaction_form.reference', 'v-error' => 'payment.errors.get("reference")', 'v-error-message' => 'payment.errors.get("reference")']) }}
|
||||
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> {{ trans('general.cancel') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
{!! Form::hidden('invoice_id', $invoice->id, ['id' => 'invoice_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('category_id', $invoice->category->id, ['id' => 'category_id', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('currency_code', $invoice->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::hidden('currency_rate', $invoice->currency_rate, ['id' => 'currency_rate', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
|
||||
{!! Form::hidden('type', 'income') !!}
|
||||
</div>
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').focus();
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment').modal('show');
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #amount").maskMoney({
|
||||
thousands : '{{ $currency->thousands_separator }}',
|
||||
decimal : '{{ $currency->decimal_mark }}',
|
||||
precision : {{ $currency->precision }},
|
||||
allowZero : true,
|
||||
@if($currency->symbol_first)
|
||||
prefix : '{{ $currency->symbol }}'
|
||||
@else
|
||||
suffix : '{{ $currency->symbol }}'
|
||||
@endif
|
||||
});
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').trigger('focusout');
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #paid_at').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
todayBtn: 'linked',
|
||||
weekStart: 1,
|
||||
autoclose: true,
|
||||
language: '{{ language()->getShortCode() }}'
|
||||
});
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #account_id").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)]) }}"
|
||||
});
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #payment_method").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '.add-payment-{{ $rand }}#modal-add-payment #account_id', function (e) {
|
||||
$.ajax({
|
||||
url: '{{ url("banking/accounts/currency") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: 'account_id=' + $(this).val(),
|
||||
success: function(data) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency').val(data.currency_name);
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency_code').val(data.currency_code);
|
||||
|
||||
amount = $('.add-payment-{{ $rand }}#modal-add-payment #amount').maskMoney('unmasked')[0];
|
||||
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment #amount").maskMoney({
|
||||
thousands : data.thousands_separator,
|
||||
decimal : data.decimal_mark,
|
||||
precision : data.precision,
|
||||
allowZero : true,
|
||||
prefix : (data.symbol_first) ? data.symbol : '',
|
||||
suffix : (data.symbol_first) ? '' : data.symbol
|
||||
});
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').val(amount);
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.add-payment-{{ $rand }} #button-add-payment', function (e) {
|
||||
$('.add-payment-{{ $rand }} .help-block').remove();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("modals/invoices/" . $invoice->id . "/payment") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $(".add-payment-{{ $rand }} #form-add-payment").serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
beforeSend: function() {
|
||||
$('.add-payment-{{ $rand }} #button-add-payment').button('loading');
|
||||
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-content').append('<div id="loading" class="text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>');
|
||||
},
|
||||
complete: function() {
|
||||
$('.add-payment-{{ $rand }} #button-add-payment').button('reset');
|
||||
$('.add-payment-{{ $rand }} #loading').remove();
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['error']) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-message').append('<div class="alert alert-danger">' + json['message'] + '</div>');
|
||||
$('.add-payment-{{ $rand }} div.alert-danger').delay(3000).fadeOut(350);
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment .modal-message').before('<div class="alert alert-success">' + json['message'] + '</div>');
|
||||
$('.add-payment-{{ $rand }} div.alert-success').delay(3000).fadeOut(350);
|
||||
|
||||
setTimeout(function(){
|
||||
$(".add-payment-{{ $rand }}#modal-add-payment").modal('hide');
|
||||
|
||||
location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.paid_at) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #paid_at').parent().after('<p class="help-block">' + errors.paid_at + '</p>');
|
||||
}
|
||||
|
||||
if (errors.amount) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #amount').parent().after('<p class="help-block">' + errors.amount + '</p>');
|
||||
}
|
||||
|
||||
if (errors.account_id) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #account_id').parent().after('<p class="help-block">' + errors.account_id + '</p>');
|
||||
}
|
||||
|
||||
if (errors.currency_code) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #currency_code').parent().after('<p class="help-block">' + errors.currency_code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.category_id) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #category_id').parent().after('<p class="help-block">' + errors.category_id + '</p>');
|
||||
}
|
||||
|
||||
if (errors.payment_method) {
|
||||
$('.add-payment-{{ $rand }}#modal-add-payment #payment_method').parent().after('<p class="help-block">' + errors.payment_method + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="modal fade create-tax-{{ $rand }}" id="modal-create-tax" style="display: none;">
|
||||
<div class="modal fade create-tax-{{ $rand }} d-none" id="modal-create-tax">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -7,17 +7,15 @@
|
||||
|
||||
<div class="modal-body">
|
||||
{!! Form::open(['id' => 'form-create-tax', 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
{{ Form::textGroup('rate', trans('taxes.rate'), 'percent') }}
|
||||
|
||||
{{ Form::textGroup('rate', trans('taxes.rate'), 'percent') }}
|
||||
|
||||
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, 'normal') }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, 'normal') }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
|
33
resources/views/modals/vendors/create.blade.php
vendored
33
resources/views/modals/vendors/create.blade.php
vendored
@ -1,4 +1,4 @@
|
||||
<div class="modal fade create-vendor-{{ $rand }}" id="modal-create-vendor" style="display: none;">
|
||||
<div class="modal fade create-vendor-{{ $rand }} d-none" id="modal-create-vendor">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -8,20 +8,19 @@
|
||||
<div class="modal-body">
|
||||
{!! Form::open(['id' => 'form-create-vendor', 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
|
||||
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
|
||||
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
|
||||
|
||||
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
|
||||
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('general.default_currency')) }}
|
||||
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('default.currency')) }}
|
||||
|
||||
{{ Form::textareaGroup('address', trans('general.address')) }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
{{ Form::textareaGroup('address', trans('general.address')) }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
@ -69,14 +68,14 @@
|
||||
|
||||
$('.create-vendor-{{ $rand }}#modal-create-vendor').modal('hide');
|
||||
|
||||
$('#vendor_id').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('#vendor_id').trigger('change');
|
||||
$('#vendor_id').select2('refresh');
|
||||
$('#contact_id').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('#contact_id').trigger('change');
|
||||
$('#contact_id').select2('refresh');
|
||||
|
||||
@if ($vendor_selector)
|
||||
$('{{ $vendor_selector }}').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('{{ $vendor_selector }}').trigger('change');
|
||||
$('{{ $vendor_selector }}').select2('refresh');
|
||||
@if ($contact_selector)
|
||||
$('{{ $contact_selector }}').append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
|
||||
$('{{ $contact_selector }}').trigger('change');
|
||||
$('{{ $contact_selector }}').select2('refresh');
|
||||
@endif
|
||||
},
|
||||
error: function(error, textStatus, errorThrown) {
|
||||
|
Reference in New Issue
Block a user