<?php

defined('BASEPATH') or exit('No direct script access allowed');

$aColumns = [
    'name'
];

$sIndexColumn = 'id';
$sTable       = db_prefix() . 'items_groups';

$result       = data_tables_init($aColumns, $sIndexColumn, $sTable, [], [], ['id']);
$output       = $result['output'];
$rResult      = $result['rResult'];

foreach ($rResult as $aRow) {
    $row = [];

    foreach ($aColumns as $column) {
        $_data = $aRow[$column];

        $row[] = $_data;
    }

    $options = '<div class="tw-flex tw-items-center tw-space-x-2">';
    $options .= '<a href="' . admin_url('item_groups/group/' . $aRow['id']) . '" class="tw-text-neutral-500 hover:tw-text-neutral-700">
        <i class="fa-regular fa-pen-to-square fa-lg"></i>
    </a>';
    $options .= '<a href="' . admin_url('item_groups/delete/' . $aRow['id']) . '" class="tw-text-neutral-500 hover:tw-text-neutral-700 _delete">
        <i class="fa-regular fa-trash-can fa-lg"></i>
    </a>';
    $options .= '</div>';

    $row[] = $options;

    $output['aaData'][] = $row;
}