@extends('layout')
@section('title', 'دیگر اکاؤنٹس')
@section('page_title', 'دیگر اکاؤنٹس')
@section('content')
    <div class="row">
        @if(auth()->user()->hasPermissionTo('create other account'))
            <div class="col-md-4">
                <div class="panel panel-card margin-b-30">
                    <div class="panel-body">

                        <form id="add_account_form">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="city_name">نام <span class="text-danger">*</span> 
                                            <span class="text-danger NameAlreadyExists" style="display:none;"> </span> 
                                        </label>
                                        <input type="text" id="account_name" autofocus class="form-control"
                                               name="name"
                                               placeholder='برائے مہربانی اکاؤنٹ کا نام درج کریں'>
                                        <span class="text-danger error" id="name_error"></span>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" id="csrf_token" value="{{ csrf_token() }}">
                            <div class="row">
                                <div class="col-md-6">
                                    <label for="">شناختی کارڈ نمبر:</label>
                                    <input type="text" class="form-control" name="cnic"
                                           data-inputmask="'mask': '99999-9999999-9'">
                                    <span class="text-danger error" id="cnic_error"></span>
                                </div>
                                <div class="col-md-6">
                                    <label for="">فون:</label>
                                    <input type="text" class="form-control" name="phone"
                                           data-inputmask="'mask': '9999-9999999'">
                                    <span class="text-danger error" id="phone_error"></span>
                                </div>
                            </div>
                            {{-- <div class="row">
                                 <div class="col-md-12">
                                     <label for="">اکاؤنٹ قسم:</label><br>
                                     <label for="debit_type">
                                         <input type="radio" id="debit_type" name="account_type"
                                                value="debit">
                                         ڈیبٹ </label>&nbsp;&nbsp;&nbsp;&nbsp;
                                     <label for="credit_type">
                                         <input type="radio" id="credit_type" name="account_type"
                                                value="credit"> کریڈٹ
                                     </label><br>
                                     <span class="text-danger error" id="account_type_error"></span>

                                 </div>
                             </div>--}}
                            <div class="row mt-2">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="city_name">شہر <span class="text-danger">*</span></label>
                                        <select name="city" id="city" class="form-control">
                                            <option value="">----منتخب شہر---</option>
                                            @forelse ($cities as $city)
                                                <option value="{{ $city->id }}">{{ $city->name }}</option>
                                            @empty
                                                <option value="">No City Available</option>
                                            @endforelse
                                        </select> <span class="text-danger error" id="city_error"></span>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="city_name">کیٹیگری: <span class="text-danger">*</span></label>
                                        <select name="category" id="category" class="form-control">
                                            <option value="">----منتخب کیٹیگری---</option>
                                            @forelse ($categories as $category)
                                                <option value="{{ $category->id }}">{{ $category->name }}</option>
                                            @empty
                                                <option value="">No Category Available</option>
                                            @endforelse
                                        </select> <span class="text-danger error" id="category_error"></span>
                                    </div>
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="">
                                        @csrf
                                        <button name="createCitySubmit" id="submit_btn"
                                                class="btn btn-sm btn-primary btn-lg"
                                                type="submit">
                                            محفوظ
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        @endif

        <div class="{{ auth()->user()->hasPermissionTo('create other account')?'col-md-8':'col-md-12' }}">
            <div class="panel panel-card ">
                <div class="panel-body">
                    <table id="cities_table" class="table table-bordered" cellspacing="0" width="100%">
                        <thead class="bg-gold text-white">
                        <tr style="white-space: nowrap">
                            <th>#</th>
                            <th>نام</th>
                            <th>شناختی کارڈ نمبر</th>
                            <th>فون</th>
                            <th>شہر</th>
                            <th>کیٹیگری</th>
                            <th>قسم</th>
                            <th>ایکشن</th>
                        </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>

    </div>

    <div class="modal fade" id="editBrokerModal" tabindex="-1" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content panel-card" id="editBrokerData">

            </div>
        </div>
    </div>

@endsection

@section('javascript')
    @include('other_accounts.js')
@endsection
