<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="#">الموردين</a></li>
            <li><a href="#">إدارة الموردين</a></li>
            <li class="active">عرض الموردين</li>
        </ol>



        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->

            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;">عرض الموردين <br />
                    {if $message != ""}
                    {$message}
                    {/if}</h3>
                <a href="{$youtubes[10]->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="supplierController.php" class="hidden-print"><input type="button"  id="submit" style="margin-left: 12px" 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  hidden-print" 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="supplierController.php?do=show"  method="post">
                    <div class="form-group">
                        <label class="sr-only">اسم المورد</label>
                        <select data-placeholder="اختر اسم المورد:"  class="select2 wdt100" name="supplierid" id="supplierid">
                            <option value="-1"></option>










                            {foreach $alldata as $data }










                            <option value="{$data->supplierid}">{$data->suppliername}</option>










                            {/foreach}










                        </select>
                    </div>
                    <input type="hidden" name="usergroupname" id="usergroupname" value="{$usergroupname}"/>
                    <input type="checkbox" name="showdelete" value="1"/>عرض المحذوف
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>

                {if {$Programsettingdata->showCurrency} eq 1}
                <div class="col-lg-offset-8 col-lg-4" style="margin-bottom: 5px;">
                    <a type="button" class="btn btn-success pull-left" href="supplierController.php?do=updateDebtsInTermsOfCurrency">تحديث قيم المديونيات حسب سعر الصرف</a>
                </div>
                {/if}
                <div class="col-lg-offset-8 col-lg-4">
                    <div class="well well-sm">
                        <h4 class="text-center">إجمالي مديونية الموردين الغير محذوفين:  {$sum}</h4>
                    </div>
                </div>
                <div class="clearfix"></div>
                <hr/>
                {literal}
                <form id="form1" name="form1" method="post" action="supplierController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                            return countChoosenProducts('supplierController');
                        } else {
                            return false;
                        }">
                    {/literal}
                    <!-- Table -->
                    <table class="table table-black" id="supplier">
                        <thead>
                            <tr>
                                <th  class="hidden-print">
                                    <label>
                                        <input type="checkbox" name="checkAll" id="checkAll"/>
                                    </label>
                                </th>
                                {if $Programsettingdata->clientserial eq 1}<th>الرقم التسلسلي</th>{/if}
                                <th>اسم المورد</th>
                                <!-- <th>المديونية</th> -->
                                <th>ليه</th>
                                <th>عليه</th>
                                {if {$Programsettingdata->showCurrency} eq 1}
                                <th>دين المورد بعملته</th>
                                {/if}
                                <th class="hidden-print">إخفاء / إظهار</th>
                                <th class="hidden-print">التعديل</th>
                                {if {$Programsettingdata->allowfinsldelete} eq 0}
                                <th class="hidden-print">حذف </th>
                                {/if}
                                <th class="hidden-print">قيد اليومية</th>
                            </tr>
                        </thead>
                        <tbody>

                            {foreach $shownData as $data}
                            {if {$data->conditions} eq 1}
                            <tr class="danger"> {elseif {$data->conditions} eq 0}
                            <tr> {/if}
                                <td class="hidden-print">
                                    <label>
                                        <input type="checkbox" name="choosedItem[]" id="checked{$i}" class="choosenItem" value="{$data->supplierid}" />
                                    </label>
                                </td>
                                {if $Programsettingdata->clientserial eq 1}<td>{$data->supplierid}</td>{/if}
                                <td>{$data->suppliername}</td>
                                {if $data->suppliercurrentDebt < 0}
                                <td>0</td>
                                <td>{$data->suppliercurrentDebt}</td>
                                {else}

                                <td>{$data->suppliercurrentDebt}</td>
                                <td>0</td>
                                {/if}
                                {if {$Programsettingdata->showCurrency} eq 1}
                                <td>{$data->suppliercurrentDebtInCurrency} {$data->currencyName}</td>
                                {/if}
                                <td  class="hidden-print"> {if {$data->conditions} eq 0} <a href="supplierController.php?do=tempdelete&id={$data->supplierid}" type="button" class="btn btn-default btn-lg removeicon"> </a> {elseif {$data->conditions} eq 1 } <a  href="supplierController.php?do=returndelete&id={$data->supplierid}" type="button" class="btn btn-default btn-lg correcticon"> </a></td>
                                {/if}
                                <td  class="hidden-print"><a href="supplierController.php?do=edit&id={$data->supplierid}" type="button" class="btn btn-default btn-lg editicon"></a></td>

                                {if {$Programsettingdata->allowfinsldelete} eq 0}
                                <td class="hidden-print">
                                    {if $data->supplierid != 1}
                                    <a href="#" name="dd" type="button" class="btn btn-default btn-lg deleteicon conformdel1" data-position="supplierController.php?do=deleteFinaly&id={$data->supplierid}&action={$data->dailyentryid}" ></a>
                                    {/if}
                                </td>
                                {/if}
                                <td class="hidden-print"><a href="dailyentry.php?id={$data->dailyentryid}" target="_blank" type="button" class="btn btn-default btn-lg editicon"> </a></td>
                            </tr>
                            {/foreach}
                        </tbody>

                    </table>
                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">إجمالي مديونية الموردين الغير محذوفين:  {$sum}</h4>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <hr />
                    <div  class="hidden-print">
                        <div class="col-lg-12">
                            <div class="well well-sm">
                                <div class="form-group">
                                    <div class="col-lg-4">
                                        <label for="operation"></label>
                                        <span id="spryselect2">
                                            <select name="operation" id="operation"  data-placeholder="اختر العملية" class="select2 wdt100">
                                                <option value="-1"></option>
                                                <option value="1">إخفاء</option>
                                                <option value="2">إظهار</option>
                                            </select>
                                            <span class="selectInvalidMsg">اختر العملية</span></span></div>
                                </div>
                                <div class="form-group">
                                    <div class="col-lg-4">
                                        <input name=""  class="hidden-print btn btn-primary" type="submit" value="تنفيذ"/>
                                    </div>
                                </div>

                                <!-----------  start noElementsError alert ------------->
                                <div class="clearfix"></div>
                                <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">×</button>
                                    <p>يجب اختيار العناصر أولاً</p>
                                    <div class="clearfix"></div>
                                </div>
                                <!----------  end noElementsError alert -------------->

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

                <div class="hidden-print">
                    <input type="button" onclick="print_Custom('mycustomheader');" class="hidden-print pull-right btn btn-success" value="طباعة" />
                </div>
                <div class="clearfix"></div>

                <!-- 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>
                                <div class="modal-body"> هل تريد حذف هذا المورد ؟ </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">لا</button>
                                    <button type="button" class="btn btn-primary savemodel1">نعم</button>
                                </div>
                            </div>
                            <!-- /.modal-content -->
                        </div>
                        <!-- /.modal-dialog -->
                    </div>
                </div>
                <!-- /.modal -->
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue: "-1", isRequired: false});
    $(document).ready(function () {
        $('#supplier').DataTable({
            dom: 'Bfrtip',
            buttons: [
            {
                    extend: "excel",
                    className: "btn yellow btn-outline ",
                    text: "اكسل",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    }
                },
                    {
                        extend: 'pdfHtml5',
                        className: "btn yellow btn-outline ",
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    }, {
                    extend: "colvis",
                    className: "btn dark btn-outline",
                    text: "المكونات"
                }
            ],
            "lengthMenu"
                    : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
        });
    });
</script>
{/literal}
