<?php $__env->startSection('title','Edit Case | '); ?>
<?php $__env->startSection('content'); ?>
<!-- Content Header (Page header) -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0">Edit Case</h1>
            </div><!-- /.col -->
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">Case Management</li>
                </ol>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
    <div class="container-fluid">

        <div class="card card-default">
            <div class="card-header">
                <h3 class="card-title">Edit Case</h3>
            </div>
            <!-- /.card-header -->
            <div class="card-body">
                <?php if(session('success')): ?>
                <div class="alert alert-success alert-dismissible fade show" role="alert">
                    <strong><?php echo e(session('success')); ?></strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <?php endif; ?>
                <?php if(session('error')): ?>
                <div class="alert alert-danger alert-dismissible fade show" role="alert">
                    <strong><?php echo e(session('error')); ?></strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <?php endif; ?>
                <?php if(session('warning')): ?>
                <div class="alert alert-warning alert-dismissible fade show" role="alert">
                    <strong><?php echo e(session('warning')); ?></strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <?php endif; ?>
                <?php if(!empty($cases)): ?>
                <form action="<?php echo e(route('update.cases')); ?>" method="post" autocomplete="off">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="id" value="<?php echo e($cases->id); ?>">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="case_number">Case Number</label>
                                <input type="text" name="case_number"
                                    class="form-control   <?php if( $errors->has('case_number')): ?> is-invalid border-danger  <?php endif; ?>"
                                    value="<?php echo e($cases->case_number); ?>" id="case_number" placeholder="Case Number">
                                <small class="text-danger case_number_error"></small>
                                <?php if($errors->has('case_number')): ?>
                                <span id="case_number-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('case_number')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <!-- <div class="col-md-6">
                            <div class="form-group">
                                <label for="case_type">Case Type <small class="text-muted">(Death/Accident)</small></label>
                                <select name="case_type" id="case_type" class="custom-select  <?php if( $errors->has('case_type')): ?> is-invalid border-danger  <?php endif; ?>" >
                                    <option value="" <?php echo e(($cases->case_type == '') ? 'selected' : ''); ?>>-- Select Case Type --</option>
                                    <option value="1" <?php echo e(($cases->case_type == '1') ? 'selected' : ''); ?>>Death</option>
                                    <option value="2" <?php echo e(($cases->case_type == '2') ? 'selected' : ''); ?>>Accident</option>
                                </select>

                                <?php if($errors->has('case_type')): ?>
                                <span id="case_type-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('case_type')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div> -->
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="case_reported_date">Case Reported Date</label>
                                <input type="date" name="case_reported_date"
                                    class="form-control   <?php if( $errors->has('case_reported_date')): ?> is-invalid border-danger  <?php endif; ?>"
                                    value="<?php echo e($cases->case_reported_date); ?>" id="case_reported_date">
                                <?php if($errors->has('case_reported_date')): ?>
                                <span id="case_reported_date-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('case_reported_date')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="case_file_date">Case File Date</label>
                                <input type="date" name="case_file_date"
                                    class="form-control  <?php if( $errors->has('case_file_date')): ?> is-invalid border-danger  <?php endif; ?>"
                                    value="<?php echo e($cases->case_file_date); ?>" id="case_file_date">
                                <?php if($errors->has('case_file_date')): ?>
                                <span id="case_file_date-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('case_file_date')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="plaintiff">Plaintiff <small class="text-muted">a person who starts a legal action against somebody in a court of law (case karne waala)</small></label>
                                <input type="text" name="plaintiff"
                                    class="form-control <?php if( $errors->has('plaintiff')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="plaintiff" value="<?php echo e($cases->plaintiff); ?>" placeholder="Plaintiff">
                                <?php if($errors->has('plaintiff')): ?>
                                <span id="plaintiff-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('plaintiff')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="defendant">Defendant <small class="text-muted">The defendant in a trial is the person accused of a crime. (Jiske khilaf case kiya gaya)</small></label>
                                <input type="text" name="defendant"
                                    class="form-control <?php if( $errors->has('defendant')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="defendant" value="<?php echo e($cases->defendant); ?>" placeholder="Defendant">
                                <?php if($errors->has('defendant')): ?>
                                <span id="defendant-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('defendant')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="lawyer_name">Lawyer Name <small class="text-muted">Name of assigned Lawyer</small></label>
                                <input type="text" name="lawyer_name"
                                    class="form-control <?php if( $errors->has('lawyer_name')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="lawyer_name" value="<?php echo e($cases->lawyer_name); ?>" placeholder="Lawyer Name">
                                <?php if($errors->has('lawyer_name')): ?>
                                <span id="lawyer_name-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('lawyer_name')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="lawyer_mobile">Lawyer Mobile <small class="text-muted">Mobile Number of assigned Lawyer</small></label>
                                <input type="number" name="lawyer_mobile"
                                    class="form-control <?php if( $errors->has('lawyer_mobile')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="lawyer_mobile" value="<?php echo e($cases->lawyer_mobile); ?>" placeholder="Lawyer Mobile"  min="6000000001" max="9999999999">
                                <?php if($errors->has('lawyer_mobile')): ?>
                                <span id="lawyer_mobile-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('lawyer_mobile')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="lawyer_email">Lawyer Email <small class="text-muted">Email of assigned Lawyer</small></label>
                                <input type="email" name="lawyer_email"
                                    class="form-control <?php if( $errors->has('lawyer_email')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="lawyer_email" value="<?php echo e($cases->lawyer_email); ?>" placeholder="Lawyer Email">
                                <?php if($errors->has('lawyer_email')): ?>
                                <span id="lawyer_email-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('lawyer_email')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="hearing_date">Hearing Date</label>
                                <input type="date" name="hearing_date"
                                    class="form-control <?php if( $errors->has('hearing_date')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="hearing_date" value="<?php echo e($cases->hearing_date); ?>" 
                                    >
                                <?php if($errors->has('hearing_date')): ?>
                                <span id="hearing_date-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('hearing_date')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="court_name">Court Name</label>
                                <input type="text" name="court_name"
                                    class="form-control <?php if( $errors->has('court_name')): ?> is-invalid border-danger  <?php endif; ?>"
                                    id="court_name" value="<?php echo e($cases->court_name); ?>" placeholder="Court Name">
                                <small class="text-danger court_name_error"></small>
                                <?php if($errors->has('court_name')): ?>
                                <span id="court_name-error"
                                    class="error text-danger invalid-feedback"><?php echo e($errors->first('court_name')); ?></span>
                                <small></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="court_address">Court Address</label>
                                <textarea name="court_address" id="court_address" class="form-control <?php if( $errors->has('court_address')): ?> is-invalid border-danger  <?php endif; ?>" rows="4" placeholder="Court Address"><?php echo e($cases->court_address); ?></textarea>
                                <?php if($errors->has('court_address')): ?>
                                <small class="text-danger court_address_error"><?php echo e($errors->first('court_address')); ?></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        
                         <div class="col-md-6">
                            <div class="form-group">
                                <label for="case_remark">Case Remark</label>
                                <textarea name="case_remark" id="case_remark" class="form-control <?php if( $errors->has('case_remark')): ?> is-invalid border-danger  <?php endif; ?>" rows="4" placeholder="Case Remark"><?php echo e($cases->case_remark); ?></textarea>
                                <?php if($errors->has('case_remark')): ?>
                                <small class="text-danger case_remark_error"><?php echo e($errors->first('case_remark')); ?></small>
                                <?php endif; ?>
                            </div>
                        </div>
                        
                        <?php if(Auth::user()->user_role == 1 || Auth::user()->user_role == 2): ?>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="assign_to">Assign To</label>
                                <select name="assign_to" id="assign_to" class="custom-select  <?php if($errors->has('assign_to')): ?> is-invalid border-danger  <?php endif; ?>">
                                    <option value="" >-- Select User --</option>    
                                    <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($user->id); ?>" <?php echo e(($cases->assign_to == $user->id) ? 'selected' : ''); ?>><?php echo e($user->full_name); ?> (<?php echo e(getUserType($user->user_role)); ?>)</option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <?php if($errors->has('assign_to')): ?>
                                <small class="text-danger "><?php echo e($errors->first('assign_to')); ?></small>
                                <?php endif; ?>
                            </div>
                        </div> 
                        <?php endif; ?>
                        <div class="col-md-12">
                            <div class="form-group">
                                <a href="<?php echo e(route('list.all.cases')); ?>" class="btn btn-secondary">Back</a>
                                <input type="submit" name="update" value="Update Case" class="btn btn-primary">
                            </div>
                            <small class="text-muted"><strong>Note: </strong>Verify the details entered by you before
                                saving and proceeding with the form</small><br>
                            <small class="text-muted"><strong>नोट: </strong>फॉर्म को सेव और आगे बढ़ाने से पहले आपके
                                द्वारा भरी गई डिटेल्स की पुष्टि कर ले</small>
                        </div>
                    </div>
                </form>
                <?php else: ?>   
                <div class="row">
                    <div class="col-md-12 col-lg-12 col-sm-12 mb-2">
                        <p class="p-0 m-0 text-secondary border-muted">
                            <strong>No Record Found</strong>
                        </p>
                    </div>
                </div>
                <?php endif; ?>
            </div>
        </div>
        <!-- /.card -->
    </div>
    <!--/. container-fluid -->
</section>
<!-- /.content -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/legalclaim231/public_html/resources/views/pages/cases/editCase.blade.php ENDPATH**/ ?>