<!DOCTYPE html>
<?php 
include ('includes/header.php');?>
<html>
<head>
    <meta charset="utf-8">
    <title>PHP JSON File CRUD (Create Read Update and Delete)</title>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css">
</head>
<body>
<div class="col-md-12 mx-auto">
        <center>
			<h1 class="colorboard"></i>App Settings ⚙️</h1>
		</center>
        <p/>
		<table class="table table-striped table-sm">
			<thead style="color:white!important">
				<tr>
				<th>AppSetting</th>
                <th>Action</th>
				<th>Modify&nbsp</th>
				</tr>
			</thead>
            <tbody>
                    <?php
                        //fetch data from json
                        $data = file_get_contents('api/RTXSettings.json');
                        //decode into php array
                        $data = json_decode($data);
 
                        $index = 0;
                        foreach($data->RTX_MODE as $row){
                            echo "
                                <tr>
                                    <td>".$row->SettingName."</td>
                                    <td>".$row->Action."</td>
                                <td>
                                        <a class='btn btn-info btn-ok' href='edit.php?index=".$index."'<i class='fa fa-pencil-square-o'>Edit</i></a>&nbsp&nbsp&nbsp
                                </td>
                                </tr>
                            ";
                            if(++$index > 14) break;
                        }
                    ?>
                </tbody>
			</table>
        </div>
</div>
<?php include ('includes/footer.php');?>
</body>
</html>