
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="clientController.php?do=show">العملاء</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[272]->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="clientController.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">

                            <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>
                            <form class="form-inline hidden-print" action="clientController.php?do=show" method="post">
                                          <div class="form-group">
                                            <label class="sr-only"> العميل</label>
                                            <input type="text" name="clients" id="clients" class="form-control" placeholder="اسم العميل">
                                          </div>
                                <div class="form-group">

                                    <label class="sr-only"> اسم العميل </label>
                                    <select class="select2 wdt300" name="clientid" id="clientid" >
                                        <option value="-1">اختر عميل </option>
                                        <option value="-2"> كل العملاء</option>
                                        {foreach $alldata as $data }



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


                                        {/foreach}


                                    </select>
                                </div>
                                <button type="submit" class="btn btn-primary">بحث</button>
                            </form>
                            <a href="clientController.php?do=downloadphone" class="btn btn-success" id="downloadPhone">تحميل أرقام الهواتف</a>
                        </div>-->
            <!--            <div class="col-lg-offset-8 col-lg-4">
                            <div class="well well-sm">
                                <h4 class="text-center">إجمالي مديونية العملاء الغير محذوفين <br/>
                                    {$sum}  {$currency}</h4>
                            </div>
                        </div>
                        <div class="clearfix"></div>-->


            <!-- Table -->
            {literal}
            <form method="post" action="clientController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                        return countChoosenProducts('clientController');
                    } else {
                        return false;
                    }">
                {/literal}
                <!-- ================================================   -->
                <!-- Nav tabs -->
               
                <ul class="nav nav-tabs hidden-print">
                    {assign var=typeItr value=1}
                    {foreach $types as $type}
                    <li {if $typeItr == 1}class="active"{/if}><a href="#tab{$typeItr}" data-toggle="tab">{$type->typeName}</a></li>
                    {assign var=typeItr value=$typeItr+1}
                    {/foreach}
                </ul>
                <!-- =================================================   -->
                <!-- Tab panes -->
                <div class="tab-content tab-product">
                    <!-- start tab1 -->


                    {assign var=typeItr value=1}
                    {foreach $types as $type}
                    <div class="tab-pane {if $typeItr == 1}active{/if}" id="tab{$typeItr}">
                        {assign var=total value=0}
                        <table class="table table-black dataTableClassn">
                            <thead>
                                <tr>
                                    {if $Programsettingdata->clientserial eq 1}<th>الرقم التسلسلي</th>{/if}
                                    <th>اسم العميل</th>
                                    <th>رقم التليفون</th>
                                    <th>الشركة / المنطقة</th>
                                    <th>المديونية</th>
                                    <th>حد الدين</th>
                                    <th>نوع العميل</th>
                                    <th>المستخدم</th>
                                    <th>اخر تعديل بواسطة</th>
                                    <th class="hidden-print">ايقاف</th>
                                    <th class="hidden-print">تعديل</th>
                                    {if {$Programsettingdata->allowfinsldelete} eq 0}
                                    <th class="hidden-print">حذف </th>
                                    {/if}
                                </tr>
                            </thead>
                            <tbody>

                                {foreach $type->clients as $data}
                                {if {$data->conditions} eq 1}
                                <tr class="danger"> {elseif {$data->conditions} eq 0}

                                <tr> {/if}
                                    {if $Programsettingdata->clientserial eq 1}<td>{$data->clientid}</td>{/if}
                                    <td>{$data->clientname}</td>
                                    <td>{$data->clientphone}<br/>{$data->clientmobile}</td>
                                    <td>
                                        {foreach $allclientarea as $area}
                                        {if $data->clientareaid eq $area->id}{$area->name}{/if}
                                        {/foreach}
                                    </td>
                                    <td>{$data->clientdebt}</td>
                                    <td>{$data->debtLimit}</td>

                                    <td>

                                        {if $data->typeclientid eq -20}
                                        كل انواع العملاء
                                        {else if $data->typeclientid eq 0 || $data->typeclientid == ''}
                                        -
                                        {else}
                                        {$type->typeName}
                                        <!--{foreach $types as $type}{if ($type->typeId|in_array:$data->typeclientid)}{$type->typeName}</br>{/if}{/foreach}-->
                                        {/if}




                                    </td>
                                    <td>{$data->employeename}</td>
                                    <td>{$data->lastEditUserName}</td>
                                    <td class="hidden-print"> {if {$data->conditions} eq 0} <a href="clientController.php?do=tempdelete&id={$data->clientid}" type="button" class="btn btn-default btn-lg removeicon"></a> {elseif {$data->conditions} eq 1 } <a href="clientController.php?do=returndelete&id={$data->clientid}" type="button" class="btn btn-default btn-lg correcticon"></a> {/if} </td>
                                    <td class="hidden-print"> <a href="clientController.php?do=edit&id={$data->clientid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>


                                    {if {$Programsettingdata->allowfinsldelete} eq 0}
                                    <td class="hidden-print">
                                        {if $data->clientid != 1}
                                        <a href="#" name="dd" type="button" class="btn btn-default btn-lg deleteicon conformdel1" data-position="clientController.php?do=deleteFinaly&id={$data->clientid}&action={$data->dailyentryid}" ></a>
                                        {/if}
                                    </td>
                                    {/if}
                                </tr>
                                {assign var=total value=$total + $data->clientdebt}
                                {/foreach}

                            </tbody>

                        </table>
                        <div style="text-align:center;border: 1px solid;border-radius: 5px;font-size:20px;
                        margin: 0px 340px;background-color: #ccc;" > الاجمالى   : {$total} </div> 
                    </div>
                    
                    {assign var=typeItr value=$typeItr+1}
                    {/foreach}

                </div>
                
                <!--                <div class="col-lg-offset-8 col-lg-4">
                                    <div class="well well-sm">
                                        <h4 class="text-center">إجمالي مديونية العملاء الغير محذوفين <br/>
                                            {$sum}  {$currency}</h4>
                                    </div>
                                </div>
                                <div class="clearfix"></div>-->

            </form>
        </div>

    </div>
</div>
{literal}
<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});
    $(function () {
        //
        var dataTableClassn = $('.dataTableClassn');
        var otable_clients = dataTableClassn.DataTable({
            dom: 'Bfrtip',
            buttons: [//'csv', 'pdf'
                {
                    extend: "print",
                    title: '',
                    className: "btn dark btn-outline",
                    text: "طباعه<i class='fa fa-print'></i>",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: [0, 1, 2, 3, 4, 5, 6],
                    },
                    customize: function (win) {
                        $(win.document.body).find('table')
                                //.addClass('compact')
                                .css('direction', 'rtl');
                    }
                }, {
                    extend: "copy",
                    className: "btn red btn-outline",
                    text: "نسخ",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    }
                }, {
                    extend: "excel",
                    className: "btn yellow btn-outline ",
                    text: "اكسل",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    }
                }, {
                    extend: "colvis",
                    className: "btn dark btn-outline",
                    text: "المكونات"
                }
            ], "bStateSave": true,
            "language": {
                "aria": {
                    "sortAscending": ": Used to order Ascending",
                    "sortDescending": ": Used to order Descending"
                },
                "emptyTable": "لا يوجد بيانات",
                "info": "عرض من  _START_ إلى  _END_  - عدد عملاء البحث _TOTAL_",
                "infoEmpty": "لا يوجد بيانات",
                "infoFiltered": "(تنقيه  من عدد عملاء كلى _MAX_)",
                "lengthMenu": " _MENU_ عنصر",
                "search": "البحث:",
                "zeroRecords": "لا يوجد بيانات تشابه البحث"
            },
            responsive: !0,
            order: [
                [0, "asc"]
            ],
            paging: true,
            lengthMenu: [
                [5, 10, 15, 20, 50, -1],
                [5, 10, 15, 20, 50, "All"]
            ],
            pageLength: 10,
            dom: "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>"
        });
    
        
    });
</script>
{/literal}