<?php 
 use App\Http\Controllers\TreatmentController;
 if(file_exists('json_files/json-file.json')){ 
    $json = file_get_contents('json_files/json-file.json');
    //Decode JSON
    $json_data = json_decode($json,true);
    $results = array();
    }
    $i=1;
    if($rncnt > 0){
    foreach($data as $result2){    
        $treatdur = $result2->TreatDur1;
        $treatdate = (new TreatmentController)->getTreatDate2($treatdur);
?>

<tr>
    <td align="center" valign="top"><input class="form-check-input" type="checkbox" value="1" id="TreatChk<?php echo e($i); ?>"
            name="TreatChk<?php echo e($i); ?>" onclick="treatcheck('TreatChk<?php echo e($i); ?>')" checked>
    </td>
    <td>
        <select class="form-control" name="TreatType<?php echo e($i); ?>" id="TreatType<?php echo e($i); ?>" style="height:35px;"  onchange="getDrugByType(this.value,<?php echo e($i); ?>)">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatType'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>" <?php if($result2->TreatType1 == $result['Values']){?>
                selected <?php } ?>>
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>

        <input class="form-control" type="text" name="TreatName<?php echo e($i); ?>" list="Treat_Name1" id="TreatName<?php echo e($i); ?>"
            value="<?php echo e($result2['TreatName1']); ?>" onClick="this.select();" style="height:35px;"
            oninput="getTreatNameDetails('TreatName<?php echo e($i); ?>','TreatDose<?php echo e($i); ?>','TreatFreq<?php echo e($i); ?>')" style="height:35px;">
        <datalist id="Treat_Name<?php echo e($i); ?>" class="treatments">
            <?php $__currentLoopData = $TreatName; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $result): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($result->TreatName); ?>">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </datalist>
    </td>
    <td>
        <select class="form-control" name="TreatDose<?php echo e($i); ?>" id="TreatDose<?php echo e($i); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatDose'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>" <?php if($result2->TreatDose1 == $result['Values']){?>
                selected <?php } ?>>
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>
        <select class="form-control" name="TreatFreq<?php echo e($i); ?>" id="TreatFreq<?php echo e($i); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatFreq'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>" <?php if($result2->TreatFreq1 == $result['Values']){?>
                selected <?php } ?>>
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>
        <select class="form-control" name="TreatDur<?php echo e($i); ?>" id="TreatDur<?php echo e($i); ?>" style="height:35px;"
            onchange="getTreatDate(<?php echo e($i); ?>,this.value)">

            <option value="" selected>...</option>
            <?php $__currentLoopData = $durationList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $result): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($result->Duration); ?>" <?php if($result2->TreatDur1 == $result->Duration){?> selected
                <?php } ?>>
                <?php echo e($result->Duration); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>


    </td>
    <!-- <td>
        <input class="form-control" type="date" name="TreatDate<?php echo e($i); ?>" id="TreatDate<?php echo e($i); ?>" value="<?php echo e($treatdate); ?>"
            style="height:31px;"></td> -->
    <td>
        <select class="form-control" name="TreatEye<?php echo e($i); ?>" id="TreatEye<?php echo e($i); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatEye'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>" <?php if($result2->TreatEye1 == $result['Values']){?>
                selected <?php } ?>>
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <!-- <td> -->
    <?php if($i > 1): ?>           
    <!-- <input type="checkbox" value="1" id="Tapchk<?php echo e($i); ?>" name="Tapchk<?php echo e($i); ?>" onclick="checkTap(<?php echo e($i-1); ?>,<?php echo e($i); ?>)" >&nbsp;<label for="Tapchk<?php echo e($i); ?>">Tap</label> -->
<?php endif; ?>
<!-- </td> -->
</tr>
<?php $i++;}} 
for($i2=$rncnt+1;$i2<=10;$i2++){
?>
<tr>
    <td align="center" valign="top"><input class="form-check-input" type="checkbox" value="1" id="TreatChk<?php echo e($i2); ?>"
            name="TreatChk<?php echo e($i2); ?>" onclick="treatcheck('TreatChk<?php echo e($i2); ?>')">
    </td>
    <td>
        <select class="form-control" name="TreatType<?php echo e($i2); ?>" id="TreatType<?php echo e($i2); ?>" style="height:35px;"  onchange="getDrugByType(this.value,<?php echo e($i2); ?>)">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatType'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>">
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>
        <input class="form-control" onClick="this.select();" type="text"
            oninput="getTreatNameDetails('TreatName<?php echo e($i2); ?>','TreatDose<?php echo e($i2); ?>','TreatFreq<?php echo e($i2); ?>')"
            name="TreatName<?php echo e($i2); ?>" list="Treat_Name3" id="TreatName<?php echo e($i2); ?>" value="" style="height: 35px;">
        <datalist id="Treat_Name<?php echo e($i2); ?>" class="treatments">
            <?php $__currentLoopData = $TreatName; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $result): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($result->TreatName); ?>">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </datalist>

    </td>
    <td>
        <select class="form-control" name="TreatDose<?php echo e($i2); ?>" id="TreatDose<?php echo e($i2); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatDose'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>">
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>
        <select class="form-control" name="TreatFreq<?php echo e($i2); ?>" id="TreatFreq<?php echo e($i2); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatFreq'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>">
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <td>
        <select class="form-control" name="TreatDur<?php echo e($i); ?>" id="TreatDur<?php echo e($i); ?>" style="height:35px;"
            onchange="getTreatDate(<?php echo e($i2); ?>,this.value)">

            <option value="" selected>...</option>
            <?php $__currentLoopData = $durationList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $result): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($result->Duration); ?>">
                <?php echo e($result->Duration); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>


    </td>
    <!-- <td><input class="form-control" type="date" name="TreatDate<?php echo e($i2); ?>" id="TreatDate<?php echo e($i2); ?>" value=""
            style="height:31px;"></td> -->
    <td>
        <select class="form-control" name="TreatEye<?php echo e($i2); ?>" id="TreatEye<?php echo e($i2); ?>" style="height:35px;">

            <option value="" selected>...</option>
            <?php
foreach($json_data['JsonData']['TreatEye'] as $result) {?>
            <option value="<?php echo $result['Values']; ?>">
                <?php echo e($result['Values']); ?></option>
            <?php } ?>
        </select>

    </td>
    <!-- <td> -->
    <?php if($i2 > 1): ?>          
        <!-- <input type="checkbox" value="1" id="Tapchk<?php echo e($i2); ?>" name="Tapchk<?php echo e($i2); ?>" onclick="checkTap(<?php echo e($i2); ?>)">&nbsp;<label for="Tapchk<?php echo e($i2); ?>">Tap</label> -->
        <?php endif; ?>
    <!-- </td> -->
</tr>
<?php }  ?><?php /**PATH C:\laragon\www\parijathosp\resources\views/masters/treatmentlist2.blade.php ENDPATH**/ ?>