<?php if(!empty($accomodation)) foreach($accomodation as $key => $value): ?>
    <tr class="border-bottom">
        <td> 
            <div class="row">
                <div class="col text-right">

                <?php if($is_in_submission_range): ?>
                    <?php if($screen_mode == 'hod'): ?>
                        <button class="btn btn-success btn-sm" 
                            data-trigger="hover" 
                            data-tooltip="tooltip" title="" 
                            data-original-title="Approved Claim" 
                            data-claim-id="<?php echo $value->id; ?>" 
                            data-mode="9" 
                            onclick="hodApproval(this)"
                            >
                            <i class="fas fa-thumbs-up" style="transform: scaleX(-1);"></i>    
                        </button>
                        <!-- button reject -->
                        <button class="btn btn-danger btn-sm" 
                            data-trigger="hover" 
                            data-tooltip="tooltip" 
                            title="" 
                            data-original-title="Disaprove Claim" 
                            data-id="<?php echo $value->id;?>"
                            data-claim-id="<?php echo $value->claim_id; ?>" 
                            data-mode="9" 
                            data-toggle="modal" 
                            data-target="#rejectModal"
                            onclick="hodReject(this)"
                            >
                            <i class="fas fa-thumbs-down"></i>
                        </button>
                        <!-- button reject -->
                    <?php else: ?>
                        <?php if(empty($screen_mode)):?>
                            <button class="btn btn-danger btn-sm" 
                                data-rqtarget="removeAccomodation" 
                                data-id="<?php echo $value->id; ?>" 
                                onclick="deleteClaim(this)" 
                                data-trigger="hover" 
                                data-tooltip="tooltip" 
                                title="" 
                                data-original-title="Remove Claim" <?php echo ($disabled || !empty($claims->is_submit))?'disabled':''; ?>
                            >
                                <i class="fa fa-trash-alt"></i>
                            </button>
                        <?php endif; ?>
                    <?php endif; ?>
                <?php endif; ?>
                
                <?php if($screen_mode == 'admin'): ?>
                    <?php if($value->is_hod_approve == 0 || $value->is_hod_approve == 2): ?>
                        <div class="text-danger">claim has not been approved or rejected by HOD</div>
                    <?php endif;?>
                    <button 
                        class="btn btn-success btn-sm text-white" 
                        onclick="approveClaim(this)" 
                        data-price="<?php echo $value->amount; ?>" 
                        data-mileage=""
                        data-rqtarget="approveAccomodation" 
                        data-id="<?php echo ($value->id)?$value->id:0; ?>" 
                        data-status="<?php echo $value->is_admin_approve; ?>" 
                        data-allocation="status" 
                        data-balanced="balanced" 
                        data-trigger="hover" 
                        data-tooltip="tooltip" 
                        title="" 
                        data-original-title="Approve Claim">
                        <i class="fas fa-thumbs-up" style="transform: scaleX(-1);"></i>
                    </button>

                    <button 
                        class="btn btn-danger btn-sm text-white" 
                        onclick="rejectClaim(this)" 
                        data-price="<?php echo number_format($value->amount,2); ?>" 
                        data-mileage=""
                        data-rqtarget="approveAccomodation" 
                        data-id="<?php echo ($value->id)?$value->id:0; ?>" 
                        data-status="<?php echo $value->is_admin_approve; ?>" 
                        data-allocation="status" 
                        data-balanced="balanced" 
                        data-trigger="hover" 
                        data-tooltip="tooltip" 
                        title="" 
                        data-original-title="Reject Claim">
                        <i class="fas fa-thumbs-down"></i>
                    </button>
                <?php endif; ?>
                
                </div>
            </div>
            <div class="row">
                <div class="col text-primary">
                    <h4>Accomodation</h4>
                    <small><?php echo date('d-F-Y',strtotime($value->date_from)); ?> - <?php echo date('d-F-Y',strtotime($value->date_to)); ?></small>
                </div>
            </div>
            <div class="row">
                <div class="col-12 col-md-10">
                    
                    <div class="row">
                        <div class="col-12 col-md-6">
                            <div class="row">
                                <div class="col-md-4">
                                    <b>Status (HOD)</b>
                                </div>
                                <div class="col">
                                    
                                    <?php if ($value->is_hod_approve == 0): ?>
                                        <span class="badge badge-secondary">Draft</span>
                                    <?php endif ?>

                                    <?php if ($value->is_hod_approve == 1): ?>
                                        <span class="badge badge-success">Approved</span>
                                    <?php endif ?>

                                    <?php if ($value->is_hod_approve == 2): ?>
                                        <span class="badge badge-danger">Rejected</span>
                                    <?php endif ?>
                                </div>
                            </div>
                        </div>
                        <div class="col-12 col-md-6">
                            <div class="row">
                                <div class="col-md-4">
                                    <b>Status (Admin)</b>
                                </div>
                                <div class="col">
                                    <?php if ($value->is_admin_approve == 0): ?>
                                        <span class="badge badge-secondary">Draft</span>
                                    <?php endif ?>

                                    <?php if ($value->is_admin_approve == 1): ?>
                                        <span class="badge badge-success">Approved</span>
                                    <?php endif ?>

                                    <?php if ($value->is_admin_approve == 2): ?>
                                        <span class="badge badge-danger">Rejected</span>
                                    <?php endif ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-2">
                            <b>Travel Type</b>
                        </div>
                        <div class="col">
                            <?php if($value->type == 0): ?> 
                                Local Travel
                            <?php else:?>
                                International Travel
                            <?php endif;?>
                        </div>
                    </div>
                        
                    <div class="row">
                        <div class="col-lg-2">
                            <b>Receipt</b>
                        </div>
                        <div class="col">
                            <ol>
                                <?php if(!empty($value->attachment_name)): ?>
                                    <li>
                                        <a href="<?php echo base_url('hr/claim/openAttachment/'.$value->unique_id.'/ACCOMODATION'); ?>" target="_blank">
                                            <?php echo $value->attachment_name; ?>
                                        </a>
                                        <small><?php echo $value->description; ?></small>
                                    </li>
                                <?php endif; ?>
                            </ol>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-lg-2">
                            <b>Staff Movement(s)</b>
                        </div>
                        <div class="col">
                            <ol>
                                <?php if(!empty($value->staff_movements)) foreach($value->staff_movements as $mov_key => $movement): ?>
                                    <li>
                                        <a href="<?php echo base_url('hr/movement/edit/'.$movement->movement_id); ?>" target="_blank">
                                            <u>
                                                <?php echo $movement->date.' - '.$movement->type.' : '.$movement->destination; ?>
                                            </u>
                                        </a>
                                    </li>
                                <?php endforeach; ?>
                            </ol>
                        </div>
                    </div>
                    

                    <div class="row">
                        <div class="col-lg-2">
                            <b>Description</b>
                        </div>
                        <div class="col">
                            <?php echo $value->claim_description; ?>
                        </div>
                    </div>


                    <div class="row">
                        <div class="col-lg-2">
                            <b>Remarks</b>
                        </div>
                        <div class="col" style="min-height:100px;">

                            <?php if($value->is_hod_approve == 2): ?>
                                <?php if(!empty($value->hod_remarks)): ?>
                                    <b>[HOD] : </b> <?php echo $value->hod_remarks; ?>
                                <?php endif; ?>
                            <?php endif; ?>

                            <?php if($value->is_admin_approve == 2): ?>
                                <?php if(!empty($value->admin_remarks)): ?>
                                    <b>[ADMIN] : </b> <?php echo $value->admin_remarks; ?>
                                <?php endif; ?>
                            <?php endif; ?>
                        </div>
                    </div>

                </div>
                <div class="col-12 col-md-2">
                    <div class="row py-1 border-bottom" style="background-color:bisque;">
                        <div class="col">
                            <b>Claimed (RM)</b>
                            <h1><?php echo number_format($value->amount,2); ?></h1>
                        </div>
                    </div>

                    <div class="row py-1 border-bottom" style="background-color:bisque;">
                        <div class="col">
                            <b>Approved (RM)</b>
                            <h1><?php echo number_format($value->amount_approved,2); ?></h1>
                        </div>
                    </div>
                </div>
            </div>
        </td>
    </tr>
<?php endforeach; ?>