<div class="container">
    <ol class="breadcrumb">
        <li><a href="#">الفواتير</a></li>
        <li><a href="#">فواتير</a></li>
        <li class="active">نقل الى الورشة</li>
    </ol>
    {if $showmsg == 1}
    {literal}
    <script>
        jQuery(".themessage").show();
        setTimeout(function () {
            jQuery(".themessage").hide().data("active", false);
        }, 2000);
    </script>
    {/literal}
    <div class="panel panel-default panel-m themessage">
        <div class="panel-heading">
            <h3 class="panel-title">{$msg1}</h3>
        </div>
        <div class="panel-body">
            <div class="form-group">
                <center>   <h1 style="font-family:'GE SS Two Light';font-size:50px;">{$msg2} </h1></center>
            </div>
        </div>
    </div>
    {/if}
    <div class="panel panel-default panel-m">
        <!-- Default panel contents -->
        <div class="panel-heading">النقل </div>
        <div class="panel-body">

            <ul class="nav nav-tabs">
                <li class="active"><a href="#toWorkshop_tab" data-toggle="tab">نقل الى الورشة</a></li>
                <li><a href="#delivered_tab" data-toggle="tab">تم التسليم</a></li>
                <li><a href="#underDelivery_tab" data-toggle="tab">تحت التوصيل</a></li>
                <li><a href="#finished_tab" data-toggle="tab">منتهى</a></li>
            </ul>
            <div class="tab-content">
                <!-- tab1-1 ----------------------------------------------------------------------------->
                <div class="tab-pane active" id="toWorkshop_tab">
                    <form class="form-horizontal" action="bills.php?do=toworkshop" method="post" id="toworkshopForm"><!--checkName(event, 'costcenter', 'name');-->
                        <!-- Table -->
                        <a href="bills.php" class="btn btn-primary" style="float: left;">اضافة فاتورة</a>
                        <table class="table table-black">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" name="checkAll" id="checkAll"></th>
                                    <th>رقم المسلسل</th>
                                    <th>اسم العميل</th>
                                    <th>التاريخ</th>
                                    <th>عدد المنتجات</th>
                                    <th>أسماء المنتجات</th>
                                    <th class="hidden-print">تفاصيل</th>
                                </tr>
                            </thead>
                            <tbody>
                                {assign var=i value=1}
                                {foreach $newBills as $data}
                                <tr>
                                    <td><input type="checkbox" name="choosedItem[]" id="checked{$i}" class="choosenItem" value="{$data->id}"></td>
                                    <td>{$i}</td>
                                    <td>{$data->clientname}</td>
                                    <td>{$data->billdate}</td>
                                    <td>{$data->billstatus}</td>
                                    <td>{$data->deleted}</td>
                                    <td class="hidden-print">  <a href="bills.php?do=details&id={$data->id}" target="_blank" type="button" class="btn btn-default btn-lg notesicon"></a>
                                    </td>
                                </tr>
                                {assign var=i value=$i+1}
                                {/foreach}

                            </tbody>

                        </table>
                        <div class="clearfix"></div>
                        <a href="javascript:;" id="send" class="btn btn-primary" style="float: left;"> ارسال</a>
                        <div id="sendDiv" style="display: none">
                            <div class="form-group col-lg-4">
                                <label class="sr-only">السائق</label>
                                <select class="select2 wdt300" id="driver" name="driver">
                                    <option value="-1"></option>
                                    {foreach $drivers as $data}
                                    <option value="{$data->userid}">{$data->employeename}</option>
                                    {assign var=i value=$i+1}
                                    {/foreach}
                                </select>
                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">الورشة</label>
                                <select class="select2 wdt300" id="workshop" name="workshop">
                                    <option value="-1"></option>
                                    {foreach $workshops as $data}
                                    <option value="{$data->id}">{$data->name}</option>
                                    {assign var=i value=$i+1}
                                    {/foreach}
                                </select>
                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">تاريخ التسليم</label>

                                <div class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                    <input class="form-control" size="16" type="text" value="{$now}" readonly="" id="deliveryDate" name="deliveryDate">
                                    <span class="input-group-addon "><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                                </div>

                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">مدة انجاز الورشة بالساعة</label>
                                <input type="text" class="form-control positiveNo" name="workshoptimeout" id="workshoptimeout" value="{$Programsettingdata->workshoptimeout}">
                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">مدة انجاز السائق بالساعة</label>
                                <input type="text" class="form-control positiveNo" name="drivertimeout" id="drivertimeout" value="{$Programsettingdata->drivertimeout}">
                            </div>

                            <div class="form-group col-lg-12">
                                <div align="center">
                                    <a href="javascript:;" id="transport" class="btn btn-success">تنفيذ و طباعة</a>
                                </div>
                            </div>
                        </div>

                        <div class="clearfix"></div>
                    </form>
                </div>

                <!-- tab2 ----------------------------------------------------------------------------->
                <div class="tab-pane" id="delivered_tab">
                    <!--form class="form-inline hidden-print" action="bills.php?do=billtransport" method="post">
                        <div class="form-group">
                            <label class="sr-only">رقم الطلبية</label>
                            <input type="text" class="form-control" placeholder="رقم الطلبية" name="orderNo" id="orderNo">
                        </div>
                        <br/>
                        <div class="form-group">
                            <label class="sr-only">من التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="datefrom" >
                        </div>
                        <div class="form-group">
                            <label class="sr-only">إلى التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="dateto" >
                        </div>
                        <button type="submit" class="btn btn-primary">بحث</button>
                    </form>
                    <br />
                    <hr/>
                    <br/-->
                    <!-- Table -->
                    <table class="table table-black">
                        <thead>
                            <tr>
                                <th>رقم المسلسل</th>
                                <th>رقم الطلبية</th>
                                <th>عامل التوصيل/السائق</th>
                                <th>تاريخ التسليم للورشة</th>
                                <th>عدد المنتجات</th>
                                <th>الفرع</th>
                                <th class="hidden-print">تفاصيل</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=1}
                            {foreach $deliveredOrders as $data}
                            <tr>
                                <td>{$i}</td>
                                <td>{$data->orderNo}</td>
                                <td>{$data->driverId}</td>
                                <td>{$data->deliverWorkshopDate}</td>
                                <td>{$data->productNo}</td>
                                <td>{$data->branchId}</td>
                                <td class="hidden-print">  <a href="workshoptransport.php?do=orderdetails&id={$data->id}" target="_blank" type="button" class="btn btn-default btn-lg notesicon"></a>
                                </td>
                            </tr>
                            {assign var=i value=$i+1}
                            {/foreach}

                        </tbody>

                    </table>


                </div>
                <!-- tab3 ----------------------------------------------------------------------------->
                <div class="tab-pane" id="underDelivery_tab">
                    <form class="form-horizontal" action="bills.php?do=tobranch" method="post" id="toBranchForm"><!--checkName(event, 'costcenter', 'name');-->
                        <!-- Table -->
                        <table class="table table-black">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" name="checkAll_4" id="checkAll_4"></th>
                                    <th>رقم المسلسل</th>
                                    <th>رقم الطلبية</th>
                                    <th>عامل التوصيل/السائق</th>
                                    <th>تاريخ التسليم للورشة</th>
                                    <th>عدد المنتجات</th>
                                    <th>الفرع</th>
                                    <th class="hidden-print">تفاصيل</th>
                                </tr>
                            </thead>
                            <tbody>
                                {assign var=i value=1}
                                {foreach $newBillsReturned as $data}
                                <tr>
                                    <td><input type="checkbox" name="choosedItem_4[]" id="checked_4{$i}" data-bind="deliverWorkshopdate{$i}" class="choosenItem_4" value="{$data->id}"></td>
                                    <td>{$i}</td>
                                    <td>{$data->orderNo}</td>
                                    <td>{$data->driverId}</td>
                                    <td><span id="deliverWorkshopdate{$i}">{$data->deliverWorkshopDate}</span></td>
                                    <td>{$data->productNo}</td>
                                    <td>{$data->branchId}</td>
                                    <td class="hidden-print">  <a href="workshoptransport.php?do=orderdetails&id={$data->id}" target="_blank" type="button" class="btn btn-default btn-lg notesicon"></a>
                                    </td>
                                </tr>
                                {assign var=i value=$i+1}
                                {/foreach}

                            </tbody>

                        </table>
                        <div class="clearfix"></div>
                        <a href="javascript:;" id="send_4" class="btn btn-primary" style="float: left;"> استلام</a>
                        <div id="sendDiv_4" style="display: none">


                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">عامل التوصيل</label>
                                <select class="select2 wdt300" id="driver_4" name="driver_4">
                                    <option value="-1"></option>
                                    {foreach $deliveryWorkers as $data}
                                    <option value="{$data->userid}">{$data->employeename}</option>
                                    {assign var=i value=$i+1}
                                    {/foreach}
                                </select>
                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group col-lg-4">
                                <label class="sr-only">تاريخ الاستلام</label>

                                <div class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                    <input class="form-control" size="16" type="text" value="{$now}" readonly="" id="recievebranchdate" name="recievebranchdate">
                                    <span class="input-group-addon "><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                                </div>

                            </div>
                            <div class="clearfix"></div>

                            <div class="form-group col-lg-12">
                                <div align="center">
                                    <a href="javascript:;" id="transport_4" class="btn btn-success">استلام و طباعة</a>
                                </div>
                            </div>
                        </div>

                        <div class="clearfix"></div>
                    </form>
                </div>
                <!-- tab3 ----------------------------------------------------------------------------->
                <div class="tab-pane" id="finished_tab">.

                    <!--form class="form-inline hidden-print" action="bills.php?do=billtransport" method="post">
                        <div class="form-group">
                            <label class="sr-only">رقم الطلبية</label>
                            <input type="text" class="form-control" placeholder="رقم الطلبية" name="orderNo_4" id="orderNo_4">
                        </div>
                        <br/>
                        <div class="form-group">
                            <label class="sr-only">من التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="datefrom_4" >
                        </div>
                        <div class="form-group">
                            <label class="sr-only">إلى التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="dateto_4" >
                        </div>
                        <button type="submit" class="btn btn-primary">بحث</button>
                    </form>
                    <br />
                    <hr/>
                    <br/-->


                    <table class="table table-black">
                        <thead>
                            <tr>
                                <th>رقم المسلسل</th>
                                <th>اسم العميل</th>
                                <th>التاريخ</th>
                                <th>عدد المنتجات</th>
                                <th>أسماء المنتجات</th>
                                <th class="hidden-print">تفاصيل</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=1}
                            {foreach $finished as $data}
                            <tr>
                                <td>{$i}</td>
                                <td>{$data->clientname}</td>
                                <td>{$data->billdate}</td>
                                <td>{$data->billstatus}</td>
                                <td>{$data->deleted}</td>
                                <td class="hidden-print">  <a href="bills.php?do=details&id={$data->id}" target="_blank" type="button" class="btn btn-default btn-lg notesicon"></a>
                                </td>
                            </tr>
                            {assign var=i value=$i+1}
                            {/foreach}

                        </tbody>

                    </table>
                    <div class="clearfix"></div>
                </div>

            </div>

        </div>
    </div>

    <!-- =================================================   -->


    <div class="modal fade in" id="confirmDriverModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">تاكيد حساب السائق</h4>
                </div>
                <div class="modal-body">
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-4 control-label">باسورد السائق</label>
                        <div class="col-lg-6">
                            <input type="password" class="form-control" placeholder="باسورد السائق" id="driverPass" name="driverPass" required="required">
                            <div id="driverPassError"></div>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <br/>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default savemodel2" onclick="closeClientForm()" data-dismiss="modal">لا</button>
                    <button type="button" class="btn btn-primary confirmDriver" >نعم</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- =================================================   -->

