 
 <?php $__env->startSection('content'); ?>
 <?php Fun::lang() ?>
 <div class="page">
     <div class="top-content">
         <div class="row">
             <div class="col-sm-12 col-xs-12">
                 <div class="pull-left">
                     <h3 class="edit-title">Edit Item</h3>
                 </div>
             </div>
         </div>
     </div>
     <div class="row">
         <div class="col-sm-12 col-xs-12">
             <div class="form-wrapper">
                 <?php echo Form::model($items, ['method' => 'PATCH','route' => ['items.update', $items->id],'enctype'=>'multipart/form-data','autocomplete'=>'off']); ?>

                 <div class="form-group col-sm-4">
                     <label for="" class="required">Project</label>
                     <?php echo Form::select('item_projectid',$projects,null,['class'=>'select2','id'=>'project_id','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Category</label>
                     <?php echo Form::select('item_categoryid',$categories,null,['class'=>'form-control select2','id'=>'category_id','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Zone</label>
                     <?php echo Form::select('item_zone_id',$item_zone,null,['class'=>'form-control select2','id'=>'zone_id','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Group</label>
                     <?php echo Form::select('item_groupid',$item_group,null,['class'=>'form-control select2','id'=>'group_id','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Title</label>
                     <?php echo Form::text('item_title',null,['class'=>'form-control','id'=>'item_title']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Code</label>
                     <?php echo Form::text('item_name',null,['class'=>'form-control','id'=>'item_name','readonly']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Name</label>
                     <?php echo Form::text('item_house',null,['class'=>'form-control','id'=>'item_house','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Cost</label>
                     <?php echo Form::text('item_cost',null,['class'=>'form-control','id'=>'item_cost','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="required">Item Price</label>
                     <?php echo Form::text('item_price',null,['class'=>'form-control','id'=>'item_price','required']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Item Type</label>
                     <?php echo Form::select('item_type',[''=>'Please Select','Sales'=>'For Sale','Rent'=>'For Rent'],null,['class'=>'form-control select2','id'=>'item_type']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Commission Type</label>
                     <?php echo Form::select('commission_type',[''=>'Please select','1'=>'Amount ($)','2'=>'Percentage (%)'],((!empty($items->commission_amount) && $items->commission_amount>0)?1:((!empty($items->commission) && $items->commission>0 )?2:null)),['class'=>'form-control select2','id'=>'commission_type']); ?>

                 </div>
                 <div class="form-group col-sm-4 type_amount <?php echo e((empty($items->commission_amount) || $items->commission_amount<=0)?'hide':''); ?>">
                     <label for="">Commission ($)</label>
                     <?php echo Form::text('commission_amount',null,['class'=>'form-control','id'=>'commission_amount']); ?>

                 </div>
                 <div class="form-group col-sm-4 type_percent <?php echo e((empty($items->commission) || $items->commission<=0)?'hide':''); ?>">
                     <label for="">Commission (%)</label>
                     <?php echo Form::text('commission',null,['class'=>'form-control','id'=>'commission']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Land Width (m)</label>
                     <?php echo Form::text('item_width_land',null,['class'=>'form-control number-only','id'=>'land_width']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Land Length (m)</label>
                     <?php echo Form::text('item_length_land',null,['class'=>'form-control number-only','id'=>'land_length']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Land Area (m<sup>2</sup>)</label>
                     <?php echo Form::text('item_size_land',null,['class'=>'form-control number-only','id'=>'land_area']); ?>

                 </div>
                 <?php if($items->item_create_type==1): ?>
                 <div class="form-group col-sm-4">
                     <label for="" >House Width (m)</label>
                     <?php echo Form::text('item_width_house',null,['class'=>'form-control number-only','id'=>'house_width']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">House Length (m)</label>
                     <?php echo Form::text('item_length_house',null,['class'=>'form-control number-only','id'=>'house_length']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">House Area (m<sup>2</sup>)</label>
                     <?php echo Form::text('item_size_house',null,['class'=>'form-control number-only','id'=>'house_area']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Complete Year</label>
                     <?php echo Form::text('item_completed_year',null,['class'=>'form-control date_picker','id'=>'item_completed_year']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Total Bedroom</label>
                     <?php echo Form::text('item_bedroom',null,['class'=>'form-control','id'=>'item_bedroom']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Total Bathroom</label>
                     <?php echo Form::text('item_bathroom',null,['class'=>'form-control','id'=>'item_bathroom']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Floor</label>
                     <?php echo Form::text('item_floor',null,['class'=>'form-control','id'=>'item_floor']); ?>

                 </div>
                 <?php endif; ?>
                 <div class="form-group col-sm-4">
                     <label for="" class="">North Border</label>
                     <?php echo Form::text('item_bordering_north',null,['class'=>'form-control','id'=>'item_bordering_north']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="">South Border</label>
                     <?php echo Form::text('item_bordering_south',null,['class'=>'form-control','id'=>'item_bordering_south']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="">East Border</label>
                     <?php echo Form::text('item_bordering_east',null,['class'=>'form-control','id'=>'item_bordering_east']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="">West Border</label>
                     <?php echo Form::text('item_bordering_west',null,['class'=>'form-control','id'=>'item_bordering_west']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Developed By</label>
                     <?php echo Form::text('item_develop_by',null,['class'=>'form-control','id'=>'item_develop_by']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="">Sq Fp</label>
                     <?php echo Form::text('item_sq_fp',null,['class'=>'form-control','id'=>'item_sq_fp']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="" class="">Parking</label>
                     <?php echo Form::text('item_parking',null,['class'=>'form-control','id'=>'item_parking']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Street N<sup>o</sup></label>
                     <?php echo Form::text('item_street',null,['class'=>'form-control','id'=>'item_street']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Item Count</label>
                     <?php echo Form::text('item_count',null,['class'=>'form-control','id'=>'item_count']); ?>

                 </div>
                 <div class="form-group col-sm-4">
                     <label for="">Block Time</label>
                     <?php echo Form::text('item_block_time',null,['class'=>'form-control','id'=>'item_block_time']); ?>

                 </div>
                 <div class="form-group col-sm-8">
                     <label for="">Description</label>
                     <?php echo Form::textarea('item_des', null, ['id' => 'item_des', 'rows' => 4, 'cols' => 54,'class'=>'form-control']); ?>

                 </div>
                 <div class="col-sm-12">
                    <button type="submit" class="btn btn-info fa fa-save pull-right"> Save</button>
                </div>
                 <?php echo Form::close(); ?>

             </div>
         </div>
     </div>
 </div>
 <?php $__env->stopSection(); ?>
 <?php $__env->startSection('js'); ?>
 <script type="text/javascript">
    $(document).on('change','#project_id,#category_id',function(){
        var project_id = $('#project_id').find(':selected').val();
        var category_id = $('#category_id').find(':selected').val();
        if(category_id != '' && project_id!=''){
            $.ajax({
                type:"POST",
                dataType:"JSON",
                url:"<?php echo e(route('get-zone-and-group-item')); ?>",
                data:{
                    _token:"<?php echo e(csrf_token()); ?>",
                    project_id:project_id,
                    category_id:category_id
                },
                success:function(response){
                    var zone = response['data']['zone'];
                    var group = response['data']['group'];
                    $('#zone_id').empty().append('<option value="">Please Select</option>');
                    $('#group_id').empty().append('<option value="">Please Select</option>');
                    $.each(zone,function(i,z){
                        $('#zone_id').append('<option value="'+z.id+'">'+z.name+'</option>');
                    });
                    $.each(group,function(i,g){
                        $('#group_id').append('<option value="'+g.id+'">'+g.name+'</option>');
                    });
                }
            });
        }
    });
    $(document).on('change','#commission_type',function(){
        var id = $(this).find(':selected').val();
        if(id==1){
            $('.type_amount').removeClass('hide');
            $('.type_percent').addClass('hide');
        }else if(id==2){
            $('.type_percent').removeClass('hide');
            $('.type_amount').addClass('hide');
        }
    });
    $(document).on('keyup','#land_width,#land_length',function(){
        var a       = $('#land_width');
        var b       = $('#land_length');
        var c       = $('#land_area');
        area(a,b,c);
    });
    $(document).on('keyup','#house_width,#house_length',function(){
        var a       = $('#house_width');
        var b       = $('#house_length');
        var c       = $('#house_area');
        area(a,b,c);
    });
    function area(a,b,c){
        var width   = !(a.val())?0:parseFloat(a.val());
        var length  = !(b.val())?0:parseFloat(b.val());
        c.val(parseFloat(width*length));
    }
 </script>

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