<div class="modal fade" id="summaryModal">
    <div class="modal-dialog"  style="max-width: 90%;">
        <div class="modal-content">
            <div class="modal-header">
                <div>
                    <h5 class="modal-title" id="summary-modal-title">Leave Summary</h5>
                    <p style="padding: 0; margin: 0;" class="text-muted" id="summary-modal-subtitle"><?php echo strtoupper($user['name']); ?></p>
                </div>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="table-responsive">
                    <table id="table_allocations" class="table table-bordered table-striped table-hover">
                        <thead>
                        <th class="text-center">Year</th>
                        <th>Leave Type</th> 
                        <th>Leave Allocated </th>
                        <th>Leave Taken</th>
                        <th>Balance</th>
                        <th>Leave Validity</th>
                        <th>BF Available / Entitled</th>
                        </thead>
                        <tbody>
                            <?php if (isset($allocations)): ?>
                                <?php foreach ($allocations as $allocation): ?>
                                    <tr>
                                        <td><?php echo $allocation['year']; ?></td>
                                        <td>
                                            <?php  
                                            echo $allocation['name'];
                                            if($allocation['extra_name']) echo ' - ' . $allocation['extra_name'];
                                            ?>
                                        </td>
                                        <td><?php echo $allocation['leave_entitled']; if($allocation['is_prorate']) echo ' <span class="text-muted">(Prorated as at ' . date('d/m/Y') . ': ' . number_format($allocation['allowed_entitled'], 1) . ')</span>'; ?></td>
                                        <td><?php echo $allocation['leave_taken']; ?></td>
                                        <td><?php echo $allocation['leave_balance'];  ?></td>
                                        <td><?php echo ($allocation['date_from'] != '0000-00-00' ? date_format(date_create($allocation['date_from']), 'd/m/Y') : ('01/01/' . date('Y'))) . ' to ' .($allocation['expiry_date'] != '0000-00-00' ? date_format(date_create($allocation['expiry_date']), 'd/m/Y') : ('31/12/' . date('Y'))) ?></td>
                                        <td><?php echo $allocation['bring_forward'] . ' / ' . $allocation['bring_forward_entitled'] ; ?></td>
                                    </tr>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>