<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">سيارات</a></li>
            <li><a href="carsreport.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="carsreport.php?do=report" method="post">
                    <div class="form-group">
                        <label>اختيار السيارة</label>
                        <select name="car_name" class="form-control">
                            <option value="">كل السيارات</option> {foreach $allCars as $c}
                                <option value="{$c.car}" {if $smarty.post.car_name == $c.car}selected{/if}>
                                    {$c.car}
                                </option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="form-group">
                        <label>من التاريخ</label>
                        <input type="date" class="form-control"  name="from">
                    </div>
                    <div class="form-group">
                        <label>إلى التاريخ</label>
                        <input type="date" class="form-control" name="to">
                    </div>
                    <button type="submit" name="search" class="btn btn-primary">بحث</button>
                </form>
<table class="table table-bordered" style="margin-top:20px;" id="example">
    <thead>
        <tr class="bg-primary">
            
              <th>السيارة</th>
                            <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.car}</td>
                            <td>{$data.color}</td>
                            <td>
                                {$data.num}
                            </td>
            <td>{$data.counter}</td>
           
            <td><a href="carsreport.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"]
                    }
                ]
            }
        });
    });


</script>
{/literal}