
  <footer>
    <div class="footer-logo">
      <img src="{{ asset('uploads/app/'.env('APP_LOGO')) }}" class="img-responsive">
    </div>
    <p class="text-right pull-right">&copy; {{ date("Y") }} {{ env("APP_NAME") }} <span>•</span> {{__('pages.footer')}}</p>
  </footer>


<!-- add income -->
    <div class="modal fade" id="addIncome" role="dialog">
        <div class="modal-dialog modal-sm">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">{{__('income.income-form.add-title')}}</h4>
                </div>
                    <div class="modal-body">
                        <p>{{__('income.income-form.add-intro')}}</p>
                        <form class="simcy-form" id="AddIncome" action="{{ url('Income@add') }}" data-parsley-validate="" method="POST" loader="true">
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.title')}}</label>
                                    <input type="text" class="form-control" name="title" placeholder="{{__('income.income-form.placeholder.title')}}" required="">
                                    <input type="hidden" name="csrf-token" value="{{csrf_token()}}" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.amount')}}</label>
                                    <span class="input-prefix">{{ currency() }}</span>
                                    <input type="number" class="form-control prefix"  step="0.01" data-parsley-pattern="^[0-9]*\.[0-9]{2}$" name="amount" min="0.01" placeholder="{{__('income.income-form.placeholder.amount')}}" required="">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.account')}}</label>
                                    <select class="form-control select2" name="account">
                                        <option value="00">{{__('income.income-form.account.other')}}</option>
                                      @if(!empty($accounts))
                                      @foreach($accounts as $account)
                                        <option value="{{ $account->id }}">{{ $account->name }}</option>
                                      @endforeach
                                      @endif
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12 ">
                                    <label>{{__('income.income-form.label.category')}}</label>
                                    <select class="form-control select2" name="category">
                                        @if(!empty($incomecategories))
                                            @foreach($incomecategories as $incomecategory)
                                                <option value="{{ $incomecategory->id }}">{{ $incomecategory->name }}</option>
                                            @endforeach
                                        @endif
                                        <option value="00">
                                            {{__('income.income-form.group.other')}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.date')}}</label>
                                    <input type="text" class="form-control datepicker" name="income_date" placeholder="{{__('income.income-form.placeholder.date')}}" required="">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.note')}}</label>
                                    <input type="text" class="form-control" name="note" placeholder="{{__('income.income-form.placeholder.note')}}">
                                </div>
                            </div>
                        </div>
                        @if (env("ALLOW_ATTACHMENTS") == "Enabled")
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('income.income-form.label.attachment')}}</label> 
                                    <div name="incomecroppie">
                                        <input type="file" name="incomeimage_attachment" id="incomeimage_attachment" class="croppie" crop-width="800" crop-height="800" accept="image/*" onchange='incomeHideFileAttachment()'>
                                    </div>
                                <div name="incomefile_attachment_label">
                                    {{__('income.income-form.label.pdf')}}</div>
                                <input type="file" class="form-control" name="incomefile_attachment" id="incomefile_attachment"  accept="application/pdf" onchange='incomeHideCroppie()'>
                                </div>
                            </div>
                            <button type="button" class="btn btn-danger btn-sm" name="incomeclearButton" onclick="incomeClearAttachment()" style="display: none">{{__('income.income-form.label.clear')}}</button>
                        </div>
                        @endif
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">{{__('income.button.close')}}</button>
                        <button type="submit" class="btn btn-primary">{{__('income.button.add-income')}}</button>
                    </div>
                </form>
            </div>

        </div>
    </div>


    <!--Record Expense-->
    <div class="modal fade" id="addExpense" role="dialog">
        <div class="modal-dialog modal-sm">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">{{__('expenses.expense-form.add-title')}}</h4>
                </div>
                <form class="simcy-form" id="AddExpense" action="{{ url('Expenses@add') }}" data-parsley-validate="" loader="true" method="POST" enctype="multipart/form-data">
                    <div class="modal-body">
                        <p>{{__('expenses.expense-form.add-intro')}}</p>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.title')}}</label>
                                    <input type="text" class="form-control" name="title" placeholder="{{__('expenses.expense-form.placeholder.title')}}" required="">
                                    <input type="hidden" name="csrf-token" value="{{csrf_token()}}" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.amount')}}</label>
                                    <span class="input-prefix">{{ currency() }}</span>
                                    <input type="number" class="form-control prefix"  step="0.01" data-parsley-pattern="^[0-9]*\.[0-9]{2}$" min="0.01" name="amount" placeholder="Amount" required="">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.account')}}</label>
                                    <select class="form-control select2" name="account">
                                        <option value="00">{{__('expenses.expense-form.account.other')}}</option>
                                      @if(!empty($accounts))
                                      @foreach($accounts as $account)
                                        <option value="{{ $account->id }}">{{ $account->name }}</option>
                                      @endforeach
                                      @endif
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                                <div class="row">
                                    <div class="col-md-12 ">
                                        <label>{{__('expenses.expense-form.label.category')}}</label>
                                        <select class="form-control select2" name="category">
                                            @if(!empty($categories))
                                                @foreach($categories as $category)
                                                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                                                @endforeach
                                            @endif
                                            <option value="00">{{__('expenses.expense-form.category.other')}}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.date')}}</label>
                                    <input type="text" class="form-control datepicker" name="expense_date" placeholder="{{__('expenses.expense-form.placeholder.date')}}" required="">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.note')}}</label>
                                    <input type="text" class="form-control" name="note" placeholder="{{__('expenses.expense-form.placeholder.note')}}">
                                </div>
                            </div>
                        </div>
                        @if (env("ALLOW_ATTACHMENTS") == "Enabled")
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">
                                    <label>{{__('expenses.expense-form.label.attachment')}}</label> 
                                    <div name="croppie">
                                        <input type="file" name="image_attachment" id="image_attachment" class="croppie" crop-width="800" crop-height="800" accept="image/*" onchange='expenseHideFileAttachment()'>
                                    </div>
                                <div name="file_attachment_label">
                                    {{__('expenses.expense-form.label.pdf')}}</div>
                                <input type="file" class="form-control" name="file_attachment" id="file_attachment"  accept="application/pdf" onchange='expenseHideCroppie()'>
                                </div>
                            </div>
                            <button type="button" class="btn btn-danger btn-sm" name="clearButton" onclick="expenseClearAttachment()" style="display: none">{{__('expenses.expense-form.label.clear')}}</button>
                        </div>
                        @endif
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">{{__('expenses.button.close')}}</button>
                        <button type="submit" class="btn btn-primary">{{__('expenses.button.save-expense')}}</button>
                    </div>
                </form>
            </div>

        </div>
    </div>

    <script>

        function expenseHideCroppie() {
               $('[name=croppie]').hide();
               $('[name=file_attachment_label]').hide();
               $('[name=clearButton]').show();
        }
        function expenseHideFileAttachment() {
               $('[name=file_attachment]').hide();
               $('[name=file_attachment_label]').hide();
               $('[name=clearButton]').show();
        }

        function expenseClearAttachment() {

            $('[name=file_attachment]').val('');
            $('[name=image_attachment]').val('');
            $('[name=croppie]').show();
            $('[name=file_attachment]').show();
            $('[name=file_attachment_label]').show();
            $('[name=clearButton]').hide();

            $('[name=image_attachment]').removeClass('ready');
            $('[name=image_attachment]').html("");

            $('[class=croppie-output]').attr("src","data:image/png;base64,[encoded data, 7000 characters]");
        }

        function incomeHideCroppie() {
               $('[name=incomecroppie]').hide();
               $('[name=incomefile_attachment_label]').hide();
               $('[name=incomeclearButton]').show();
        }
        function incomeHideFileAttachment() {
               $('[name=incomefile_attachment]').hide();
               $('[name=incomefile_attachment_label]').hide();
               $('[name=incomeclearButton]').show();
        }

        function incomeClearAttachment() {

            $('[name=incomefile_attachment]').val('');
            $('[name=incomeimage_attachment]').val('');
            $('[name=incomecroppie]').show();
            $('[name=incomefile_attachment]').show();
            $('[name=incomefile_attachment_label]').show();
            $('[name=incomeclearButton]').hide();

            $('[name=incomeimage_attachment]').removeClass('ready');
            $('[name=incomeimage_attachment]').html("");

            $('[class=croppie-output]').attr("src","data:image/png;base64,[encoded data, 7000 characters]");
        }

      </script>