<?php 
include ('includes/json_utils.php');
include ('includes/header.php');

$page_name = 'extra_app_settings';

if (isset($_POST['submit']) && isset($_POST['data'])) {
    foreach ($_POST['data'] as $id => $fields) {
        updateJsonRecordByIdMulty($id, $fields);
    }

    echo "<script>window.location.href='" . $page_name . ".php?status=1'</script>";
}
?>

<div class="col-md-6 mx-auto ctmain-table">
    <div class="card-body">
        <div class="card text-white ctcard">
            <div class="card-header card-header-warning">
                <center>
                    <h2><i class="icon icon-bullhorn"></i> Extra app settings</h2>
                </center>
            </div>

            <div class="card-body">
                <form method="post">
                    <div class="form-group ctinput">
                        <label class="form-label"> Button :</label>
                        <input type="hidden" name="data[30][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[30][preftype]" value="string">
                        <input type="hidden" name="data[30][prefname]" value="btn_extra_visiblity">
                        <select name="data[30][mods]">
                            <option value="enable" <?php echo (getmodsbyid('30') == 'enable') ? 'selected' : ''; ?>>
                                Enable</option>
                            <option value="disable" <?php echo (getmodsbyid('30') == 'disable') ? 'selected' : ''; ?>>
                                Disable</option>
                        </select>
                    </div>
                    <div class="form-group ctinput">
                        <label class="form-label"> Button Text :</label>
                        <input type="hidden" name="data[31][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[31][preftype]" value="string">
                        <input type="hidden" name="data[31][prefname]" value="btn_extra_text">
                        <div class="form-group ctinput">
                            <input class="form-control" name="data[31][mods]" value="<?php echo getmodsbyid('31')?>"
                                placeholder="Eg: Flix Vision" type="text" />
                        </div>
                    </div>
                    <div class="form-group ctinput">
                        <label class="form-label"> Package name :</label>
                        <input type="hidden" name="data[32][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[32][preftype]" value="string">
                        <input type="hidden" name="data[32][prefname]" value="btn_extra_package">
                        <div class="form-group ctinput">
                            <input class="form-control" name="data[32][mods]" value="<?php echo getmodsbyid('32')?>"
                                placeholder="Eg: com.rtx.flix" type="text" />
                        </div>
                    </div>
                    <div class="form-group ctinput">
                        <label class="form-label"> Launcher activity :</label>
                        <input type="hidden" name="data[33][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[33][preftype]" value="string">
                        <input type="hidden" name="data[33][prefname]" value="btn_extra_activity">
                        <div class="form-group ctinput">
                            <input class="form-control" name="data[33][mods]" value="<?php echo getmodsbyid('33')?>"
                                placeholder="Eg: con.rtx.mods.splash" type="text" />
                        </div>
                    </div>
                    <div class="form-group ctinput">
                        <label class="form-label"> Downloader code :</label>
                        <input type="hidden" name="data[34][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[34][preftype]" value="string">
                        <input type="hidden" name="data[34][prefname]" value="btn_extra_code">
                        <div class="form-group ctinput">
                            <input class="form-control" name="data[34][mods]" value="<?php echo getmodsbyid('34')?>"
                                placeholder="Eg : 12345" type="text" />
                        </div>
                    </div>
                    <div class="form-group ctinput">
                        <label class="form-label"> Download Link :</label>
                        <input type="hidden" name="data[35][preffile]" value="RTXRebrand">
                        <input type="hidden" name="data[35][preftype]" value="string">
                        <input type="hidden" name="data[35][prefname]" value="btn_extra_link">
                        <div class="form-group ctinput">
                            <input class="form-control" name="data[35][mods]" value="<?php echo getmodsbyid('35')?>"
                                placeholder="Eg: https://example.com/download/flix.apk" type="text" />
                        </div>
                    </div>
                    <div class="form-group ctinputform-group">
                        <center>
                            <button class="btn btn-info" name="submit" type="submit">
                                <i class="icon icon-check"></i> Submit
                            </button>
                        </center>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php include ('includes/footer.php');?>