
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المصروفات والإيرادات</a></li>
            <li><a href="#">الكمبيالات</a></li>
            <li class="active">عرض الكمبيالات</li>
        </ol>
        <div class="panel panel-default panel-m">
            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;"> عرض الكمبيالات</h3>
                <a href="{$youtubes[96]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
                <a href="kempialaController.php" class="hidden-print"><input type="button" style="margin-left: 12px" id="submit"  class="btn btn-primary pull-left " value="إضافة جديد"/></a>
            </div>

            <div class="panel-body">

                <!---------- start outputString alert ----------->
                <div id="outputString" class="alert alert-block alert-success fade in" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>
                <form class="form-inline hidden-print" action="kempialaController.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">اختر عميل</label>
                        <select data-placeholder="اختر عميل" class="select2 wdt100" style="width:200px !important;" name="clientId" id="clientId" onchange=" getResult();">
                            <option value="-1" selected>اختر عميل</option>

                            {foreach $allclientdata as $clients}



                            <option value="{$clients->clientid}">{$clients->clientname}</option>




                            {/foreach}

                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary hidden-print">بحث</button>
                </form>

                <div class="panel panel-default panel-m">
                    <!-- Default panel contents -->
                    <div class="panel-heading">{$message}</div>
                    <div class="panel-body">
                        <hr  />

                        <div class="hidden-print"> <a href="kempialaController.php?do=show" class="btn btn-primary hidden-print"> المتاح من الكمبيالات</a>
                            <a href="kempialaController.php?do=showexit" class="btn btn-warning hidden-print">  الكمبيالات المنتهيه</a>
                            <a href="kempialaController.php?do=showsold" class="btn btn-success hidden-print">  الكمبيالات المباعه</a></div>


                        <div class="table-responsive">
                            <table class="table table-black">
                                <thead>
                                    <tr>

                                        <th>إسم العميل</th>
                                        <th>تاريخ الإستلام</th>
                                        <th>تاريخ الإنتهاء</th>
                                        <th>القيمه</th>
                                        <th class="hidden-print">تعديل</th>
                                        <th class="hidden-print">إلغاء</th>
                                        <th class="hidden-print">بيع</th>
                                        <th class="hidden-print">طباعة</th>
                                    </tr>
                                </thead>
                                <tbody>

                                    {foreach $shownData as $kempData}
                                    {if {$kempData->conditions} eq 1}
                                    <tr class="danger"> {elseif {$kempData->conditions} eq 0}
                                    <tr> {/if}
                                        {if {$kempData->clientID} eq {$myClient->clientid} }
                                        <td>{$myClient->clientname}</td>
                                        {else}
                                        <td>{$kempData->clientname}</td>
                                        {/if}
                                        <td>{$kempData->recievingdate}</td>
                                        <td>{$kempData->expiredate }</td>
                                        <td>{$kempData->value}</td>

                                        <td  class="hidden-print"><a href="kempialaController.php?do=edit&id={$kempData->id}"  type="button" class="btn btn-default btn-lg editicon"></a></td>

                                        <td  class="hidden-print"> {if {$kempData->conditions} eq 0 && {$kempData->supplierID} eq 0 && {$type} eq 'avelabel'}
                                            <a href="#"  id="delbtn" type="button" data-id="{$kempData->id}" class="btn btn-default btn-lg removeicon">  </a>
                                            {elseif  {$type} <> 'avelabel' && {$kempData->conditions} eq 0}
                                            <a href="kempialaController.php?do=deletefinal&id={$kempData->id}" class="btn btn-danger"> إلغاء الكمبيالة وسداد المديونية </a>
                                            {elseif  {$type} <> 'avelabel' && {$kempData->conditions} eq 1}
                                            تم إلغاء الكمبيالة وسداد المديونية
                                            {else}
                                            تم إلغاءه من قبل
                                            {/if}
                                            <!--a onclick="getValue({$kempDataId->kempDataId},{$kempData->type})" name="dd" class="deletefinal button with_icon16_notext"-->
                                        </td>
                                        <td   class="hidden-print">
                                            {if {$kempData->conditions} eq 0  && {$kempData->supplierID} eq 0}
                                            <a href="kempialaController.php?do=sell&id={$kempData->id}"  type="button" class="btn btn-default btn-lg moneyicon">
                                                {else}
                                                لا يمكن بيع الكمبيالة
                                                {/if} </td>
                                        <td  class="hidden-print"><a href="kempialaController.php?do=editprint&id={$kempData->id}"  type="button" class="btn btn-default btn-lg printicon">  </a></td>
                                    </tr>
                                    {/foreach}


                                </tbody>

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

                        <!----------  pagination  -------------->
                        <div class="hidden-print">
                            <div class="dataTables_info" id="datatable_2_info"> هناك &nbsp;[{$paginate.first}-{$paginate.last}]&nbsp; عنصر من &nbsp; &nbsp; [{$paginate.total}]</div>
                            <div class="dataTables_paginate paging_full_numbers" id="datatable_2_paginate"> {if {paginate_prev} eq ""}
                                {else} <span class="next paginate_button" id="datatable_2_next">{paginate_prev}</span> {/if} <span> {if {paginate_middle} eq ""}
                                    {else} <span class="paginate_button">{paginate_middle format="page"}</span> {/if} </span> {if {paginate_next} eq ""}
                                {else} <span class="last paginate_button" id="datatable_2_last">{paginate_next}</span> {/if} </div>
                        </div>
                        <!----------  pagination  -------------->

                        <div  class="hidden-print">
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <div class="col-lg-4">
                                        <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right">طباعة</button>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        </form>

                        <!-- Modal -->
                        <div class="hidden-print">
                            <div class="modal fade " id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title">تأكيد حذف الكمبيالة</h4>
                                        </div>
                                        <form id="delform" action="kempialaController.php?do=delete&id={$kempData->id}" method="post" class="form-horizontal">

                                            <div class="modal-body"> هل تريد حذف هذه  الكمبيالة ؟ </div>
                                            <div class="modal-footer">
                                                <button type="button" id="delconfbtn" class="btn btn-primary savemodel1">نعم</button>
                                                <button type="button" class="btn btn-default" data-dismiss="modal">لا</button>
                                            </div>
                                        </form>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>
                        </div>
                        <!-- /.modal -->

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