<?php
require("header.php")
?>

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <!-- <h1>Add Notice for user!!</h1> -->
                </div>
                <div class="col-sm-6">

                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <!-- /.card -->

                    <div class="card card-secondary">
                        <div class="card-header">
                            <h3 class="card-title"> Telegram Group</h3>
                            <ol class="breadcrumb float-sm-right">
                                <li class="breadcrumb-item"><a href="#">Telegram</a></li>
                                <!-- <li class="breadcrumb-item">Notice Update</li> -->
                                <li class="breadcrumb-item active">Add Group</li>
                            </ol>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body">

                            <form action="add_telegram_channel.php" method="POST">
                                <!-- Edit form fields go here -->
                                <div class="row">

                                    <div class="col-12 col-md-6 col-lg-6">
                                        <!-- Adjust the column sizes as needed -->
                                        <div class="form-group">
                                            <label> Add Group</label>
                                            <input type="text" required class="form-control" placeholder="Enter Channel Name" value="<?php echo $row['tele_channel']; ?>" name="tele_channel">
                                            <input type="hidden" class="form-control" value="<?php echo $row['username']; ?>" placeholder="Enter Channel Name" name="username">
                                            <input type="hidden" class="form-control" value="<?php echo $row['number']; ?>" placeholder="Enter Channel Name" name="number">
                                        </div>
                                    </div>
                                    <div class="col-12 col-md-6 col-lg-6">
                                        <!-- Adjust the column sizes as needed -->
                                        <div class="form-group">
                                            <label>URL</label>
                                            <input type="text" required class="form-control" name="tele_url">
                                        </div>
                                    </div>
                                    <div class="col-12 col-md-2 col-lg-2" style="float: right;">
                                        <!-- Adjust the column size for the submit button -->
                                        <button type="submit" class="btn btn-danger btn-block btn-sm" name="add"><i class="fa fa-book"></i>
                                            Add</button>
                                    </div>
                                </div>
                            </form>

                            <section class="content mt-2">
                                <div class="container-fluid">
                                    <div class="row">
                                        <div class="col-12">
                                            <!-- /.card -->

                                            <div class="card card-secondary">
                                                <div class="card-header">
                                                    <h3 class="card-title"> View </h3>

                                                </div>
                                                <!-- /.card-header -->
                                                <div class="card-body">
                                                    <table id="example1" class="table table-bordered table-striped">
                                                        <thead>
                                                            <tr>
                                                                <th>Sr. No</th>

                                                                <th>Product name</th>
                                                                <th>Origin</th>
                                                                <th>Quntity</th>
                                                                <th>Credits</th>

                                                                <th style="width:20%;">Price Update</th>

                                                            </tr>
                                                        </thead>
                                                        <tbody>

                                                        </tbody>



                                                    </table>

                                                </div>
                                            </div>
                                            <!-- /.card-body -->
                                        </div>
                                        <!-- /.card -->
                                    </div>
                                    <!-- /.col -->
                                </div>
                                <!-- /.row -->

                                <!-- /.container-fluid -->
                            </section>

                        </div>
                    </div>
                    <!-- /.card-body -->

                </div>

                <!-- /.card -->
            </div>

            <!-- /.col -->
        </div>
        <!-- /.row -->

        <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
</div>

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Sweet Alert  start-->
<?php if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 1) { ?>
    <script>
        Swal.fire(
            'Good job!',
            'Track Added Successfully!!',
            'success'
        ).then(() => {
            window.location.href = "add_track.php";
        });
    </script>
<?php } ?>

<?php if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 2) { ?>
    <script>
        Swal.fire(
            'Oops...',
            'Something went wrong!!',
            'error'
        ).then(() => {
            window.location.href = "add_track.php";
        });
    </script>
<?php } ?>
<?php
require("footer.php")
?>