@extends('template.app')

@section('meta')
@endsection

@section('title')
Global Configuration
@endsection

<style type="text/css">
    /*#galeria{
        display: flex;
    }*/
    #galeria img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }

    #pan_image_multi{
        display: flex;
        width: 21px;
    }
    #pan_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    #login_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }

    #cash_receipt_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;

    }
    #receiptlogo_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    #obf_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    #obflogo_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    #invoice_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;   
    }
    #invoicelogo_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;   
    }
    #gatepasslogo_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;

    }
    #gatepass_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;

    }

    /*#adhar_image_multi{
        display: flex;
    }*/
    #adhar_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
/*#rcbook_multi{
        display: flex;
    }*/
    #rcbook_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    /*#insurance_multi{
        display: flex;
    }*/
    #insurance_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
     /*#totto_multi{
        display: flex;
    }*/
    #totto_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
   /* #documents_multi{
        display: flex;
    }*/
    #documents_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }

    /*#licance_image_multi{
        display: flex;
    }*/
    #licance_image_multi img{
        width: 85px;
        height: 85px;
        border-radius: 10px;
        box-shadow: 0 0 8px rgba(0,0,0,0.2);
        opacity: 85%;
        padding: 3px;
    }
    @media (min-width: 768px) {
        .col-md-3 {
            flex: 0 0 25%;
            max-width: 21% !important;
        }
    }
</style>
@section('styles')
<link href="{{ asset('assets/css/dropify.min.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/sweetalert2.bundle.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/select2.css') }}" rel="stylesheet">
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.css"> -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<style>
    .col-md-3{
        font-size:15px;
    }
    .form-control{
        height: 30px;
        font-size: 14px;
    }
</style>
@endsection
@section('content')
<div class="page-breadcrumb">
    <div class="row">
        <div class="col-7 align-self-center">
            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Global Configuration</h4>
            <div class="d-flex align-items-center">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb m-0 p-0">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('global-configuration') }}" class="text-muted">Global Configuration</a></li>
                        <li class="breadcrumb-item text-muted active" aria-current="page">Create</li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('global-configuration.insert') }}" name="form" id="form" method="post" enctype="multipart/form-data">
                        @csrf
                        @method('POST')
                        <div class="row">
                            <div class="form-group col-md-3">
                                <label class="banknoc-label">Branch</label>
                                <select name="branch_id" class="form-control dropify">
                                <option value="">Select Branch</option>
                                    @foreach($branch as $b)
                                <option value="{{ $b['id'] }}">{{ $b['city'] }}</option>
                                @endforeach
                            </select>
                                <span class="kt-form__help error login_logo1"></span>
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Login Page Company Logo </label>
                                
                                <input type="file" name="login_logo1" id="login_logo1" onchange="previewMultiple(event,'pan_image_multi','login_logo1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error login_logo1"></span>
                            </div>
                            <div id="pan_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Login Page Brand Logo </label>
                                
                                <input type="file" name="login_logo2" id="login_logo2" onchange="previewMultiple(event,'login_image_multi','login_logo1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error login_logo2"></span>
                            </div>
                            <div id="login_image_multi" class="form-group col-md-3">
                            </div>
                            
                            <div class="form-group">
                                <label class="banknoc-label">Cash Receipt Company Logo </label>
                                
                                <input type="file" name="cash_receipt_logo1" id="cash_receipt_logo1" onchange="previewMultiple(event,'cash_receipt_image_multi','cash_receipt_logo1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error cash_receipt_logo1"></span>
                            </div>
                            <div id="cash_receipt_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Cash Receipt Brand Logo </label>
                                
                                <input type="file" name="cash_receipt_logo2" id="cash_receipt_logo2" onchange="previewMultiple(event,'receiptlogo_image_multi','cash_receipt_logo2')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error cash_receipt_logo2"></span>
                            </div>
                            <div id="receiptlogo_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Obf Company Print</label>
                                
                                <input type="file" name="obf_print1" id="obf_print1" onchange="previewMultiple(event,'obf_image_multi','obf_print1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error obf_image_multi"></span>
                            </div>
                            <div id="obf_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Obf Print Brand Logo</label>
                                
                                <input type="file" name="obf_print2" id="obf_print2" onchange="previewMultiple(event,'obflogo_image_multi','obf_print2')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error obflogo_image_multi"></span>
                            </div>
                            <div id="obflogo_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Invoice Company Logo </label>
                                
                                <input type="file" name="invoice_logo1" id="invoice_logo1" onchange="previewMultiple(event,'invoice_image_multi','invoice_logo1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error invoice_logo1"></span>
                            </div>
                            <div id="invoice_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Invoice Brand Logo </label>
                                
                                <input type="file" name="invoice_logo2" id="invoice_logo2" onchange="previewMultiple(event,'invoicelogo_image_multi','invoice_logo2')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error invoicelogo_image_multi"></span>
                            </div>
                            <div id="invoicelogo_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Gatepass Company Logo </label>
                                
                                <input type="file" name="gatepass_logo1" id="gatepass_logo1" onchange="previewMultiple(event,'gatepasslogo_image_multi','gatepass_logo1')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error gatepass_logo1"></span>
                            </div>
                            <div id="gatepasslogo_image_multi" class="form-group col-md-3">
                            </div>
                            <div class="form-group">
                                <label class="banknoc-label">Gatepass Brand Logo </label>
                                
                                <input type="file" name="gatepass_logo2" id="gatepass_logo2" onchange="previewMultiple(event,'gatepass_image_multi','gatepass_logo2')" class="form-control dropify" data-default-file="" data-max-file-size-preview="2M" multiple="">
                                
                                <span class="kt-form__help error gatepass_logo2"></span>
                            </div>
                            <div id="gatepass_image_multi" class="form-group col-md-3">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <button type="submit" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-primary">Submit</button>
                            <a href="{{ route('global-configuration') }}" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-secondary">Back</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('scripts')
<script src="{{ asset('assets/js/promise.min.js') }}"></script>
<script src="{{ asset('assets/js/sweetalert2.bundle.js') }}"></script>

<script>

    $(document).ready(function() {
        var form = $('#form');
        $('.kt-form__help').html('');
        form.submit(function(e) {
            $('.help-block').html('');
            $('.m-form__help').html('');
            $.ajax({
                url: form.attr('action'),
                type: form.attr('method'),
                data: new FormData($(this)[0]),
                dataType: 'json',
                async: false,
                processData: false,
                contentType: false,
                success: function(json) {
                    return true;
                },
                error: function(json) {
                    if (json.status === 422) {
                        e.preventDefault();
                        var errors_ = json.responseJSON;
                        $('.kt-form__help').html('');
                        $.each(errors_.errors, function(key, value) {
                            $('.' + key).html(value);
                        });
                    }
                }
            });
        });
    });
</script>
<script>
    function previewMultiple(event,idnamediv,id_name){
        var saida = document.getElementById(id_name);
        var quantos = saida.files.length;
         $('#'+idnamediv).empty();
        for(i = 0; i < quantos; i++){
            var urls = URL.createObjectURL(event.target.files[i]);
            document.getElementById(idnamediv).innerHTML += '<img src="'+urls+'">';
        }
    }
    </script>

    
@endsection