<div class="table-wrap">
    <div class="table-responsive">
        <table class="table table-sm text-white">
            <tbody>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('name'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->name; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('name'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->name; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('phone'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->phone; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('phone'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->phone; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('gender'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->gender; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('gender'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->gender; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('appointment'); ?> <?php echo $this->lang->line('date'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->date; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('appointment'); ?> <?php echo $this->lang->line('date'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->date; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('appointment_no'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->appointment_no; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('appointment_no'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->appointment_no; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('doctor'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->doctor_id ? get_doctor_name(json_decode($appointment->old_data)->doctor_id) : ''; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('doctor'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->doctor_id ? get_doctor_name(json_decode($appointment->new_data)->doctor_id) : ''; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('old'); ?> <?php echo $this->lang->line('reference'); ?></td>
                    <td><?php echo json_decode($appointment->old_data)->reference_id ? get_doctor_name(json_decode($appointment->old_data)->reference_id) : ''; ?></td>
                    <td><?php echo $this->lang->line('new'); ?> <?php echo $this->lang->line('reference'); ?></td>
                    <td><?php echo json_decode($appointment->new_data)->reference_id ? get_doctor_name(json_decode($appointment->new_data)->reference_id) : ''; ?></td>
                </tr>
                <tr>
                    <td><?php echo $this->lang->line('created_by'); ?></td>
                    <td><?php echo $appointment->created_by; ?></td>
                    <td><?php echo $this->lang->line('date'); ?></td>
                    <td><?php echo date('d F, Y h:i A', strtotime($appointment->created_at)); ?></td>
                </tr>
                <?php if ($this->session->userdata('role_id') == SUPER_ADMIN || !empty(custom_permission('modified_by'))) { ?>
                    <tr>
                        <td><?php echo $this->lang->line('modified_by'); ?></td>
                        <td><?php echo $appointment->modified_by; ?></td>
                        <td><?php echo $this->lang->line('date'); ?></td>
                        <td><?php echo $appointment->modified_by ? date('d F, Y h:i A', strtotime($appointment->modified_at)) : ''; ?>
                        </td>
                    </tr>
                <?php } ?>
                <?php if ($this->session->userdata('role_id') == SUPER_ADMIN) { ?>
                    <tr>
                        <td><?php echo $this->lang->line('old'); ?></td>
                        <td colspan="3"><?php echo $appointment->old_data; ?></td>
                    </tr>
                    <tr>
                        <td><?php echo $this->lang->line('new'); ?></td>
                        <td colspan="3"><?php echo $appointment->new_data; ?></td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
</div>