<style type="text/css">


    .panel.panel-default.panel-body{
        margin-top: 20px;
    }


    .label-circle {


    }
    .table-background-odd{
        background-color: #f3e3e0;

    }
    .table-background-even{
        background-color: #f6f0ee  
    }
    .table-background-head{
        background-color: #e8eff4;  
    }




    .spinner{
        margin-top: 8px;
        margin-left: -5px;
        display: none;
    }
    .form_label{
        margin-top: 4px;
    }
    .td_success{
        background-color: green;
    }
    .td_danger{
        background-color: red;
    }
    .td_dots{
        background-color: blue;
    }
    .td_outside{
        background-color: #0099FF;
    }
    .td_remain{
        background-color: #5bc0de;
    }
    .permanent_patient_id{
        cursor: pointer;
    }

    .table-user-information tbody tr td{
        text-align: center;
        color: #269abc;

    }
    .table-user-information{
        margin-top: -12px;

    }


    .table-user-information > tbody > tr {
        border-top: 1px solid rgb(221, 221, 221);
    }

    .table-user-information > tbody > tr:first-child {
        border-top: 0;
    }


    .table-user-information > tbody > tr > td {
        border-top: 0;
    }



    #patient_dose_taken_phase1_table{
        border: 1px solid #857875;
    }
    #patient_dose_taken_phase1_table > thead > tr > th,
    #patient_dose_taken_phase1_table > tbody > tr > th,
    #patient_dose_taken_phase1_table > tfoot > tr > th,
    #patient_dose_taken_phase1_table > thead > tr > td,
    #patient_dose_taken_phase1_table > tbody > tr > td,
    #patient_dose_taken_phase1_table > tfoot > tr > td {
        border: 1px solid #857875;

    }
    #patient_dose_taken_phase1_table{
        display:inline-block;
        width: 100%;
        overflow-x: scroll;


    }

    .field-coordinator-patient-dose .panel{

    }
    .verticalLine {
        border:solid #ecf2f2;
    }
    .text-setting{
        margin-top: 4px;
    }
</style>
<div class="panel"> 
    <?php $this->load->view('mira_anm_work_button') ?>


    <div class="panel-body" style="margin: 0">
        <table class="table tatable-bordered table-hover tableborder" id="patient_dose_taken_phase1_table" style="margin: 0">
            <thead>         
                <tr class="table-background-head">
                    <th class="text-center fix" rowspan="2">#</th> 
                    <th class="text-center fix" rowspan="2">H.&nbsp;No.</th> 
                    <th class="text-center" rowspan="2">Asha&nbsp;Worker</th>
                    <th class="text-center" rowspan="2">Women&nbsp;Name</th>

                    <th class="text-center" rowspan="2">Done</th>
                    <th class="text-center" rowspan="2">Missed</th>
                    <th class="text-center" rowspan="2">Pending</th>
                    <th class="text-center" colspan="3">HRP Risk1</th>
                    <th class="text-center" colspan="3">HRP Risk2</th>
                    <th class="text-center" colspan="3">HRP Risk3</th>
                    <th class="text-center" colspan="3">HRP Risk4</th>
                    <th class="text-center" colspan="3">HRP Risk5</th>
                </tr>
                <tr class="table-background-head">
                    <th class="text-center">Week</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Refer</th>


                    <th class="text-center">Week</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Refer</th>

                    <th class="text-center">Week</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Refer</th>

                    <th class="text-center">Week</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Refer</th>



                    <th class="text-center">Week</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Refer</th>



                </tr>


            </thead>
            <tbody>
                <?php
                if (isset($anm_work_detail) and $anm_work_detail) {
                    for ($i = 0; $i < count($anm_work_detail); $i++) {
                        ?>
                        <tr>
                            <td class="text-center" ><?= ($i + 1) ?></td> 
                            <td class="text-center" ><?= $anm_work_detail[$i]['house_number'] ?></td> 
                            <td class="text-center"><?= str_replace(' ', '&nbsp', $anm_work_detail[$i]['name']) ?></td>
                            <td class="text-center"><?= str_replace(' ', '&nbsp', $anm_work_detail[$i]['name']) ?></td>

                            <td class="text-center"><span class="label label-success"><?= $anm_work_detail[$i]['status']['done'] ?></span></td>
                            <td class="text-center"><span class="label label-danger"><?= $anm_work_detail[$i]['status']['missed'] ?></span></td>
                            <td class="text-center"><span class="label label-warning"><?= $anm_work_detail[$i]['status']['pending'] ?></span></td>

                            <?php
                            for ($k = 0; $k < 5; $k++) {
                                $upperBlockFlag=TRUE;
                                if (!$k) {
                                    for ($j = 0; $j < count($anm_work_detail[$i]['status']['referCount']); $j++) {
                                        $k=$j;
                                        $upperBlockFlag=FALSE;
                                        ?>
                                        <td class="text-center"><?= $anm_work_detail[$i]['status']['referCount'][$j]['week'] ?></td>
                                        <?php if ($anm_work_detail[$i]['status']['referCount'][$j]['status'] == 1) { ?>
                                            <td class="text-center"><span class="text-center text-success"><i class="fa fa-check"></i></span></td>
                                            <?php if ($anm_work_detail[$i]['status']['referCount'][$j]['refer_to'] == 3) { ?>
                                                <td class="text-center"><span class="label label-warning">Doctor</span></td>
                                            <?php } elseif ($anm_work_detail[$i]['status']['referCount'][$j]['refer_to'] == 4) { ?>
                                                <td class="text-center"><span class="label label-danger">Ambulance</span></td>
                                            <?php } else { ?>
                                                <td class="text-center"><span class="label label-info">CHW</span></td> 
                                            <?php }
                                            ?>

                                        <?php } elseif ($anm_work_detail[$i]['status']['referCount'][$j]['status'] == 2) { ?>
                                            <td class="text-center"><span class="text-center text-warning"><i class="fa fa-clock-o"></i></span></td>
                                            <td class="text-center"><span class="label label-warning">Pending</span></td>
                                        <?php } else { ?>
                                            <td class="text-center"><span class="text-center text-danger"><i class="fa fa-times"></i></span></td>
                                            <td class="text-center"><span class="label label-danger">Missed</span></td>
                                            <?php
                                        }
                                    }
                                }
                                ?>
                                
                                <?php if($upperBlockFlag){ ?>
                                <td class="text-center"></td>
                                <td class="text-center"><span class="text-center info"></span></td>
                                <td class="text-center"><span class="label label-info"></span></td>
  
                              <?php  }
                                
                             }
                            ?>

                        </tr>
                        <?php
                    }
                }
                ?>



            </tbody>
        </table>
        <div class="panel-footer" style="margin: 0">
            <div class="row">
                <div class="col-lg-6">
                    <ul class="pagination pagination-large">
                        <?php
                        if (isset($totalPage) and $totalPage and $totalPage > 1) {
                            for ($i = 0; $i < $totalPage; $i++) {
                                if ($i == 0) {
                                    if ($activePage == 1) {
                                        ?>
                                        <li class="disabled"><span>«</span></li>
                                    <?php } else { ?>
                                        <li class="page" value="<?= ($activePage - 1) ?>"><a href="<?= base_url('anm-work-detail-hrp/' . ($activePage - 1) . '/' . $region_detail[0]['region_code']) ?>"><span>«</span></a></li>
                                        <?php
                                    }
                                }


                                if (($i + 1) == $activePage) {
                                    ?>

                                    <li class="active page"><span><?= ($i + 1) ?></span></li>  
                                <?php } else { ?>
                                    <li class="page"><a href="<?= base_url('anm-work-detail-hrp/' . ($i + 1) . '/' . $region_detail[0]['region_code']) ?>"><span><?= ($i + 1) ?></span></a></li>
                                    <?php
                                }


                                if (($i + 1) == $totalPage) {
                                    if ($totalPage == $activePage) {
                                        ?>
                                        <li class="disabled page"><span>Next</span></li>
                                    <?php } else { ?>
                                        <li class="page"><a href="<?= base_url('anm-work-detail-hrp/' . ($activePage + 1) . '/' . $region_detail[0]['region_code']) ?>"><span>Next</span></a></li>
                                        <?php
                                    }
                                }
                            }
                        }
                        ?>
                    </ul>
                </div>
                <div class="col-lg-6">
                    <p class="text-center">
                        <span class="label label-warning ">0-> Not Attempt By Asha</span>
                        <span class="label label-success ">1,2->Attempt By Asha</span>
                        <span class="label label-primary ">3,4,5->Action By ANM</span>

                    </p>
                </div>
            </div>

        </div>
    </div>
</div>