

<?php $__env->startSection('title'); ?>
<?php
    $map= \App\ProjectType::high_rise_map.' or '.\App\ProjectType::society_map;

    

?>

Edit  <?php echo e($map); ?> 
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
 
<ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>
         <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-unit-floor')): ?>
        <li ><a href="<?php echo e(route('unitFloor.all')); ?>"> <?php echo e($map); ?>s </a></li>
        <?php endif; ?>
        <li class="active">Edit <?php echo e($map); ?></li>
      </ol>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>

 

 

<div class="container-fluid">
                <!--.row-->
                <div class="row">

                    <div class="col-md-12">
                        <div class="white-box">
                            <h3 class="box-title m-b-0">Edit <?php echo e($map); ?></h3><hr>
                            <form class="form-horizontal" action="<?php echo e(route('unitFloor.update')); ?>" method="post">
                               <?php echo e(csrf_field()); ?>

                               <input type="hidden" name="id" value="<?php echo e($floor->id); ?>">
                                <div class="form-group">
                                    <label for="exampleInputuname" class="col-sm-2 control-label"> Name <span style="color: red">*</span></label>
                                    <div class="col-sm-10">
                                        <div class="input-group" style="width:300px">

                                            <input  type="text" class="form-control" name="name" value="<?php echo e($floor->name); ?>" id="exampleInputuname" placeholder="Name">
                                        <?php if($errors->has('name')): ?>
                                    <span class="help-block">
                                        <strong><?php echo e($errors->first('name')); ?></strong>
                                    </span>
                                <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputuname" class="col-sm-2 control-label"> Project Type <span
                                            style="color: red">*</span></label>
                                    <div class="col-sm-10">
                                        <div class="input-group" style="width: 29%;">
        
                                            <select style="width: 300px" name="project_type_id" id='project_type_id' class="form-control chosen-select">
                                                <option value="" selected="">None</option>
                                                <?php $__currentLoopData = $product_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($floor->project_type_id == $p->id): ?>
                                                <option  value="<?php echo e($p->id); ?>" selected><?php echo e($p->name); ?></option>
                                                <?php else: ?>
                                                    <option value="<?php echo e($p->id); ?>"><?php echo e($p->name); ?></option>
                                                 <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
        
                                            <?php if($errors->has('project_type_id')): ?>
                                                <span class="help-block">
                                                    <strong><?php echo e($errors->first('project_type_id')); ?></strong>
                                                </span>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputuname" class="col-sm-2 control-label"> Block<span style="color: red">*</span></label>
                                    <div class="col-sm-10">
                                        <div class="input-group" style="width: 29%;">

                                            <select style="width: 300px" name="unit_block_id" class="form-control chosen-select">
                                                <option value="" selected="">None</option>
                                                <?php $__currentLoopData = $blocks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($floor->unit_block_id == $b->id): ?>
                                                <option selected="" value="<?php echo e($b->id); ?>"><?php echo e($b->name); ?></option>
                                                <?php else: ?>
                                                <option value="<?php echo e($b->id); ?>"><?php echo e($b->name); ?></option>
                                                <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>

                                        <?php if($errors->has('unit_block_id')): ?>
                                    <span class="help-block">
                                        <strong><?php echo e($errors->first('unit_block_id')); ?></strong>
                                    </span>
                                <?php endif; ?>
                                        </div>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div class="input_fields_wrap1">
                                        <button type="button" style="float: left!important;" class="btn btn-default add_field_button" >Add New Type</button>
                                        <div class="clearfix"></div>
                                        <div>
                                            <?php
                                            $count=0;
                                            ?>
                                            <?php $__currentLoopData = $floor->unitFloors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            
                                            <?php
                                            $count=$count+1;
                                            ?>
                                <div class="form-group" style="margin-left: -2px;">
                                    <label for="exampleInputuname" class="col-sm-2 control-label"> Type <span style="color: red">*</span></label>
                                    <div class="col-sm-10">
                                        <div class="input-group" style="width: 29%;">

                                            <select style="width: 300px" name="type[]" class="form-control chosen-select type" id='type<?php echo e($count); ?>'>
                                                <?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($b->unit_type_id == $type->id): ?>
                                                <option selected="" value="<?php echo e($type->id); ?>"><?php echo e($type->name); ?></option>
                                                <?php else: ?>
                                                <option value="<?php echo e($type->id); ?>"><?php echo e($type->name); ?></option>
                                                <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>

                                        <?php if($errors->has('type')): ?>
                                    <span class="help-block">
                                        <strong><?php echo e($errors->first('type')); ?></strong>
                                    </span>
                                <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    </div>


                                </div>

                                <div class="form-group m-b-0">
                                    <div class="col-sm-offset-3 col-sm-9">
                                        <button type="submit" class="btn btn-info waves-effect waves-light m-t-10" style="width: 100px;">Save</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!--./row-->
            </div>
            <!-- /.container-fluid -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
<script type="text/javascript">
    $(document).ready(function() {
    var max_fields      = 5; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap1"); //Fields wrapper
     var wrapper1         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".add_field_button"); //Add button ID

    var x = 1; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        e.preventDefault();
        if(x < max_fields){ //max input box allowed
            x++; //text box increment
            var newSelectBox = $(
                        '<select style="width: 300px" name="type[]" class="form-control chosen-select type"></select>'
                        );

                    // Get the options from the original select box
                    var originalSelectBoxOptions = $('#type1').find('option');

                    // Iterate over each option and clone it to the new select box
                    originalSelectBoxOptions.each(function() {
                        var clonedOption = $(this).clone();
                        newSelectBox.append(clonedOption);
                    });


                    $(wrapper).prepend(
                        '<div><br><br> <div class="form-group"><label for="exampleInputuname" class="col-sm-2 control-label"> Type <span style="color: red">*</span></label><div class="col-sm-10"><div class="input-group" >' +
                        newSelectBox.prop('outerHTML') +
                        '</div></div></div> <div class="form-group"></div>  <a href="#" class="remove_field">Remove</a>'
                    ); //add input box

// $(wrapper).prepend('<div><br><br><div class="form-group"><label for="exampleInputuname" class="col-sm-2 control-label"> Type <span style="color: red">*</span></label><div class="col-sm-10"><div class="input-group" ><select style="width: 300px" name="type[]" class="form-control chosen-select"><?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($t->id); ?>"><?php echo e($t->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div></div></div>   <a href="#" class="remove_field">Remove</a>'); //add input box

// $('.chosen-select').chosen-select();
//         $(".bdpk").datepicker(
// {
//   dateFormat: "dd-mm-yy"
// });
        }
    });

    $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;
    })
    $(wrapper1).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;
    })
});
$('#project_type_id').change(function() {



var project_type = $('#project_type_id').find(":selected").val();

var data = {

    'project_type': project_type
};

$.get('<?php echo e(route('unitFloor.get-type')); ?>', data, function(data) {
    $('.preloader').fadeIn();

    $('.type').chosen('destroy');
    $('.type').empty();
    for (var i = 0; i < data.length; i++) {
        optionsData = data;
        $('.type').append($('<option>', {
            value: data[i].id,
            text: data[i].name
        }));
    }
    //        


    $('.preloader').fadeOut();



});
//     $('.type').chosen();
//   $('.type').trigger('chosen:updated');
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/proje372/akram-city.projecterp.net/resources/views/Setting/unitFloor/edit-floor.blade.php ENDPATH**/ ?>