@extends('layouts.app')

@section('title','Add Customers')



@section('content')

<div class="main-content">

                <div class="page-content">
                    <div class="container-fluid">

                        <div class="row accounts_page">
                            <div class="col-12">
                            
                                <div class="row">
                                    <!-- Validation Errors -->
									@if ($errors->any())
								    <div class="alert alert-danger" role="alert">
										<button type="button" class="close" data-dismiss="alert">×</button>
									    <ul>
										@foreach ($errors->all() as $error)
											<li>{{ $error }}</li>
									    @endforeach
									    </ul>
									</div>
							        @endif
    
								    @if (session('status'))
								    <div class="alert alert-success" role="alert">
								        <button type="button" class="close" data-dismiss="alert">×</button>
								                {{ session('status') }}
								    </div>
								    @endif 
                                </div>
                                    
                                <form method="POST" action="{{route('maintain_customers')}}">

                                    @csrf
        						<div class="row">
        									
        							<div class="col-lg-6 col-md-6">
        								<div class="card">
        									<div class="card-header" style="padding: 0.8rem 1.25rem !important;">
        										<span style="font-weight:bold;">DISPATCH SETTINGS</span>
        									</div>
        									<div class="card-body">
        										<div class="row mb-3">
        									      <input type="hidden" name="company_name" value="{{Auth::user()->name}}">
        											
        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-sm-3 col-form-label">NAME:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="text" name="customer_name" class="form-control" id="horizontal-firstname-input" value="{{old('customer_name')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>
	                                                
        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-form-label">PHONE:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="text" name="customer_phone" class="form-control" id="horizontal-firstname-input">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-form-label">EMAIL:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="email" name="customer_email" class="form-control" id="horizontal-firstname-input" value="{{old('customer_email')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div>
        										<!-- inner form row end -->
        										
        										<div class="row mb-3">
        											
	                                                <label class="col-lg-3 col-md-4 col-sm-3 col-form-label">PRIORITY</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                  
	                                                   <select class="form-control" name="priority">
	                                                    	<option value="1">1</option>
															<option value="2">2</option>
															<option value="3">3</option>
															<option value="4">4</option>
															<option value="5" selected="selected">5</option>
	                                                    	
	                                                    </select>
	                                                    	
	                                                    	
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											
	                                                <label class="col-lg-3 col-md-4 col-sm-3 col-form-label">DISCOUNT:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <select name="user_discount" class="form-control">
															<option value="0">0</option>
															<option value="1">1</option>
															<option value="2">2</option>
															<option value="3">3</option>
															<option value="4">4</option>
															<option value="5">5</option>
															<option value="6">6</option>
															<option value="7">7</option>
															<option value="8">8</option>
															<option value="9">9</option>
															<option value="10">10</option>
															<option value="11">11</option>
															<option value="12">12</option>
															<option value="13">13</option>
															<option value="14">14</option>
															<option value="15">15</option>
															<option value="16">16</option>
															<option value="17">17</option>
															<option value="18">18</option>
															<option value="19">19</option>
															<option value="20">20</option>
															<option value="21">21</option>
															<option value="22">22</option>
															<option value="23">23</option>
															<option value="24">24</option>
															<option value="25">25</option>
															<option value="26">26</option>
															<option value="27">27</option>
															<option value="28">28</option>
															<option value="29">29</option>
															<option value="30">30</option>
															<option value="31">31</option>
															<option value="32">32</option>
															<option value="33">33</option>
															<option value="34">34</option>
															<option value="35">35</option>
															<option value="36">36</option>
															<option value="37">37</option>
															<option value="38">38</option>
															<option value="39">39</option>
															<option value="40">40</option>
															<option value="41">41</option>
															<option value="42">42</option>
															<option value="43">43</option>
															<option value="44">44</option>
															<option value="45">45</option>
															<option value="46">46</option>
															<option value="47">47</option>
															<option value="48">48</option>
															<option value="49">49</option>
															<option value="50">50</option>
															<option value="51">51</option>
															<option value="52">52</option>
															<option value="53">53</option>
															<option value="54">54</option>
															<option value="55">55</option>
															<option value="56">56</option>
															<option value="57">57</option>
															<option value="58">58</option>
															<option value="59">59</option>
															<option value="60">60</option>
															<option value="61">61</option>
															<option value="62">62</option>
															<option value="63">63</option>
															<option value="64">64</option>
															<option value="65">65</option>
															<option value="66">66</option>
															<option value="67">67</option>
															<option value="68">68</option>
															<option value="69">69</option>
															<option value="70">70</option>
															<option value="71">71</option>
															<option value="72">72</option>
															<option value="73">73</option>
															<option value="74">74</option>
															<option value="75">75</option>
															<option value="76">76</option>
															<option value="77">77</option>
															<option value="78">78</option>
															<option value="79">79</option>
															<option value="80">80</option>
															<option value="81">81</option>
															<option value="82">82</option>
															<option value="83">83</option>
															<option value="84">84</option>
															<option value="85">85</option>
															<option value="86">86</option>
															<option value="87">87</option>
															<option value="88">88</option>
															<option value="89">89</option>
															<option value="90">90</option>
															<option value="91">91</option>
															<option value="92">92</option>
															<option value="93">93</option>
															<option value="94">94</option>
															<option value="95">95</option>
															<option value="96">96</option>
															<option value="97">97</option>
															<option value="98">98</option>
															<option value="99">99</option>
															<option value="100">100</option>
															</select>
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->
        										
        										
        										
        									</div>	
        								</div>	<!-- card end -->
	
        								        
        							</div><!-- first col outer 6 end -->

        							<div class="col-lg-6 col-md-6">
        								<div class="card">
        									<div class="card-header" style="padding: 0.8rem 1.25rem !important;">
        										<span style="font-weight:bold;">CONSUMER APP & WEBSITE LOGIN (OPTIONAL)</span>
        									</div>
        									<div class="card-body" style="padding-bottom: 193px;">
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-sm-3 col-form-label">Login:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="text" name="username" class="form-control" id="horizontal-firstname-input" value="{{old('username')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>
	                                                
        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-form-label">PASSWORD:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="password" name="userpassword" class="form-control" id="horizontal-firstname-input" value="{{old('userpassword')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->

        									</div>	
        								</div>
        								

        								        
        							</div><!-- second col outer 6 end -->

        									

        									
        						</div> <!-- outer row end -->

        						<div class="row">
        									
        							<div class="col-lg-12 col-md-12">
        							
        								<div class="card">
        									<div class="card-header" style="padding: 0.8rem 1.25rem !important;">
        										<span style="font-weight:bold;">ADD AN ADDRESS (OPTIONAL)</span>
        									</div>
        									<div class="card-body">
        										<div class="col-lg-6 col-md-6">
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-form-label">ADDRESS:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="text" name="address" class="form-control" id="horizontal-firstname-input" value="{{old('address')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->
        										<div class="row mb-3">
        											<label class="col-lg-3 col-md-4 col-form-label">INSTRUCTIONS:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <input type="text" name="instructions" class="form-control" id="horizontal-firstname-input" value="{{old('instructions')}}">
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->

        										<div class="row mb-3">
        											
	                                                <label class="col-lg-3 col-md-4 col-sm-3 col-form-label">DISCOUNT:</label>
	                                                <div class="col-lg-7 col-md-8">
	                                                    <select name="discount" class="form-control">
															<option value="0">0</option>
															<option value="1">1</option>
															<option value="2">2</option>
															<option value="3">3</option>
															<option value="4">4</option>
															<option value="5">5</option>
															<option value="6">6</option>
															<option value="7">7</option>
															<option value="8">8</option>
															<option value="9">9</option>
															<option value="10">10</option>
															<option value="11">11</option>
															<option value="12">12</option>
															<option value="13">13</option>
															<option value="14">14</option>
															<option value="15">15</option>
															<option value="16">16</option>
															<option value="17">17</option>
															<option value="18">18</option>
															<option value="19">19</option>
															<option value="20">20</option>
															<option value="21">21</option>
															<option value="22">22</option>
															<option value="23">23</option>
															<option value="24">24</option>
															<option value="25">25</option>
															<option value="26">26</option>
															<option value="27">27</option>
															<option value="28">28</option>
															<option value="29">29</option>
															<option value="30">30</option>
															<option value="31">31</option>
															<option value="32">32</option>
															<option value="33">33</option>
															<option value="34">34</option>
															<option value="35">35</option>
															<option value="36">36</option>
															<option value="37">37</option>
															<option value="38">38</option>
															<option value="39">39</option>
															<option value="40">40</option>
															<option value="41">41</option>
															<option value="42">42</option>
															<option value="43">43</option>
															<option value="44">44</option>
															<option value="45">45</option>
															<option value="46">46</option>
															<option value="47">47</option>
															<option value="48">48</option>
															<option value="49">49</option>
															<option value="50">50</option>
															<option value="51">51</option>
															<option value="52">52</option>
															<option value="53">53</option>
															<option value="54">54</option>
															<option value="55">55</option>
															<option value="56">56</option>
															<option value="57">57</option>
															<option value="58">58</option>
															<option value="59">59</option>
															<option value="60">60</option>
															<option value="61">61</option>
															<option value="62">62</option>
															<option value="63">63</option>
															<option value="64">64</option>
															<option value="65">65</option>
															<option value="66">66</option>
															<option value="67">67</option>
															<option value="68">68</option>
															<option value="69">69</option>
															<option value="70">70</option>
															<option value="71">71</option>
															<option value="72">72</option>
															<option value="73">73</option>
															<option value="74">74</option>
															<option value="75">75</option>
															<option value="76">76</option>
															<option value="77">77</option>
															<option value="78">78</option>
															<option value="79">79</option>
															<option value="80">80</option>
															<option value="81">81</option>
															<option value="82">82</option>
															<option value="83">83</option>
															<option value="84">84</option>
															<option value="85">85</option>
															<option value="86">86</option>
															<option value="87">87</option>
															<option value="88">88</option>
															<option value="89">89</option>
															<option value="90">90</option>
															<option value="91">91</option>
															<option value="92">92</option>
															<option value="93">93</option>
															<option value="94">94</option>
															<option value="95">95</option>
															<option value="96">96</option>
															<option value="97">97</option>
															<option value="98">98</option>
															<option value="99">99</option>
															<option value="100">100</option>
															</select>
	                                                </div>
	                                                <div class="col-lg-2 col-md-2"></div>

        										</div><!-- inner form row end -->
        										</div>
        									</div>	
        								</div><!-- card end -->	
        								        
        							</div><!-- first col outer 6 end -->

        							

        									
        						</div> <!-- outer row end -->

        						
        						

        						<div class="row">
        							<div class="col-md-12">
        								<div class="card">
        									<div class="card-body">
        										<button type="submit" class="btn btn-md btn-primary w-md btn-right distance_form">Save Driver</button>
        									</div>
        								</div>
        							</div>
        						</div>

                                </form>
        
                            
                                
                            </div> <!-- end col -->
                        </div> <!-- end row -->
        
                    </div> <!-- container-fluid -->
                </div>
                <!-- End Page-content -->

                
            </div>
            <!-- end main content-->


    <script type="text/javascript">

        var route = "{{ url('autocomplete_driver_vehicle') }}";
       
        $('.vehicle_ref').typeahead({

            source: function (query, process) {
                return $.get(route, {
                    query: query
                }, function (data) {
                    return process(data);
                });
            }
        });

       $.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		    }
		});

        
        $(document).on('click',function(e){
        	
        	var vehicle_id=$('.vehicle_ref').val();
            //alert(owner_name);
        	$.ajax({
               type:'POST',
               url:"{{route('get_vehicle_info')}}",
               data:{vehicle_id:vehicle_id},
               success:function(data) {
               	//alert(data);
                  $('.veh_ref_auto').val(data);
                  //$('.auto_owner').attr("readonly", false); 
               }
            });
        });


    </script>    


@endsection

