<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">اجتماع مجلس الادارة</a></li>
            <li><a href="meetingsreport.php?do=report">تقرير موضوعات مجلس الادارة</a></li>
            <li class="active">عرض</li>
        </ol>
        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">عرض</h3>
            </div>
            <div class="panel-body"> 
               <form class="form-inline hidden-print" action="meetingsreport.php?do=report" method="post">
                     <div style="display: flex; align-items: center; gap: 10px;">
                 <div style="display: flex; align-items: center; gap: 10px;">
                        <label style="margin: 0; white-space: nowrap; font-weight: bold;">من تاريخ:</label>
                        <input type="date" id="from_date" class="form-control" style="width: 160px;" value="{$smarty.get.from_date}">
                    </div>

                    <div style="display: flex; align-items: center; gap: 10px;">
                        <label style="margin: 0; white-space: nowrap; font-weight: bold;">إلى تاريخ:</label>
                        <input type="date" id="to_date" class="form-control" style="width: 160px;" value="{$smarty.get.to_date}">
                    </div>

                    <button type="button" onclick="filterData()" class="btn btn-primary" style="padding: 6px 20px;">
                        <i class="fa fa-filter"></i> عرض النتائج
                    </button>
                        <a href="meetingsreport.php?do=report" class="btn btn-default" style="text-decoration: none;">إظهار الكل</a>
                </div>
                </form>
<table class="table table-bordered" style="margin-top:20px;" id="example">
    <thead>
        <tr class="bg-primary">
            
             <th class="hidden-print">موضوع الاجتماع </th>
             <th class="hidden-print">تاريخ الاجتماع</th>
            <th class="hidden-print">اسم المستخدم </th>
           
            <th>تفاصيل</th>
        </tr>
    </thead>
    <tbody>
        {foreach $showData as $data}
        <tr>
           
           <td>{$data.comment}</td>
           <td>{$data.meeting_date}</td>
            <td>{$data.employeename}</td>
            <td>{$data.sys_date}</td>
            <td><a href="meetingsreport.php?do=view&id={$data.id}" class="btn btn-xs btn-info">تفاصيل</a></td>
        </tr>
        {/foreach}
    </tbody>
</table>

{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    $('#spbutton').live('click', function (e) {
        if (!$('#spbutton').hasClass("processing")) {
            $('#spbutton').addClass("processing");
            var myForm = document.getElementById("spform");
            var SS = Spry.Widget.Form.validate(myForm);
            if (SS == true) {
                myForm.submit();
            } else {
                $('#spbutton').removeClass("processing");
            }
        }
    });
$(document).ready(function() {
    $('#nature').on('change', function() {
        if ($(this).val() === 'other') {
            $('#other_input_container').show();
        } else {
            $('#other_input_container').hide(); 
            $('#other_nature').val(''); 
        }
    });
});
$(document).ready(function(){
    $('#name').on('change', function() {
        let sideValue = $(this).find(':selected').data('side');
        if (sideValue) {
                $('#side').val(sideValue);
            } else {
                $('#side').val(''); 
            }
        });
});



    $(document).ready(function () {
        $('#example').dataTable({
            "aaSorting": [[ 0, "desc" ]],
            "scrollX":true,
            "bPaginate": false,
            "bStateSave": false,
            "sDom": 'TCR<"clear">lfrtip',
            "oTableTools": {
                "aButtons": [
                    "copy",
                    "print",
                    {
                        "sExtends": "collection",
                        "sButtonText": "حفظ",
                        "aButtons": ["csv", "xls"]
                    }
                ]
            }
        });
    });
function filterData() {
    var from = document.getElementById('from_date').value;
    var to = document.getElementById('to_date').value;
    var url = "meetingsreport.php?do=report";
    if (from && to) {
        url += "&from_date=" + from + "&to_date=" + to;
    }
    window.location.href = url;
}


</script>
{/literal}