import validation fixed create and edit action on invoice, bill, revenue, payment.

refs #392
This commit is contained in:
cuneytsenturk
2018-06-25 17:53:43 +03:00
parent 409f83ae54
commit 55ac8447fc
16 changed files with 154 additions and 136 deletions

View File

@@ -115,6 +115,15 @@
{{ Form::recurring('create') }}
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
{{ Form::hidden('vendor_name', '', ['id' => 'vendor_name']) }}
{{ Form::hidden('vendor_email', '', ['id' => 'vendor_email']) }}
{{ Form::hidden('vendor_tax_number', '', ['id' => 'vendor_tax_number']) }}
{{ Form::hidden('vendor_phone', '', ['id' => 'vendor_phone']) }}
{{ Form::hidden('vendor_address', '', ['id' => 'vendor_address']) }}
{{ Form::hidden('currency_rate', '', ['id' => 'currency_rate']) }}
{{ Form::hidden('bill_status_code', 'draft', ['id' => 'bill_status_code']) }}
{{ Form::hidden('amount', '0', ['id' => 'amount']) }}
</div>
<!-- /.box-body -->
@@ -327,7 +336,14 @@
dataType: 'JSON',
data: 'vendor_id=' + $(this).val(),
success: function(data) {
$('#vendor_name').val(data.name);
$('#vendor_email').val(data.email);
$('#vendor_tax_number').val(data.tax_number);
$('#vendor_phone').val(data.phone);
$('#vendor_address').val(data.address);
$('#currency_code').val(data.currency_code);
$('#currency_rate').val(data.currency_rate);
// This event Select2 Stylesheet
$('#currency_code').trigger('change');
@@ -452,6 +468,7 @@
$('#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');
},
error: function(error, textStatus, errorThrown) {

View File

@@ -121,6 +121,15 @@
{{ Form::recurring('edit', $bill) }}
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
{{ Form::hidden('vendor_name', null, ['id' => 'vendor_name']) }}
{{ Form::hidden('vendor_email', null, ['id' => 'vendor_email']) }}
{{ Form::hidden('vendor_tax_number', null, ['id' => 'vendor_tax_number']) }}
{{ Form::hidden('vendor_phone', null, ['id' => 'vendor_phone']) }}
{{ Form::hidden('vendor_address', null, ['id' => 'vendor_address']) }}
{{ Form::hidden('currency_rate', null, ['id' => 'currency_rate']) }}
{{ Form::hidden('bill_status_code', null, ['id' => 'bill_status_code']) }}
{{ Form::hidden('amount', null, ['id' => 'amount']) }}
</div>
<!-- /.box-body -->
@@ -360,7 +369,14 @@
dataType: 'JSON',
data: 'vendor_id=' + $(this).val(),
success: function(data) {
$('#vendor_name').val(data.name);
$('#vendor_email').val(data.email);
$('#vendor_tax_number').val(data.tax_number);
$('#vendor_phone').val(data.phone);
$('#vendor_address').val(data.address);
$('#currency_code').val(data.currency_code);
$('#currency_rate').val(data.currency_rate);
// This event Select2 Stylesheet
$('#currency_code').trigger('change');

View File

@@ -20,6 +20,7 @@
<div class="input-group-append">
{!! Form::text('currency', $account_currency_code, ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
{!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
{!! Form::hidden('currency_rate', '', ['id' => 'currency_rate']) !!}
</div>
</div>
</div>
@@ -84,6 +85,8 @@
@push('scripts')
<script type="text/javascript">
$(document).ready(function(){
$('#account_id').trigger('change');
//Date picker
$('#paid_at').datepicker({
format: 'yyyy-mm-dd',
@@ -113,18 +116,20 @@
style : 'btn-default',
placeholder : '{{ trans('general.form.no_file_selected') }}'
});
});
$(document).on('change', '#account_id', function (e) {
$.ajax({
url: '{{ url("settings/currencies/currency") }}',
type: 'GET',
dataType: 'JSON',
data: 'account_id=' + $(this).val(),
success: function(data) {
$('#currency').val(data.currency_code);
$('#currency_code').val(data.currency_code);
}
});
$(document).on('change', '#account_id', function (e) {
$.ajax({
url: '{{ url("banking/accounts/currency") }}',
type: 'GET',
dataType: 'JSON',
data: 'account_id=' + $(this).val(),
success: function(data) {
$('#currency').val(data.currency_code);
$('#currency_code').val(data.currency_code);
$('#currency_rate').val(data.currency_rate);
}
});
});

View File

@@ -37,6 +37,7 @@
<div class="input-group-append">
{!! Form::text('currency', $account_currency_code, ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
{!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
{!! Form::hidden('currency_rate', null, ['id' => 'currency_rate']) !!}
</div>
</div>
</div>
@@ -82,6 +83,8 @@
@push('scripts')
<script type="text/javascript">
$(document).ready(function(){
$('#account_id').trigger('change');
//Date picker
$('#paid_at').datepicker({
format: 'yyyy-mm-dd',
@@ -136,18 +139,20 @@
confirmDelete("#attachment-{!! $payment->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $payment->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
});
$(document).on('change', '#account_id', function (e) {
$.ajax({
url: '{{ url("settings/currencies/currency") }}',
type: 'GET',
dataType: 'JSON',
data: 'account_id=' + $(this).val(),
success: function(data) {
$('#currency').val(data.currency_code);
$('#currency_code').val(data.currency_code);
}
});
$(document).on('change', '#account_id', function (e) {
$.ajax({
url: '{{ url("banking/accounts/currency") }}',
type: 'GET',
dataType: 'JSON',
data: 'account_id=' + $(this).val(),
success: function(data) {
$('#currency').val(data.currency_code);
$('#currency_code').val(data.currency_code);
$('#currency_rate').val(data.currency_rate);
}
});
});
</script>