2017-09-14 22:21:00 +03:00
|
|
|
@extends('layouts.admin')
|
|
|
|
|
|
|
|
@section('title', trans('general.title.edit', ['type' => trans_choice('general.revenues', 1)]))
|
|
|
|
|
|
|
|
@section('content')
|
2018-05-02 18:56:05 +03:00
|
|
|
@if (($recurring = $revenue->recurring) && ($next = $recurring->next()))
|
2018-04-28 11:56:11 +03:00
|
|
|
<div class="callout callout-info">
|
|
|
|
<h4>{{ trans('recurring.recurring') }}</h4>
|
|
|
|
|
|
|
|
<p>{{ trans('recurring.message', [
|
|
|
|
'type' => mb_strtolower(trans_choice('general.revenues', 1)),
|
2018-05-02 00:59:55 +03:00
|
|
|
'date' => $next->format($date_format)
|
2018-04-28 11:56:11 +03:00
|
|
|
]) }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
2017-09-14 22:21:00 +03:00
|
|
|
<!-- Default box -->
|
|
|
|
<div class="box box-success">
|
|
|
|
{!! Form::model($revenue, [
|
|
|
|
'method' => 'PATCH',
|
|
|
|
'files' => true,
|
|
|
|
'url' => ['incomes/revenues', $revenue->id],
|
2018-09-17 13:57:03 +03:00
|
|
|
'role' => 'form',
|
|
|
|
'class' => 'form-loading-button'
|
2017-09-14 22:21:00 +03:00
|
|
|
]) !!}
|
|
|
|
|
|
|
|
<div class="box-body">
|
2018-07-18 16:04:33 +03:00
|
|
|
{{ 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::parse($revenue->paid_at)->toDateString()) }}
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2018-07-10 19:37:06 +03:00
|
|
|
{!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
|
|
|
{!! Form::hidden('currency_rate', null, ['id' => 'currency_rate']) !!}
|
|
|
|
|
2018-04-30 11:49:47 +03:00
|
|
|
{{ Form::textGroup('amount', trans('general.amount'), 'money', ['required' => 'required', 'autofocus' => 'autofocus']) }}
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2018-08-15 18:03:21 +03:00
|
|
|
@stack('account_id_input_start')
|
2018-04-26 15:31:26 +03:00
|
|
|
<div class="form-group col-md-6 form-small">
|
|
|
|
{!! Form::label('account_id', trans_choice('general.accounts', 1), ['class' => 'control-label']) !!}
|
2017-09-14 22:21:00 +03:00
|
|
|
<div class="input-group">
|
2018-04-26 15:31:26 +03:00
|
|
|
<div class="input-group-addon"><i class="fa fa-university"></i></div>
|
|
|
|
{!! Form::select('account_id', $accounts, null, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)])])) !!}
|
|
|
|
<div class="input-group-append">
|
2018-04-26 15:42:46 +03:00
|
|
|
{!! Form::text('currency', $account_currency_code, ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
2018-04-26 15:31:26 +03:00
|
|
|
</div>
|
2017-09-14 22:21:00 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-15 18:03:21 +03:00
|
|
|
@stack('account_id_input_end')
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2018-04-26 18:40:04 +03:00
|
|
|
{{ Form::selectGroup('customer_id', trans_choice('general.customers', 1), 'user', $customers, null, []) }}
|
|
|
|
|
2017-09-14 22:21:00 +03:00
|
|
|
{{ Form::textareaGroup('description', trans('general.description')) }}
|
|
|
|
|
|
|
|
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
|
|
|
|
2018-04-26 18:40:04 +03:00
|
|
|
{{ Form::recurring('edit', $revenue) }}
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2017-12-21 18:20:29 +03:00
|
|
|
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods) }}
|
2017-09-14 22:21:00 +03:00
|
|
|
|
|
|
|
{{ Form::textGroup('reference', trans('general.reference'), 'file-text-o',[]) }}
|
|
|
|
|
|
|
|
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
|
|
|
|
</div>
|
|
|
|
<!-- /.box-body -->
|
|
|
|
|
|
|
|
@permission('update-incomes-revenues')
|
|
|
|
<div class="box-footer">
|
|
|
|
{{ Form::saveButtons('incomes/revenues') }}
|
|
|
|
</div>
|
|
|
|
<!-- /.box-footer -->
|
|
|
|
@endpermission
|
|
|
|
|
|
|
|
{!! Form::close() !!}
|
|
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
|
2017-11-13 21:55:15 +03:00
|
|
|
@push('js')
|
2017-09-14 22:21:00 +03:00
|
|
|
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
2018-11-05 17:10:08 +03:00
|
|
|
@if (language()->getShortCode() != 'en')
|
2018-05-01 13:40:08 +03:00
|
|
|
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
2018-11-05 17:10:08 +03:00
|
|
|
@endif
|
2017-09-14 22:21:00 +03:00
|
|
|
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
|
2017-11-13 21:55:15 +03:00
|
|
|
@endpush
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2017-11-13 21:55:15 +03:00
|
|
|
@push('css')
|
2017-09-14 22:21:00 +03:00
|
|
|
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
|
|
|
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
|
2017-11-13 21:55:15 +03:00
|
|
|
@endpush
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2017-11-13 21:55:15 +03:00
|
|
|
@push('scripts')
|
2017-09-14 22:21:00 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
2018-08-13 21:14:58 +03:00
|
|
|
$("#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
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#amount').trigger('focus');
|
|
|
|
|
2018-06-25 17:53:43 +03:00
|
|
|
$('#account_id').trigger('change');
|
|
|
|
|
2017-09-14 22:21:00 +03:00
|
|
|
//Date picker
|
|
|
|
$('#paid_at').datepicker({
|
|
|
|
format: 'yyyy-mm-dd',
|
2018-09-17 11:49:36 +03:00
|
|
|
todayBtn: 'linked',
|
2018-06-24 00:36:46 +03:00
|
|
|
weekStart: 1,
|
2018-05-01 13:40:08 +03:00
|
|
|
autoclose: true,
|
|
|
|
language: '{{ language()->getShortCode() }}'
|
2017-09-14 22:21:00 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
$("#account_id").select2({
|
|
|
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)]) }}"
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#category_id").select2({
|
|
|
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)]) }}"
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#customer_id").select2({
|
2018-08-13 11:45:28 +03:00
|
|
|
placeholder: {
|
|
|
|
id: '-1', // the value of the option
|
|
|
|
text: "{{ trans('general.form.select.field', ['field' => trans_choice('general.customers', 1)]) }}"
|
|
|
|
}
|
2017-09-14 22:21:00 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
$("#payment_method").select2({
|
|
|
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#attachment').fancyfile({
|
|
|
|
text : '{{ trans('general.form.select.file') }}',
|
|
|
|
style : 'btn-default',
|
2018-01-02 18:20:52 +03:00
|
|
|
@if($revenue->attachment)
|
|
|
|
placeholder : '<?php echo $revenue->attachment->basename; ?>'
|
2018-01-03 14:02:27 +03:00
|
|
|
@else
|
|
|
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
2018-01-02 18:20:52 +03:00
|
|
|
@endif
|
2017-09-14 22:21:00 +03:00
|
|
|
});
|
|
|
|
|
2018-01-02 18:20:52 +03:00
|
|
|
@if($revenue->attachment)
|
|
|
|
attachment_html = '<span class="attachment">';
|
|
|
|
attachment_html += ' <a href="{{ url('uploads/' . $revenue->attachment->id . '/download') }}">';
|
|
|
|
attachment_html += ' <span id="download-attachment" class="text-primary">';
|
|
|
|
attachment_html += ' <i class="fa fa-file-{{ $revenue->attachment->aggregate_type }}-o"></i> {{ $revenue->attachment->basename }}';
|
|
|
|
attachment_html += ' </span>';
|
|
|
|
attachment_html += ' </a>';
|
|
|
|
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $revenue->attachment->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $revenue->attachment->id)], 'style' => 'display:inline']) !!}';
|
|
|
|
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
|
|
|
|
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
|
|
|
attachment_html += ' </a>';
|
|
|
|
attachment_html += ' {!! Form::close() !!}';
|
|
|
|
attachment_html += '</span>';
|
|
|
|
|
|
|
|
$('.fancy-file .fake-file').append(attachment_html);
|
|
|
|
|
|
|
|
$(document).on('click', '#remove-attachment', function (e) {
|
|
|
|
confirmDelete("#attachment-{!! $revenue->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $revenue->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
|
|
|
});
|
|
|
|
@endif
|
2018-06-25 17:53:43 +03:00
|
|
|
});
|
2018-01-02 18:20:52 +03:00
|
|
|
|
2018-06-25 17:53:43 +03:00
|
|
|
$(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);
|
2018-08-13 21:14:58 +03:00
|
|
|
|
|
|
|
amount = $('#amount').maskMoney('unmasked')[0];
|
|
|
|
|
|
|
|
$("#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
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#amount').val(amount);
|
|
|
|
|
|
|
|
$('#amount').trigger('focus');
|
2018-06-25 17:53:43 +03:00
|
|
|
}
|
2017-09-14 22:21:00 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2017-11-13 21:55:15 +03:00
|
|
|
@endpush
|