You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
6.6 KiB
191 lines
6.6 KiB
<!DOCTYPE html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
|
|
<head th:replace="~{fragments/modules/base/head :: head}">
|
|
<style>
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="wrapper">
|
|
<!-- header top menu Start -->
|
|
<header th:replace="~{fragments/modules/base/header :: header}"></header>
|
|
<!-- header top menu end -->
|
|
<div class="page-wrap">
|
|
<!--=============== Left Menu side Start ================-->
|
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
|
|
<!--=============== Left side End ================-->
|
|
<div class="main-content">
|
|
<div class="container-fluid">
|
|
<div class="page-header mb-2">
|
|
<div class="row align-items-end">
|
|
<div class="col-lg-8">
|
|
<div class="page-header-title">
|
|
<!-- <i class="far fa-calendar-plus bg-blue"></i> -->
|
|
<div class="d-inline">
|
|
<h5>Hall Allocation</h5>
|
|
<span>Hall Allocation Process</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
<div class="card" style="margin-top: 15px;">
|
|
|
|
<div class="card-body">
|
|
|
|
<input type="hidden" id="loginUserId" th:value="${loginUserId}">
|
|
|
|
<div class="form-group">
|
|
<div class="row">
|
|
|
|
|
|
<!-- Department -->
|
|
|
|
<div class="col-sm-12 col-md-6">
|
|
<label class="form-label" for="traininglist">Select traininglist
|
|
<span class="text-danger">*</span>
|
|
</label>
|
|
<select class="form-control" id="traininglist" required>
|
|
<option value=""> Select traininglist </option>
|
|
|
|
</select>
|
|
</div>
|
|
<!-- Office Name -->
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group text-center">
|
|
<button type="submit" class="btn btn-primary " id="createdBtn">Submit</button>
|
|
<button type="reset" class="btn btn-secondary ml-2" id="resetBtn">Reset</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div id="pageLoader"
|
|
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
|
|
<div style="position: relative; top: 50%; transform: translateY(-50%);">
|
|
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
|
|
<span class="sr-only">Loading...</span>
|
|
</div>
|
|
<!-- Add the 'Please wait' text below the spinner -->
|
|
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
|
|
|
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script th:replace="~{fragments/modules/base/script :: script}"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
// ✅ Reset Button
|
|
document.getElementById('resetBtn').addEventListener('click', function (e) {
|
|
e.preventDefault();
|
|
location.reload();
|
|
});
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
// load training list
|
|
$.ajax({
|
|
url: "/election/api/checkAvailability",
|
|
method: "GET",
|
|
success: function (response) {
|
|
|
|
let traininglist = $("#traininglist");
|
|
traininglist.empty().append('<option value="">-- Select Training --</option>');
|
|
|
|
if (response.status !== "success" || !response.data || response.data.length === 0) {
|
|
return;
|
|
}
|
|
|
|
response.data.forEach(training => {
|
|
traininglist.append(`
|
|
<option
|
|
value="${training.id}"
|
|
data-allocation-url="${training.allocation_url || ''}">
|
|
${training.training_name}
|
|
</option>
|
|
`);
|
|
});
|
|
},
|
|
error: function () {
|
|
Swal.fire("Error", "Failed to load training list", "error");
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// ✅ Create Batch
|
|
$("#createdBtn").click(function (e) {
|
|
e.preventDefault();
|
|
|
|
const selectedOption = $("#traininglist option:selected");
|
|
const allocationUrl = selectedOption.data("allocation-url");
|
|
|
|
if (!allocationUrl) {
|
|
Swal.fire(
|
|
"Validation Error",
|
|
"Selected training does not have an allocation URL.",
|
|
"warning"
|
|
);
|
|
return;
|
|
}
|
|
|
|
// Show loader
|
|
$("#pageLoader").show();
|
|
|
|
// ✅ Call selected allocation URL
|
|
$.ajax({
|
|
url: allocationUrl,
|
|
type: "POST",
|
|
success: function (response) {
|
|
$("#pageLoader").hide();
|
|
Swal.fire("Success", "Hall Allocation Process completed successfully.", "success");
|
|
},
|
|
error: function (xhr) {
|
|
$("#pageLoader").hide();
|
|
Swal.fire("Error", "Failed to process hall allocation.", "error");
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|