<?php

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

$aColumns = [
    'm.group',
    'm.brand',
    'm.model',
    'm.type',
    'm.valor'
];

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

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

    $row[] = $aRow['group'];
    $row[] = $aRow['brand'];
    $row[] = $aRow['model'];
    $row[] = $aRow['type'];
    $row[] = $aRow['valor'];

    $options = '<div class="tw-flex tw-items-center tw-space-x-2">';
    $options .= '<a href="' . admin_url('corredicas_dobradicas/corredica_dobradica/' . $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('corredicas_dobradicas/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;
}