@extends('reciption.layouts.master')
@section('title', 'لوحة التحكم | الإستقبال')
@push('styles')
    <link rel="stylesheet" href="{{ asset('theme/plugins/bootstrap-select.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/print.css') }}">
@endpush
@section('main-content')
    @if( session()->has('dataPrinted'))
        <button class="btn btn-warning" id="print">طباعة وصل استلام</button>
        @include('reciption.orders.print_page')
    @endisset
    <div id="form-section">
        <h2> إضافة طلب جديد </h2>
        <hr>
        <div class="text-center">
            @foreach ($errors->all() as $error)
                <div class="alert alert-danger">{{ $error }}</div>
            @endforeach

        </div>
        <p>----معلومات الزبون----</p>
        <form action="{{ route('rec.new-order-store') }}" method="post" enctype="multipart/form-data">
            @csrf
            <div class="row clearfix" id="selected">
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="customer-name">إسم الزيون</label>
                        <input type="text" id="customer_name" name="name" value="{{ old('name') }}" class="form-control @error('name') is-invalid @enderror ">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="customer-phone">رقم هاتف الزبون</label>
                        <input type="text" id="customer_phone" name="phone" value="{{ old('phone') }}" class="form-control  @error('phone') is-invalid @enderror">
                    </div>
                </div>
            </div>
            <p class="m-t-20">----معلومات الجهاز----</p>
            <div class="row clearfix ">
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="device_serial">رقم معرف الجهاز</label>
                        <input type="text" id="device_serial" name="serial" value="{{ old('serial') }}" class="form-control @error('serial') is-invalid @enderror">
                    </div>
                </div>
                {{--            <div class="col-md-4">--}}
                {{--                <div class="form-group">--}}
                {{--                    <label for="brand">الشركة المصنعة</label>--}}
                {{--                    <input type="text" id="brand" value="{{ old('brand') }}" name="brand" class="form-control">--}}
                {{--                </div>--}}
                {{--            </div>--}}
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="color">لون الجهاز</label>
                        <input type="text" id="color" value="{{ old('color') }}" name="color" class="form-control">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="device-type">نوع الجهاز</label>
                        <select id="device-type"  name="device_type" class="form-control show-tick  @error('device_type') is-invalid @enderror">
                            <option>--تحديد النوع--</option>
                            <option value="1" @if (old('device_type') == '1') selected="selected" @endif>كمبيوتر</option>
                            <option value="3" @if (old('device_type') == '3') selected="selected" @endif>لابتوب</option>
                            <option value="2" @if (old('device_type') == '2') selected="selected" @endif>هاتف</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="device-type">الماركة</label>
                        <select id="device-type"  name="device_type" class="form-control show-tick  @error('device_type') is-invalid @enderror">
                            <option>--تحديد النوع--</option>
                            <option value="1" @if (old('device_type') == '1') selected="selected" @endif>كمبيوتر</option>
                            <option value="3" @if (old('device_type') == '3') selected="selected" @endif>لابتوب</option>
                            <option value="2" @if (old('device_type') == '2') selected="selected" @endif>هاتف</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="proccess-type">نوع الصيانة</label>
                        <select id="proccess-type" name="proccess_type" class="form-control show-tick  @error('proccess_type') is-invalid @enderror">
                            <option>--تحديد النوع--</option>
                            <option value="1" @if (old('proccess_type') == '1') selected="selected" @endif>هاردوير كمبيوتر</option>
                            <option value="2" @if (old('proccess_type') == '2') selected="selected" @endif>سوفت وير كمبيوتر</option>
                            <option value="3" @if (old('proccess_type') == '3') selected="selected" @endif>1-هاردوير 2-سوفت وير</option>
                            <option value="4" @if (old('proccess_type') == '4') selected="selected" @endif>1-سوفت وير 2-كمبيوتر</option>
                            <option value="5" @if (old('proccess_type') == '5') selected="selected" @endif>موبايل</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="row clearfix">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="notice">ملاحظات</label>
                        <textarea name="notice" id="notice" class="form-control no-resize" placeholder="ملاحظات الجهاز"
                                  rows="4">{{ old('notice') }}</textarea>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label for="photo">صورة مرفقة</label>
                        <input type="file" id="photo" name="photo" class="form-control photo">
                    </div>
                </div>
            </div>
            <button type="submit" class="btn bg-blue">حفظ البيانات</button>
        </form>
    </div>
@endsection
@push('scripts')
    <script>
        window.onload = function () {
            var input = document.getElementById("customer_name").focus();
        }
        $('#print').on('click', function (){
            window.print()
        });
    </script>
    <script>

    </script>
@endpush
