@extends('layout')
@section('title', 'پمپس')
@section('page_title', 'پمپس')
@section('page_sub_title', '')
@section('content')
    <div class="row">
        @if(auth()->user()->hasPermissionTo('create pump'))
            <div class="col-md-4">
                <div class="panel panel-card margin-b-30">
                    <div class="panel-body">


                        <form id="add_pump_form">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="city_name">نام <span class="text-danger">*</span></label>
                                        <input type="text" id="city_name" autofocus class="form-control"
                                               name="city_name">

                                        <span class="text-danger error" id="city_name_error"></span>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="phone">فون </label>
                                        <input type="text" id="phone" name="phone" class="form-control" data-masked=""
                                               data-inputmask="'mask': '9999-9999999'">

                                        <span class="text-danger error" id="phone_error"></span>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="note">شہر</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>
                            <div class="row mt-2">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="note">Note</label>
                                        <textarea id="note" name="note" class="form-control"></textarea>
                                        <span class="text-danger error" id="note_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 pump')?'col-md-8':'col-md-12' }}">
            <div class="panel panel-card ">
                <div class="panel-body">
                    <table id="pump_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>
                        </tr>
                        </thead>
                        <tbody>

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



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

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

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