
{if $append eq 0}
<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">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة  </h3>
            </div>
            <div class="panel-body">
                  <form  method="post" action="employeeHolidays?do=add" class="nameToBeChecked form-horizontal" enctype="multipart/form-data">
                <div class="appends">

{/if}        
                    <div class="form-group">
                        <label class="col-lg-1 control-label">العطله</label>
                        <div class="col-lg-5">
                            <span id="sprytextfield1">
                                <input name="holiday" type="text" data-id="{$employeeholidays->id}"  class="form-control holidays autosave" value="{$employeeholidays->holiday}" />
                            <span class="textfieldRequiredMsg"></span></span>
                        </div>
                   
                    
                        <label class="col-lg-1 control-label">التاريخ</label>
                        <div class="col-lg-5">
                             <span id="sprytextfield1">
                            <input name="holiday_date" id="holiday_date"    data-id="{$employeeholidays->id}"  class="form-control awdatepicker autosave" autocomplete="off"  data-date-format="yyyy-mm-dd" type="text" value="{$employeeholidays->holiday_date}"/>
                                <span class="textfieldRequiredMsg">من فضلك اختر الاسم</span></span>
                        </div>
                    </div>  

{if $append eq 0}
                </div>  
                   
                </form>
            </div>
        </div>
    </div>
</div>


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

    $(document).ready(function () {

        $('body').on('change', '.holidays', function () {
            var allempty = 0;
            $(".holidays").each(function() {
               if ($(this).val().length == 0) {
                  allempty += 1;
               }
            });
            if(allempty == 0){
                $.post('employeeHolidays.php?do=addappend', function (result) {
                   $('.appends').append(result);
                });
            }

        });

        $('body').on('change', '.autosave', function () {
            var id = $(this).attr('data-id');
            var name = $(this).attr('name');
            var val = $(this).val();
            $.post('employeeHolidays.php?do=autosave',{id: id, name: name, val: val});
        });
        

    });

</script>
{/literal}
{/if}