@extends('layout.main')
@section('title', config('app.name') . ' | Customer Views')
@section('content')
        <!-- main content start-->
<!-- main content start-->

<!-- main content start-->
<div id="page-wrapper">
    <div class="pull-right" style="position: relative;top:-3em;">
        <div class="">
            <div class="form-body widget-shadow" data-example-id="simple-form-inline">
                <span style="font-size: 15px;position: relative;left:0em;"> Customer id, Name,Email,Phone  </span>
                <form class="form-inline" method="get" action="/filter-customer"
                      style="position: relative;left:0em;">
                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                    <input type="hidden" name="_method" value="post">
                    <div class="form-group">
                        <input type="text" class="form-control input-theme-style"
                               id="serach_id" name="search_id" @if(isset($set_name) && $set_name) value="{{$set_name}}"
                               @else @endif
                               placeholder="Search Here" required>
                    </div>
                    <div class="form-group">
                        <input type="submit" class="btn btn-info theme-btn" style="padding: 10px;"
                               value="submit">
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="pull-right" style="position: relative;top:-3em;">
        <div class="">
            <div class="form-body widget-shadow" data-example-id="simple-form-inline">
                <span style="font-size: 15px;position: relative;left:0em;">Filter Category List  </span>
                <form name="order_status" method="get" id="order-status-form" action="/customer-category-filter"
                >
                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                    <input type="hidden" name="_method" value="post">


                    <select class="form-control input-theme-style" id="show_status_order" name="category_name"
                            onchange="this.form.submit()">
                        <option @if(isset($set_category) && $set_category==0) selected @else @endif value="0">Show All
                            Category
                        </option>
                        <option @if(isset($set_category) && $set_category==1) selected @else @endif value="1">
                            Indvidual
                        </option>
                        <option @if(isset($set_category) && $set_category==2) selected @else @endif value="2">Company
                        </option>
                        <option @if(isset($set_category) && $set_category==3) selected @else @endif value="3">
                            Enterprices
                        </option>

                    </select>
                </form>
            </div>
        </div>
    </div>
    <div class="pull-right" style="position: relative;top:-3em;">
        <div class="">
            <div class="form-body widget-shadow" data-example-id="simple-form-inline">
                <span style="font-size: 15px;position: relative;left:0em;">Filter Company List  </span>
                <form name="order_status" method="get" id="order-status-form"
                      action="/customer-company-filter"
                >
                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                    <input type="hidden" name="_method" value="post">

                    <select class="form-control input-theme-style " id="show_status_order" name="company"
                            onchange="this.form.submit()">
                        <option value="">Show all Company</option>
                        @foreach($customer_companies as $company_list)
                            <option @if(@isset($set_company) && $set_company==$company_list->id)
                                    selected @else @endif value="{{$company_list->id}}
                                    ">{{$company_list->company}}</option>

                        @endforeach


                    </select>
                </form>
            </div>
        </div>
    </div>
    <div class="main-page">

        <div class="tables">
            <h3 class="title1">Customer Lists</h3>


            <div class="" style="position: relative;top:-1em;" data-example-id="bordered-table">
                <div class="widget-shadow">
                    @include('partials.errors')
                    @include('partials.success')
                </div>
                <table class="table table-bordered">
                    <thead style="background: #4F52BA; color: #FFFFFF;font-size: 15px;">
                    <tr>
                        <th>#</th>
                        <th>Name</th>
                        <th>Customer_id</th>
                        <th>Mobile</th>
                        <th>Email</th>

                        <th>
                            Category
                        </th>
                        <th>
                            Company
                        </th>
                        <th>Actions</th>
                    </tr>
                    </thead>
                    <tbody style="font-size: 15px;">
                    <?php
                    $i = 1;
                    ?>
                    @if(isset($customer_lists))
                        @forelse($customer_lists as $customer_list)
                            <tr>
                                <th scope="row">{{$i++}}</th>
                                <td>{{$customer_list->customer_name}}</td>
                                <td>{{$customer_list->customer_id}}</td>
                                <td>{{$customer_list->mobile}}</td>
                                <td>{{$customer_list->email}}</td>
                                <td>@if($customer_list->category==1)Indvidual @elseif($customer_list->category==2)
                                        Company @else Enterprices @endif</td>
                                <td>@if($customer_list->company==0) Company Not
                                    Available @else{{$customer_list->companyList->company}}@endif</td>
                                <td>
                                    <a href="" id="{{$customer_list->id}}"
                                       class="btn btn-primary update_customer_btn"
                                       data-toggle="tooltip"
                                       data-placement="top" title="Edit"
                                       data-original-title="Tooltip on top"><i class="fa fa-edit"></i></a>
                                    <a href="" id="{{$customer_list->id}}" data-id="{{$customer_list->visibility}}"
                                       data-toggle="tooltip"
                                       data-placement="top" title="Visiblity"
                                       data-original-title="Tooltip on top"
                                       @if($customer_list->visibility==0)  class="btn btn-success customer_visible"
                                       @else   class="btn btn-warning customer_visible" @endif ><i
                                                @if($customer_list->visibility==0) class="fa fa-eye"
                                                @else  class="fa fa-eye-slash" @endif></i></a>

                                    <a href="" id="{{$customer_list->id}}" data-toggle="tooltip"
                                       data-placement="top" title="delete"
                                       data-original-title="Tooltip on top" class="btn btn-danger customer_delete"><i
                                                class="fa fa-trash-o"></i></a>
                                </td>

                            </tr>


                        @empty
                            <tr>
                                <td class="text-center" colspan="8"><span
                                            class="badge badge-danger"> No Record Found!</span></td>
                            </tr>
                        @endforelse
                    @endif

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

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


<div class="modal fade update_customer lg" id="exampleModal" tabindex="-1" role="dialog"
     aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">Created By : <span
                            class="badge badge-primary created_by_edit" style="position: relative;top:-0.1em;"></span>
                </h4>

            </div>
            <form name="update-customer" action="/update-customer" method="post">
                <div class="modal-body">
                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                    <input type="hidden" name="_method" value="post">
                    <input type="hidden" name="customer_table_id" id="customer_table_id">
                    <div class="row">
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Name</label>
                            <input type="text" class="form-control" name="cus_name" id="cus_name">
                        </div>
                        <div class="form-group col-lg-6 company_view_edit">
                            <label for="recipient-name" class="control-label">Company</label>

                            <select data-placeholder="Choose a Company" class="form-control1"
                                    style="width: 100% !important;"
                                    tabindex="2" id="cus_company" name="company">
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Customer Id</label>
                            <input type="text" class="form-control" name="customer_id" id="customer_id" disabled>
                        </div>
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Mobile No</label>
                            <input type="text" class="form-control" name="customer_mobile" id="customer_mobile">
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Email</label>
                            <input type="text" class="form-control" name="customer_email" id="customer_email">
                        </div>
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Gender</label>
                            <select class="form-control" name="customer_gender" id="customer_gender">
                                <option value="1">Male</option>
                                <option value="2">Female</option>
                                <option value="3">Transgender</option>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Category</label>
                            <select class="form-control" name="customer_category" id="customer_category">
                                <option value="1">Indivdual</option>
                                <option value="2">Company</option>
                                <option value="3">Enterprices</option>
                            </select>
                        </div>
                        <div class="form-group col-lg-6">
                            <label for="recipient-name" class="control-label">Reffered By</label>
                            <input type="text" class="form-control" name="customer_refer_by" id="customer_refer_by">
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-lg-12">
                            <label for="recipient-name" class="control-label">Address</label>
                            <textarea class="form-control" name="customer_address" id="customer_address"></textarea>
                        </div>

                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default theme-btn2" data-dismiss="modal">Close</button>
                    <input type="submit" class="btn btn-primary theme-btn update-customer" value="save">
                </div>
            </form>
        </div>
    </div>
</div>

<!--footer-->
@endsection