first commit
This commit is contained in:
		
							
								
								
									
										141
									
								
								resources/views/expenses/bills/bill.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								resources/views/expenses/bills/bill.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,141 @@
 | 
			
		||||
@extends('layouts.bill')
 | 
			
		||||
 | 
			
		||||
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number)
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <section class="bill">
 | 
			
		||||
        <div class="row invoice-header">
 | 
			
		||||
            <div class="col-xs-7">
 | 
			
		||||
                @if (setting('general.invoice_logo'))
 | 
			
		||||
                    <img src="{{ asset(setting('general.invoice_logo')) }}" class="invoice-logo" />
 | 
			
		||||
                @else
 | 
			
		||||
                    <img src="{{ asset(setting('general.company_logo')) }}" class="invoice-logo" />
 | 
			
		||||
                @endif
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-xs-5 invoice-company">
 | 
			
		||||
                <address>
 | 
			
		||||
                    <strong>{{ setting('general.company_name') }}</strong><br>
 | 
			
		||||
                    {{ setting('general.company_address') }}<br>
 | 
			
		||||
                    @if (setting('general.company_tax_number'))
 | 
			
		||||
                        {{ trans('general.tax_number') }}: {{ setting('general.company_tax_number') }}<br>
 | 
			
		||||
                    @endif
 | 
			
		||||
                    <br>
 | 
			
		||||
                    @if (setting('general.company_phone'))
 | 
			
		||||
                        {{ setting('general.company_phone') }}<br>
 | 
			
		||||
                    @endif
 | 
			
		||||
                    {{ setting('general.company_email') }}
 | 
			
		||||
                </address>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-xs-7">
 | 
			
		||||
                {{ trans('bills.bill_from') }}
 | 
			
		||||
                <address>
 | 
			
		||||
                    <strong>{{ $bill->vendor_name }}</strong><br>
 | 
			
		||||
                    {{ $bill->vendor_address }}<br>
 | 
			
		||||
                    @if ($bill->vendor_tax_number)
 | 
			
		||||
                        {{ trans('general.tax_number') }}: {{ $bill->vendor_tax_number }}<br>
 | 
			
		||||
                    @endif
 | 
			
		||||
                    <br>
 | 
			
		||||
                    @if ($bill->vendor_phone)
 | 
			
		||||
                        {{ $bill->vendor_phone }}<br>
 | 
			
		||||
                    @endif
 | 
			
		||||
                    {{ $bill->vendor_email }}
 | 
			
		||||
                </address>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-xs-5">
 | 
			
		||||
                <div class="table-responsive">
 | 
			
		||||
                    <table class="table no-border">
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('bills.bill_number') }}:</th>
 | 
			
		||||
                            <td class="text-right">{{ $bill->bill_number }}</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        @if ($bill->order_number)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.order_number') }}:</th>
 | 
			
		||||
                                <td class="text-right">{{ $bill->order_number }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('bills.bill_date') }}:</th>
 | 
			
		||||
                            <td class="text-right">{{ Date::parse($bill->billed_at)->format($date_format) }}</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('bills.payment_due') }}:</th>
 | 
			
		||||
                            <td class="text-right">{{ Date::parse($bill->due_at)->format($date_format) }}</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-xs-12 table-responsive">
 | 
			
		||||
                <table class="table table-striped">
 | 
			
		||||
                    <tbody>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>{{ trans_choice('general.items', 1) }}</th>
 | 
			
		||||
                        <th class="text-center">{{ trans('bills.quantity') }}</th>
 | 
			
		||||
                        <th class="text-right">{{ trans('bills.price') }}</th>
 | 
			
		||||
                        <th class="text-right">{{ trans('bills.total') }}</th>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    @foreach($bill->items as $item)
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                {{ $item->name }}
 | 
			
		||||
                                @if ($item->sku)
 | 
			
		||||
                                    <br><small>{{ trans('items.sku') }}: {{ $item->sku }}</small>
 | 
			
		||||
                                @endif
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td class="text-center">{{ $item->quantity }}</td>
 | 
			
		||||
                            <td class="text-right">@money($item->price, $bill->currency_code, true)</td>
 | 
			
		||||
                            <td class="text-right">@money($item->total - $item->tax, $bill->currency_code, true)</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                    @endforeach
 | 
			
		||||
                    </tbody>
 | 
			
		||||
                </table>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-xs-7">
 | 
			
		||||
                @if ($bill->notes)
 | 
			
		||||
                    <p class="lead">{{ trans_choice('general.notes', 2) }}:</p>
 | 
			
		||||
 | 
			
		||||
                    <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
 | 
			
		||||
                        {{ $bill->notes }}
 | 
			
		||||
                    </p>
 | 
			
		||||
                @endif
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-xs-5">
 | 
			
		||||
                <div class="table-responsive">
 | 
			
		||||
                    <table class="table">
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th style="width:50%">{{ trans('bills.sub_total') }}:</th>
 | 
			
		||||
                            <td class="text-right">@money($bill->sub_total, $bill->currency_code, true)</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('bills.tax_total') }}:</th>
 | 
			
		||||
                            <td class="text-right">@money($bill->tax_total, $bill->currency_code, true)</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        @if($bill->paid)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.paid') }}:</th>
 | 
			
		||||
                                <td class="text-right">@money('-' . $bill->paid, $bill->currency_code, true)</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('bills.total') }}:</th>
 | 
			
		||||
                            <td class="text-right">@money($bill->grand_total, $bill->currency_code, true)</td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </section>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										264
									
								
								resources/views/expenses/bills/create.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										264
									
								
								resources/views/expenses/bills/create.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,264 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.new', ['type' => trans_choice('general.bills', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
<!-- Default box -->
 | 
			
		||||
<div class="box box-success">
 | 
			
		||||
    {!! Form::open(['url' => 'expenses/bills', 'files' => true, 'role' => 'form']) !!}
 | 
			
		||||
 | 
			
		||||
    <div class="box-body">
 | 
			
		||||
        {{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('general.default_currency')) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('billed_at', trans('bills.bill_date'), 'calendar',['id' => 'billed_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy/mm/dd\'', 'data-mask' => ''],Date::now()->toDateString()) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('due_at', trans('bills.due_date'), 'calendar',['id' => 'due_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy/mm/dd\'', 'data-mask' => ''],Date::now()->toDateString()) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('bill_number', trans('bills.bill_number'), 'file-text-o') }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
 | 
			
		||||
 | 
			
		||||
        <div class="form-group col-md-12">
 | 
			
		||||
            {!! Form::label('items', trans_choice('general.items', 1), ['class' => 'control-label']) !!}
 | 
			
		||||
            <div class="table-responsive">
 | 
			
		||||
                <table class="table table-bordered" id="items">
 | 
			
		||||
                    <thead>
 | 
			
		||||
                        <tr style="background-color: #f9f9f9;">
 | 
			
		||||
                            <th width="5%"  class="text-center">{{ trans('general.actions') }}</th>
 | 
			
		||||
                            <th width="40%" class="text-left">{{ trans('general.name') }}</th>
 | 
			
		||||
                            <th width="5%" class="text-center">{{ trans('bills.quantity') }}</th>
 | 
			
		||||
                            <th width="10%" class="text-right">{{ trans('bills.price') }}</th>
 | 
			
		||||
                            <th width="15%" class="text-right">{{ trans_choice('general.taxes', 1) }}</th>
 | 
			
		||||
                            <th width="10%" class="text-right">{{ trans('bills.total') }}</th>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                    </thead>
 | 
			
		||||
                    <tbody>
 | 
			
		||||
                        <?php $item_row = 0; ?>
 | 
			
		||||
                        <tr id="item-row-{{ $item_row }}">
 | 
			
		||||
                            <td class="text-center" style="vertical-align: middle;">
 | 
			
		||||
                                <button type="button" onclick="$(this).tooltip('destroy'); $('#item-row-{{ $item_row }}').remove(); totalItem();" data-toggle="tooltip" title="{{ trans('general.delete') }}" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <input class="form-control typeahead" required="required" placeholder="{{ trans('general.form.enter', ['field' => trans_choice('bills.item_name', 1)]) }}" name="item[{{ $item_row }}][name]" type="text" id="item-name-{{ $item_row }}">
 | 
			
		||||
                                <input name="item[{{ $item_row }}][item_id]" type="hidden" id="item-id-{{ $item_row }}">
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <input class="form-control text-center" required="required" name="item[{{ $item_row }}][quantity]" type="text" id="item-quantity-{{ $item_row }}">
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <input class="form-control text-right" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                {!! Form::select('item[' . $item_row . '][tax]', $taxes, setting('general.default_tax'), ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control select2', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)])]) !!}
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td class="text-right" style="vertical-align: middle;">
 | 
			
		||||
                                <span id="item-total-{{ $item_row }}">0</span>
 | 
			
		||||
                            </td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <?php $item_row++; ?>
 | 
			
		||||
                        <tr id="addItem">
 | 
			
		||||
                            <td class="text-center"><button type="button" onclick="addItem();" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-xs btn-primary" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i></button></td>
 | 
			
		||||
                            <td class="text-right" colspan="5"></td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <td class="text-right" colspan="5"><strong>{{ trans('bills.sub_total') }}</strong></td>
 | 
			
		||||
                            <td class="text-right"><span id="sub-total">0</span></td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <td class="text-right" colspan="5"><strong>{{ trans_choice('general.taxes', 1) }}</strong></td>
 | 
			
		||||
                            <td class="text-right"><span id="tax-total">0</span></td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <td class="text-right" colspan="5"><strong>{{ trans('bills.total') }}</strong></td>
 | 
			
		||||
                            <td class="text-right"><span id="grand-total">0</span></td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                    </tbody>
 | 
			
		||||
                </table>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        {{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
    <div class="box-footer">
 | 
			
		||||
        {{ Form::saveButtons('expenses/bills') }}
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-footer -->
 | 
			
		||||
 | 
			
		||||
    {!! Form::close() !!}
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('js')
 | 
			
		||||
    <script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
 | 
			
		||||
    <script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
 | 
			
		||||
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.1/bootstrap3-typeahead.min.js"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('css')
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        var item_row = {{ $item_row }};
 | 
			
		||||
 | 
			
		||||
        function addItem() {
 | 
			
		||||
            html  = '<tr id="item-row-' + item_row + '">';
 | 
			
		||||
            html += '  <td class="text-center" style="vertical-align: middle;">';
 | 
			
		||||
            html += '      <button type="button" onclick="$(this).tooltip(\'destroy\'); $(\'#item-row-' + item_row + '\').remove(); totalItem();" data-toggle="tooltip" title="{{ trans('general.delete') }}" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control typeahead" required="required" placeholder="{{ trans('general.form.enter', ['field' => trans_choice('bills.item_name', 1)]) }}" name="item[' + item_row + '][name]" type="text" id="item-name-' + item_row + '">';
 | 
			
		||||
            html += '      <input name="item[' + item_row + '][item_id]" type="hidden" id="item-id-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control text-center" required="required" name="item[' + item_row + '][quantity]" type="text" id="item-quantity-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control text-right" required="required" name="item[' + item_row + '][price]" type="text" id="item-price-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <select class="form-control select2" name="item[' + item_row + '][tax]" id="item-tax-' + item_row + '">';
 | 
			
		||||
            html += '         <option selected="selected" value="">{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}</option>';
 | 
			
		||||
            @foreach($taxes as $tax_key => $tax_value)
 | 
			
		||||
            html += '         <option value="{{ $tax_key }}">{{ $tax_value }}</option>';
 | 
			
		||||
            @endforeach
 | 
			
		||||
            html += '      </select>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td class="text-right" style="vertical-align: middle;">';
 | 
			
		||||
            html += '      <span id="item-total-' + item_row + '">0</span>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
 | 
			
		||||
            $('#items tbody #addItem').before(html);
 | 
			
		||||
            //$('[rel=tooltip]').tooltip();
 | 
			
		||||
 | 
			
		||||
            $('[data-toggle="tooltip"]').tooltip('hide');
 | 
			
		||||
 | 
			
		||||
            $('#item-row-' + item_row + ' .select2').select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            item_row++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            //Date picker
 | 
			
		||||
            $('#billed_at').datepicker({
 | 
			
		||||
                format: 'yyyy-mm-dd',
 | 
			
		||||
                autoclose: true
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //Date picker
 | 
			
		||||
            $('#due_at').datepicker({
 | 
			
		||||
                format: 'yyyy-mm-dd',
 | 
			
		||||
                autoclose: true
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(".select2").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $("#vendor_id").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $("#currency_code").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $('#attachment').fancyfile({
 | 
			
		||||
                text  : '{{ trans('general.form.select.file') }}',
 | 
			
		||||
                style : 'btn-default',
 | 
			
		||||
                placeholder : '{{ trans('general.form.no_file_selected') }}'
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            var autocomplete_path = "{{ url('items/items/autocomplete') }}";
 | 
			
		||||
 | 
			
		||||
            $(document).on('click', '.form-control.typeahead', function() {
 | 
			
		||||
                input_id = $(this).attr('id').split('-');
 | 
			
		||||
 | 
			
		||||
                item_id = parseInt(input_id[input_id.length-1]);
 | 
			
		||||
 | 
			
		||||
                $(this).typeahead({
 | 
			
		||||
                    minLength: 3,
 | 
			
		||||
                    displayText:function (data) {
 | 
			
		||||
                        return data.name;
 | 
			
		||||
                    },
 | 
			
		||||
                    source: function (query, process) {
 | 
			
		||||
                        $.ajax({
 | 
			
		||||
                            url: autocomplete_path,
 | 
			
		||||
                            type: 'GET',
 | 
			
		||||
                            dataType: 'JSON',
 | 
			
		||||
                            data: 'query=' + query + '&type=bill¤cy_code=' + $('#currency_code').val(),
 | 
			
		||||
                            success: function(data) {
 | 
			
		||||
                                return process(data);
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
                    },
 | 
			
		||||
                    afterSelect: function (data) {
 | 
			
		||||
                        $('#item-id-' + item_id).val(data.item_id);
 | 
			
		||||
                        $('#item-quantity-' + item_id).val('1');
 | 
			
		||||
                        $('#item-price-' + item_id).val(data.purchase_price);
 | 
			
		||||
                        $('#item-tax-' + item_id).val(data.tax_id);
 | 
			
		||||
 | 
			
		||||
                        // This event Select2 Stylesheet
 | 
			
		||||
                        $('#item-tax-' + item_id).trigger('change');
 | 
			
		||||
 | 
			
		||||
                        $('#item-total-' + item_id).html(data.total);
 | 
			
		||||
 | 
			
		||||
                        totalItem();
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('change', '#currency_code, #items tbody select', function(){
 | 
			
		||||
                totalItem();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('keyup', '#items tbody .form-control', function(){
 | 
			
		||||
                totalItem();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('change', '#vendor_id', function (e) {
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    url: '{{ url("expenses/vendors/currency") }}',
 | 
			
		||||
                    type: 'GET',
 | 
			
		||||
                    dataType: 'JSON',
 | 
			
		||||
                    data: 'vendor_id=' + $(this).val(),
 | 
			
		||||
                    success: function(data) {
 | 
			
		||||
                        $('#currency_code').val(data.currency_code);
 | 
			
		||||
 | 
			
		||||
                        // This event Select2 Stylesheet
 | 
			
		||||
                        $('#currency_code').trigger('change');
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        function totalItem() {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("items/items/totalItem") }}',
 | 
			
		||||
                type: 'POST',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'hidden\'], #items textarea, #items select'),
 | 
			
		||||
                headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
 | 
			
		||||
                success: function(data) {
 | 
			
		||||
                    if (data) {
 | 
			
		||||
                        $.each( data.items, function( key, value ) {
 | 
			
		||||
                            $('#item-total-' + key).html(value);
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        $('#sub-total').html(data.sub_total);
 | 
			
		||||
                        $('#tax-total').html(data.tax_total);
 | 
			
		||||
                        $('#grand-total').html(data.grand_total);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										294
									
								
								resources/views/expenses/bills/edit.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										294
									
								
								resources/views/expenses/bills/edit.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,294 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.edit', ['type' => trans_choice('general.bills', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <!-- Default box -->
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        {!! Form::model($bill, ['method' => 'PATCH', 'files' => true, 'url' => ['expenses/bills', $bill->id], 'role' => 'form']) !!}
 | 
			
		||||
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('billed_at', trans('bills.bill_date'), 'calendar',['id' => 'billed_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy/mm/dd\'', 'data-mask' => ''],Date::now()->toDateString()) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('due_at', trans('bills.due_date'), 'calendar',['id' => 'due_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy/mm/dd\'', 'data-mask' => ''],Date::now()->toDateString()) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('bill_number', trans('bills.bill_number'), 'file-text-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
 | 
			
		||||
 | 
			
		||||
            <div class="form-group col-md-12">
 | 
			
		||||
                {!! Form::label('items', trans_choice('general.items', 1), ['class' => 'control-label']) !!}
 | 
			
		||||
                <div class="table-responsive">
 | 
			
		||||
                    <table class="table table-bordered" id="items">
 | 
			
		||||
                        <thead>
 | 
			
		||||
                            <tr style="background-color: #f9f9f9;">
 | 
			
		||||
                                <th width="5%"  class="text-center">{{ trans('general.actions') }}</th>
 | 
			
		||||
                                <th width="40%" class="text-left">{{ trans('general.name') }}</th>
 | 
			
		||||
                                <th width="5%" class="text-center">{{ trans('bills.quantity') }}</th>
 | 
			
		||||
                                <th width="10%" class="text-right">{{ trans('bills.price') }}</th>
 | 
			
		||||
                                <th width="15%" class="text-right">{{ trans_choice('general.taxes', 1) }}</th>
 | 
			
		||||
                                <th width="10%" class="text-right">{{ trans('bills.total') }}</th>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        </thead>
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                        <?php $item_row = 0; ?>
 | 
			
		||||
                        @foreach($bill->items as $item)
 | 
			
		||||
                            <tr id="item-row-{{ $item_row }}">
 | 
			
		||||
                                <td class="text-center" style="vertical-align: middle;">
 | 
			
		||||
                                    <button type="button" onclick="$(this).tooltip('destroy'); $('#item-row-{{ $item_row }}').remove(); totalItem();" data-toggle="tooltip" title="Remove Item" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input value="{{ $item->name }}" class="form-control typeahead" required="required" placeholder="Enter Item Name" name="item[{{ $item_row }}][name]" type="text" id="item-name-{{ $item_row }}">
 | 
			
		||||
                                    <input value="{{ $item->item_id }}" name="item[{{ $item_row }}][item_id]" type="hidden" id="item-id-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input value="{{ $item->quantity }}" class="form-control text-center" required="required" name="item[{{ $item_row }}][quantity]" type="text" id="item-quantity-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input value="{{ $item->price }}" class="form-control text-right" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    {!! Form::select('item[' . $item_row . '][tax]', $taxes, $item->tax, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control select2', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)])]) !!}
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td class="text-right" style="vertical-align: middle;">
 | 
			
		||||
                                    <span id="item-total-{{ $item_row }}">@money($item->total, $bill->currency_code, true)</span>
 | 
			
		||||
                                </td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            <?php $item_row++; ?>
 | 
			
		||||
                        @endforeach
 | 
			
		||||
                        @if (empty($bill->items))
 | 
			
		||||
                            <tr id="item-row-{{ $item_row }}">
 | 
			
		||||
                                <td class="text-center" style="vertical-align: middle;">
 | 
			
		||||
                                    <button type="button" onclick="$(this).tooltip('destroy'); $('#item-row-{{ $item_row }}').remove(); totalItem();" data-toggle="tooltip" title="{{ trans('general.delete') }}" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input class="form-control typeahead" required="required" placeholder="{{ trans('general.form.enter', ['field' => trans_choice('bills.item_name', 1)]) }}" name="item[{{ $item_row }}][name]" type="text" id="item-name-{{ $item_row }}">
 | 
			
		||||
                                    <input name="item[{{ $item_row }}][item_id]" type="hidden" id="item-id-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input class="form-control text-center" required="required" name="item[{{ $item_row }}][quantity]" type="text" id="item-quantity-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <input class="form-control text-right" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    {!! Form::select('item[' . $item_row . '][tax]', $taxes, null, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control select2', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)])])  !!}
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td class="text-right" style="vertical-align: middle;">
 | 
			
		||||
                                    <span id="item-total-{{ $item_row }}">0</span>
 | 
			
		||||
                                </td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        @endif
 | 
			
		||||
                            <?php $item_row++; ?>
 | 
			
		||||
                            <tr id="addItem">
 | 
			
		||||
                                <td class="text-center"><button type="button" onclick="addItem();" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-xs btn-primary" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i></button></td>
 | 
			
		||||
                                <td class="text-right" colspan="5"></td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td class="text-right" colspan="5"><strong>{{ trans('bills.sub_total') }}</strong></td>
 | 
			
		||||
                                <td class="text-right"><span id="sub-total">0</span></td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td class="text-right" colspan="5"><strong>{{ trans_choice('general.taxes', 1) }}</strong></td>
 | 
			
		||||
                                <td class="text-right"><span id="tax-total">0</span></td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td class="text-right" colspan="5"><strong>{{ trans('bills.total') }}</strong></td>
 | 
			
		||||
                                <td class="text-right"><span id="grand-total">0</span></td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            {{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
        @permission('update-expenses-bills')
 | 
			
		||||
        <div class="box-footer">
 | 
			
		||||
            {{ Form::saveButtons('expenses/bills') }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-footer -->
 | 
			
		||||
        @endpermission
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('js')
 | 
			
		||||
    <script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
 | 
			
		||||
    <script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
 | 
			
		||||
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.1/bootstrap3-typeahead.min.js"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('css')
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        var item_row = {{ $item_row }};
 | 
			
		||||
 | 
			
		||||
        function addItem() {
 | 
			
		||||
            html  = '<tr id="item-row-' + item_row + '">';
 | 
			
		||||
            html += '  <td class="text-center" style="vertical-align: middle;">';
 | 
			
		||||
            html += '      <button type="button" onclick="$(this).tooltip(\'destroy\'); $(\'#item-row-' + item_row + '\').remove(); totalItem();" data-toggle="tooltip" title="{{ trans('general.delete') }}" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control typeahead" required="required" placeholder="{{ trans('general.form.enter', ['field' => trans_choice('bills.item_name', 1)]) }}" name="item[' + item_row + '][name]" type="text" id="item-name-' + item_row + '">';
 | 
			
		||||
            html += '      <input name="item[' + item_row + '][item_id]" type="hidden" id="item-id-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control text-center" required="required" name="item[' + item_row + '][quantity]" type="text" id="item-quantity-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <input class="form-control text-right" required="required" name="item[' + item_row + '][price]" type="text" id="item-price-' + item_row + '">';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td>';
 | 
			
		||||
            html += '      <select class="form-control select2" name="item[' + item_row + '][tax]" id="item-tax-' + item_row + '">';
 | 
			
		||||
            html += '         <option selected="selected" value="">{{ trans('general.form.select.filed', ['field' => trans_choice('general.taxes', 1)]) }}</option>';
 | 
			
		||||
            @foreach($taxes as $tax_key => $tax_value)
 | 
			
		||||
            html += '         <option value="{{ $tax_key }}">{{ $tax_value }}</option>';
 | 
			
		||||
            @endforeach
 | 
			
		||||
            html += '      </select>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
            html += '  <td class="text-right" style="vertical-align: middle;">';
 | 
			
		||||
            html += '      <span id="item-total-' + item_row + '">0</span>';
 | 
			
		||||
            html += '  </td>';
 | 
			
		||||
 | 
			
		||||
            $('#items tbody #addItem').before(html);
 | 
			
		||||
            //$('[rel=tooltip]').tooltip();
 | 
			
		||||
 | 
			
		||||
            $('[data-toggle="tooltip"]').tooltip('hide');
 | 
			
		||||
 | 
			
		||||
            $('#item-row-' + item_row + ' .select2').select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            item_row++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            totalItem();
 | 
			
		||||
 | 
			
		||||
            //Date picker
 | 
			
		||||
            $('#billed_at').datepicker({
 | 
			
		||||
                format: 'yyyy-mm-dd',
 | 
			
		||||
                autoclose: true
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //Date picker
 | 
			
		||||
            $('#due_at').datepicker({
 | 
			
		||||
                format: 'yyyy-mm-dd',
 | 
			
		||||
                autoclose: true
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(".select2").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $("#vendor_id").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $("#currency_code").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $('#attachment').fancyfile({
 | 
			
		||||
                text  : '{{ trans('general.form.select.file') }}',
 | 
			
		||||
                style : 'btn-default',
 | 
			
		||||
                placeholder : '<?php echo $bill->attachment; ?>'
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            var autocomplete_path = "{{ url('items/items/autocomplete') }}";
 | 
			
		||||
 | 
			
		||||
            $(document).on('click', '.form-control.typeahead', function() {
 | 
			
		||||
                input_id = $(this).attr('id').split('-');
 | 
			
		||||
 | 
			
		||||
                item_id = parseInt(input_id[input_id.length-1]);
 | 
			
		||||
 | 
			
		||||
                $(this).typeahead({
 | 
			
		||||
                    minLength: 3,
 | 
			
		||||
                    displayText:function (data) {
 | 
			
		||||
                        return data.name;
 | 
			
		||||
                    },
 | 
			
		||||
                    source: function (query, process) {
 | 
			
		||||
                        $.ajax({
 | 
			
		||||
                            url: autocomplete_path,
 | 
			
		||||
                            type: 'GET',
 | 
			
		||||
                            dataType: 'JSON',
 | 
			
		||||
                            data: 'query=' + query + '&type=bill¤cy_code=' + $('#currency_code').val(),
 | 
			
		||||
                            success: function(data) {
 | 
			
		||||
                                return process(data);
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
                    },
 | 
			
		||||
                    afterSelect: function (data) {
 | 
			
		||||
                        $('#item-id-' + item_id).val(data.item_id);
 | 
			
		||||
                        $('#item-quantity-' + item_id).val('1');
 | 
			
		||||
                        $('#item-price-' + item_id).val(data.purchase_price);
 | 
			
		||||
                        $('#item-tax-' + item_id).val(data.tax_id);
 | 
			
		||||
 | 
			
		||||
                        // This event Select2 Stylesheet
 | 
			
		||||
                        $('#item-tax-' + item_id).trigger('change');
 | 
			
		||||
 | 
			
		||||
                        $('#item-total-' + item_id).html(data.total);
 | 
			
		||||
 | 
			
		||||
                        totalItem();
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('change', '#currency_code, #items tbody select', function(){
 | 
			
		||||
                totalItem();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('keyup', '#items tbody .form-control', function(){
 | 
			
		||||
                totalItem();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('change', '#vendor_id', function (e) {
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    url: '{{ url("expenses/vendors/currency") }}',
 | 
			
		||||
                    type: 'GET',
 | 
			
		||||
                    dataType: 'JSON',
 | 
			
		||||
                    data: 'vendor_id=' + $(this).val(),
 | 
			
		||||
                    success: function(data) {
 | 
			
		||||
                        $('#currency_code').val(data.currency_code);
 | 
			
		||||
 | 
			
		||||
                        // This event Select2 Stylesheet
 | 
			
		||||
                        $('#currency_code').trigger('change');
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        function totalItem() {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("items/items/totalItem") }}',
 | 
			
		||||
                type: 'POST',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'hidden\'], #items textarea, #items select'),
 | 
			
		||||
                headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
 | 
			
		||||
                success: function(data) {
 | 
			
		||||
                    if (data) {
 | 
			
		||||
                        $.each( data.items, function( key, value ) {
 | 
			
		||||
                            $('#item-total-' + key).html(value);
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        $('#sub-total').html(data.sub_total);
 | 
			
		||||
                        $('#tax-total').html(data.tax_total);
 | 
			
		||||
                        $('#grand-total').html(data.grand_total);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										75
									
								
								resources/views/expenses/bills/index.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								resources/views/expenses/bills/index.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans_choice('general.bills', 2))
 | 
			
		||||
 | 
			
		||||
@permission('create-expenses-bills')
 | 
			
		||||
@section('new_button')
 | 
			
		||||
<span class="new-button"><a href="{{ url('expenses/bills/create') }}" class="btn btn-success btn-sm"><span class="fa fa-plus"></span>  {{ trans('general.add_new') }}</a></span>
 | 
			
		||||
@endsection
 | 
			
		||||
@endpermission
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
<!-- Default box -->
 | 
			
		||||
<div class="box box-success">
 | 
			
		||||
    <div class="box-header">
 | 
			
		||||
        {!! Form::open(['url' => 'expenses/bills', 'role' => 'form', 'method' => 'GET']) !!}
 | 
			
		||||
        <div class="pull-left">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.search') }}:</span>
 | 
			
		||||
            {!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
 | 
			
		||||
            {!! Form::select('status', $status, request('status'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('status.all')]) !!}
 | 
			
		||||
            {!! Form::button('<span class="fa fa-filter"></span>  ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="pull-right">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.show') }}:</span>
 | 
			
		||||
            {!! Form::select('limit', $limits, request('limit', setting('general.list_limit', '25')), ['class' => 'form-control input-filter input-sm', 'onchange' => 'this.form.submit()']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-header -->
 | 
			
		||||
 | 
			
		||||
    <div class="box-body">
 | 
			
		||||
        <div class="table table-responsive">
 | 
			
		||||
            <table class="table table-bordered table-striped table-hover" id="tbl-bills">
 | 
			
		||||
                <thead>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th class="col-md-1">@sortablelink('bill_number', trans_choice('general.numbers', 1))</th>
 | 
			
		||||
                        <th class="col-md-3">@sortablelink('vendor_name', trans_choice('general.vendors', 1))</th>
 | 
			
		||||
                        <th class="col-md-1">@sortablelink('amount', trans('general.amount'))</th>
 | 
			
		||||
                        <th class="col-md-1">@sortablelink('status.name', trans('general.status'))</th>
 | 
			
		||||
                        <th>@sortablelink('billed_at', trans('bills.bill_date'))</th>
 | 
			
		||||
                        <th>@sortablelink('due_at', trans('bills.due_date'))</th>
 | 
			
		||||
                        <th class="col-md-3">{{ trans('general.actions') }}</th>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </thead>
 | 
			
		||||
                <tbody>
 | 
			
		||||
                @foreach($bills as $item)
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td><a href="{{ url('expenses/bills/' . $item->id . ' ') }}">{{ $item->bill_number }}</a></td>
 | 
			
		||||
                        <td>{{ $item->vendor_name }}</td>
 | 
			
		||||
                        <td>@money($item->amount, $item->currency_code, true)</td>
 | 
			
		||||
                        <td>{{ $item->status->name }}</td>
 | 
			
		||||
                        <td>{{ Date::parse($item->billed_at)->format($date_format) }}</td>
 | 
			
		||||
                        <td>{{ Date::parse($item->due_at)->format($date_format) }}</td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <a href="{{ url('expenses/bills/' . $item->id) }}" class="btn btn-info btn-xs"><i class="fa fa-eye" aria-hidden="true"></i> {{ trans('general.show') }}</a>
 | 
			
		||||
                            <a href="{{ url('expenses/bills/' . $item->id . '/edit') }}" class="btn btn-primary btn-xs"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
 | 
			
		||||
                            @permission('delete-expenses-bills')
 | 
			
		||||
                            {!! Form::deleteButton($item, 'expenses/bills') !!}
 | 
			
		||||
                            @endpermission
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                @endforeach
 | 
			
		||||
                </tbody>
 | 
			
		||||
            </table>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
    <div class="box-footer">
 | 
			
		||||
        @include('partials.admin.pagination', ['items' => $bills, 'type' => 'bills'])
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-footer -->
 | 
			
		||||
</div>
 | 
			
		||||
<!-- /.box -->
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										449
									
								
								resources/views/expenses/bills/show.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										449
									
								
								resources/views/expenses/bills/show.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,449 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number)
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        <div class="bill">
 | 
			
		||||
            <span class="badge bg-aqua">{{ $bill->status->name }}</span>
 | 
			
		||||
 | 
			
		||||
            <div class="row invoice-header">
 | 
			
		||||
                <div class="col-xs-7">
 | 
			
		||||
                    @if (setting('general.invoice_logo'))
 | 
			
		||||
                        <img src="{{ asset(setting('general.invoice_logo')) }}" class="invoice-logo" />
 | 
			
		||||
                    @else
 | 
			
		||||
                        <img src="{{ asset(setting('general.company_logo')) }}" class="invoice-logo" />
 | 
			
		||||
                    @endif
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-xs-5 invoice-company">
 | 
			
		||||
                    <address>
 | 
			
		||||
                        <strong>{{ setting('general.company_name') }}</strong><br>
 | 
			
		||||
                        {{ setting('general.company_address') }}<br>
 | 
			
		||||
                        @if (setting('general.company_tax_number'))
 | 
			
		||||
                            {{ trans('general.tax_number') }}: {{ setting('general.company_tax_number') }}<br>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        <br>
 | 
			
		||||
                        @if (setting('general.company_phone'))
 | 
			
		||||
                            {{ setting('general.company_phone') }}<br>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        {{ setting('general.company_email') }}
 | 
			
		||||
                    </address>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-xs-7">
 | 
			
		||||
                    {{ trans('bills.bill_from') }}
 | 
			
		||||
                    <address>
 | 
			
		||||
                        <strong>{{ $bill->vendor_name }}</strong><br>
 | 
			
		||||
                        {{ $bill->vendor_address }}<br>
 | 
			
		||||
                        @if ($bill->vendor_tax_number)
 | 
			
		||||
                        {{ trans('general.tax_number') }}: {{ $bill->vendor_tax_number }}<br>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        <br>
 | 
			
		||||
                        @if ($bill->vendor_phone)
 | 
			
		||||
                        {{ $bill->vendor_phone }}<br>
 | 
			
		||||
                        @endif
 | 
			
		||||
                        {{ $bill->vendor_email }}
 | 
			
		||||
                    </address>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-xs-5">
 | 
			
		||||
                    <div class="table-responsive">
 | 
			
		||||
                        <table class="table no-border">
 | 
			
		||||
                            <tbody>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.bill_number') }}:</th>
 | 
			
		||||
                                <td class="text-right">{{ $bill->bill_number }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            @if ($bill->order_number)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.order_number') }}:</th>
 | 
			
		||||
                                <td class="text-right">{{ $bill->order_number }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            @endif
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.bill_date') }}:</th>
 | 
			
		||||
                                <td class="text-right">{{ Date::parse($bill->billed_at)->format($date_format) }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans('bills.payment_due') }}:</th>
 | 
			
		||||
                                <td class="text-right">{{ Date::parse($bill->due_at)->format($date_format) }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            </tbody>
 | 
			
		||||
                        </table>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-xs-12 table-responsive">
 | 
			
		||||
                    <table class="table table-striped">
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <th>{{ trans_choice('general.items', 1) }}</th>
 | 
			
		||||
                                <th class="text-center">{{ trans('bills.quantity') }}</th>
 | 
			
		||||
                                <th class="text-right">{{ trans('bills.price') }}</th>
 | 
			
		||||
                                <th class="text-right">{{ trans('bills.total') }}</th>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            @foreach($bill->items as $item)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    {{ $item->name }}
 | 
			
		||||
                                    @if ($item->sku)
 | 
			
		||||
                                        <br><small>{{ trans('items.sku') }}: {{ $item->sku }}</small>
 | 
			
		||||
                                    @endif
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td class="text-center">{{ $item->quantity }}</td>
 | 
			
		||||
                                <td class="text-right">@money($item->price, $bill->currency_code, true)</td>
 | 
			
		||||
                                <td class="text-right">@money($item->total - $item->tax, $bill->currency_code, true)</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                            @endforeach
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-xs-7">
 | 
			
		||||
                    @if ($bill->notes)
 | 
			
		||||
                        <p class="lead">{{ trans_choice('general.notes', 2) }}:</p>
 | 
			
		||||
 | 
			
		||||
                        <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
 | 
			
		||||
                            {{ $bill->notes }}
 | 
			
		||||
                        </p>
 | 
			
		||||
                    @endif
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-xs-5">
 | 
			
		||||
                    <div class="table-responsive">
 | 
			
		||||
                        <table class="table">
 | 
			
		||||
                            <tbody>
 | 
			
		||||
                                <tr>
 | 
			
		||||
                                    <th style="width:50%">{{ trans('bills.sub_total') }}:</th>
 | 
			
		||||
                                    <td class="text-right">@money($bill->sub_total, $bill->currency_code, true)</td>
 | 
			
		||||
                                </tr>
 | 
			
		||||
                                <tr>
 | 
			
		||||
                                    <th>{{ trans('bills.tax_total') }}:</th>
 | 
			
		||||
                                    <td class="text-right">@money($bill->tax_total, $bill->currency_code, true)</td>
 | 
			
		||||
                                </tr>
 | 
			
		||||
                                @if($bill->paid)
 | 
			
		||||
                                <tr>
 | 
			
		||||
                                    <th>{{ trans('bills.paid') }}:</th>
 | 
			
		||||
                                    <td class="text-right">@money('-' . $bill->paid, $bill->currency_code, true)</td>
 | 
			
		||||
                                </tr>
 | 
			
		||||
                                @endif
 | 
			
		||||
                                <tr>
 | 
			
		||||
                                    <th>{{ trans('bills.total') }}:</th>
 | 
			
		||||
                                    <td class="text-right">@money($bill->grand_total, $bill->currency_code, true)</td>
 | 
			
		||||
                                </tr>
 | 
			
		||||
                            </tbody>
 | 
			
		||||
                        </table>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div class="box-footer row no-print">
 | 
			
		||||
                <div class="col-xs-12">
 | 
			
		||||
                    <a href="{{ url('expenses/bills/' . $bill->id . '/edit') }}" class="btn btn-primary">
 | 
			
		||||
                        <i class="fa fa-pencil-square-o"></i>  {{ trans('general.edit') }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                    <a href="{{ url('expenses/bills/' . $bill->id . '/print') }}" target="_blank" class="btn btn-default">
 | 
			
		||||
                        <i class="fa fa-print"></i>  {{ trans('general.print') }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                    <button type="button" id="button-pdf" class="btn btn-default" data-toggle="tooltip" title="{{ trans('bills.download_pdf') }}">
 | 
			
		||||
                        <i class="fa fa-file-pdf-o"></i>  {{ trans('general.download') }}
 | 
			
		||||
                    </button>
 | 
			
		||||
                    <button type="button" id="button-payment" class="btn btn-success">
 | 
			
		||||
                        <i class="fa fa-credit-card"></i>  {{ trans('bills.add_payment') }}
 | 
			
		||||
                    </button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="col-xs-6 no-padding-left">
 | 
			
		||||
        <div class="box box-default collapsed-box">
 | 
			
		||||
            <div class="box-header with-border">
 | 
			
		||||
                <h3 class="box-title">{{ trans('bills.histories') }}</h3>
 | 
			
		||||
 | 
			
		||||
                <div class="box-tools pull-right">
 | 
			
		||||
                    <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
 | 
			
		||||
                </div>
 | 
			
		||||
                <!-- /.box-tools -->
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="box-body">
 | 
			
		||||
                <div class="table-responsive">
 | 
			
		||||
                    <table class="table">
 | 
			
		||||
                        <thead>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('general.date') }}</th>
 | 
			
		||||
                            <th>{{ trans('general.status') }}</th>
 | 
			
		||||
                            <th>{{ trans('general.description') }}</th>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        </thead>
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                        @foreach($bill->histories as $history)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td>{{ Date::parse($bill->created_at)->format($date_format) }}</td>
 | 
			
		||||
                                <td>{{ $bill->status->name }}</td>
 | 
			
		||||
                                <td>{{ $bill->description }}</td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        @endforeach
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="col-xs-6 no-padding-right">
 | 
			
		||||
        <div class="box box-default collapsed-box">
 | 
			
		||||
            <div class="box-header with-border">
 | 
			
		||||
                <h3 class="box-title">{{ trans('bills.payments') }}</h3>
 | 
			
		||||
 | 
			
		||||
                <div class="box-tools pull-right">
 | 
			
		||||
                    <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
 | 
			
		||||
                </div>
 | 
			
		||||
                <!-- /.box-tools -->
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="box-body">
 | 
			
		||||
                <div class="table-responsive">
 | 
			
		||||
                    <table class="table">
 | 
			
		||||
                        <thead>
 | 
			
		||||
                        <tr>
 | 
			
		||||
                            <th>{{ trans('general.date') }}</th>
 | 
			
		||||
                            <th>{{ trans('general.amount') }}</th>
 | 
			
		||||
                            <th>{{ trans_choice('general.accounts', 1) }}</th>
 | 
			
		||||
                            <th style="width: 15%;">{{ trans('general.actions') }}</th>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                        </thead>
 | 
			
		||||
                        <tbody>
 | 
			
		||||
                        @foreach($bill->payments as $payment)
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td>{{ Date::parse($payment->paid_at)->format($date_format) }}</td>
 | 
			
		||||
                                <td>@money($payment->amount, $payment->currency_code, true)</td>
 | 
			
		||||
                                <td>{{ $payment->account->name }}</td>
 | 
			
		||||
                                <td>
 | 
			
		||||
                                    <a href="{{ url('expenses/bills/' . $payment->id) }}" class="btn btn-info btn-xs hidden"><i class="fa fa-eye" aria-hidden="true"></i> {{ trans('general.show') }}</a>
 | 
			
		||||
                                    <a href="{{ url('expenses/bills/' . $payment->id . '/edit') }}" class="btn btn-primary btn-xs  hidden"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
 | 
			
		||||
                                    {!! Form::open([
 | 
			
		||||
                                        'id' => 'bill-payment-' . $payment->id,
 | 
			
		||||
                                        'method' => 'DELETE',
 | 
			
		||||
                                        'url' => ['expenses/bills/paymentDestroy', $payment->id],
 | 
			
		||||
                                        'style' => 'display:inline'
 | 
			
		||||
                                    ]) !!}
 | 
			
		||||
                                    {!! Form::button('<i class="fa fa-trash-o" aria-hidden="true"></i> ' . trans('general.delete'), array(
 | 
			
		||||
                                        'type'    => 'button',
 | 
			
		||||
                                        'class'   => 'btn btn-danger btn-xs',
 | 
			
		||||
                                        'title'   => trans('general.delete'),
 | 
			
		||||
                                        'onclick' => 'confirmDelete("' . '#bill-payment-' . $payment->id . '", "' . trans_choice('general.payments', 2) . '", "' . trans('general.delete_confirm', ['name' => '<strong>' . Date::parse($payment->paid_at)->format($date_format) . ' - ' . money($payment->amount, $payment->currency_code, true) . ' - ' . $payment->account->name . '</strong>', 'type' => strtolower(trans_choice('general.revenues', 1))]) . '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
 | 
			
		||||
                                    )) !!}
 | 
			
		||||
                                    {!! Form::close() !!}
 | 
			
		||||
                                </td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                        @endforeach
 | 
			
		||||
                        </tbody>
 | 
			
		||||
                    </table>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('js')
 | 
			
		||||
    <script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
 | 
			
		||||
    <script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('css')
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            $(document).on('click', '#button-payment', function (e) {
 | 
			
		||||
                $('#payment-modal').remove();
 | 
			
		||||
 | 
			
		||||
                var html = '';
 | 
			
		||||
 | 
			
		||||
                html += '<div class="modal fade" id="payment-modal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel">';
 | 
			
		||||
                html += '   <div class="modal-dialog" role="document">';
 | 
			
		||||
                html += '       <div class="modal-content box box-success">';
 | 
			
		||||
                html += '           <div class="modal-header">';
 | 
			
		||||
                html += '               <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>';
 | 
			
		||||
                html += '               <h4 class="modal-title" id="paymentModalLabel">{{ trans('bills.add_payment') }}</h4>';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '           <div class="modal-body box-body">';
 | 
			
		||||
                html += '               <div class="form-group col-md-6 required">';
 | 
			
		||||
                html += '                   {!! Form::label('paid_at', trans('general.date'), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-calendar"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::text('paid_at', \Date::now()->toDateString(), ['id' => 'paid_at', 'class' => 'form-control', 'required' => 'required', 'data-inputmask' => '\'alias\': \'yyyy-mm-dd\'', 'data-mask' => '']) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-6 required">';
 | 
			
		||||
                html += '                   {!! Form::label('amount', trans('general.amount'), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-money"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::text('amount', $bill->grand_total, ['class' => 'form-control', 'required' => 'required', 'placeholder' => trans('general.form.enter', ['field' => trans('general.amount')])]) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-6 required">';
 | 
			
		||||
                html += '                   {!! Form::label('account_id', trans_choice('general.accounts', 1), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-university"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::select('account_id', $accounts, setting('general.default_account'), ['class' => 'form-control', 'required' => 'required', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)])]) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-6 required">';
 | 
			
		||||
                html += '                   {!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-exchange"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::text('currency', $currencies[$account_currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}';
 | 
			
		||||
                html += '                       {!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-12">';
 | 
			
		||||
                html += '                   {!! Form::label('description', trans('general.description'), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   {!! Form::textarea('description', null, ['class' => 'form-control', 'rows' => '3', 'placeholder' => trans('general.form.enter', ['field' => trans('general.description')])]) !!}';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-6 required">';
 | 
			
		||||
                html += '                   {!! Form::label('payment_method', trans_choice('general.payment_methods', 1), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-folder-open-o"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::select('payment_method', $payment_methods, setting('general.default_payment_method'), ['class' => 'form-control', 'required' => 'required', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])]) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               <div class="form-group col-md-6">';
 | 
			
		||||
                html += '                   {!! Form::label('reference', trans('general.reference'), ['class' => 'control-label']) !!}';
 | 
			
		||||
                html += '                   <div class="input-group">';
 | 
			
		||||
                html += '                       <div class="input-group-addon"><i class="fa fa-file-text-o"></i></div>';
 | 
			
		||||
                html += '                       {!! Form::text('reference', null, ['class' => 'form-control', 'placeholder' => trans('general.form.enter', ['field' => trans('general.reference')])]) !!}';
 | 
			
		||||
                html += '                   </div>';
 | 
			
		||||
                html += '               </div>';
 | 
			
		||||
                html += '               {!! Form::hidden('bill_id', $bill->id, ['id' => 'bill_id', 'class' => 'form-control', 'required' => 'required']) !!}';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '           <div class="modal-footer">';
 | 
			
		||||
                html += '               <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('general.cancel') }}</button>';
 | 
			
		||||
                html += '               <button type="button" onclick="addPayment();" class="btn btn-success">{{ trans('general.save') }}</button>';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '       </div>';
 | 
			
		||||
                html += '   </div>';
 | 
			
		||||
                html += '</div>';
 | 
			
		||||
 | 
			
		||||
                $('body').append(html);
 | 
			
		||||
 | 
			
		||||
                $('#paid_at').datepicker({
 | 
			
		||||
                    format: 'yyyy-mm-dd',
 | 
			
		||||
                    autoclose: true
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                $("#account_id").select2({
 | 
			
		||||
                    placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.accounts', 1)]) }}"
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                $("#payment_method").select2({
 | 
			
		||||
                    placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                $('#payment-modal').modal('show');
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(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_name);
 | 
			
		||||
                        $('#currency_code').val(data.currency_code);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('click', '#button-pdf', function (e) {
 | 
			
		||||
                location.href = "{{ url('expenses/bills/' . $bill->id . '/pdf') }}";
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('click', '#button-email', function (e) {
 | 
			
		||||
                $('#email-modal').remove();
 | 
			
		||||
 | 
			
		||||
                var html = '<div class="modal fade" id="email-modal" tabindex="-1" role="dialog" aria-labelledby="emailModalLabel">';
 | 
			
		||||
                html += '   <div class="modal-dialog" role="document">';
 | 
			
		||||
                html += '       <div class="modal-content">';
 | 
			
		||||
                html += '           <div class="modal-header">';
 | 
			
		||||
                html += '               <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>';
 | 
			
		||||
                html += '               <h4 class="modal-title" id="emailModalLabel">Overflowing text</h4>';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '           <div class="modal-body">';
 | 
			
		||||
                html += '               N/A';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '           <div class="modal-footer">';
 | 
			
		||||
                html += '               <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('general.cancel') }}</button>';
 | 
			
		||||
                html += '               <button type="button" class="btn btn-success">Save changes</button>';
 | 
			
		||||
                html += '           </div>';
 | 
			
		||||
                html += '       </div>';
 | 
			
		||||
                html += '   </div>';
 | 
			
		||||
                html += '</div>';
 | 
			
		||||
 | 
			
		||||
                $('body').append(html);
 | 
			
		||||
 | 
			
		||||
                $('#email-modal').modal('show');
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        function addPayment() {
 | 
			
		||||
            $('.help-block').remove();
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("expenses/bills/payment") }}',
 | 
			
		||||
                type: 'POST',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: $('#payment-modal input[type=\'text\'], #payment-modal input[type=\'hidden\'], #payment-modal textarea, #payment-modal select'),
 | 
			
		||||
                headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
 | 
			
		||||
                beforeSend: function() {
 | 
			
		||||
                    $('#payment-modal .modal-content').append('<div id="loading" class="text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>');
 | 
			
		||||
                },
 | 
			
		||||
                complete: function() {
 | 
			
		||||
                    $('#loading').remove();
 | 
			
		||||
                },
 | 
			
		||||
                success: function(data) {
 | 
			
		||||
                    $("#payment-modal").modal('hide');
 | 
			
		||||
 | 
			
		||||
                    location.reload();
 | 
			
		||||
                },
 | 
			
		||||
                error: function(data){
 | 
			
		||||
                    var errors = data.responseJSON;
 | 
			
		||||
 | 
			
		||||
                    if (typeof errors !== 'undefined') {
 | 
			
		||||
                        if (errors.paid_at) {
 | 
			
		||||
                            $('#payment-modal #paid_at').parent().after('<p class="help-block">' + errors.paid_at + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (errors.amount) {
 | 
			
		||||
                            $('#payment-modal #amount').parent().after('<p class="help-block">' + errors.amount + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (errors.account_id) {
 | 
			
		||||
                            $('#payment-modal #account_id').parent().after('<p class="help-block">' + errors.account_id + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (errors.currency_code) {
 | 
			
		||||
                            $('#payment-modal #currency_code').parent().after('<p class="help-block">' + errors.currency_code + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (errors.category_id) {
 | 
			
		||||
                            $('#payment-modal #category_id').parent().after('<p class="help-block">' + errors.category_id + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (errors.payment_method) {
 | 
			
		||||
                            $('#payment-modal #payment_method').parent().after('<p class="help-block">' + errors.payment_method + '</p>');
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										105
									
								
								resources/views/expenses/payments/create.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								resources/views/expenses/payments/create.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,105 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.new', ['type' => trans_choice('general.payments', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <!-- Default box -->
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        {!! Form::open(['url' => 'expenses/payments', 'files' => true, 'role' => 'form']) !!}
 | 
			
		||||
 | 
			
		||||
        <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' => ''], Date::now()->toDateString()) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('amount', trans('general.amount'), 'money', ['required' => 'required', 'autofocus' => 'autofocus']) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('general.default_account')) }}
 | 
			
		||||
 | 
			
		||||
            <div class="form-group col-md-6 {{ $errors->has('currency_code') ? 'has-error' : ''}}">
 | 
			
		||||
                {!! 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[$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']) !!}
 | 
			
		||||
                </div>
 | 
			
		||||
                {!! $errors->first('currency_code', '<p class="help-block">:message</p>') !!}
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            {{ Form::textareaGroup('description', trans('general.description')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors, null, []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card',['cash' => trans('general.cash'), 'bank' => trans('general.bank'), 'paypal' => trans('general.paypal')], setting('general.default_payment_method')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('reference', trans('general.reference'), 'file-text-o',[]) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::fileGroup('attachment', trans('general.attachment')) }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
        <div class="box-footer">
 | 
			
		||||
            {{ Form::saveButtons('expenses/payments') }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-footer -->
 | 
			
		||||
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('js')
 | 
			
		||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
 | 
			
		||||
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('css')
 | 
			
		||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
 | 
			
		||||
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    $(document).ready(function(){
 | 
			
		||||
        //Date picker
 | 
			
		||||
        $('#paid_at').datepicker({
 | 
			
		||||
            format: 'yyyy-mm-dd',
 | 
			
		||||
            autoclose: true
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#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)]) }}"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#vendor_id").select2({
 | 
			
		||||
            placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)]) }}"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#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',
 | 
			
		||||
            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_name);
 | 
			
		||||
                    $('#currency_code').val(data.currency_code);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										112
									
								
								resources/views/expenses/payments/edit.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								resources/views/expenses/payments/edit.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,112 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <!-- Default box -->
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        {!! Form::model($payment, [
 | 
			
		||||
            'method' => 'PATCH',
 | 
			
		||||
            'files' => true,
 | 
			
		||||
            'url' => ['expenses/payments', $payment->id],
 | 
			
		||||
            'role' => 'form'
 | 
			
		||||
        ]) !!}
 | 
			
		||||
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('paid_at', trans('general.date'), 'calendar') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('amount', trans('general.amount'), 'money', ['required' => 'required', 'autofocus' => 'autofocus']) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('general.default_account')) }}
 | 
			
		||||
 | 
			
		||||
            <div class="form-group col-md-6 {{ $errors->has('currency_code') ? 'has-error' : ''}}">
 | 
			
		||||
                {!! 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[$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']) !!}
 | 
			
		||||
                </div>
 | 
			
		||||
                {!! $errors->first('currency_code', '<p class="help-block">:message</p>') !!}
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            {{ Form::textareaGroup('description', trans('general.description')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors, null, []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card',['cash' => 'Cash', 'bank' => 'Bank Transfer', 'paypal' => 'PayPal'], setting('general.default_payment_method')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('reference', trans('general.reference'), 'file-text-o',[]) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::fileGroup('attachment', trans('general.attachment')) }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
        @permission('update-expenses-payments')
 | 
			
		||||
        <div class="box-footer">
 | 
			
		||||
            {{ Form::saveButtons('expenses/payments') }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-footer -->
 | 
			
		||||
        @endpermission
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
      {!! Form::close() !!}
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('js')
 | 
			
		||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
 | 
			
		||||
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('css')
 | 
			
		||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
 | 
			
		||||
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    $(document).ready(function(){
 | 
			
		||||
        //Date picker
 | 
			
		||||
        $('#paid_at').datepicker({
 | 
			
		||||
            format: 'yyyy-mm-dd',
 | 
			
		||||
            autoclose: true
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#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)]) }}"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#vendor_id").select2({
 | 
			
		||||
            placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)]) }}"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#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',
 | 
			
		||||
            placeholder : '<?php echo ($payment->attachment) ? $payment->attachment : 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_name);
 | 
			
		||||
                    $('#currency_code').val(data.currency_code);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										70
									
								
								resources/views/expenses/payments/index.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								resources/views/expenses/payments/index.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans_choice('general.payments', 2))
 | 
			
		||||
 | 
			
		||||
@permission('create-expenses-payments')
 | 
			
		||||
@section('new_button')
 | 
			
		||||
<span class="new-button"><a href="{{ url('expenses/payments/create') }}" class="btn btn-success btn-sm"><span class="fa fa-plus"></span>  {{ trans('general.add_new') }}</a></span>
 | 
			
		||||
@endsection
 | 
			
		||||
@endpermission
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
<!-- Default box -->
 | 
			
		||||
<div class="box box-success">
 | 
			
		||||
    <div class="box-header">
 | 
			
		||||
        {!! Form::open(['url' => 'expenses/payments', 'role' => 'form', 'method' => 'GET']) !!}
 | 
			
		||||
        <div class="pull-left">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.search') }}:</span>
 | 
			
		||||
            {!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
 | 
			
		||||
            {!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('categories.all')]) !!}
 | 
			
		||||
            {!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('accounts.all')]) !!}
 | 
			
		||||
            {!! Form::button('<span class="fa fa-filter"></span>  ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="pull-right">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.show') }}:</span>
 | 
			
		||||
            {!! Form::select('limit', $limits, request('limit', setting('general.list_limit', '25')), ['class' => 'form-control input-filter input-sm', 'onchange' => 'this.form.submit()']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="box-body">
 | 
			
		||||
        <div class="table table-responsive">
 | 
			
		||||
            <table class="table table-bordered table-striped table-hover" id="tbl-payments">
 | 
			
		||||
                <thead>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>@sortablelink('paid_at', trans('general.date'))</th>
 | 
			
		||||
                        <th>@sortablelink('amount', trans('general.amount'))</th>
 | 
			
		||||
                        <th>@sortablelink('category.name', trans_choice('general.categories', 1))</th>
 | 
			
		||||
                        <th>@sortablelink('account.name', trans_choice('general.accounts', 1))</th>
 | 
			
		||||
                        <th style="width: 15%;">{{ trans('general.actions') }}</th>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </thead>
 | 
			
		||||
                <tbody>
 | 
			
		||||
                @foreach($payments as $item)
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td><a href="{{ url('expenses/payments/' . $item->id . '/edit') }}">{{ Date::parse($item->paid_at)->format($date_format) }}</a></td>
 | 
			
		||||
                        <td>@money($item->amount, $item->currency_code, true)</td>
 | 
			
		||||
                        <td>{{ $item->category->name }}</td>
 | 
			
		||||
                        <td>{{ $item->account->name }}</td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <a href="{{ url('expenses/payments/' . $item->id . '/edit') }}" class="btn btn-primary btn-xs"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
 | 
			
		||||
                            @permission('delete-expenses-payments')
 | 
			
		||||
                            {!! Form::deleteButton($item, 'expenses/payments') !!}
 | 
			
		||||
                            @endpermission
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                @endforeach
 | 
			
		||||
                </tbody>
 | 
			
		||||
            </table>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
    <div class="box-footer">
 | 
			
		||||
        @include('partials.admin.pagination', ['items' => $payments, 'type' => 'payments'])
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-footer -->
 | 
			
		||||
</div>
 | 
			
		||||
<!-- /.box -->
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								resources/views/expenses/vendors/create.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								resources/views/expenses/vendors/create.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.new', ['type' => trans_choice('general.vendors', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <!-- Default box -->
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        {!! Form::open(['url' => 'expenses/vendors', 'role' => 'form']) !!}
 | 
			
		||||
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
 | 
			
		||||
            {{ 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::textGroup('phone', trans('general.phone'), 'phone', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('website', trans('general.website'), 'globe',[]) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textareaGroup('address', trans('general.address')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::radioGroup('enabled', trans('general.enabled')) }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
        <div class="box-footer">
 | 
			
		||||
            {{ Form::saveButtons('expenses/vendors') }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-footer -->
 | 
			
		||||
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        var text_yes = '{{ trans('general.yes') }}';
 | 
			
		||||
        var text_no = '{{ trans('general.no') }}';
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            $('#enabled_1').trigger('click');
 | 
			
		||||
 | 
			
		||||
            $('#name').focus();
 | 
			
		||||
 | 
			
		||||
            $("#currency_code").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										54
									
								
								resources/views/expenses/vendors/edit.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								resources/views/expenses/vendors/edit.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans('general.title.edit', ['type' => trans_choice('general.vendors', 1)]))
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <!-- Default box -->
 | 
			
		||||
    <div class="box box-success">
 | 
			
		||||
        {!! Form::model($vendor, [
 | 
			
		||||
            'method' => 'PATCH',
 | 
			
		||||
            'url' => ['expenses/vendors', $vendor->id],
 | 
			
		||||
            'role' => 'form'
 | 
			
		||||
        ]) !!}
 | 
			
		||||
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('phone', trans('general.phone'), 'phone', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('website', trans('general.website'), 'globe',[]) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textareaGroup('address', trans('general.address')) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::radioGroup('enabled', trans('general.enabled')) }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-body -->
 | 
			
		||||
 | 
			
		||||
        @permission('update-expenses-vendors')
 | 
			
		||||
        <div class="box-footer">
 | 
			
		||||
            {{ Form::saveButtons('expenses/vendors') }}
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- /.box-footer -->
 | 
			
		||||
        @endpermission
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('scripts')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        var text_yes = '{{ trans('general.yes') }}';
 | 
			
		||||
        var text_no = '{{ trans('general.no') }}';
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            $("#currency_code").select2({
 | 
			
		||||
                placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
@endsection
 | 
			
		||||
							
								
								
									
										73
									
								
								resources/views/expenses/vendors/index.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								resources/views/expenses/vendors/index.blade.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
@extends('layouts.admin')
 | 
			
		||||
 | 
			
		||||
@section('title', trans_choice('general.vendors', 2))
 | 
			
		||||
 | 
			
		||||
@permission('create-expenses-vendors')
 | 
			
		||||
@section('new_button')
 | 
			
		||||
<span class="new-button"><a href="{{ url('expenses/vendors/create') }}" class="btn btn-success btn-sm"><span class="fa fa-plus"></span>  {{ trans('general.add_new') }}</a></span>
 | 
			
		||||
@endsection
 | 
			
		||||
@endpermission
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
<!-- Default box -->
 | 
			
		||||
<div class="box box-success">
 | 
			
		||||
    <div class="box-header">
 | 
			
		||||
        {!! Form::open(['url' => 'expenses/vendors', 'role' => 'form', 'method' => 'GET']) !!}
 | 
			
		||||
        <div class="pull-left">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.search') }}:</span>
 | 
			
		||||
            {!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
 | 
			
		||||
            {!! Form::button('<span class="fa fa-filter"></span>  ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="pull-right">
 | 
			
		||||
            <span class="title-filter">{{ trans('general.show') }}:</span>
 | 
			
		||||
            {!! Form::select('limit', $limits, request('limit', setting('general.list_limit', '25')), ['class' => 'form-control input-filter input-sm', 'onchange' => 'this.form.submit()']) !!}
 | 
			
		||||
        </div>
 | 
			
		||||
        {!! Form::close() !!}
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-header -->
 | 
			
		||||
 | 
			
		||||
    <div class="box-body">
 | 
			
		||||
        <div class="table table-responsive">
 | 
			
		||||
            <table class="table table-bordered table-striped table-hover" id="tbl-vendors">
 | 
			
		||||
                <thead>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>@sortablelink('name', trans('general.name'))</th>
 | 
			
		||||
                        <th>@sortablelink('email', trans('general.email'))</th>
 | 
			
		||||
                        <th>@sortablelink('phone', trans('general.phone'))</th>
 | 
			
		||||
                        <th>@sortablelink('enabled', trans('general.status'))</th>
 | 
			
		||||
                        <th style="width: 15%;">{{ trans('general.actions') }}</th>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </thead>
 | 
			
		||||
                <tbody>
 | 
			
		||||
                @foreach($vendors as $item)
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td><a href="{{ url('expenses/vendors/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
 | 
			
		||||
                        <td>{{ $item->email }}</td>
 | 
			
		||||
                        <td>{{ $item->phone }}</td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            @if ($item->enabled)
 | 
			
		||||
                                <span class="label label-success">{{ trans('general.enabled') }}</span>
 | 
			
		||||
                            @else
 | 
			
		||||
                                <span class="label label-danger">{{ trans('general.disabled') }}</span>
 | 
			
		||||
                            @endif
 | 
			
		||||
                        </td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <a href="{{ url('expenses/vendors/' . $item->id . '/edit') }}" class="btn btn-primary btn-xs"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
 | 
			
		||||
                            @permission('delete-expenses-vendors')
 | 
			
		||||
                            {!! Form::deleteButton($item, 'expenses/vendors') !!}
 | 
			
		||||
                            @endpermission
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                @endforeach
 | 
			
		||||
                </tbody>
 | 
			
		||||
            </table>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /.box-body -->
 | 
			
		||||
    <div class="box-footer">
 | 
			
		||||
        @include('partials.admin.pagination', ['items' => $vendors, 'type' => 'vendors'])
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<!-- /.box-footer -->
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user