chess/application/views/pages/manage_tournament.php

748 lines
33 KiB
PHP

<!doctype html>
<html lang="en" data-layout="vertical" data-topbar="light" data-sidebar="dark" data-sidebar-size="lg"
data-sidebar-image="none" data-preloader="disable">
<!-- Mirrored from themesbrand.com/velzon/html/default/ by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 23 Mar 2023 12:52:34 GMT -->
<head>
<?php include 'link/links.php'?>
</head>
<body>
<!-- Begin page -->
<div id="layout-wrapper">
<?php include 'common_file/header.php'?>
<!-- removeNotificationModal -->
<!-- ========== App Menu ========== -->
<?php include 'common_file/sidebar.php'?>
<!-- Left Sidebar End -->
<!-- Vertical Overlay-->
<div class="vertical-overlay"></div>
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<div class="main-content">
<div class="page-content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Tournament Management</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?php echo base_url('dashboard')?>">Home</a>
</li>
<li class="breadcrumb-item active">Tournament Management</li>
</ol>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<?php if ($this->session->flashdata('error')): ?>
<div class="alert alert-danger">
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-header align-items-center d-flex">
<h4 class="card-title mb-0 flex-grow-1">Tournament Management</h4>
<div class="flex-shrink-0">
<!-- <div class="form-check form-switch form-switch-right form-switch-md">
<label for="responsive-table-showcode" class="form-label text-muted">Show
Code</label>
<input class="form-check-input code-switcher" type="checkbox"
id="responsive-table-showcode">
</div> -->
<div class="d-flex align-items-center gap-2">
<button data-bs-toggle="modal" data-bs-target="#adddeals"
class="btn btn-primary btn-sm"><i
class="ri-add-fill align-bottom me-1"></i>
Add
Tournament</button>
<div class="search-box">
<input type="search" class="form-control search-input form-control-sm "
id=" searchMemberList" placeholder="Search here..."
data-table="table_list">
<i class="ri-search-line search-icon"></i>
</div>
</div>
<!-- <div id="example3_filter" class="dataTables_filter" style="float:right;">
<label>
<input id="abc" type="search" placeholder="Search"
class=" form-control search-input form-control-sm mt-2"
aria-controls="example3" data-table="table_list"></label>
</div> -->
</div>
</div><!-- end card header -->
<div class="card-body">
<!-- <p class="text-muted">Use <code>table-responsive</code> class to make any table
responsive across all viewports. Responsive tables allow tables to be scrolled
horizontally with ease.</p> -->
<div class="live-preview">
<div class="table-responsive">
<table
class="table align-middle table-bordered table-sortable table-nowrap mb-0 table_list">
<thead class="table-light">
<tr>
<th scope="col">Sr.No.</th>
<th scope="col">Tournament Name</th>
<th scope="col">Entry Fee</th>
<th scope="col">Start Date</th>
<th scope="col">Win Amount</th>
<th scope="col">Time Slot</th>
<th scope="col">Participants</th>
<th scope="col">Round</th>
<!-- <th scope="col">Participants</th> -->
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php if(count($data) > 0) {
$i = 1;
foreach($data as $data){
$tslott = "";
$tslot = $this->db->get_where('tbl_time_slot', array('id' => $data['time_slot']))->row_array();
if($tslot){
$tslott = $tslot['time_slot'];
}
// $cust_id = $row['cust_id'];
// $cus_dat = $this->db->get_where('tbl_cust', $where)->row_array();
?>
<tr>
<td><a href="#" class="fw-medium"><?php echo $data['tid'];?></a></td>
<td>
<?php echo $data['tname'];?>
</td>
<td>Rs. <?php echo $data['entry_fee']; ?></td>
<td><?php echo date($data['start_date_time']); ?></td>
<td>Rs. <?php echo $data['win_amount']; ?></td>
<td>
<?php echo $tslott; ?>
</td>
<td>
<a href="<?php echo base_url('tournament_participant')?>">
<div class="avatar-group "><a
href="<?php echo base_url('tournament_participant')?>"
class="avatar-group-item"
data-img="assets/images/users/avatar-1.jpg"
data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-title="Curtis Saenz"> <img
src="assets/images/users/avatar-1.jpg"
alt="" class="rounded-circle avatar-xxs">
</a><a href="javascript: void(0);"
class="avatar-group-item"
data-img="assets/images/users/avatar-3.jpg"
data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-title="John Robles"> <img
src="assets/images/users/avatar-3.jpg"
alt="" class="rounded-circle avatar-xxs">
</a></div>
</a>
</td>
<td> <button type="button" data-bs-toggle="modal"
data-bs-target="#round_<?php echo $i; ?>"
class="btn btn-primary btn-xs btn-icon waves-effect waves-light"><i
class="ri-eye-line"></i></button></td>
<td>
<div class="">
<!--<button type="button" data-bs-toggle="modal"
data-bs-target="#edittournament_<--?php echo $i; ?>"
class="btn btn-warning btn-xs btn-icon waves-effect waves-light"><i
class="ri-pencil-fill"></i>edit
</button>-->
<button type="button" data-bs-toggle="modal" data-bs-target="#edittournament_<?php echo $data['tid']; ?>"
class="btn btn-warning btn-xs btn-icon waves-effect waves-light">
<i class="ri-pencil-fill"></i>
</button>
<button type="button" id="sa-param"
onclick="delete_Data('<?php echo $data['tid'];?>')"
class="btn btn-danger btn-icon waves-effect waves-light"><i
class="ri-delete-bin-5-line"></i></button>
<!--<button type="button" class="btn btn-danger btn-icon waves-effect waves-light" onclick="deleteTournament(<--?php echo $data['tid']; ?>)">
<i class="ri-delete-bin-5-line"></i>Delete
</button>-->
<!-- <button type="button" id="custom-sa-warning"
class="btn btn-danger btn-icon waves-effect waves-light"><i
class="ri-delete-bin-5-line"></i>Delete
</button>-->
</div>
</td>
</tr>
<div class="modal fade " id="round_<?php echo $i; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-modal="true"
role="dialog">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light p-3">
<h5 class="modal-title" id="exampleModalLabel">Round</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form class="needs-validation" novalidate="" id="deals-form" onsubmit="return false">
<div class="modal-body">
<div class="row">
<?php
$tid = $data['tid'];
$round_data = $this->db->get_where('tournament_round', array('tid' => $tid))->result_array();
?>
<?php
if(!empty($round_data)){
foreach($round_data as $round_data) {
?>
<div class="col-md-6">
<div class="card">
<a class="card-body bg-soft-success" href="#leadDiscovered" role="button"
aria-expanded="false" aria-controls="leadDiscovered">
<h5 class="card-title text-uppercase fw-semibold mb-1 fs-15">
<?php echo $round_data['round']; ?>
</h5>
</a>
</div>
</div>
<?php
} }
?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" id="close-modal"
data-bs-dismiss="modal">Close</button>
<!-- <button type="submit" class="btn btn-success">
Update</button> -->
</div>
</form>
</div>
</div>
</div>
<!---
update tournament form
-->
<!-- application/views/update_tournament.php -->
<!-- Your previous HTML content -->
<!-- Edit Form Modal -->
<!--<div class="modal fade" id="edittournament_<--?php echo $i; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-modal="true" role="dialog">-->
<div class="modal fade" id="edittournament_<?php echo $data['tid']; ?>" tabindex="-1" aria-labelledby="exampleModalLabel"
aria-modal="true" role="dialog">
<!-- Your modal content goes here -->
<div class="modal-dialog modal-lg modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light p-3">
<h5 class="modal-title" id="exampleModalLabel">Update Tournament1</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!--<form method="post" action="<--?php echo base_url('tournaments/update/' . $tournament['tid']); ?>" enctype="multipart/form-data"> -->
<!--<form class="needs-validation" method="post" action="<--?php echo base_url('tournaments/update/' . $tournament['tid']); ?>">-->
<form class="needs-validation" method="post"
action="<?php echo base_url('tournaments/update/' . $data['tid']); ?>">
<div class="modal-body">
<!-- Your form fields go here -->
<div class="mb-3">
<label for="tournament" class="form-label">Tournament Name</label>
<input type="text" class="form-control" name="tname" value="<?php echo $data['tname']; ?>" required>
</div>
<div class="mb-3">
<label for="entry_fee" class="form-label">Entry Fee</label>
<input type="number" class="form-control" name="entry_fee" step="0.01" value="<?php echo $data['entry_fee']; ?>" required>
</div>
<div class="mb-3">
<label for="start_date_time" class="form-label">Start Date</label>
<input type="datetime" class="form-control" name="start_date_time" value="<?php echo $data['start_date_time']; ?>" required>
</div>
<!-- <div class="mb-3">
<label for="start_time" class="form-label">start_time</label>
<input type="time" class="form-control" name="start_time" value="<?php ?>" required>
</div> -->
<div class="mb-3">
<label for="win_amount" class="form-label">Win Amount</label>
<input type="number" class="form-control" name="win_amount" value="<?php echo $data['win_amount']; ?>" required>
</div>
<div class="mb-3">
<label for="time_slot" class="form-label">Time Slot</label>
<select class="form-select mb-3" name="time_slot" aria-label="Default select example">
<?php foreach ($time_slot as $slot): ?>
<?php
$selected = ($selectedTimeSlot == $slot['id']) ? 'selected' : '';
?>
<option value="<?php echo $slot['id']; ?>" <?php echo $selected; ?>>
<?php echo $slot['time_slot']; ?>
</option>
<?php endforeach; ?>
</select>
</div>
<!-- Additional form fields as needed -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Update Tournament</button>
</div>
</form>
</div>
</div>
</div>
<!-- update tournament update end-->
<!-- edit -->
<?php $i++; } }?>
</tbody>
</table>
<p id="table_list" class="text-warning">No matching records found
</p>
<div class="d-flex justify-content-end mt-4">
<?php echo $this->pagination->create_links(); ?>
</div>
<!-- end table -->
</div>
<!-- end table responsive -->
</div>
</div><!-- end card-body -->
</div><!-- end card -->
</div><!-- end col -->
</div>
</div>
<!-- container-fluid -->
</div>
<!-- End Page-content -->
<!--h2>Tournament Information</h2>
<p>Total Participants: <--?php echo $totalParticipants; ?></p>
<p>Number of Rounds: <--?php echo $numberOfRounds; ?></p>-->
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<script>
document.write(new Date().getFullYear())
</script> © Chess.
</div>
<div class="col-sm-6">
<div class="text-sm-end d-none d-sm-block">
Design & Develop by Appzia
</div>
</div>
</div>
</div>
</footer>
</div>
<!-- end main content-->
</div>
<!-- END layout-wrapper -->
<!--start back-to-top-->
<button onclick="topFunction()" class="btn btn-danger btn-icon" id="back-to-top">
<i class="ri-arrow-up-line"></i>
</button>
<!--end back-to-top-->
<!--preloader-->
<div id="preloader">
<div id="status">
<div class="spinner-border text-primary avatar-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
<div class="modal fade " id="adddeals" tabindex="-1" aria-labelledby="exampleModalLabel" aria-modal="true"
role="dialog">
<div class="modal-dialog modal-lg modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light p-3">
<h5 class="modal-title" id="exampleModalLabel">Create Tournament</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- <form class="needs-validation" novalidate="" id="deals-form" onsubmit="return false"> -->
<form class="needs-validation" method="post" action="<?php echo base_url(); ?>add_tournament">
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="dealTitle" class="form-label">Tournament Name</label>
<input type="text" class="form-control" name="tournament" placeholder=""
required="">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="dealValue" class="form-label">Entry Fee</label>
<input type="number" class="form-control" name="entry_fee" step="0.01"
placeholder="2000" required="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="date" class="form-label">Start Date</label>
<input type="date" class="form-control" name="start_date" required=""
placeholder="">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="time" class="form-label">start_time</label>
<input type="time" class="form-control" name="start_time" required=""
placeholder="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="amount" class="form-label">Win Amount</label>
<input type="number" class="form-control" name="win_Amount" required="" placeholder="">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="amount" class="form-label">Time Slot</label>
<select class="form-select mb-3" name="time_slot" aria-label="Default select example">
<option selected="">Select Time Slot </option>
<?php foreach($time_slot as $time_slot) {?>
<option value="<?php echo $time_slot['id'];?>"><?php echo $time_slot['time_slot'];?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="row">
<!-- <div class="mb-3 col-md-4 form-group">
<label class="form-label">Spa Photo</label>
<input type="file" class="form-control" placeholder="" required="">
</div>
<div class="mb-3 col-md-4 form-group">
<label class="form-label">Spa Type</label>
<input type="text" class="form-control" placeholder="Herbal Body Wrap" required="">
</div> -->
<div class="mb-3 col-md-6 form-group">
<label class="form-label">Round</label>
<div class="input-group">
<input type="text" class="form-control" name="round[]" placeholder=""
>
<button type="button" id="btnAdd1" class="btn btn-sm btn-primary"><i
class="ri-add-line"></i>Add More Round</button>
</div>
</div>
</div>
<div id="TextBoxContainer1" class="mb-1"></div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-light" id="close-modal"
data-bs-dismiss="modal">Close</button> -->
<button type="submit" class="btn btn-success"><i class="ri-add-fill align-bottom me-1"></i>
Add</button>
</div>
</form>
</div>
</div>
</div>
<?php include 'link/script.php'?>
<script>
$("#s_date").change(function() {
$("#e_date").prop("min", $(this).val());
$("#e_date").val(""); //clear end date input when start date changes
});
</script>
<script>
$(function() {
$("#btnAdd1").bind("click", function() {
var div = $("<div class=''/>");
div.html(GetDynamicTextBox(""));
$("#TextBoxContainer1").append(div);
});
$("body").on("click", "#DeleteRow", function() {
$(this).parents("#row").remove();
})
});
function GetDynamicTextBox(value) {
// console.log(i);
return ' <div id="row" class="row">' +
'<div class="mb-3 col-md-6 form-group">' +
'<label class="form-label">round</label>' +
'<div class="input-group">' +
'<input type="text" class="form-control" name="round[]" placeholder="" required="">' +
'<button type="button" value="Remove" id="DeleteRow" class="remove btn btn-danger btn-sm">' +
'<i class="ri-close-fill"></i></button></div></div>'
}
</script>
<script>
$(function() {
$("#btnAdd2").bind("click", function() {
var div = $("<div class=''/>");
div.html(GetDynamicTextBox2(""));
$("#TextBoxContainer2").append(div);
});
$("body").on("click", "#DeleteRow1", function() {
$(this).parents("#row").remove();
})
});
function GetDynamicTextBox2(value) {
// console.log(i);
return ' <div id="row" class="row">' +
'<div class="mb-3 col-md-6 form-group">' +
'<label class="form-label">round</label>' +
'<div class="input-group">' +
'<input type="text" class="form-control" placeholder="" required="">' +
'<button type="button" value="Remove" id="DeleteRow1" class="remove btn btn-danger btn-sm">' +
'<i class="ri-close-fill"></i></button></div></div>'
}
</script>
<!--<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script>
function deleteTournament(tournamentId) {
// You can use JavaScript confirmation or any other method to confirm deletion
var confirmDelete = confirm("Are you sure you want to delete this tournament?");
if (confirmDelete) {
// If user confirms deletion, send an AJAX request to delete the record
$.ajax({
type: "POST",
url: "<--?php echo base_url('tournaments/delete'); ?>/" + tournamentId,
data: { tournament_id: tournamentId },
success: function(response) {
// Optionally handle the response from the server
console.log(response);
// Reload the page or update the UI as needed
location.reload();
},
error: function(xhr, status, error) {
console.error(error);
}
});
}
}
</script>-->
<?php include 'link/script.php'?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
function delete_Data(idd) {
Swal.fire({
title: "Are you sure?",
text: "You won't be able to revert this!",
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel!",
confirmButtonClass: "btn btn-primary w-xs me-2 mt-2",
cancelButtonClass: "btn btn-danger w-xs mt-2",
buttonsStyling: !1,
showCloseButton: !0
}).then(function(t) {
t.value ? Swal.fire(
// ajax
$.ajax({
url: "<?php echo base_url('tournaments/delete'); ?>",
type: "POST",
cache: false,
data:{
tournament_id: idd
},
success: function(dataResult){
//alert(dataResult);
var dataResult = JSON.parse(dataResult);
if(dataResult.statusCode==200){
//$ele.fadeOut().remove();
swal.fire({
title: "Deleted!",
text: "Your file has been deleted.",
icon: "success",
confirmButtonClass: "btn btn-primary w-xs mt-2",
buttonsStyling: !1
});
setTimeout(function(){ location.reload();}, 2000);
}
else {
// swal.fire({
// title: "Cancelled",
// text: "Some Error is Occured :)",
// icon: "error",
// confirmButtonClass: "btn btn-primary mt-2",
// buttonsStyling: !1
// });
}//else
}// success
}),
// ajax
) : t.dismiss === Swal.DismissReason.cancel && Swal.fire({
title: "Cancelled",
text: "Your imaginary file is safe :)",
icon: "error",
confirmButtonClass: "btn btn-primary mt-2",
buttonsStyling: !1
})
})
}
</script>
</body>
</html>