<?php require PATH . '/view/common/head.php'; ?>
<?php require PATH . '/view/common/header.php'; ?>
<?php require_once PATH.'/config/array.config.php'; ?>
<div class="container">
    <!-- table -->
    <form method="post" enctype="multipart/form-data">
        <input type="hidden" name="_ACTION" value="save">
        <input type="hidden" name="_TOKEN" value="<?php echo $Token?>">
        <div class="row gy-2 gx-4">
            <?php 
            $i=0;
            foreach ($Data as $Key) { 
            ?>
            <div class="col-lg-4">
                <?php if($Key['name'] != 'All') {  ?>
                <label class="form-label">
                    <?php echo $Key['name'];?></label>
                <?php } ?>
                <input type="hidden" name="data[<?php echo $i;?>][name]" value="<?php echo $Key['name'];?>">
                <input type="hidden" name="data[<?php echo $i;?>][url]" value="<?php echo $Key['url'];?>">
                <?php if($Key['name'] != 'All') {  ?>
                <select name="data[<?php echo $i;?>][category]" class="form-select mt-2" required="true">
                    <?php foreach ($Categories as $Category) { ?>
                    <option value="<?php echo $Category['id'];?>" <?php if(isset($Key['category']) AND $Category['id']==$Key['category']) echo ' selected=""' ;?>>
                        <?php echo $Category['name'];?>
                    </option>
                    <?php } ?>
                </select>
                <?php } ?>
            </div>
            <?php $i++; }  ?>
        </div>
        <button type="submit" class="btn btn-primary py-3 w-lg-300 mt-3">
            <?php echo self::translate('Save Changes');?></button>
    </form>
</div>
<?php require PATH . '/view/common/javascript.php'; ?>
<?php require PATH . '/view/common/footer.php'; ?>