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.

601 lines
19 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <html xmlns:th="http://www.thymeleaf.org">
  4. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  5. <style>
  6. body {
  7. background-color: #f8f9fa;
  8. /* font-family: Arial, sans-serif;*/
  9. }
  10. .header {
  11. font-size: 22px;
  12. font-weight: bold;
  13. margin-bottom: 20px;
  14. }
  15. .table {
  16. border: 1px solid #dee2e6;
  17. }
  18. .table th,
  19. .table td {
  20. border: 1px solid #dee2e6;
  21. padding: 10px;
  22. }
  23. .section-title {
  24. font-size: 18px;
  25. font-weight: bold;
  26. margin-top: 20px;
  27. border-bottom: 2px solid #007bff;
  28. padding-bottom: 5px;
  29. }
  30. .form-group {
  31. margin-top: 15px;
  32. }
  33. .radio-group {
  34. display: flex;
  35. gap: 20px;
  36. margin-top: 10px;
  37. }
  38. </style>
  39. <body>
  40. <div class="wrapper">
  41. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  42. <div class="page-wrap">
  43. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  44. <div class="main-content">
  45. <div class="container">
  46. <div class="col-md-12">
  47. <div class="d-flex justify-content-between align-items-center">
  48. <h4 style="margin-left: -256px;">Room Wise Asset Mapping - IT Assits</h4>
  49. <button type="button" class="btn btn-primary"
  50. style="background-color: #0D587B; border: none; border-radius: 6px; padding: 6px 16px;"
  51. data-bs-toggle="modal" data-bs-target="#assetModal">
  52. + Add Assets
  53. </button>
  54. </div>
  55. <hr
  56. style="border: 1px solid #ccc; margin-top: 10px; margin-bottom: 20px; margin-left: -261px;">
  57. </div>
  58. <div class="row mt-4" style=" margin-left: -281px;">
  59. <div class="col-md-12">
  60. <div class="card">
  61. <div class="card-block">
  62. <h5 style="font-weight:bold;">List of IT Assets</h5>
  63. <h5 style="font-weight:bold;">
  64. <span th:text="${deptId}" id="deptId" style="display:none"></span>
  65. </h5>
  66. <span th:text="${userId}" id="userId" style="display:none"></span>
  67. <div id="completedCPSTable">
  68. <table id="CompletedCPSDatatable1"
  69. class="table table-striped table-bordered table-hover dataTable" role="grid"
  70. style="width:100%">
  71. <thead class="thead-dark">
  72. <tr>
  73. <th style="width: 5%;">S.NO</th>
  74. <th style="width: 10%;">ASSET CODE</th>
  75. <th style="width: 15%;">NAME</th>
  76. <th style="width: 10%;">SOURCE</th>
  77. <th style="width: 15%;">SERIAL NUMBER</th>
  78. <th style="width: 15%;">RECEIVED DATE</th>
  79. <th style="width: 10%;">RECEIVED BY</th>
  80. <th style="width: 10%;">VENDOR DETAILS</th>
  81. <th style="width: 10%;">INVOICE NUMBER</th>
  82. <th style="width: 10%;">LOCATION</th>
  83. </tr>
  84. </thead>
  85. <tbody>
  86. <tr>
  87. <td>1</td>
  88. <td>TH40V40I</td>
  89. <td>CAMERA</td>
  90. <td>GCC</td>
  91. <td>22023293837281</td>
  92. <td>JUN 23, 2025 12:40 PM</td>
  93. <td>RECEIVED BY</td>
  94. <td>N/A</td>
  95. <td>2345676543ER</td>
  96. <td>CHENNAI</td>
  97. </tr>
  98. <tr>
  99. <td>2</td>
  100. <td>TH40V40I</td>
  101. <td>CAMERA</td>
  102. <td>GCC</td>
  103. <td>22023293837281</td>
  104. <td>JUN 23, 2025 12:40 PM</td>
  105. <td>RECEIVED BY</td>
  106. <td>N/A</td>
  107. <td>2345676543ER</td>
  108. <td>CHENNAI</td>
  109. </tr>
  110. <tr>
  111. <td>3</td>
  112. <td>TH40V40I</td>
  113. <td>CAMERA</td>
  114. <td>GCC</td>
  115. <td>22023293837281</td>
  116. <td>JUN 23, 2025 12:40 PM</td>
  117. <td>RECEIVED BY</td>
  118. <td>N/A</td>
  119. <td>2345676543ER</td>
  120. <td>CHENNAI</td>
  121. </tr>
  122. </tbody>
  123. </table>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="row mt-4" style="margin-left: -281px;">
  130. <div class="col-md-12">
  131. <div class="card">
  132. <div class="card-block">
  133. <h5 style="font-weight:bold;">Building Wise Asset Mapping status - IT Assets</h5>
  134. <span th:text="${deptId}" id="deptId" style="display:none"></span>
  135. <span th:text="${userId}" id="userId" style="display:none"></span>
  136. <div id="completedCPSTable">
  137. <table id="CompletedCPSDatatable2"
  138. class="table table-striped table-bordered table-hover dataTable" role="grid"
  139. style="width:100%">
  140. <thead class="thead-dark">
  141. <tr>
  142. <th>S.NO</th>
  143. <th>BUILDING NAME</th>
  144. <th>FLOORS</th>
  145. <th>STATUS</th>
  146. <th>ACTION</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <tr>
  151. <td>1</td>
  152. <td>RIPON BUILDING</td>
  153. <td>3</td>
  154. <td>COMPLETED</td>
  155. <td><span class="badge badge-success" style="cursor:pointer;"
  156. onclick="openRoomMappingModal(1, 'RIPON BUILDING')">Add Room
  157. Mapping</span></td>
  158. </tr>
  159. <tr>
  160. <td>2</td>
  161. <td>GREEN BUILDING</td>
  162. <td>2</td>
  163. <td>PENDING</td>
  164. <td><span class="badge badge-success" style="cursor:pointer;"
  165. onclick="openRoomMappingModal(2, 'GREEN BUILDING')">Add Room
  166. Mapping</span></td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <!-- Card 2: Other Details -->
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <!-- Modal -->
  181. <div class="modal fade" id="roomMappingModal" tabindex="-1" role="dialog" aria-labelledby="roomMappingModalLabel"
  182. aria-hidden="true">
  183. <div class="modal-dialog modal-xl" role="document">
  184. <div class="modal-content">
  185. <div class="modal-header">
  186. <h5 class="modal-title" id="roomMappingModalLabel">Room Mapping for <span id="buildingName"></span>
  187. </h5>
  188. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  189. <span aria-hidden="true">&times;</span>
  190. </button>
  191. </div>
  192. <div class="modal-body">
  193. <table class="table table-striped">
  194. <thead>
  195. <tr>
  196. <th>S.NO</th>
  197. <th>Floor</th>
  198. <th>Room</th>
  199. <th>Status</th>
  200. <th>Action</th>
  201. </tr>
  202. </thead>
  203. <tbody id="roomMappingBody">
  204. <!-- Dynamic Data Will Be Inserted Here -->
  205. </tbody>
  206. </table>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. <!-- Add Room Mapping Modal -->
  212. <div class="modal fade" id="addRoomMappingModal" tabindex="-1" role="dialog"
  213. aria-labelledby="addRoomMappingModalLabel" aria-hidden="true">
  214. <div class="modal-dialog modal-lg" role="document">
  215. <div class="modal-content">
  216. <div class="modal-header">
  217. <h5 class="modal-title" id="addRoomMappingModalLabel">Add Room Mapping for <span
  218. id="roomFloor"></span> - <span id="roomName"></span></h5>
  219. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  220. <span aria-hidden="true">&times;</span>
  221. </button>
  222. </div>
  223. <div class="modal-body">
  224. <table class="table table-striped">
  225. <thead>
  226. <tr>
  227. <th>S.NO</th>
  228. <th>Room Type</th>
  229. <th>Room Name</th>
  230. <th>Status</th>
  231. <th>Action</th>
  232. </tr>
  233. </thead>
  234. <tbody id="addRoomMappingBody">
  235. <!-- Dynamic Data Will Be Inserted Here -->
  236. </tbody>
  237. </table>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. <!-- Asset Mapping Modal -->
  243. <div class="modal fade" id="assetMappingModal" tabindex="-1" role="dialog" aria-labelledby="assetMappingModalLabel" aria-hidden="true">
  244. <div class="modal-dialog modal-lg" role="document">
  245. <div class="modal-content">
  246. <div class="modal-header">
  247. <h5 class="modal-title">Asset Mapping for <span id="assetRoomName"></span></h5>
  248. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  249. <span aria-hidden="true">&times;</span>
  250. </button>
  251. </div>
  252. <div class="modal-body">
  253. <table class="table table-striped">
  254. <thead>
  255. <tr>
  256. <th>S.NO</th>
  257. <th>Room Type</th>
  258. <th>Assets</th>
  259. <th>Status</th>
  260. <th>Action</th>
  261. </tr>
  262. </thead>
  263. <tbody id="assetMappingBody"></tbody>
  264. </table>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. <!-- Modal -->
  270. <div class="modal fade" id="assetModal" tabindex="-1" role="dialog" aria-labelledby="assetModalLabel"
  271. aria-hidden="true">
  272. <div class="modal-dialog modal-lg" role="document">
  273. <div class="modal-content">
  274. <div class="modal-header">
  275. <h5 class="modal-title">Room Wise Asset Mapping - IT Assets</h5>
  276. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  277. <span aria-hidden="true">&times;</span>
  278. </button>
  279. </div>
  280. <div class="modal-body">
  281. <div class="row">
  282. <!-- Building Dropdown -->
  283. <div class="col-md-6">
  284. <div class="form-group">
  285. <label for="buildingDropdown">Select Building *</label>
  286. <select id="buildingDropdown" class="form-control">
  287. <option value="">-- Select Building --</option>
  288. <option value="building1">Building 1</option>
  289. <option value="building2">Building 2</option>
  290. </select>
  291. </div>
  292. </div>
  293. <!-- Floor Dropdown -->
  294. <div class="col-md-6">
  295. <div class="form-group">
  296. <label for="floorDropdown">Select Floor *</label>
  297. <select id="floorDropdown" class="form-control">
  298. <option value="">-- Select Floor --</option>
  299. <option value="floor1">1st Floor</option>
  300. <option value="floor2">2nd Floor</option>
  301. </select>
  302. </div>
  303. </div>
  304. <!-- Room Type Dropdown -->
  305. <div class="col-md-6">
  306. <div class="form-group">
  307. <label for="roomTypeDropdown">Select Room Type *</label>
  308. <select id="roomTypeDropdown" class="form-control">
  309. <option value="">-- Select Room Type --</option>
  310. <option value="classroom">Classroom</option>
  311. <option value="conference">Conference Room</option>
  312. </select>
  313. </div>
  314. </div>
  315. <!-- Room Dropdown -->
  316. <div class="col-md-6">
  317. <div class="form-group">
  318. <label for="roomDropdown">Select Room *</label>
  319. <select id="roomDropdown" class="form-control">
  320. <option value="">-- Select Room --</option>
  321. <option value="room1">Number 1</option>
  322. <option value="room2">Number 2</option>
  323. </select>
  324. </div>
  325. </div>
  326. <!-- Assets Dropdown -->
  327. <div class="col-md-12">
  328. <div class="form-group">
  329. <label for="assetDropdown">Select Assets *</label>
  330. <div class="form-control" id="assetDropdown">
  331. <div class="form-check">
  332. <input type="checkbox" class="asset-checkbox" value="Computer"> Computer
  333. </div>
  334. <div class="form-check">
  335. <input type="checkbox" class="asset-checkbox" value="Smart TV"> Smart TV
  336. </div>
  337. <div class="form-check">
  338. <input type="checkbox" class="asset-checkbox" value="Projector"> Projector
  339. </div>
  340. <div class="form-check">
  341. <input type="checkbox" class="asset-checkbox" value="Printer"> Printer
  342. </div>
  343. </div>
  344. </div>
  345. </div>
  346. <!-- Dynamic Asset Selection Section -->
  347. <div class="col-md-12" id="assetContainer"></div>
  348. </div>
  349. <div class="modal-footer">
  350. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  351. <button type="button" class="btn btn-primary">Save</button>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  358. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  359. </body>
  360. <script>
  361. $(document).ready(function () {
  362. $('#CompletedCPSDatatable1').DataTable({
  363. scrollX: true, // Enables horizontal scrolling
  364. autoWidth: false, // Ensures manual column widths are respected
  365. responsive: true, // Ensures better mobile view
  366. dom: 'Bftip',
  367. lengthMenu: [
  368. [10, 50, 100, 200, -1],
  369. ['10 rows', '50 rows', '100 rows', 'Show all']
  370. ],
  371. buttons: [
  372. {extend: 'pageLength', className: 'btn btn-warning'},
  373. {extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary'},
  374. {extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary'},
  375. {extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary'},
  376. {extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary'}
  377. ],
  378. fixedHeader: true,
  379. searching: true,
  380. select: false,
  381. processing: false
  382. });
  383. $('#CompletedCPSDatatable2').DataTable();
  384. });
  385. document.getElementById('buildingDropdown').addEventListener('change', function () {
  386. const floorDropdown = document.getElementById('floorDropdown').parentElement;
  387. const roomTypeDropdown = document.getElementById('roomTypeDropdown').parentElement;
  388. const roomDropdown = document.getElementById('roomDropdown').parentElement;
  389. const assetDropdown = document.getElementById('assetDropdown').parentElement;
  390. if (this.value) {
  391. floorDropdown.style.display = 'block';
  392. roomTypeDropdown.style.display = 'block';
  393. roomDropdown.style.display = 'block';
  394. } else {
  395. floorDropdown.style.display = 'none';
  396. roomTypeDropdown.style.display = 'none';
  397. roomDropdown.style.display = 'none';
  398. assetDropdown.style.display = 'none';
  399. }
  400. document.getElementById('floorDropdown').value = "";
  401. document.getElementById('roomTypeDropdown').value = "";
  402. document.getElementById('roomDropdown').value = "";
  403. });
  404. // Show assets only when all dropdowns are selected
  405. function checkAllSelections() {
  406. const building = document.getElementById('buildingDropdown').value;
  407. const floor = document.getElementById('floorDropdown').value;
  408. const roomType = document.getElementById('roomTypeDropdown').value;
  409. const room = document.getElementById('roomDropdown').value;
  410. const assetDropdown = document.getElementById('assetDropdown').parentElement;
  411. if (building && floor && roomType && room) {
  412. assetDropdown.style.display = 'block';
  413. } else {
  414. assetDropdown.style.display = 'none';
  415. document.getElementById('assetContainer').innerHTML = ''; // Clear asset selection
  416. }
  417. }
  418. document.getElementById('floorDropdown').addEventListener('change', checkAllSelections);
  419. document.getElementById('roomTypeDropdown').addEventListener('change', checkAllSelections);
  420. document.getElementById('roomDropdown').addEventListener('change', checkAllSelections);
  421. // Initially hide all dependent dropdowns and asset section
  422. window.addEventListener('DOMContentLoaded', function () {
  423. document.getElementById('floorDropdown').parentElement.style.display = 'none';
  424. document.getElementById('roomTypeDropdown').parentElement.style.display = 'none';
  425. document.getElementById('roomDropdown').parentElement.style.display = 'none';
  426. document.getElementById('assetDropdown').parentElement.style.display = 'none';
  427. });
  428. // Dynamic Asset Mapping with Quantity Input
  429. document.querySelectorAll('.asset-checkbox').forEach(checkbox => {
  430. checkbox.addEventListener('change', function () {
  431. const assetContainer = document.getElementById('assetContainer');
  432. const assetValue = this.value;
  433. if (this.checked) {
  434. const assetDiv = document.createElement('div');
  435. assetDiv.classList.add('asset-item');
  436. assetDiv.id = `asset-${assetValue}`;
  437. assetDiv.innerHTML = `
  438. <div class="row">
  439. <div class="col-md-6">
  440. <div class="form-group mt-2">
  441. <label>${assetValue} Quantity *</label>
  442. <input type="number" class="form-control" placeholder="Enter Quantity" required>
  443. </div>
  444. </div>
  445. </div>
  446. `;
  447. assetContainer.appendChild(assetDiv);
  448. } else {
  449. const existingDiv = document.getElementById(`asset-${assetValue}`);
  450. if (existingDiv) {
  451. assetContainer.removeChild(existingDiv);
  452. }
  453. }
  454. });
  455. });
  456. function openRoomMappingModal(buildingId, buildingName) {
  457. $('#buildingName').text(buildingName);
  458. const data = [
  459. {sno: 1, floor: 'G', room: 'CLASSROOMS,LIBRARY', status: 'COMPLETED'},
  460. {sno: 2, floor: 'G+1', room: '-', status: 'PENDING'},
  461. {sno: 3, floor: 'G+2', room: '-', status: 'PENDING'}
  462. ];
  463. $('#roomMappingBody').empty();
  464. data.forEach((item) => {
  465. $('#roomMappingBody').append(`
  466. <tr>
  467. <td>${item.sno}</td>
  468. <td>${item.floor}</td>
  469. <td>${item.room}</td>
  470. <td>${item.status}</td>
  471. <td>
  472. <button class="btn btn-success" onclick="openAddRoomMapping('${item.room}', '${item.floor}')">Add Room Mapping</button>
  473. </td>
  474. </tr>
  475. `);
  476. });
  477. $('#roomMappingModal').modal('show');
  478. }
  479. function openAddRoomMapping(roomName, floor) {
  480. $('#roomFloor').text(floor);
  481. $('#roomName').text(roomName);
  482. $('#addRoomMappingModal').modal('show');
  483. // Example Data (You can replace it with AJAX call)
  484. let roomData = [
  485. {sno: 1, roomType: 'Lab', roomName: 'Physics Lab', status: 'Pending'},
  486. {sno: 2, roomType: 'Classroom', roomName: 'Class 10-A', status: 'Completed'}
  487. ];
  488. let tbody = $('#addRoomMappingBody');
  489. tbody.empty();
  490. roomData.forEach((item) => {
  491. tbody.append(`
  492. <tr>
  493. <td>${item.sno}</td>
  494. <td>${item.roomType}</td>
  495. <td>${item.roomName}</td>
  496. <td>${item.status}</td>
  497. <td><button class="btn btn-success" onclick="openAssetMappingModal('${item.roomName}', '${item.roomType}')">Add Room Mapping</button></td>
  498. </tr>
  499. `);
  500. });
  501. }
  502. function openAssetMappingModal(roomName, roomType) {
  503. $('#assetRoomName').text(`${roomName} (${roomType})`);
  504. const assetData = [
  505. { sno: 1, roomType: roomType, assets: 'Projector', status: 'Completed' },
  506. { sno: 2, roomType: roomType, assets: 'Whiteboard', status: 'Pending' }
  507. ];
  508. $('#assetMappingBody').empty();
  509. assetData.forEach((item) => {
  510. $('#assetMappingBody').append(`
  511. <tr>
  512. <td>${item.sno}</td>
  513. <td>${item.roomType}</td>
  514. <td>${item.assets}</td>
  515. <td>${item.status}</td>
  516. <td>
  517. <button class="btn btn-success" onclick="openAssetModal('${roomName}', '${roomType}')">Add Room Mapping</button>
  518. </td>
  519. </tr>
  520. `);
  521. });
  522. $('#assetMappingModal').modal('show');
  523. }
  524. // Function to Open Asset Modal
  525. function openAssetModal(roomName, roomType) {
  526. // Optional: Pre-fill the room name and type in the modal
  527. $('#roomTypeDropdown').val(roomType.toLowerCase());
  528. $('#roomDropdown').val(roomName.toLowerCase());
  529. $('#assetModal').modal('show');
  530. }
  531. </script>
  532. </html>