 <?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="#">Task Working</a></li>
            <li><a href="#">Create</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>Create Task Working</h3>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12 col-xs-12">

            <div class="form-wrapper">
                <?php echo Form::open(array('route' => 'task-working-construction.store','method'=>'POST', 'enctype'=>'multipart/form-data')); ?>

                <div class="row">
                    <div class="form-group col-sm-4 col-xs-12">
                        <label class="required">Name</label>
                        <?php echo Form::text('name', null, array('placeholder' => 'Name','class' => 'form-control','required')); ?>

                    </div>
                    <div class="form-group col-sm-4 col-xs-12">
                        <label class="required">Type of building</label>
                        <?php echo Form::select('sub_category_id', $type_of_building, null, ['class' => 'form-control select2','required']); ?>

                    </div>
                    <div class="form-group col-sm-4 col-xs-12">
                        <label>Description</label>
                        <?php echo Form::textarea('description', null, array('placeholder' => 'Description','class' => 'form-control','rows'=>'2')); ?>

                    </div>
                </div>
                <div class="row" style="padding:15px;">
                    <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                            <th colspan="6">Create Sub Task Working</th>
                            <th>
                                <span class="pull-right button_primary btn-sm plus_ens fa fa-plus add"></span>
                            </th>
                            </tr>
                        </thead>
                        <tbody class="resultbody">
                            <tr>
                                <td width="5%">
                                    <label class="control-label"><strong> No : </strong></label>
                                </td>
                                <td width="8%">
                                    <input type="text" class="form-control" name="payment_no[]" value="1" readonly="readonly">
                                </td>
                                <td width="8%">
                                    <label class="control-label required"><strong> Sub Task : </strong></label>
                                    </td>
                                <td>
                                    <?php echo Form::textarea('name_sub_task[]', null, array('placeholder' => 'Name','class' => 'form-control','rows'=>'2','required')); ?>

                                </td>
                                <td width="9%">
                                    <label class="control-label"><strong> Description : </strong></label>
                                </td>
                                <td>
                                    <?php echo Form::textarea('description_sub_task[]', null, array('placeholder' => 'Description','class' => 'form-control','rows'=>'2')); ?>

                                </td>
                                <td><button class="btn btn-sm btn-danger" disabled><span class="fa fa-trash"></span></button></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-sm-12 col-xs-12">
                        <div class="form-group">
                            <button type="submit" class="button_sm button_primary pull-right"><span class="fa fa-save"></span> Save</button>
                            <button type="button" onClick="javascript:history.go(-1)" class="button_sm button_warning pull-right">
                                <span class=" fa fa-arrow-circle-left"></span> Back</button>
                        </div>
                    </div>
                </div>

                <?php echo Form::close(); ?>

            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?>
<script>
    $(document).on("click",".add",function(){
        var tr = `  <tr class="tr-no">
                        <td width="5%">
                            <label class="control-label"><strong> No : </strong></label>
                        </td>
                        <td width="8%">
                            <input type="text" class="form-control" name="payment_no[]" value="${$(".resultbody").find("tr").length+1}" readonly="readonly">
                        </td>
                        <td width="8%">
                            <label class="control-label required"><strong> Sub Task : </strong></label>
                            </td>
                        <td>
                        <?php echo Form::textarea('name_sub_task[]', null, array('placeholder' => 'Name','class' => 'form-control','rows'=>'2','required')); ?>

                        </td>
                        <td width="9%">
                            <label class="control-label"><strong> Description : </strong></label>
                        </td>
                        <td>
                            <?php echo Form::textarea('description_sub_task[]', null, array('placeholder' => 'Description','class' => 'form-control','rows'=>'2')); ?>

                        </td>
                        <td><button class="btn btn-sm btn-danger" onclick="remove_sub_task(this)"><span class="fa fa-trash"></span></button></td>
                    </tr>`;
        $(".resultbody").append(tr);
    });
    function remove_sub_task(obj)
    {
        $(obj).closest('tr').remove();
        var index = 2;
        $(".tr-no").each(function(){
            $(this).find("td:eq(1)").find("input").val(index);
            index++;
        });
    }
</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>