yogiwhere/public/schoolarea/settingsschool.php

156 lines
5.2 KiB
PHP

<?php include('include/headscript.php');
$idyogaschool = 1;
?>
<?php
$conn = new mysqli($servername, $username, $password, $database);
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
$query = $conn->prepare("SELECT * FROM yogaschool WHERE idyogaschool = ?");
$query->bind_param("i", $idyogaschool);
$query->execute();
$result = $query->get_result();
if ($result->num_rows == 0) {
die("Nessuna scuola trovata.");
}
$schoolData = $result->fetch_assoc();
// Variabili per i dati della scuola
$schoolnamedb = $schoolData['nameschool'];
$addressdb = $schoolData['address'];
// ...altre variabili
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<?php include('include/seo.php'); ?>
<link rel="shortcut icon" href="assets/images/favicon.ico">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
<style>
input[type="checkbox"] {
display: none;
}
.switch-label {
width: 50px;
height: 26px;
background-color: #ccc;
position: relative;
border-radius: 50px;
cursor: pointer;
}
.switch-label::before {
content: '';
position: absolute;
width: 22px;
height: 22px;
background-color: white;
border-radius: 50%;
top: 2px;
left: 2px;
transition: 0.3s;
}
input[type="checkbox"]:checked+.switch-label {
background-color: #4caf50;
}
input[type="checkbox"]:checked+.switch-label::before {
transform: translateX(24px);
}
</style>
</head>
<body class="fixed-left">
<div id="wrapper">
<?php include('include/navigationbar.php'); ?>
<div class="content-page">
<div class="content">
<?php include('include/topbar.php'); ?>
<div class="page-content-wrapper ">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="btn-group float-right">
<ol class="breadcrumb hide-phone p-0 m-0">
<li class="breadcrumb-item"><a href="#">YogiWhere</a></li>
<li class="breadcrumb-item active">Dashboard</li>
</ol>
</div>
<h4 class="page-title"><?php echo isset($myschool) ? $myschool : ''; ?></h4>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h5 class="font-18"><?php echo isset($settingtitle) ? $settingtitle : ''; ?></h5>
<p class="font-13 text-muted"><?php echo isset($settinginstruction) ? $settinginstruction : ''; ?></p>
<!-- Switch per la fee -->
<div class="form-group">
<label><?php echo isset($feeinclude) ? $feeinclude : ''; ?></label>
<div>
<input type="checkbox" id="feeSwitch" <?php echo $schoolData['addedfee'] == 'Y' ? 'checked' : ''; ?>>
<label for="feeSwitch" class="switch-label"></label><br>
<?php echo $feeinclude2; ?>
</div>
</div>
</div>
</div>
<hr>
</div>
</div>
</div>
<?php include('include/footer.php'); ?>
</div>
</div>
<script src="assets/js/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#feeSwitch').on('change', function() {
var addedFee = $(this).is(':checked') ? 'Y' : 'N';
var idYogaSchool = <?php echo $idyogaschool; ?>;
$.ajax({
url: 'update_fee_setting.php',
type: 'POST',
data: {
idyogaschool: idYogaSchool,
addedfee: addedFee
},
success: function(response) {
if (response.success) {
} else {
}
},
error: function() {
alert('AJAX error!');
}
});
});
});
</script>
</body>
</html>