<?php $__env->startSection('contentchild'); ?>

<style>
.help-block{
  color:red;
}
.is-invalid{border:1px solid red !important;}
</style>


<script>
  
$(document).ready(function(){

  $("#project_id").on('change',function(){ // you have not need to apply to delegate for dynamic content form 
   var project_id=$(this).val();
    //var selectele=$(this).closest('tr').find('.subcategory');
     //alert(project_id);


   $("#person").find('option').not(':first').remove();

         $.ajax({
           url: 'getpersonname/'+project_id,
           type: 'get',
           dataType: 'json',
           success: function(response){
//alert(response['data']);
             var len = 0;
             if(response['data'] != null){
               len = response['data'].length;
             }

             if(len > 0){
               // Read data and create <option >
               for(var i=0; i<len; i++){

                 var id = response['data'][i].id;
                 var name = response['data'][i].name;
                 var role = response['data'][i].role;

                 var option = "<option value='"+id+"'>"+name +"("+role+")"+"</option>"; 

               $("#person").append(option); 
               }
             }

           }
        });
 



});


});



</script>



      <?php 
$projectlist=App\Project::all()->pluck('id','projectnm');
//dd($projectlist);
 ?>             
<div class="row justify-content-center">
   <div class="col-lg-5">
    <div class="card shadow-lg border-0 rounded-lg mt-5">
      <div class="col-sm-12">
                         <h4 class="text-center font-weight-light my-4">Create Account</h4>
                                    <form method="post" action="<?php echo e(route('saveamount')); ?>">
<?php echo csrf_field(); ?>
          <?php $__currentLoopData = ["success","error"]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if(Session::has($status)): ?>
<div class="alert alert-<?php echo e($status); ?> alert-dismissible">
  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
  <strong><?php echo e($status); ?>!</strong> <?php echo e(Session::get($status)); ?> action.
</div>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<div class="form-group">
  <label for="password">Choose Project</label>
<select class='<?php $__errorArgs = ['project_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> form-control' id='project_id' name="project_id">
 <option value=''>-- Select--</option>

<?php 

//echo "<pre>";print_R($data);
foreach ($projectlist as $key=>$value) {
  echo "<option value='".$value."'>".$key."</option>"; 
}
?>

</select>
 <?php if($errors->has('project_id')): ?>
  <p class="help-block"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
            <?php echo e($errors->first('project_id')); ?></p>
        <?php endif; ?>


     </div>

<div class="form-group">
  <label for="password">Choose Person</label>
<select class='<?php $__errorArgs = ['person'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> form-control' name='person' id="person">
 <option value=''>-- Select--</option>

 
</select>
 <?php if($errors->has('person')): ?>
  <p class="help-block"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
            <?php echo e($errors->first('person')); ?></p>
        <?php endif; ?>


     </div>


<div class="form-group">
  <label for="password">Amount</label>
 
<input type="text" name="amount" class='<?php $__errorArgs = ['amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> form-control' />
 <?php if($errors->has('amount')): ?>
  <p class="help-block"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
            <?php echo e($errors->first('amount')); ?></p>
        <?php endif; ?>

</div>


<div class="form-group">
  <label for="password">Date</label>
 
<input type="date" name="date" class='<?php $__errorArgs = ['cat_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> form-control' />
 <?php if($errors->has('date')): ?>
  <p class="help-block"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
            <?php echo e($errors->first('date')); ?></p>
        <?php endif; ?>

</div>


<div class="col-sm-12 text-center">
<button type="submit" name="change" class="btn btn-primary" >create</button>
</div>
</div>
 </form>
                             
        </div>
</div>
</div>


     <?php $__env->stopSection(); ?>
             
<?php echo $__env->make('layout/master2', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/utjn1ubt98bo/public_html/sangyatraders.com/admin/resources/views/addamount.blade.php ENDPATH**/ ?>