<?php
$translation         = \DynCom\mysyde\common\classes\Registry::get("translation");
$formname            = "form_field_table_list_" . $fieldSetup['id'];
$inputname           = "input_id";
$input_page_id       = (isset($_REQUEST["input_page_id"]) ? $_REQUEST["input_page_id"] : "");
$input_collection_id = (isset($_REQUEST["input_collection_id"]) ? $_REQUEST["input_collection_id"] : "");

$query = "SELECT tb.* FROM main_collection_table_link as mctl INNER JOIN table_header as tb on mctl.table_id = tb.id WHERE mctl.main_collection_id = ".$collectionData['id']." AND field_id = ".$fieldSetup['id']." LIMIT 1";
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
$input_tableform = @mysqli_fetch_array($result);
?>

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input type="hidden" name="input_page_id" value="<?php echo $input_page_id; ?>" />
    <input type="hidden" name="input_collection_id" value="<?php echo $input_collection_id; ?>" />
    <input type="hidden" name="collection_modul_input_<?php echo $fieldSetup['id']; ?>" value="table" />
    <input type="hidden" name="input_table_id_<?php echo $fieldSetup['id']; ?>" value="<?= (!empty($input_tableform)) ? $input_tableform['id'] : 0 ?>" />
    
    <table style="height:550px;" class="cardform" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <? input($translation->get("description"), "input_table_description_".$fieldSetup['id'], "text", $input_tableform["description"], 255) ?>
                    <? input($translation->get("Code"), "input_table_code_".$fieldSetup['id'], "text", $input_tableform["code"], 255) ?>
                    <? input($translation->get("rows"), "no_rows_".$fieldSetup['id'], "number", $input_tableform["no_rows"], 255) ?>
                    <? input($translation->get("columns"), "no_columns_".$fieldSetup['id'], "number", $input_tableform["no_columns"], 255) ?>
                   
                </td>
                <td>
                    

                     
                    <?php
                    if ($input_tableform["id"] != "") {
                        show_changed_on($input_tableform["id"], "table_header");
                        show_changed_by($input_tableform["id"], "table_header");
                    }
                    ?>
                </td>
            </tr> 
            <?php
                    if ($input_tableform["id"] != "") {
                        create_collection_table_set($input_tableform, $collectionData['id'], $fieldSetup['id']);
                    }
            ?>
    </table>
</form>