<?php
include "../../root.class.php";
$html = new html();
$html->add_styles_page();
$table_name = "item_sub_categories";
$db_safeguard = new db_safeguard();
?>

<div class="search_form">
    <h1> SEARCH ITEM CATEGORIES</h1>
    <?php echo $html->input_html("name", "", "name", "name");


    $restorants_res = $db_safeguard->query("restorants", "SELECT * FROM restorants WHERE record_id = {$_SESSION['restorant_id']}");

    $restorant_data = $restorants_res->fetch_assoc();
    $like_query = "restorant_id = {$restorant_data['record_id']}";

    echo $html->select_html_from_db('item_categories', 'record_id', 'name', $like_query, "item_categories_id", "item_categories_id");
    echo $html->submit_btn('submit', 'SEARCH', "search_$table_name()"); ?>

</div>

<?php echo $html->html_form_ajax("search_$table_name", "SELECT", $table_name, '', false, ['name'], "edit_$table_name.php"); ?>