<div>
    <table class="table">
        <thead>
            <tr>
                <th><?php echo e(__('administrator.no.')); ?></th>
                <th><?php echo e(__('administrator.certificate')); ?></th>
                <th><?php echo e(__('administrator.major')); ?></th>
                <th><?php echo e(__('administrator.from_date')); ?></th>
                <th><?php echo e(__('administrator.to_date')); ?></th>
                <th><?php echo e(__('administrator.description')); ?></th>
                <th><?php echo e(__('administrator.foreign')); ?></th>
                <th><?php echo e(__('administrator.hobbies')); ?></th>
                <th style="width: 100px;">  <a href="javascript:void(0)"  class="btn btn-xs btn-default r-add-edu"><i class="fa fa-plus"></i> + </a> </th>
            </tr>
        </thead>
        <tbody class="tbody-family-edu">
            <?php
                //dd($emp);
            ?>
            <?php if(isset($emp->educate)): ?>
                <?php if(is_array($emp->educate)): ?>
                    <?php if(count($emp->educate)>0): ?>
                        <?php $__currentLoopData = $emp->educate; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        <?php
                            $certificate = isset($r['certificate'])?$r['certificate']:'';
                            $major = isset($r['major'])?$r['major']:'';
                            $from_date = isset($r['from_date'])?$r['from_date']:'';
                            $to_date = isset($r['to_date'])?$r['to_date']:'';
                            $description = isset($r['description'])?$r['description']:'';
                            $foreign_language_ability = isset($r['foreign_language_ability'])?$r['foreign_language_ability']:'';
                            $hobbies = isset($r['hobbies'])?$r['hobbies']:'';
                        ?>

                        <tr>
                            <td class="r-no-edu">1</td>
                            <td>
                                <input class="form-control" value="<?php echo e($certificate); ?>" name="education[<?php echo e($k); ?>][certificate]" >
                            </td>
                            <td>
                                <input class="form-control" value="<?php echo e($major); ?>" type="text" name="education[<?php echo e($k); ?>][major]">
                            </td>
                            <td>
                                <input class="form-control from_date" value="<?php echo e($from_date); ?>" type="text" name="education[<?php echo e($k); ?>][from_date]">
                            </td>
                            <td>
                                <input class="form-control to_date" value="<?php echo e($to_date); ?>" type="text" name="education[<?php echo e($k); ?>][to_date]">
                            </td>
                            <td>
                                <input class="form-control" value="<?php echo e($description); ?>" type="text" name="education[<?php echo e($k); ?>][description]">
                            </td>
                            <td>
                                <input class="form-control" value="<?php echo e($foreign_language_ability); ?>" type="text" name="education[<?php echo e($k); ?>][foreign_language_ability]">
                            </td>
                            <td>
                                <input class="form-control" value="<?php echo e($hobbies); ?>" type="text" name="education[<?php echo e($k); ?>][hobbies]">
                            </td>

                            <td style="text-align:center">
                                <a href="javascript:void(0)"  class="btn btn-xs btn-default r-del-edu"><i class="fa fa-trash"></i> - </a>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                <?php endif; ?>
            <?php endif; ?>
        </tbody>
    </table>
</div>


<?php $__env->startPush('script'); ?>
<script>
    $(function () {

       $('body').on('click', '.r-del-edu', function (e) {
            e.preventDefault();
            $(this).parent().parent().remove();
            //updateNo();
        });

       $('body').on('click', '.r-add-edu', function (e) {
            e.preventDefault();
            var r =  Math.floor(Math.random() * 26) + Date.now();

            var tr = '<tr>\n' +
                '    <td class="r-no-edu">1</td>\n' +
                '    <td>\n' +
                '        <input class="form-control"  name="education['+r+'][certificate]" >\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control"  type="text" name="education['+r+'][major]">\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control from_date"  type="text" name="education['+r+'][from_date]">\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control to_date"  type="text" name="education['+r+'][to_date]">\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control"  type="text" name="education['+r+'][description]">\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control"  type="text" name="education['+r+'][foreign_language_ability]">\n' +
                '    </td>\n' +
                '    <td>\n' +
                '        <input class="form-control"  type="text" name="education['+r+'][hobbies]">\n' +
                '    </td>\n' +
                '    <td style="text-align:center">\n' +
                '        <a href="javascript:void(0)"  class="btn btn-xs btn-default r-del-edu"><i class="fa fa-trash"></i> - </a>\n' +
                '    </td>\n' +
                '</tr>';

            $('.tbody-family-edu').append(tr);

            // $('.from_date,.to_date').bootstrapDP({
            //     format: 'yyyy-mm-dd'
            // });
           updateNoEdu();
        });

        // $('.from_date,.to_date').bootstrapDP({
        //     format: 'yyyy-mm-dd'
        // });

        updateNoEdu();

        <?php if(!isset($emp->educate)): ?>
            $('.r-add-edu').trigger('click');
        <?php endif; ?>
    });

    function updateNoEdu() {
        $('.r-no-edu').each(function (i,item) {
            $(this).text(i+1);
        });
    }
</script>
<?php $__env->stopPush(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/hr/employee/script-education.blade.php ENDPATH**/ ?>