 <?php $__env->startSection('content'); ?>
<?php Fun::lang()?>
<div class="title-page">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="#">Construction</a></li>
            <li><a href="#">Manage Contractor</a></li>
            <li><a href="#">Check Tasks Working</a></li>
        </ul>
    </div>
</div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-page">
                        <div class="pull-left">
                            <h3>Tasks of Contractor List</h3>
                        </div>
                        <div class="pull-right">
                            <a class="button_sm button_info" href="javascript:void(0)" id="filter-toggle-search"><span class="fa fa-plus"></span>  Filter Toggle</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body table-responsive">
            <div class="row" id="toggle-seaching">
                <div class="col-md-6">
                    <div class="form-group">
                        <strong >Project :</strong>
                        <?php echo Form::select('project',\Globals::get_project(),null, array('class' => 'form-control select2')); ?>

                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <strong >Contractor Name :</strong>
                        <?php echo Form::text('contractor_name',null, array('class' => 'form-control')); ?>

                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <strong >Zone :</strong>
                        <?php echo Form::select('zone_id',\Globals::get_zone(),null, array('class' => 'form-control select2')); ?>

                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <strong >Work Group Type :</strong>
                        <?php echo Form::select('work_group_type_id',\Globals::get_work_group_type(),null, array('class' => 'form-control select2')); ?>

                    </div>
                </div>
                <div class="col-md-12" style="text-align:right;margin-bottom:40px !important;">
                    <a class="button_sm button_success" href="javascript:void(0)" id="search-submit" onclick="searching()"><span class="fa fa-search"></span> Search</a>
                </div>
            </div> 
            <table id="datatable_task__index" width="100%" class="table table-striped table-bordered table-hover nowrap">
                <thead>
                    <tr>
                        <th>NO</th>
                        <th>Date</th>
                        <th>Start Work Date</th>
                        <th>Duration(Day)</th>
                        <th>Deadline</th>
                        <th>Project</th>
                        <th>Work Group Type</th>
                        <th>Zone</th>
                        <th>Building Type</th>
                        <th>Constructor</th>
                        <th>Total Amount</th>
                        <th>Constructor Type</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                   
                </tbody>
            </table>

        </div>
    </div>
    <?php $__env->stopSection(); ?>
    <?php echo $__env->make('administrator.construction.contractor-task-responsibilities.complete-construction', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <?php $__env->startSection('js'); ?>
    <?php echo $__env->make('administrator.construction.contractor-task-responsibilities.script', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <script type="text/javascript">
            function searching(){
                $("#datatable_task__index").DataTable().draw(true);
            }
            $(document).ready(function () {
                $('#form-complete-construction').on('submit',function (e) {
                    e.preventDefault();
                    var id = $('#construct_id').val();
                    $.ajax({
                       url:"<?php echo e(route('complete_construction')); ?>",
                       dataType:"JSON",
                       type:"POST",
                       data : {"_token" : "<?php echo e(csrf_token()); ?>","id" : id},
                       success:function (data) {
                          if(data.success === true)
                          {
                              $('#complete-construction').modal('hide');
                              $('#complete-success .p-text').html(data.message);
                              $('#complete-success').show();
                              $('#datatable_task__index').DataTable().draw(true);
                              window.location.reload();
                          }
                       },
                       error:function (err) {
                           console.log(err);
                       }
                    });
                });
            });
            $(document).on('click','.btn-complete',function () {
               $('#construct_id').val($(this).data('id'));
            });
        </script>
    <?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>