ok
Direktori : /proc/thread-self/root/proc/self/root/home2/selectio/www/thecomponents.in/admin/ |
Current File : //proc/thread-self/root/proc/self/root/home2/selectio/www/thecomponents.in/admin/new-offers.php |
<?php // start session session_start(); // set time for session timeout $currentTime = time() + 25200; $expired = 3600; // if session not set go to login page if (!isset($_SESSION['user'])) { header("location:index.php"); } // if current time is more than session timeout back to login page if ($currentTime > $_SESSION['timeout']) { session_destroy(); header("location:index.php"); } // destroy previous session timeout and create new one unset($_SESSION['timeout']); $_SESSION['timeout'] = $currentTime + $expired; include "header.php"; include_once('includes/functions.php'); $allowed = ALLOW_MODIFICATION; $sql_query_pro_type = "SELECT id, name FROM category ORDER BY id ASC"; $db->sql($sql_query_pro_type); $result_category_type = $db->getResult(); ?> <html> <head> <title> Offers | <?= $settings['app_name'] ?> - Dashboard</title> <script src="dist/js/jquery.min.js" crossorigin="anonymous"></script> </head> <body> <div class="content-wrapper"> <section class="content-header"> <h1> Offers for Customers</h1> <ol class="breadcrumb"> <li><a href="home.php"><i class="fa fa-home"></i> Home</a></li> </ol> <hr /> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <?php if ($permissions['new_offers']['create'] == 0) { ?> <div class="alert alert-danger">You have no permission to create offers</div> <?php } ?> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Add Offers here</h3> </div> <form id="offer_form" method="post" action="api-firebase/offer-images.php" enctype="multipart/form-data" > <div class="box-body"> <input type='hidden' name='accesskey' id='accesskey' value='90336' /> <input type='hidden' name='add-image' id='add-image' value='1' /> <input type='hidden' name='ajax_call' value='1' /> <div class="row"> <div class="col-lg-6"> <div class="form-group"> <label for="position">Main Title :</label> <!--<input type="text" class="form-control" name="position" id="position" required>--> <input type="text" class="form-control" name="main_title" id="main_title" required> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="position">Second Title :</label> <input type="text" class="form-control" name="second_title" id="second_title" required> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="type">Image type:</label> <select name="type" id="type" class="form-control" required> <option value="image">image</option> <!--<option value="video">video</option>--> </select> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="position">Category Type :</label> <select name="position" id="position" class="form-control" required> <option value="image">--- Select Category ---</option> <?php if ($permissions['categories']['read'] == 1) { ?> <?php foreach ($result_category_type as $row) { ?> <option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option> <?php } } ?> </select> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="image">Upload Image :</label> <!--/ Video (Video Ratio 16:9) --> <input type='file' name="image" id="image" required /> </div> </div> </div> <div class="form-group" id="section_positions" style="display:none;"> <label for="section_position">Section Position :</label> <select name="section_position" id="section_position" class="form-control"> <?php $sql = "SELECT * FROM `sections` order by id DESC"; $db->sql($sql); $section_res = $db->getResult(); ?> <option value="">Select Section</option> <?php foreach ($section_res as $value) { ?> <option value="<?= $value['id'] ?>"><?= $value['title'] ?></option> <?php } ?> </select> </div> </div> <div class="box-footer"> <input type="submit" id="submit_btn" class="btn-primary btn" value="Upload" /> </div> </form> <div id="result"></div> </div> </div> <div class="col-md-12"> <?php if ($permissions['new_offers']['read'] == 1) { ?> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Manage Offer Section</h3> </div> <table id="offers_table" class="table table-hover" data-toggle="table" data-url="api-firebase/get-bootstrap-table-data.php?table=offers" data-page-list="[5, 10, 20, 50, 100, 200]" data-show-refresh="true" data-show-columns="true" data-side-pagination="server" data-pagination="true" data-search="true" data-trim-on-search="false" data-sort-name="id" data-sort-order="desc"> <thead> <tr> <th data-field="id" data-sortable="true">ID</th> <th data-field="type">Type</th> <th data-field="image">Image</th> <th data-field="main_title">Main Title</th> <th data-field="second_title">Second Title</th> <th data-field="position">Position</th> <!--<th data-field="section_position">Section Position</th>--> <th data-field="status">Status</th> <th data-field="date_created" data-visible="false">Date Created</th> <th data-field="operate" data-events="actionEvents">Action</th> </tr> </thead> </table> </div> <?php } else { ?> <div class="alert alert-danger">You have no permission to view new offer.</div> <?php } ?> </div> </div> </section> </div> <script> function clearform() { document.getElementById("main_title").value=""; //don't forget to set the textbox id document.getElementById("second_title").value=""; } </script> <script> var allowed = '<?= $allowed; ?>'; $("#position").change(function() { type = $("#position").val(); if (type == 'below_section') { $("#section_positions").show(); } else { $("#section_positions").hide(); } }); $('#offer_form').on('submit', function(e) { e.preventDefault(); if (allowed == 0) { alert('Sorry! This operation is not allowed in demo panel!.'); window.location.reload(); return false; } var formData = new FormData(this); $.ajax({ type: 'POST', url: $(this).attr('action'), data: formData, dataType: 'json', beforeSend: function() { $('#submit_btn').val('Please wait..').attr('disabled', true); }, cache: false, contentType: false, processData: false, success: function(result) { $('#result').html(result.message); $('#result').show().delay(2000).fadeOut(); $('#submit_btn').val('Upload').attr('disabled', false); $('#image').val(''); $('#offers_table').bootstrapTable('refresh'); } }); }); </script> <script> $(document).on('click', '.delete-offer', function() { if (confirm('Are you sure?')) { id = $(this).data("id"); image = $(this).data("image"); $.ajax({ url: 'api-firebase/offer-images.php', type: "get", data: 'accesskey=90336&id=' + id + '&image=' + image + '&type=delete-offer&ajax_call=1', success: function(result) { if (result == 1) { $('#offers_table').bootstrapTable('refresh'); } if (result == 2) { alert('You have no permission to delete new offers'); } if (result == 0) { alert('Error! offer could not be deleted'); } } }); } }); </script> <script> window.actionEvents = { 'click .set-offers-deactive': function(e, value, rows, index) { var id = $(this).data("id"); $.ajax({ url: 'public/db-operation.php', type: "get", data: 'id=' + id + '&offer_status=1&type=deactive', success: function(result) { if (result == 1) $('#offers_table').bootstrapTable('refresh'); else alert('Error! Offers could not be activated.'); } }); }, 'click .set-offers-active': function(e, value, rows, index) { var id = $(this).data("id"); $.ajax({ url: 'public/db-operation.php', type: "get", data: 'id=' + id + '&offer_status=1&type=active', success: function(result) { if (result == 1) $('#offers_table').bootstrapTable('refresh'); else alert('Error! Offers could not be deactivated.'); } }); } }; </script> </body> </html> <?php include "footer.php"; ?>