<?= message_box('success'); ?>
<?= message_box('error'); ?>

<?php
$created = can_action('187', 'created');
$edited = can_action('187', 'edited');
$deleted = can_action('187', 'deleted');
?>

<style>
    #DataTables th,
    #DataTables td {
        vertical-align: middle;
    }

    #DataTables th:first-child,
    #DataTables td:first-child {
        text-align: center;
        width: 42px;
    }

    <?php if (!empty($deleted)) { ?>
    #DataTables th:nth-child(6),
    #DataTables td:nth-child(6) {
        text-align: right;
        white-space: nowrap;
    }

    #DataTables th:nth-child(7),
    #DataTables td:nth-child(7) {
        text-align: center;
        white-space: nowrap;
    }
    <?php } else { ?>
    #DataTables th:nth-child(5),
    #DataTables td:nth-child(5) {
        text-align: right;
        white-space: nowrap;
    }

    #DataTables th:nth-child(6),
    #DataTables td:nth-child(6) {
        text-align: center;
        white-space: nowrap;
    }
    <?php } ?>

    #DataTables th.col-options,
    #DataTables td:last-child {
        text-align: right;
        white-space: nowrap;
    }
</style>

<div class="space-y-4">
    <div class="rounded-2xl border border-border bg-card shadow-sm">        
        <div class="table-responsive p-4">
            <table class="table table-striped DataTables" id="DataTables" width="100%">
                <thead>
                    <tr>
                        <?php if (!empty($deleted)) { ?>
                        <th class="no-sort">
                            <span class="sr-only"><?= lang('select') ?></span>
                        </th>
                        <?php } ?>
                        <th><?= lang('reference_no') ?></th>
                        <th><?= lang('date') ?></th>
                        <th><?= lang('warehouse') . ' (' . lang('FROM') . ')' ?></th>
                        <th><?= lang('warehouse') . ' (' . lang('TO') . ')' ?></th>
                        <th class="text-right"><?= lang('Total price') ?></th>
                        <th><?= lang('status') ?></th>
                        <?php $show_custom_fields = custom_form_table(18, null);
                        if (!empty($show_custom_fields)) {
                            foreach ($show_custom_fields as $c_label => $v_fields) {
                                if (!empty($c_label)) {
                        ?>
                        <th><?= $c_label ?> </th>
                        <?php }
                            }
                        }
                        ?>
                        <?php if (!empty($edited) || !empty($deleted)) { ?>
                        <th class="col-options no-sort text-right"><?= lang('action') ?></th>
                        <?php } ?>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
    </div>
</div>

<script type="text/javascript">
    list = base_url + "admin/items/transferItemList";
</script>
