

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
          <li><a href="#">ادراه الموظفين</a></li>
            <li><a href="employeeHolidays.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;"> عرض       </h3>
                <a href="{$youtubes[198]->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="employeeHolidays.php" class="hidden-print"><input type="button"  id="submit" style="margin-left: 12px" class="btn btn-primary pull-left " value="إضافة جديد"/></a>
            </div>
            
            <hr/>

            <form class="form-inline hidden-print" method="post" action="employeeHolidays.php?do=show">
                    
                   
                  
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker searchdata" id="fromdate"   data-date-format="yyyy-mm-dd"  >
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker searchdata"  id="todate"   data-date-format="yyyy-mm-dd"  >
                    </div>
                    <div class="form-group" style="min-width: 419px;">
                        <label class="sr-only">العطلات</label>
                        <input type="text" class="searchdata wdt100 holidays" id="holidays" data-placeholder="اختر " />

                    </div>
                    
                </form>
            <hr/>



            <table class="table table-black" id="getajaxdata" 
            data-controll="employeeHolidays.php?do=showajax">
                <thead>
                    <tr>
                        <th style="width:50px;">م</th>

                        <th>العطله</th>
                        <th>التاريخ</th>
                        <th>المستخدم</th>
                        <th>تاريخ الاضافه </th>
                        <th class="noprint">تعديل</th>
                        <th class="noprint">حذف</th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>





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


           


        </div>



    </div>

</div>



{literal}
<script type="text/javascript">


    $(document).ready(function () {
        var formatResult;
        formatResult = function (data) {
            return  data.text;
        }



        $("#holidays").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "employeeHolidays.php?do=holidays",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });
      

        fetch_data();
        function fetch_data(fromdate = '', todate = '', data1 = '')
        {
            var dataTable = $('#getajaxdata').DataTable({
                "lengthMenu": [[20, 40, 60, 80, 100, -1], [20, 40, 60, 80, 100, "All"]],
                dom: 'Bfrtip',
                buttons: [
                    {
                        extend: 'copyHtml5',
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    },
                    {
                        extend: 'csvHtml5',
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    },
                    {
                        extend: 'print',
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    },
                    {
                        extend: 'excelHtml5',
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    },
                    {
                        extend: 'pdfHtml5',
                        exportOptions: {
                            columns: [0, 1, 2, 3, 4, 5, 6, 7]
                        }
                    },
                    'colvis'
                ],
                "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>>",
                "order": [[0, "asc"]],
                "displayLength": 20,
                "ajax": {
                    url: 'employeeHolidays.php?do=showajax',
                    type: "POST",
                    data: {
                        fromdate: fromdate,
                        todate: todate,
                        data1: data1,
                    }
                },
               

            });

        }


        $('.searchdata').change(function () {
            var fromdate = $('#fromdate').val();
            var todate = $('#todate').val();
            var data1 = $('#holidays').val();
            $('#getajaxdata').DataTable().destroy();
            fetch_data(fromdate, todate, data1);

        });


      

    });





$('body').on('click', '.removerow', function () {
    var id = $(this).attr('data-id');
    if (confirm('هل انت متاكد من الحذف ؟')) {
        var thisis = $(this);
        $.post('employeeHolidays.php?do=del', {id: id}, function (data) {
            if (data == 1) {
                thisis.parent().parent().remove();
            }else{
               alert('حدث خطأ أثناء التنفيذ');
            }
        });
    } else {
         alert('لماذا ضغطت إلغاء؟ يجب أن تكون قد أكدت');
    }
});

</script>
{/literal}
