<?php

include "../../classes/app.class.php";
$app = new app();
$db = new DBMain();
?>

<div class='container flex_container'>
    <h1>SEARCH TOOLS BY:</h1>
    <div class="container flex_container" style='border: 1px solid black; width:80%;padding: 10px;border-radius: 10px;'>

        <div class='flex_container_content'>
        <label>Name</label>
            <input type="text" name="name" id="name">
        </div>
        <br>
        <button onclick="search_tools_category()" class='font_size_2vw'>SEARCH</button>
    </div>
</div>

<div class='flex_container' id='tool_category_content'>

</div>

<script>
    function search_tools_category() {

        var name = document.getElementById('name').value;

        var xhttp = new XMLHttpRequest();
        xhttp.onload = function() {
            console.log(this.responseText);
            document.getElementById('tool_category_content').innerHTML = this.responseText;
        }
        xhttp.open("GET", '../../ajax/tools/search_tools_category.php?name=' + name);
        xhttp.send();
    }

    function edit_tool_category($id) {
        window.location.href = 'edit_tool_category.php?record_id=' + $id;
    }
</script>