 
<?php $__env->startSection('title', 'Calling Input Form'); ?>
<?php $__env->startSection('content'); ?>  
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">

<?php 
    $getstatecodedata = DB::table('state_master')->get();
    $getdistrictcodedata = DB::table('district_master')->get();
    $getlfumisdata = DB::table('lfu_mis_master')->get();
    $getlfucidata = DB::table('lfu_ci_master')->get();

    $adminstatecode = auth()->user()->state_code;
    $admindistcode = auth()->user()->dist_code;
    $art_centre_code = auth()->user()->art_centre_code;
    $role_name  = auth()->user()->roles->pluck('name');
    if($role_name[0] == "Super Admin" || $role_name[0] == "Admin")
    {
        $getartcentredata = DB::table('art_centre_master')->get();
        $getpatregdata = DB::table('patient_register')->get();
    }
    else
    {
        $getartcentredata = DB::table('art_centre_master')->where(['state_code'=>$adminstatecode,'dist_code'=>$admindistcode])->get();
        $art_centre_code = explode(', ',$art_centre_code);
        $getpatregdata = DB::table('patient_register')->whereIn('art_centre_code',$art_centre_code)->get();
    }
?>

<div class="container-fluid">
    <div class="page-header">
        <div class="row align-items-end">
            <div class="col-lg-8">
                <div class="page-header-title">
                    <i class="ik ik-edit bg-blue"></i>
                    <div class="d-inline">
                        <h5><?php echo e(__('Calling Input Form')); ?></h5>
                    </div>
                </div>
            </div>
            <div class="col-lg-4">
                <nav class="breadcrumb-container" aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                            <a href="<?php echo e(route('dashboard')); ?>"><i class="ik ik-home"></i></a>
                        </li>
                        <li class="breadcrumb-item"><a href="#"><?php echo e(__('Forms')); ?></a></li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-7 mx-auto">
            <div class="card">
                <div class="card-header"><h3><?php echo e(__('Calling Input Form')); ?></h3></div>
                <div class="card-body">
                    <form class="forms-sample"  method='POST' <?php if(!empty($showdata)): ?> action="<?php echo e(url('updateoutreachinput')); ?>" <?php else: ?> action="<?php echo e(url('insertoutreachinput')); ?>" <?php endif; ?> name='patientregister'>
                        <?php echo csrf_field(); ?>
                        
                        <?php if(!empty($showdata)): ?>
                        <input type='hidden' name='id' value='<?php echo e($showdata[0]->id); ?>'>
                        <?php endif; ?>

                        <input type="hidden" class="form-control" id="doe" name='doe' <?php if(!empty($showdata)){ ?> value="<?php echo e($showdata[0]->doe); ?>" <?php } else{?> value="<?php echo e(date('d-m-Y')); ?>"<?php } ?> placeholder="Enter Date of Entry" readonly>
                        
                        <input type="hidden" class="form-control" id="doe_for" name='doe_for' value="2" readonly>
                        <input type="hidden" class="form-control" id="state_code" name='state_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->state_code); ?>' <?php } else{?> value='<?php echo e(auth()->user()->state_code); ?>'<?php } ?> placeholder="Enter State code" readonly>
                        <input type="hidden" class="form-control" id="dist_code" name='dist_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->dist_code); ?>' <?php } else{?> value='<?php echo e(auth()->user()->dist_code); ?>'<?php } ?> placeholder="Enter District code" readonly>
                        <input type="hidden" class="form-control" id="emp_code" name='emp_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->emp_code); ?>' <?php } else{?> value='<?php echo e(auth()->user()->emp_code); ?>'<?php } ?> placeholder="Enter Staff code" readonly>
                        <input type="hidden" class="form-control" id="art_centre_code" name='art_centre_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->art_centre_code); ?>' <?php } else{?> value='<?php echo e(auth()->user()->art_centre_code); ?>'<?php } ?> placeholder="Enter Staff code" readonly>
                        
                        <?php if(!empty($showdata)): ?>
                        <?php
                        $patdata = DB::table('patient_register')->where('id',$showdata[0]->pat_uid)->first();
                        ?>
                        <?php endif; ?>

                        <div class="form-group">
                            <label for="pat_uid"><?php echo e(__('Client Detail')); ?></label>
                            <?php if(empty($showdata)): ?>
                            <select name='pat_uid' id='pat_uid' class='form-control' <?php if(!empty($showdata[0]->pat_uid)): ?> disabled="" <?php endif; ?> required>
                                <option value="">Select Client UID</option>
                                <?php foreach($getpatregdata as $getpatreg)
                                { 
                                    $patmapdata = DB::table('patient_mapping')->where(['pat_uid'=>$getpatreg->id,'linelist_status'=>'Open'])->where('linelist_type',2)->count();
                                    if($patmapdata > 0){
                                ?>  
                                    <option value='<?php echo $getpatreg->id; ?>' <?php if(!empty($showdata)): ?><?php echo e($patdata->pat_uid == $getpatreg->pat_uid ? 'selected' : ''); ?> <?php endif; ?>><?php echo $getpatreg->pre_art_reg_num.' | '.$getpatreg->art_reg_num.' | '.$getpatreg->pat_name; ?></option>
                                <?php 
                                    } 
                                }
                                ?>
                            </select>
                            <?php else: ?>
                            <input type="text" class="form-control" value="<?php echo e($patdata->pre_art_reg_num.' | '.$patdata->art_reg_num.' | '.$patdata->pat_name); ?>" readonly>
                            <input type="hidden" name="pat_uid" value="<?php echo e($showdata[0]->pat_uid); ?>">
                            <?php endif; ?>
                        </div>
                        <div class="form-group">
                            <label for="linelist_date"><?php echo e(__('Linelist Received Date')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='linelist_date' <?php if(!empty($showdata[0]->linelist_date)): ?> value='<?php echo e($showdata[0]->linelist_date); ?>' readonly="" <?php endif; ?> class="form-control" name="linelist_date" placeholder="dd-mm-yyyy" required/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="art_centre"><?php echo e(__('ART Center Code')); ?></label>
                            <input type="text" class="form-control" id="art_centre" name='art_centre' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->art_centre); ?>' <?php } ?> placeholder="Enter ART Center Name" readonly>
                        </div>
                        <div class="form-group">
                            <label for="art_centre_name"><?php echo e(__('ART Center Name')); ?></label>
                            <input type="text" class="form-control" id="art_centre_name" name='art_centre_name' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->art_centre_name); ?>' <?php } ?> placeholder="Enter ART Center Name" readonly>
                        </div>
                        <div class="form-group">
                            <label for="pre_art_reg_num"><?php echo e(__('Pre ART REG Number')); ?></label>
                            <input type="text" class="form-control" id="pre_art_reg_num" name='pre_art_reg_num' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->pre_art_reg_num); ?>' <?php } ?> placeholder="Enter Pre ART REG Number" readonly>
                        </div>
                        <div class="form-group">
                            <label for="art_reg_num"><?php echo e(__('ART REG Number')); ?></label>
                            <input type="text" class="form-control" id="art_reg_num" name='art_reg_num' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->art_reg_num); ?>' <?php } ?> placeholder="Enter ART REG Number" readonly>                            
                        </div>
                        <div class="form-group">
                            <label for="pat_name"><?php echo e(__('Client Name')); ?></label>
                            <input type="text" class="form-control" id="pat_name" name='pat_name' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->pat_name); ?>' <?php } ?> placeholder="Enter Client Name" readonly>
                        </div>
                        <div class="form-group">
                            <label for="pat_age"><?php echo e(__('Client Age')); ?></label>
                            <input type="number" class="form-control" id="pat_age" name='pat_age' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->pat_age); ?>' <?php } ?> placeholder="Enter Client Age" readonly>
                        </div>
                        <div class="form-group">
                            <label for="pat_sex"><?php echo e(__('Client Sex')); ?></label>
                            <input type="text" class="form-control" id="pat_sex" name='pat_sex' <?php if(!empty($showdata)){ ?> value='<?php echo e($patdata->pat_sex); ?>' <?php } ?> placeholder="Enter Client Sex" readonly>
                        </div>
                        <div class="form-group outreach_calling">
                            <label for="dlva_date"><?php echo e(__('Date of Last Visit to ARTC')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='dlva_date' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->dlva_date); ?>' readonly="" <?php endif; ?> class="form-control" name="dlva_date" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group outreach_calling">
                            <label for="ddva_date"><?php echo e(__('Due Date of Visit to ARTC')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='ddva_date' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->ddva_date); ?>' readonly="" <?php endif; ?> class="form-control" name="ddva_date" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="contact_visit"><?php echo e(__('Number of Contact/Visit')); ?></label>
                            <select name='contact_visit' id='contact_visit' class='form-control' required>
                                <?php if(empty($showdata)): ?>
                                <option value="">Select Contact Visit</option>
                                <?php endif; ?>
                                <option value='1' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 1 ? 'selected' : ''); ?> <?php endif; ?>>1st Contact/Visit</option>
                                <?php if(!empty($showdata)): ?>
                                <option value='2' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 2 ? 'selected' : ''); ?> <?php endif; ?>>2nd Contact/Visit</option>
                                <option value='3' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 3 ? 'selected' : ''); ?> <?php endif; ?>>3rd Contact/Visit</option>
                                <option value='4' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 4 ? 'selected' : ''); ?> <?php endif; ?>>4th Contact/Visit</option>
                                <option value='5' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 5 ? 'selected' : ''); ?> <?php endif; ?>>5th Contact/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->contact_visit == 6 ? 'selected' : ''); ?> <?php endif; ?>>Final Contact/Visit</option>
                                <?php endif; ?>
                            </select>
                        </div>

                        <!-- 1st Visit -->
                        <div class="form-group v1">
                            <label for="contact_date_v1"><?php echo e(__('Contact Date V1')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='contact_date_v1' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->contact_date_v1); ?>' readonly="" <?php endif; ?> class="form-control" name="contact_date_v1" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group v1">
                            <label for="contact_mode_v1"><?php echo e(__('Contact Mode V1')); ?></label><br>
                            <?php if(empty($showdata[0]->contact_mode_v1)): ?>
                            <input type='radio' value="Phone" name="contact_mode_v1"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v1 == 'Phone')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Phone</span>
                            <input type='radio' value="Home Visit" name="contact_mode_v1"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v1 == 'Home Visit')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Home Visit</span>
                            <?php else: ?>
                            <input type='text' value='<?php echo e($showdata[0]->contact_mode_v1); ?>' readonly="" class="form-control" name="contact_mode_v1"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group v1">
                            <label for="linelist_reason_v1"><?php echo e(__('Reason for Calling/Visit V1')); ?></label>
                            <select name='linelist_reason_v1' id='linelist_reason_v1' class='form-control' <?php if(!empty($showdata[0]->linelist_reason_v1)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Reason for Calling/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_v1)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_v1); ?>' readonly="" class="form-control" name="linelist_reason_v1"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_reason_id_v1">
                            <label><?php echo e(__('Outcome of Calling/Visit V1')); ?></label>
                            <select name='linelist_reason_id_v1' id="linelist_reason_id_v1" class='form-control' <?php if(!empty($showdata[0]->linelist_reason_id_v1)): ?> disabled="" <?php endif; ?>>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_id_v1)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_id_v1); ?>' readonly="" class="form-control" name="linelist_reason_id_v1"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_other_reason_v1">
                            <label for="linelist_other_reason_v1"><?php echo e(__('Outcome of Calling/Visit Other Reason V1')); ?></label>
                            <input type="text" class="form-control" id="linelist_other_reason_v1" name='linelist_other_reason_v1' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->linelist_other_reason_v1); ?>' <?php } ?> placeholder="Enter Outcome of Calling/Visit Other Reason V1">
                        </div>
                        <!-- 1st Visit -->

                        <!-- 2nd Visit -->
                        <div class="form-group v2">
                            <label for="contact_date_v2"><?php echo e(__('Contact Date V2')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='contact_date_v2' <?php if(!empty($showdata[0]->contact_date_v2)): ?> value='<?php echo e($showdata[0]->contact_date_v2); ?>' readonly="" <?php endif; ?> class="form-control" name="contact_date_v2" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group v2">
                            <label for="contact_mode_v2"><?php echo e(__('Contact Mode V2')); ?></label><br>
                            <?php if(empty($showdata[0]->contact_mode_v2)): ?>
                            <input type='radio' value="Phone" name="contact_mode_v2"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v2 == 'Phone')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Phone</span>
                            <input type='radio' value="Home Visit" name="contact_mode_v2"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v2 == 'Home Visit')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Home Visit</span>
                            <?php else: ?>
                            <input type='text' value='<?php echo e($showdata[0]->contact_mode_v2); ?>' readonly="" class="form-control" name="contact_mode_v2"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group v2">
                            <label for="linelist_reason_v2"><?php echo e(__('Reason for Calling/Visit V2')); ?></label>
                            <select name='linelist_reason_v2' id='linelist_reason_v2' class='form-control' <?php if(!empty($showdata[0]->linelist_reason_v2)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Reason for Calling/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_v2)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_v2); ?>' readonly="" class="form-control" name="linelist_reason_v2"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_reason_id_v2">
                            <label><?php echo e(__('Outcome of Calling/Visit V2')); ?></label>
                            <select name='linelist_reason_id_v2' id="linelist_reason_id_v2" class='form-control' <?php if(!empty($showdata[0]->linelist_reason_id_v2)): ?> disabled="" <?php endif; ?>>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_id_v2)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_id_v2); ?>' readonly="" class="form-control" name="linelist_reason_id_v2"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_other_reason_v2">
                            <label for="linelist_other_reason_v2"><?php echo e(__('Outcome of Calling/Visit Other Reason V2')); ?></label>
                            <input type="text" class="form-control" id="linelist_other_reason_v2" name='linelist_other_reason_v2' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->linelist_other_reason_v2); ?>' <?php } ?> placeholder="Enter Outcome of Calling/Visit Other Reason V2">
                        </div>
                        <!-- 2nd Visit -->

                        <!-- 3rd Visit -->
                        <div class="form-group v3">
                            <label for="contact_date_v3"><?php echo e(__('Contact Date V3')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='contact_date_v3' <?php if(!empty($showdata[0]->contact_date_v3)): ?> value='<?php echo e($showdata[0]->contact_date_v3); ?>' readonly="" <?php endif; ?> class="form-control" name="contact_date_v3" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group v3">
                            <label for="contact_mode_v3"><?php echo e(__('Contact Mode V3')); ?></label><br>
                            <?php if(empty($showdata[0]->contact_mode_v3)): ?>
                            <input type='radio' value="Phone" name="contact_mode_v3"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v3 == 'Phone')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Phone</span>
                            <input type='radio' value="Home Visit" name="contact_mode_v3"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v3 == 'Home Visit')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Home Visit</span>
                            <?php else: ?>
                            <input type='text' value='<?php echo e($showdata[0]->contact_mode_v3); ?>' readonly="" class="form-control" name="contact_mode_v3"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group v3">
                            <label for="linelist_reason_v3"><?php echo e(__('Reason for Calling/Visit V3')); ?></label>
                            <select name='linelist_reason_v3' id='linelist_reason_v3' class='form-control' <?php if(!empty($showdata[0]->linelist_reason_v3)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Reason for Calling/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_v3)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_v3); ?>' readonly="" class="form-control" name="linelist_reason_v3"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_reason_id_v3">
                            <label><?php echo e(__('Outcome of Calling/Visit V3')); ?></label>
                            <select name='linelist_reason_id_v3' id="linelist_reason_id_v3" class='form-control' <?php if(!empty($showdata[0]->linelist_reason_id_v3)): ?> disabled="" <?php endif; ?>>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_id_v3)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_id_v3); ?>' readonly="" class="form-control" name="linelist_reason_id_v3"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_other_reason_v3">
                            <label for="linelist_other_reason_v3"><?php echo e(__('Outcome of Calling/Visit Other Reason V3')); ?></label>
                            <input type="text" class="form-control" id="linelist_other_reason_v3" name='linelist_other_reason_v3' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->linelist_other_reason_v3); ?>' <?php } ?> placeholder="Enter Outcome of Calling/Visit Other Reason V3">
                        </div>
                        <!-- 3rd Visit -->

                        <!-- 4th Visit -->
                        <div class="form-group v4">
                            <label for="contact_date_v4"><?php echo e(__('Contact Date V4')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='contact_date_v4' <?php if(!empty($showdata[0]->contact_date_v4)): ?> value='<?php echo e($showdata[0]->contact_date_v4); ?>' readonly="" <?php endif; ?> class="form-control" name="contact_date_v4" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group v4">
                            <label for="contact_mode_v4"><?php echo e(__('Contact Mode V4')); ?></label><br>
                            <?php if(empty($showdata[0]->contact_mode_v4)): ?>
                            <input type='radio' value="Phone" name="contact_mode_v4"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v4 == 'Phone')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Phone</span>
                            <input type='radio' value="Home Visit" name="contact_mode_v4"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v4 == 'Home Visit')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Home Visit</span>
                            <?php else: ?>
                            <input type='text' value='<?php echo e($showdata[0]->contact_mode_v4); ?>' readonly="" class="form-control" name="contact_mode_v4"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group v4">
                            <label for="linelist_reason_v4"><?php echo e(__('Reason for Calling/Visit V4')); ?></label>
                            <select name='linelist_reason_v4' id='linelist_reason_v4' class='form-control' <?php if(!empty($showdata[0]->linelist_reason_v4)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Reason for Calling/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_v4)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_v4); ?>' readonly="" class="form-control" name="linelist_reason_v4"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_reason_id_v4">
                            <label><?php echo e(__('Outcome of Calling/Visit V4')); ?></label>
                            <select name='linelist_reason_id_v4' id="linelist_reason_id_v4" class='form-control' <?php if(!empty($showdata[0]->linelist_reason_id_v4)): ?> disabled="" <?php endif; ?>>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_id_v4)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_id_v4); ?>' readonly="" class="form-control" name="linelist_reason_id_v4"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_other_reason_v4">
                            <label for="linelist_other_reason_v4"><?php echo e(__('Outcome of Calling/Visit Other Reason V4')); ?></label>
                            <input type="text" class="form-control" id="linelist_other_reason_v4" name='linelist_other_reason_v4' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->linelist_other_reason_v4); ?>' readonly="" <?php } ?> placeholder="Enter Outcome of Calling/Visit Other Reason V4">
                        </div>
                        <!-- 4th Visit -->

                        <!-- 5th Visit -->
                        <div class="form-group v5">
                            <label for="contact_date_v5"><?php echo e(__('Contact Date V5')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='contact_date_v5' <?php if(!empty($showdata[0]->contact_date_v5)): ?> value='<?php echo e($showdata[0]->contact_date_v5); ?>' readonly="" <?php endif; ?> class="form-control" name="contact_date_v5" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group v5">
                            <label for="contact_mode_v5"><?php echo e(__('Contact Mode V5')); ?></label><br>
                            <?php if(empty($showdata[0]->contact_mode_v5)): ?>
                            <input type='radio' value="Phone" name="contact_mode_v5"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v5 == 'Phone')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Phone</span>
                            <input type='radio' value="Home Visit" name="contact_mode_v5"  <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->contact_mode_v5 == 'Home Visit')? "checked" : ""); ?> <?php endif; ?>><span class="pl-5 pr-10">Home Visit</span>
                            <?php else: ?>
                            <input type='text' value='<?php echo e($showdata[0]->contact_mode_v5); ?>' readonly="" class="form-control" name="contact_mode_v5"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group v5">
                            <label for="linelist_reason_v5"><?php echo e(__('Reason for Calling/Visit V5')); ?></label>
                            <select name='linelist_reason_v5' id='linelist_reason_v5' class='form-control' <?php if(!empty($showdata[0]->linelist_reason_v5)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Reason for Calling/Visit</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_v5)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_v5); ?>' readonly="" class="form-control" name="linelist_reason_v5"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_reason_id_v5">
                            <label><?php echo e(__('Outcome of Calling/Visit V5')); ?></label>
                            <select name='linelist_reason_id_v5' id="linelist_reason_id_v5" class='form-control' <?php if(!empty($showdata[0]->linelist_reason_id_v5)): ?> disabled="" <?php endif; ?>>
                            </select>
                            <?php if(!empty($showdata[0]->linelist_reason_id_v5)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->linelist_reason_id_v5); ?>' readonly="" class="form-control" name="linelist_reason_id_v5"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group linelist_other_reason_v5">
                            <label for="linelist_other_reason_v5"><?php echo e(__('Outcome of Calling/Visit Other Reason V5')); ?></label>
                            <input type="text" class="form-control" id="linelist_other_reason_v5" name='linelist_other_reason_v5' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->linelist_other_reason_v5); ?>' <?php } ?> placeholder="Enter Outcome of Calling/Visit Other Reason V5">
                        </div>
                        <!-- 5th Visit -->

                        <div class="form-group final_outcome">
                            <label for="final_outcome"><?php echo e(__('Final Outcome')); ?></label>
                            <select name='final_outcome' id='final_outcome' class='form-control' <?php if(!empty($showdata[0]->final_outcome)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Final Outcome</option>
                                <option value='6' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 6 ? 'selected' : ''); ?> <?php endif; ?>>LFU</option>
                                <option value='7' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 7 ? 'selected' : ''); ?> <?php endif; ?>>MIS</option>
                                <option value='8' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 8 ? 'selected' : ''); ?> <?php endif; ?>>CD4</option>
                                <option value='9' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 9 ? 'selected' : ''); ?> <?php endif; ?>>TLD</option>
                                <option value='10' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 10 ? 'selected' : ''); ?> <?php endif; ?>>Due Date Call</option>
                                <option value='11' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->linelist_reason_v1 == 11 ? 'selected' : ''); ?> <?php endif; ?>>TB Follow up</option>
                            </select>
                            <?php if(!empty($showdata[0]->final_outcome)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->final_outcome); ?>' readonly="" class="form-control" name="final_outcome"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group final_outcome">
                            <label><?php echo e(__('Final Outcome Id')); ?></label>
                            <select name='final_outcome_id' id="final_outcome_id" class='form-control' <?php if(!empty($showdata[0]->final_outcome_id)): ?> disabled="" <?php endif; ?>>
                                <option value="">Select Final Outcome Id</option>
                            </select>
                            <?php if(!empty($showdata[0]->final_outcome_id)): ?>
                            <input type='hidden' value='<?php echo e($showdata[0]->final_outcome_id); ?>' readonly="" class="form-control" name="final_outcome_id"/>
                            <?php endif; ?>
                        </div>
                        <div class="form-group final_outcome_other_reason">
                            <label for="final_outcome_other_reason"><?php echo e(__('Final Outcome Other Reason')); ?></label>
                            <input type="text" class="form-control" id="final_outcome_other_reason" name='final_outcome_other_reason' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->final_outcome_other_reason); ?>' readonly="" <?php } ?> placeholder="Enter Final Outcome Other Reason">
                        </div>
                        <div class="form-group final_outcome">
                            <label for="final_outcome_date"><?php echo e(__('Final Outcome Date')); ?></label>
                            <div class='input-group date datetimepicker'>
                                <input type='text' id='final_outcome_date' <?php if(!empty($showdata[0]->final_outcome_date)): ?> value='<?php echo e($showdata[0]->final_outcome_date); ?>' readonly="" <?php endif; ?> class="form-control" name="final_outcome_date" placeholder="dd-mm-yyyy"/>
                                <span class="input-group-addon">
                                  <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <br><br>
                        <button type="submit" id="submit" class="btn btn-primary mr-2"><?php echo e(__('Submit')); ?></button>
                        <?php if(empty($showdata)): ?>
                        <a href="<?php echo e('outreach-input-data'); ?>" class="btn btn-light"><?php echo e(__('Cancel')); ?></a>
                        <?php endif; ?>
                      </form>
                </div>
            </div>
        </div>
    </div>
</div>
    
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>
<script>  
    $(function() {  
        $("select").select2();
        $('.final_outcome').css('display','none');
        $('.final_outcome_id').css('display','none');
        $('.final_outcome_other_reason').css('display','none');

        $('.linelist_reason_id_v1').css('display','none');
        $('.linelist_reason_id_v2').css('display','none');
        $('.linelist_reason_id_v3').css('display','none');
        $('.linelist_reason_id_v4').css('display','none');
        $('.linelist_reason_id_v5').css('display','none');
        $('.linelist_other_reason_v1').css('display','none');
        $('.linelist_other_reason_v2').css('display','none');
        $('.linelist_other_reason_v3').css('display','none');
        $('.linelist_other_reason_v4').css('display','none');
        $('.linelist_other_reason_v5').css('display','none');

        var contact_visit = $('#contact_visit').val();
        var linelist_reason_v1 = "<?php echo e($showdata[0]->linelist_reason_v1 ?? ''); ?>";
        
        if(contact_visit != "")
        {
            $("#contact_visit option").each(function (index) {
                if(index != 5)
                {
                    if(index > contact_visit || index < contact_visit)
                    {
                        $(this).prop('disabled', true);
                    }
                }
            });

            if(contact_visit == 1)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','none');
                $('.v3').css('display','none');
                $('.v4').css('display','none');
                $('.v5').css('display','none');
                $('.final_outcome').css('display','none');

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getlinelistmaster')); ?>",
                    data: {linelist_reason:linelist_reason_v1, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        $('#linelist_reason_id_v1').html(res.html);

                        var showdata = "<?php echo e($showdata ?? ''); ?>";
                        if(showdata != "")
                        {
                            $('.linelist_reason_id_v1').css('display','block');
                            var linelist_reason_id_v1 = "<?php echo e($showdata[0]->linelist_reason_id_v1 ?? ''); ?>";
                            $("#linelist_reason_id_v1").val(linelist_reason_id_v1).change();
                        }
                    },
                    error: function (jqXHR, exception) {

                    }
                });
            }
            else if(contact_visit == 2)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','none');
                $('.v4').css('display','none');
                $('.v5').css('display','none');
                $('.final_outcome').css('display','none');

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getlinelistmaster')); ?>",
                    data: {linelist_reason:linelist_reason_v1, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        $('#linelist_reason_id_v1').html(res.html);
                        $('#linelist_reason_id_v2').html(res.html);

                        var showdata = "<?php echo e($showdata ?? ''); ?>";
                        if(showdata != "")
                        {
                            $('.linelist_reason_id_v1').css('display','block');
                            var linelist_reason_id_v1 = "<?php echo e($showdata[0]->linelist_reason_id_v1 ?? ''); ?>";
                            $("#linelist_reason_id_v1").val(linelist_reason_id_v1).change();
                            $('.linelist_reason_id_v2').css('display','block');
                            var linelist_reason_id_v2 = "<?php echo e($showdata[0]->linelist_reason_id_v2 ?? ''); ?>";
                            $("#linelist_reason_id_v2").val(linelist_reason_id_v2).change();
                        }
                    },
                    error: function (jqXHR, exception) {

                    }
                });
            }
            else if(contact_visit == 3)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','none');
                $('.v5').css('display','none');
                $('.final_outcome').css('display','none');

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getlinelistmaster')); ?>",
                    data: {linelist_reason:linelist_reason_v1, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        $('#linelist_reason_id_v1').html(res.html);
                        $('#linelist_reason_id_v2').html(res.html);
                        $('#linelist_reason_id_v3').html(res.html);

                        var showdata = "<?php echo e($showdata ?? ''); ?>";
                        if(showdata != "")
                        {
                            $('.linelist_reason_id_v1').css('display','block');
                            var linelist_reason_id_v1 = "<?php echo e($showdata[0]->linelist_reason_id_v1 ?? ''); ?>";
                            $("#linelist_reason_id_v1").val(linelist_reason_id_v1).change();
                            $('.linelist_reason_id_v2').css('display','block');
                            var linelist_reason_id_v2 = "<?php echo e($showdata[0]->linelist_reason_id_v2 ?? ''); ?>";
                            $("#linelist_reason_id_v2").val(linelist_reason_id_v2).change();
                            $('.linelist_reason_id_v3').css('display','block');
                            var linelist_reason_id_v3 = "<?php echo e($showdata[0]->linelist_reason_id_v3 ?? ''); ?>";
                            $("#linelist_reason_id_v3").val(linelist_reason_id_v3).change();
                        }
                    },
                    error: function (jqXHR, exception) {

                    }
                });
            }
            else if(contact_visit == 4)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','block');
                $('.v5').css('display','none');
                $('.final_outcome').css('display','none');

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getlinelistmaster')); ?>",
                    data: {linelist_reason:linelist_reason_v1, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        $('#linelist_reason_id_v1').html(res.html);
                        $('#linelist_reason_id_v2').html(res.html);
                        $('#linelist_reason_id_v3').html(res.html);
                        $('#linelist_reason_id_v4').html(res.html);

                        var showdata = "<?php echo e($showdata ?? ''); ?>";
                        if(showdata != "")
                        {
                            $('.linelist_reason_id_v1').css('display','block');
                            var linelist_reason_id_v1 = "<?php echo e($showdata[0]->linelist_reason_id_v1 ?? ''); ?>";
                            $("#linelist_reason_id_v1").val(linelist_reason_id_v1).change();
                            $('.linelist_reason_id_v2').css('display','block');
                            var linelist_reason_id_v2 = "<?php echo e($showdata[0]->linelist_reason_id_v2 ?? ''); ?>";
                            $("#linelist_reason_id_v2").val(linelist_reason_id_v2).change();
                            $('.linelist_reason_id_v3').css('display','block');
                            var linelist_reason_id_v3 = "<?php echo e($showdata[0]->linelist_reason_id_v3 ?? ''); ?>";
                            $("#linelist_reason_id_v3").val(linelist_reason_id_v3).change();
                            $('.linelist_reason_id_v4').css('display','block');
                            var linelist_reason_id_v4 = "<?php echo e($showdata[0]->linelist_reason_id_v4 ?? ''); ?>";
                            $("#linelist_reason_id_v4").val(linelist_reason_id_v4).change();
                        }
                    },
                    error: function (jqXHR, exception) {

                    }
                });
            }
            else if(contact_visit == 5)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','block');
                $('.v5').css('display','block');
                $('.final_outcome').css('display','none');

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getlinelistmaster')); ?>",
                    data: {linelist_reason:linelist_reason_v1, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        $('#linelist_reason_id_v1').html(res.html);
                        $('#linelist_reason_id_v2').html(res.html);
                        $('#linelist_reason_id_v3').html(res.html);
                        $('#linelist_reason_id_v4').html(res.html);
                        $('#linelist_reason_id_v5').html(res.html);

                        var showdata = "<?php echo e($showdata ?? ''); ?>";
                        if(showdata != "")
                        {
                            $('.linelist_reason_id_v1').css('display','block');
                            var linelist_reason_id_v1 = "<?php echo e($showdata[0]->linelist_reason_id_v1 ?? ''); ?>";
                            $("#linelist_reason_id_v1").val(linelist_reason_id_v1).change();
                            $('.linelist_reason_id_v2').css('display','block');
                            var linelist_reason_id_v2 = "<?php echo e($showdata[0]->linelist_reason_id_v2 ?? ''); ?>";
                            $("#linelist_reason_id_v2").val(linelist_reason_id_v2).change();
                            $('.linelist_reason_id_v3').css('display','block');
                            var linelist_reason_id_v3 = "<?php echo e($showdata[0]->linelist_reason_id_v3 ?? ''); ?>";
                            $("#linelist_reason_id_v3").val(linelist_reason_id_v3).change();
                            $('.linelist_reason_id_v4').css('display','block');
                            var linelist_reason_id_v4 = "<?php echo e($showdata[0]->linelist_reason_id_v4 ?? ''); ?>";
                            $("#linelist_reason_id_v4").val(linelist_reason_id_v4).change();
                            $('.linelist_reason_id_v5').css('display','block');
                            var linelist_reason_id_v5 = "<?php echo e($showdata[0]->linelist_reason_id_v5 ?? ''); ?>";
                            $("#linelist_reason_id_v5").val(linelist_reason_id_v5).change();
                        }
                    },
                    error: function (jqXHR, exception) {

                    }
                });
            }
            else
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','block');
                $('.v5').css('display','block');
                $('.final_outcome').css('display','block');
            }
        }
        else
        {
            $('.v1').css('display','none');
            $('.v2').css('display','none');
            $('.v3').css('display','none');
            $('.v4').css('display','none');
            $('.v5').css('display','none');
            $('.final_outcome').css('display','none');
        }
               
        var default_date=  new Date();
        $('.datetimepicker').datetimepicker({  
           format: 'DD-MM-YYYY', 
            useCurrent:false, 
            defaultDate: default_date
        });
    });  

    function isNumber(evt)
    {
        evt = (evt) ? evt : window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode;
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        }
        return true; 
    }

    $( "#pat_uid" ).change(function() { 
        var pat_uid = $(this).val();
        var linelist_type = 2;
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('checkpatmapdata')); ?>",
            data: {pat_uid:pat_uid,linelist_type:linelist_type, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                var art_centre = res.showdata.art_centre;
                var art_centre_name = res.showdata.art_centre_name;
                var pre_art_reg_num = res.showdata.pre_art_reg_num;
                var art_reg_num = res.showdata.art_reg_num;
                var pat_name = res.showdata.pat_name;
                var pat_age = res.showdata.pat_age;
                var pat_sex = res.showdata.pat_sex;
                var linelist_date = res.showdata.linelist_date;
                var linelist_reason = res.showdata.linelist_reason;
                $('#art_centre').val(art_centre);
                $('#art_centre_name').val(art_centre_name);
                $('#pre_art_reg_num').val(pre_art_reg_num);
                $('#art_reg_num').val(art_reg_num);
                $('#pat_name').val(pat_name);
                $('#pat_age').val(pat_age);
                $('#pat_sex').val(pat_sex);
                $("#linelist_date").val(linelist_date);
                $('.v1').css('display','block');

                $("#linelist_reason_v1 option").each(function (index) {
                    $(this).prop('disabled', true);
                });
                
                $("#linelist_reason_v1 option[value='"+linelist_reason+"']").attr("disabled",false);
                $("#linelist_reason_v1").val(linelist_reason).change();
                $("#contact_visit option").each(function (index) {
                    $(this).prop('disabled', true);
                });
                $("#contact_visit option[value='1']").attr("disabled",false);
                $("#contact_visit").val(1).change();
            },
            error: function (jqXHR, exception) {

            }
        });
    });

    $( "#doe_for" ).change(function() { 
        var doe_for = $(this).val();
        if(doe_for == 1 || doe_for == 2)
        {
            $('.outreach_calling').css('display','block');
        }
        else
        {
            $('.outreach_calling').css('display','none');
        }
    });

    $( "#contact_visit" ).change(function() { 
        var contact_visit = $('#contact_visit').val();
        if(contact_visit != "")
        {
            if(contact_visit == 1)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','none');
                $('.linelist_reason_id_v2').css('display','none');
                $('.v3').css('display','none');
                $('.linelist_reason_id_v3').css('display','none');
                $('.v4').css('display','none');
                $('.linelist_reason_id_v4').css('display','none');
                $('.v5').css('display','none');
                $('.linelist_reason_id_v5').css('display','none');
                $('.final_outcome').css('display','none');
                linelist_reason_v1();
            }
            else if(contact_visit == 2)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','none');
                $('.linelist_reason_id_v3').css('display','none');
                $('.v4').css('display','none');
                $('.linelist_reason_id_v4').css('display','none');
                $('.v5').css('display','none');
                $('.linelist_reason_id_v5').css('display','none');
                $('.final_outcome').css('display','none');
                linelist_reason_v1();
                linelist_reason_v2();
            }
            else if(contact_visit == 3)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','none');
                $('.linelist_reason_id_v4').css('display','none');
                $('.v5').css('display','none');
                $('.linelist_reason_id_v5').css('display','none');
                $('.final_outcome').css('display','none');
                linelist_reason_v1();
                linelist_reason_v2();
                linelist_reason_v3();
            }
            else if(contact_visit == 4)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','block');
                $('.v5').css('display','none');
                $('.final_outcome').css('display','none');
                linelist_reason_v1();
                linelist_reason_v2();
                linelist_reason_v3();
                linelist_reason_v4();
            }
            else if(contact_visit == 5)
            {
                $('.v1').css('display','block');
                $('.v2').css('display','block');
                $('.v3').css('display','block');
                $('.v4').css('display','block');
                $('.v5').css('display','block');
                $('.final_outcome').css('display','none');
                linelist_reason_v1();
                linelist_reason_v2();
                linelist_reason_v3();
                linelist_reason_v4();
                linelist_reason_v5();
            }
            else
            {
                $('.v1').css('display','block');
                $('.final_outcome').css('display','block');

                var showdata = "<?php echo e($showdata ?? ''); ?>";
                if(showdata != "")
                {
                    var contact_visit = "<?php echo e($showdata[0]->contact_visit ?? ''); ?>";
                    if(contact_visit == 2)
                    {
                        $('.v2').css('display','block');
                        linelist_reason_v2();
                    }
                    else if(contact_visit == 3)
                    {
                        $('.v3').css('display','block');
                        linelist_reason_v3();
                    }
                    else if(contact_visit == 4)
                    {
                        $('.v4').css('display','block');
                        linelist_reason_v4();
                    }
                    else if(contact_visit == 5)
                    {
                        $('.v5').css('display','block');
                        linelist_reason_v5();
                    }
                }
                linelist_reason_v1();
                final_outcome();
            }
        }
        else
        {
            $('.v1').css('display','none');
            $('.v2').css('display','none');
            $('.v3').css('display','none');
            $('.v4').css('display','none');
            $('.v5').css('display','none');
            $('.final_outcome').css('display','none');
        }
    });

    function linelist_reason_v1()
    {
        var linelist_reason = $("#linelist_reason_v1").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.linelist_other_reason_v1').css('display','none');
                $('.linelist_reason_id_v1').css('display','block');
                $('#linelist_reason_id_v1').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }

    function linelist_reason_v2()
    {
        var linelist_reason = $("#linelist_reason_v2").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.linelist_other_reason_v2').css('display','none');
                $('.linelist_reason_id_v2').css('display','block');
                $('#linelist_reason_id_v2').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }

    function linelist_reason_v3()
    {
        var linelist_reason = $("#linelist_reason_v3").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.linelist_other_reason_v3').css('display','none');
                $('.linelist_reason_id_v3').css('display','block');
                $('#linelist_reason_id_v3').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }
    
    function linelist_reason_v4()
    {
        var linelist_reason = $("#linelist_reason_v4").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.linelist_other_reason_v4').css('display','none');
                $('.linelist_reason_id_v4').css('display','block');
                $('#linelist_reason_id_v4').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }

    function linelist_reason_v5()
    {
        var linelist_reason = $("#linelist_reason_v5").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.linelist_other_reason_v5').css('display','none');
                $('.linelist_reason_id_v5').css('display','block');
                $('#linelist_reason_id_v5').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }
    
    function final_outcome()
    {
        var linelist_reason = $("#final_outcome").val();
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('getlinelistmaster')); ?>",
            data: {linelist_reason:linelist_reason, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "json",
            success: function(res) { 
                $('.final_outcome_other_reason').css('display','none');
                $('.final_outcome_id').css('display','block');
                $('#final_outcome_id').html(res.html);
            },
            error: function (jqXHR, exception) {

            }
        });
    }

    $( "#linelist_reason_id_v1" ).change(function() { 
        var linelist_reason_id_v1 = $("#linelist_reason_id_v1 option:selected").text();
        if(linelist_reason_id_v1 == "Others (Specify)")
        {
            $('.linelist_other_reason_v1').css('display','block');
        }
        else
        {
            $('.linelist_other_reason_v1').css('display','none');
        }
    }); 
    $( "#linelist_reason_id_v2" ).change(function() { 
        var linelist_reason_id_v2 = $("#linelist_reason_id_v2 option:selected").text();
        if(linelist_reason_id_v2 == "Others (Specify)")
        {
            $('.linelist_other_reason_v2').css('display','block');
        }
        else
        {
            $('.linelist_other_reason_v2').css('display','none');
        }
    }); 
    $( "#linelist_reason_id_v3" ).change(function() { 
        var linelist_reason_id_v3 = $("#linelist_reason_id_v3 option:selected").text();
        if(linelist_reason_id_v3 == "Others (Specify)")
        {
            $('.linelist_other_reason_v3').css('display','block');
        }
        else
        {
            $('.linelist_other_reason_v3').css('display','none');
        }
    }); 
    $( "#linelist_reason_id_v4" ).change(function() { 
        var linelist_reason_id_v4 = $("#linelist_reason_id_v4 option:selected").text();
        if(linelist_reason_id_v4 == "Others (Specify)")
        {
            $('.linelist_other_reason_v4').css('display','block');
        }
        else
        {
            $('.linelist_other_reason_v4').css('display','none');
        }
    }); 
    $( "#linelist_reason_id_v5" ).change(function() { 
        var linelist_reason_id_v5 = $("#linelist_reason_id_v5 option:selected").text();
        if(linelist_reason_id_v5 == "Others (Specify)")
        {
            $('.linelist_other_reason_v5').css('display','block');
        }
        else
        {
            $('.linelist_other_reason_v5').css('display','none');
        }
    }); 

    $( "#final_outcome_id" ).change(function() { 
        var final_outcome_id = $("#final_outcome_id option:selected").text();
        if(final_outcome_id == "Others (Specify)")
        {
            $('.final_outcome_other_reason').css('display','block');
        }
        else
        {
            $('.final_outcome_other_reason').css('display','none');
        }
    }); 
</script>
<?php $__env->startPush('script'); ?>
    <script src="<?php echo e(asset('js/form-components.js')); ?>"></script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/viruxyz/public_html/treatbuddy/resources/views/pages/calling-input.blade.php ENDPATH**/ ?>