Browse Source

implemented coworkspacce report with detailed and performance report

master
AJITHKUMAR12 3 months ago
parent
commit
3c2c2dfe20
  1. 18
      src/main/java/com/gcc/commissionerreview/controller/CoworkspaceApicontroller.java
  2. 5
      src/main/java/com/gcc/commissionerreview/controller/MainController.java
  3. 569
      src/main/java/com/gcc/commissionerreview/service/CoworkspaceService.java
  4. 407
      src/main/resources/templates/modules/communityreport.html
  5. 483
      src/main/resources/templates/modules/coworkspace.html

18
src/main/java/com/gcc/commissionerreview/controller/CoworkspaceApicontroller.java

@ -10,6 +10,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.commissionerreview.service.CommunityHallService;
@ -63,11 +64,22 @@ public class CoworkspaceApicontroller {
@GetMapping("/getReport")
public ResponseEntity<List<Map<String, Object>>> getReport(
@RequestParam(required = false) String fromDate,
@RequestParam(required = false) String toDate,
@RequestParam(required = false) String filterBy) {
@RequestParam(required = false) String toDate) {
return ResponseEntity.ok(
reportService.getReport(fromDate, toDate, filterBy));
reportService.getReport(fromDate, toDate));
}
@GetMapping("/performance")
@ResponseBody
public List<Map<String, Object>> getPerformance(
@RequestParam String fromDate,
@RequestParam String toDate) {
return reportService.getPerformance(fromDate, toDate);
}
}

5
src/main/java/com/gcc/commissionerreview/controller/MainController.java

@ -368,4 +368,9 @@ public class MainController {
return "modules/coworkspace";
}
@GetMapping("/communityhalloverview")
public String communityhalloverview(Model model) {
return "modules/communityreport";
}
}

569
src/main/java/com/gcc/commissionerreview/service/CoworkspaceService.java

@ -115,38 +115,44 @@ public class CoworkspaceService {
if (fromDate != null && !fromDate.isBlank()
&& toDate != null && !toDate.isBlank()) {
if ("slot_date".equals(filterBy)) {
sql.append("""
AND EXISTS (
SELECT 1
FROM calendar cl
WHERE cl.bookingid = bk.booking_id
AND DATE(cl.bdate) BETWEEN ? AND ?
)
""");
params.add(fromDate);
params.add(toDate);
} else if ("current_date".equals(filterBy)) {
sql.append("""
AND DATE(bk.cdate) BETWEEN ? AND ?
""");
params.add(fromDate);
params.add(toDate);
} else {
sql.append("""
AND bk.from_date BETWEEN ? AND ?
""");
/*
* if ("slot_date".equals(filterBy)) {
*
* sql.append("""
* AND EXISTS (
* SELECT 1
* FROM calendar cl
* WHERE cl.bookingid = bk.booking_id
* AND DATE(cl.bdate) BETWEEN ? AND ?
* )
* """);
*
* params.add(fromDate);
* params.add(toDate);
*
* } else if ("current_date".equals(filterBy)) {
*
* sql.append("""
* AND DATE(bk.cdate) BETWEEN ? AND ?
* """);
*
* params.add(fromDate);
* params.add(toDate);
*
* } else {
*
* sql.append("""
* AND bk.from_date BETWEEN ? AND ?
* """);
*
* params.add(fromDate);
* params.add(toDate);
* }
*/
sql.append(" AND DATE(bk.cdate) BETWEEN ? AND ? ");
params.add(fromDate);
params.add(toDate);
params.add(fromDate);
params.add(toDate);
}
}
sql.append("""
@ -308,6 +314,22 @@ public class CoworkspaceService {
sl.name
""");
List<Map<String, Object>> locationDetails = jdbcTemplate.queryForList("""
SELECT
c.cid,
c.display_name,
b.bid,
b.name AS building_name
FROM category c
INNER JOIN buildings b
ON c.bid = b.bid
WHERE b.isactive = 1
AND b.isdelete = 0
ORDER BY b.bid
""");
dashboard.put("locationDetails", locationDetails);
dashboard.put("totalBuildings", totalBuildings);
dashboard.put("totalBookings", totalBookings);
dashboard.put("totalRevenue", totalRevenue);
@ -321,7 +343,7 @@ public class CoworkspaceService {
}
// new requirement
public List<Map<String, Object>> getReport(String fromDate, String toDate, String filterBy) {
public List<Map<String, Object>> getReport(String fromDate, String toDate) {
StringBuilder sql = new StringBuilder();
@ -395,55 +417,56 @@ public class CoworkspaceService {
""");
sql.append(" WHERE 1=1 AND bk.booking_status = 'success' ");
List<Object> params = new ArrayList<>();
// List<Object> params = new ArrayList<>();
if (fromDate != null && !fromDate.isBlank()
&& toDate != null && !toDate.isBlank()) {
if ("slot_date".equals(filterBy)) {
sql.append("""
AND EXISTS (
SELECT 1
FROM calendar cl
WHERE cl.bookingid = bk.booking_id
AND DATE(cl.bdate) BETWEEN ? AND ?
)
""");
params.add(fromDate);
params.add(toDate);
} else if ("current_date".equals(filterBy)) {
sql.append("""
AND DATE(bk.cdate) BETWEEN ? AND ?
""");
params.add(fromDate);
params.add(toDate);
} else {
sql.append("""
AND bk.from_date BETWEEN ? AND ?
""");
params.add(fromDate);
params.add(toDate);
}
}
/*
* List<Object> params = new ArrayList<>();
* if (fromDate != null && !fromDate.isBlank()
* && toDate != null && !toDate.isBlank()) {
*
* sql.append(" AND bk.from_date BETWEEN ? AND ? ");
* if ("slot_date".equals(filterBy)) {
*
* sql.append("""
* AND EXISTS (
* SELECT 1
* FROM calendar cl
* WHERE cl.bookingid = bk.booking_id
* AND DATE(cl.bdate) BETWEEN ? AND ?
* )
* """);
*
* params.add(fromDate);
* params.add(toDate);
*
* } else if ("current_date".equals(filterBy)) {
*
* sql.append("""
* AND DATE(bk.cdate) BETWEEN ? AND ?
* """);
*
* params.add(fromDate);
* params.add(toDate);
*
* } else {
*
* sql.append("""
* AND bk.from_date BETWEEN ? AND ?
* """);
*
* params.add(fromDate);
* params.add(toDate);
* }
* }
*/
List<Object> params = new ArrayList<>();
if (fromDate != null && !fromDate.isBlank()
&& toDate != null && !toDate.isBlank()) {
sql.append(" AND DATE(bk.cdate) BETWEEN ? AND ? ");
params.add(fromDate);
params.add(toDate);
}
sql.append("""
GROUP BY
b.bid,
@ -458,4 +481,408 @@ public class CoworkspaceService {
return jdbcTemplate.queryForList(sql.toString(), params.toArray());
}
public List<Map<String, Object>> getPerformance(String fromDate, String toDate) {
StringBuilder sql = new StringBuilder();
sql.append(
"""
SELECT
b.bid, b.name AS building_name, b.inauguration_date,
CASE WHEN DATE(b.inauguration_date) > ? THEN 0 ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1 END AS coverage_days,
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
COALESCE(
(
SELECT 2 * sc.capacity
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Desk Space'
AND sl.slotid IN (8,9,110,111,62,61)
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
LIMIT 1
),0) AS desk_available_slots,
(
SELECT COALESCE(
SUM(
CASE
WHEN cl.slotid IN (8,9,110,111,62,61) THEN 2
ELSE 1
END
),
0
)
FROM calendar cl
INNER JOIN booking bk
ON bk.booking_id = cl.bookingid
INNER JOIN category c
ON c.cid = bk.cid
AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Desk Space'
AND DATE(cl.bdate) BETWEEN ? AND ?
AND cl.is_active = 1
AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS desk_booked_slots,
/* (
SELECT COALESCE(count(cl.bookingid),0)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Desk Space'
AND DATE(cl.bdate) BETWEEN ? AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS desk_booked_slots,*/
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COALESCE(SUM(t.total_capacity), 0)
FROM (
SELECT
COUNT(sl.slotid) * sc.capacity AS total_capacity
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Learning Centre'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
GROUP BY sc.scid, sc.capacity
) t
) AS learning_available_slots,
(
SELECT COALESCE(count(cl.bookingid), 0)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Learning Centre'
AND DATE(cl.bdate) BETWEEN GREATEST(DATE(b.inauguration_date), ?) AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS learning_booked_slots,
(
CASE
WHEN b.bid <> 1 THEN 0
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END * 12 )AS meeting_available_slots,
/* (
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COALESCE(SUM(t.total_capacity), 0)
FROM (
SELECT
COUNT(sl.slotid) * sc.capacity AS total_capacity
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Meeting Rooms'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
GROUP BY sc.scid, sc.capacity
) t
) AS meeting_available_slots,*/
(
SELECT COUNT(cl.calid)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Meeting Rooms'
AND DATE(cl.bdate) BETWEEN GREATEST(DATE(b.inauguration_date), ?) AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS meeting_booked_slots
FROM buildings b
WHERE b.isactive = 1 AND b.isdelete = 0
ORDER BY b.bid
""");
List<Object> params = new ArrayList<>();
// COVERAGE DAYS
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// DESK available (CASE for coverage)
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// Desk booked
params.add(fromDate);
params.add(toDate);
// Learning available (CASE)
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// Learning booked
params.add(fromDate);
params.add(toDate);
// Meeting available (CASE)
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// Meeting booked
params.add(fromDate);
params.add(toDate);
return jdbcTemplate.queryForList(sql.toString(), params.toArray());
}
public List<Map<String, Object>> getPerformance1(String fromDate, String toDate) {
StringBuilder sql = new StringBuilder();
sql.append(
"""
SELECT
b.bid,
b.name AS building_name,
b.inauguration_date,
CASE WHEN DATE(b.inauguration_date) > ? THEN 0 ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1 END AS coverage_days,
/* CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(
?,
GREATEST(DATE(b.inauguration_date), ?)
) + 1
END
*
(
SELECT COALESCE(
SUM(
CASE
WHEN sl.slotid IN (8,9,110,111,62,61) THEN 2
ELSE 1
END
),0)
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Desk Space'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
) AS desk_available_slots, */
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COALESCE(
SUM(
(
CASE
WHEN sl.slotid IN (8,9,110,111,62,61) THEN 2
ELSE 1
END
) * sc.capacity
),0)
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Desk Space'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
) AS desk_available_slots,
(
SELECT COALESCE(count(cl.bookingid),0)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Desk Space'
AND DATE(cl.bdate) BETWEEN ? AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS desk_booked_slots,
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COALESCE(
SUM(COUNT(sl.slotid) * sc.capacity),0
)
FROM category c
INNER JOIN subcategory sc ON sc.cid = c.cid
INNER JOIN slots sl ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Learning Centre'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
) AS learning_available_slots,
/* (
CASE WHEN DATE(b.inauguration_date) > ? THEN 0 ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1 END
) * 5 AS learning_available_slots,*/
(
SELECT COALESCE(count(cl.bookingid), 0)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Learning Centre'
AND DATE(cl.bdate) BETWEEN GREATEST(DATE(b.inauguration_date), ?) AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS learning_booked_slots,
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COALESCE(
SUM(sc.capacity),0
)
FROM category c
INNER JOIN subcategory sc ON sc.cid = c.cid
INNER JOIN slots sl ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Meeting Rooms'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
) AS meeting_available_slots,
(
CASE
WHEN DATE(b.inauguration_date) > ? THEN 0
ELSE DATEDIFF(?, GREATEST(DATE(b.inauguration_date), ?)) + 1
END
)
*
(
SELECT COUNT(sl.slotid)
FROM category c
INNER JOIN subcategory sc
ON sc.cid = c.cid
INNER JOIN slots sl
ON sl.scid = sc.scid
WHERE c.bid = b.bid
AND c.display_name = 'Meeting Rooms'
AND c.isactive = 1
AND c.isdelete = 0
AND sc.isactive = 1
AND sc.isdelete = 0
AND sl.isactive = 1
AND sl.isdelete = 0
) AS meeting_available_slots,*/
(
SELECT COUNT(cl.calid)
FROM calendar cl
INNER JOIN booking bk ON bk.booking_id = cl.bookingid
INNER JOIN category c ON c.cid = bk.cid AND c.bid = bk.bid
WHERE bk.bid = b.bid
AND c.display_name = 'Meeting Rooms'
AND DATE(cl.bdate) BETWEEN GREATEST(DATE(b.inauguration_date), ?) AND ?
AND cl.is_active = 1 AND cl.is_delete = 0
AND bk.booking_status = 'success'
) AS meeting_booked_slots
FROM buildings b
WHERE b.isactive = 1 AND b.isdelete = 0
ORDER BY b.bid
""");
List<Object> params = new ArrayList<>();
// COVERAGE DAYS
params.add(toDate); // WHEN DATE(b.inauguration_date) > ?
params.add(toDate); // DATEDIFF end
params.add(fromDate); // GREATEST()
// DESK SPACE AVAILABLE
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// Desk Space Booked
params.add(fromDate);
params.add(toDate);
// Learning Available
params.add(toDate); // WHEN inauguration_date > ?
params.add(toDate); // DATEDIFF(end_date, ...)
params.add(fromDate); // GREATEST(inauguration, fromDate)
// Learning Centre Booked
params.add(fromDate); // GREATEST(inauguration_date, fromDate)
params.add(toDate); // bdate <= toDate
// Meeting Available
params.add(toDate);
params.add(toDate);
params.add(fromDate);
// Meeting Rooms Booked
params.add(fromDate);
params.add(toDate);
return jdbcTemplate.queryForList(sql.toString(), params.toArray());
}
}

407
src/main/resources/templates/modules/communityreport.html

@ -0,0 +1,407 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Coworkspace Report</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- FontAwesome CSS for icons -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<!-- DataTables CSS -->
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/fixedcolumns/4.2.2/css/fixedColumns.dataTables.min.css" rel="stylesheet" />
<style>
body {
background-color: #f8f9fa;
}
.report-container {
overflow-x: auto;
}
/*#hallBookingTable {
width: 100% !important;
}*/
.page-header-title h4 {
margin: 20px 0;
text-align: center;
font-weight: bold;
color: #003366;
text-transform: uppercase;
}
.filter-section {
background: #fff;
padding: 15px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
margin-bottom: 20px;
}
.report-container {
background: #fff;
padding: 15px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
/* table.dataTable th,
table.dataTable td {
text-align: center;
vertical-align: middle;
border: 1px solid #dee2e6 !important;
white-space: nowrap;
}*/
.dashboard-card {
height: 180px;
}
.dashboard-card .card-body {
display: flex;
flex-direction: column;
justify-content: center;
}
.category-card .card-body {
display: block;
overflow-y: auto;
height: 120px;
}
thead th {
background-color: #003366 !important;
color: white !important;
}
/* Horizontal Scroll */
.dataTables_scrollBody {
overflow-x: auto !important;
overflow-y: auto !important;
}
/* Fixed Column Background */
table.dataTable tbody tr td.dtfc-fixed-left {
background-color: #fff !important;
}
table.dataTable.table-striped tbody tr:nth-of-type(odd) td.dtfc-fixed-left {
background-color: #f9f9f9 !important;
}
.dataTables_scrollBody {
overflow-x: auto !important;
overflow-y: auto !important;
}
.select2-container {
width: 100% !important;
}
.select2-results__options {
max-height: 400px !important;
/* increase height */
}
.select2-dropdown {
z-index: 9999 !important;
}
/*.dataTables_scrollHeadInner,
#hallBookingTable {
width: max-content !important;
}*/
/* table.dataTable th,
table.dataTable td {
white-space: nowrap;
}*/
/* table.dataTable th,
table.dataTable td {
text-align: center;
vertical-align: middle;
border: 1px solid #dee2e6 !important;
}
#hallBookingTable th:nth-child(8),
#hallBookingTable td:nth-child(8) {
white-space: nowrap !important;
min-width: 180px;
}
#hallBookingTable th:nth-child(5),
#hallBookingTable td:nth-child(5) {
min-width: 220px;
max-width: 220px;
white-space: normal !important;
word-wrap: break-word;
word-break: break-word;
}
#hallBookingTable th:nth-child(20),
#hallBookingTable td:nth-child(20) {
width: 80px !important;
max-width: 80px !important;
min-width: 80px !important;
white-space: normal !important;
word-break: break-word !important;
}*/
.hall-name-wrap {
min-width: 220px !important;
max-width: 220px !important;
white-space: normal !important;
word-break: break-word;
}
.dashboard-card {
border: none;
border-radius: 12px;
min-height: 110px;
}
/* Total Buildings */
.building-card {
background: #E3F2FD;
color: #1565C0;
}
/* Total Bookings */
.booking-card {
background: #E8F5E9;
color: #2E7D32;
}
/* Total Revenue */
.revenue-card {
background: #FFF8E1;
color: #EF6C00;
}
.dashboard-card h6 {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
}
.dashboard-card h3 {
font-size: 42px;
font-weight: 700;
margin: 0;
}
#bookingTable th:nth-child(8),
#bookingTable td:nth-child(8) {
width: 50px !important;
min-width: 50px !important;
max-width: 50px !important;
text-align: center;
}
#bookingTable th:nth-child(9),
#bookingTable td:nth-child(9) {
width: 50px !important;
min-width: 50px !important;
max-width: 50px !important;
text-align: center;
}
/* #hallBookingTable th:not(:nth-child(4)),
#hallBookingTable td:not(:nth-child(4)) {
white-space: nowrap;
}*/
/* Wrap selected columns */
.wrap {
white-space: normal !important;
word-break: break-word;
line-height: 1.2;
text-align: center;
vertical-align: middle;
min-width: 110px;
}
#performanceTable thead tr:first-child th {
text-align: center;
vertical-align: middle;
background: #003366;
color: #fff;
}
#performanceTable thead tr:nth-child(2) th {
text-align: center;
vertical-align: middle;
background: #0d6efd;
color: #fff;
}
#performanceTable td {
text-align: center;
}
#performanceTable td:nth-child(2) {
text-align: left;
}
/* Scrollbar */
.dataTables_scrollBody::-webkit-scrollbar {
height: 8px;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 4px;
}
.dataTables_scrollBody::-webkit-scrollbar-track {
background: #f1f1f1;
}
</style>
</head>
<body>
<div class="container-fluid py-4">
<div class="page-header-title">
<h4> community Hall report</h4>
</div>
<div class="row mb-4">
<!-- Card 1 -->
<div class="col-md-4">
<div class="card dashboard-card building-card shadow" style="cursor:pointer;"
onclick="window.open('https://gccservices.in/commissionerreview/communityhallcaretaker', '_blank');">
<div class="card-body text-center">
<h6>Community Hall CareTaker Performance Report</h6>
</div>
</div>
</div>
<!-- Card 2 -->
<div class="col-md-4">
<div class="card dashboard-card booking-card shadow" style="cursor:pointer;"
onclick="window.open('https://gccservices.in/commissionerreview/communityhallreport', '_blank');">
<div class="card-body text-center">
<h6>Community Hall Popularity Report</h6>
</div>
</div>
</div>
<!-- Card 3 -->
<div class="col-md-4">
<div class="card dashboard-card revenue-card shadow" style="cursor:pointer;"
onclick="window.open('https://gccservices.in/commissionerreview/communityhallrefund', '_blank');">
<div class="card-body text-center">
<h6>Community Hall Refund Review Report</h6>
</div>
</div>
</div>
</div>
<!--<div class="col-md-3">
<div class="card bg-primary text-white shadow dashboard-card">
<div class="card-body text-center">
<h6>Total Buildings</h6>
<h3 id="totalBuildings">0</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-success text-white shadow dashboard-card">
<div class="card-body text-center">
<h6>Total Bookings</h6>
<h3 id="totalBookings">0</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-warning text-dark shadow dashboard-card">
<div class="card-body text-center">
<h6>Total Revenue</h6>
<h3 id="totalRevenue">0</h3>
</div>
</div>
</div>-->
<!-- Media Modal -->
<div class="modal fade" id="mediaModal" tabindex="-1" aria-labelledby="mediaModalLabel" aria-hidden="true"
style="z-index: 1060;">
<div class="modal-dialog modal-lg modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="mediaModalLabel">Media Viewer</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body text-center" id="mediaModalBody">
</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"></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>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
<script src="https://cdn.datatables.net/fixedcolumns/4.2.2/js/dataTables.fixedColumns.min.js"></script>
<!-- SweetAlert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script th:inline="none">
</script>
</body>
</html>

483
src/main/resources/templates/modules/coworkspace.html

@ -236,6 +236,28 @@
min-width: 110px;
}
#performanceTable thead tr:first-child th {
text-align: center;
vertical-align: middle;
background: #003366;
color: #fff;
}
#performanceTable thead tr:nth-child(2) th {
text-align: center;
vertical-align: middle;
background: #0d6efd;
color: #fff;
}
#performanceTable td {
text-align: center;
}
#performanceTable td:nth-child(2) {
text-align: left;
}
@ -364,13 +386,21 @@
<label>To Date</label>
<input type="date" id="toDate" class="form-control">
</div>
<div class="col-md-3">
<!--<div class="col-md-3">
<label>Filter By</label>
<select class="form-control" id="filterBy" name="filterBy">
<option value="">Select</option>
<option value="slot_date">Slot Date</option>
<option value="current_date">Booking Date</option>
</select>
</div>-->
<div class="col-md-3">
<label>Report Type <span class="text-danger">*</span></label>
<select class="form-control" id="reportType" name="reportType">
<option value="">Select</option>
<option value="DETAIL">Detailed Report</option>
<option value="PERFORMANCE">Performance Report</option>
</select>
</div>
<div class="col-md-3 mt-4">
@ -398,33 +428,99 @@
</div>-->
<div id="detailReportDiv">
<div class="report-container">
<table id="reportTable" class="table table-bordered table-striped nowrap" width="100%">
<thead>
<tr>
<th>S.No</th>
<th>Muthalvarpadaippagam Name</th>
<th>Inauguration Date</th>
<th class="wrap">Operational Days</th>
<th>Total Booking</th>
<th>Total Reveneue</th>
<th>Total Slot Booked</th>
<th class="wrap">Desk Space Bookings</th>
<th class="wrap">Learning Center Bookings</th>
<th class="wrap">Meeting Room Bookings</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div id="performanceReportDiv" style="display:none;">
<div class="report-container">
<table id="performanceTable" class="table table-bordered table-striped nowrap" width="100%">
<thead>
<tr>
<div class="report-container">
<table id="reportTable" class="table table-bordered table-striped nowrap" width="100%">
<th rowspan="2">S.No</th>
<thead>
<th rowspan="2">
Muthalvarpadaippagam Name
</th>
<tr>
<th rowspan="2">
Inauguration Date
</th>
<th>S.No</th>
<th>Muthalvarpadaippagam Name</th>
<th>Inauguration Date</th>
<th class="wrap">Operational Days</th>
<th>Total Booking</th>
<th>Total Reveneue</th>
<th>Total Slot Booked</th>
<th class="wrap">Desk Space Bookings</th>
<th class="wrap">Learning Center Bookings</th>
<th class="wrap">Meeting Room Bookings</th>
<th rowspan="2">
Coverage Days
</th>
<th colspan="2">
Desk Space
</th>
</tr>
<th colspan="2">
Learning Centre
</th>
</thead>
<th colspan="2">
Meeting Rooms
</th>
<tbody></tbody>
</tr>
<tr>
<th>Available Slots</th>
<th>Booked Slots</th>
<th>Available Slots</th>
<th>Booked Slots</th>
<th>Available Slots</th>
<th>Booked Slots</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</table>
</div>
<div class="modal fade" id="categoryModal">
@ -516,6 +612,37 @@
</div>
</div>
<div class="modal fade" id="locationModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 id="locationTitle">Locations</h5>
<button class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<table class="table table-bordered" id="locationTable">
<thead>
<tr>
<th>S.No</th>
<th>Building Name</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Media Modal -->
<div class="modal fade" id="mediaModal" tabindex="-1" aria-labelledby="mediaModalLabel" aria-hidden="true"
@ -592,7 +719,10 @@
loadDashboard();
loadReport();
//loadReport();
loadDetailReport();
$("#detailReportDiv").show();
$("#performanceReportDiv").hide();
});
let slotData = [];
@ -625,21 +755,45 @@
});
$("#slotDetails").html(slotHtml);
/* let categoryHtml = "";
res.categories.forEach(function (item) {
categoryHtml += `
<div class="d-flex justify-content-between border-bottom py-2">
<span>${item.display_name}</span>
<span><b>${item.total}</b></span>
</div>
`;
});*/
/* $("#totalCategories").html(categoryHtml);*/
let categoryHtml = "";
res.categories.forEach(function (item) {
categoryHtml += `
<div class="d-flex justify-content-between border-bottom py-2">
<span>${item.display_name}</span>
<span><b>${item.total}</b></span>
<span>
<a href="javascript:void(0)"
onclick="viewLocation('${item.display_name}')">
<b>${item.total}</b>
</a>
</span>
</div>
`;
});
$("#totalCategories").html(categoryHtml);
// Save all location details
locationData = res.locationDetails;
slotData = res.slotDetails;
$("#slotCount").text(slotData.length);
@ -647,13 +801,50 @@
});
}
let locationData = [];
function viewLocation(categoryName) {
$("#locationTitle").text(categoryName + " Locations");
let tbody = "";
let list = locationData.filter(function (item) {
return item.display_name === categoryName;
});
list.forEach(function (item, index) {
tbody += `
<tr>
<td>${index + 1}</td>
<td>
${item.building_name}
</td>
</tr>
`;
});
$("#locationTable tbody").html(tbody);
$("#locationModal").modal("show");
}
let bookingTable;
function viewBookings(bid, cid) {
/* if ($.fn.DataTable.isDataTable('#bookingTable')) {
$('#bookingTable').DataTable().destroy();
}*/
if ($.fn.DataTable.isDataTable('#bookingTable')) {
$('#bookingTable').DataTable().destroy();
$('#bookingTable').DataTable().clear().destroy();
}
$('#bookingTable tbody').empty();
$('#pageLoader').show();
$('#bookingTable').DataTable({
@ -908,10 +1099,11 @@
}
function loadReport(isUserAction = false) {
// function loadReport(isUserAction = false) {
function loadDetailReport(isUserAction = false) {
let fromDate = $("#fromDate").val();
let toDate = $("#toDate").val();
let filterBy = $("#filterBy").val();
let filterBy = $("#reportType").val();
if (isUserAction) {
if (!fromDate && !toDate) {
@ -966,8 +1158,8 @@
toDate: $("#toDate").val(),
filterBy: $("#filterBy").val()*/
fromDate: fromDate,
toDate: toDate,
filterBy: filterBy
toDate: toDate
},
@ -1088,11 +1280,240 @@
});
}
/* $("#searchBtn").click(function () {
loadReport(true);
});*/
$("#searchBtn").click(function () {
loadReport(true);
let reportType = $("#reportType").val();
if (reportType == "") {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select Report Type."
});
return;
}
if (reportType == "DETAIL") {
$("#detailReportDiv").show();
$("#performanceReportDiv").hide();
loadDetailReport(true);
} else if (reportType == "PERFORMANCE") {
if ($("#fromDate").val() == "" || $("#toDate").val() == "") {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select From Date and To Date."
});
return;
}
$("#detailReportDiv").hide();
$("#performanceReportDiv").show();
loadPerformanceReport();
}
});
function loadPerformanceReport() {
let fromDate = $("#fromDate").val();
let toDate = $("#toDate").val();
let filterBy = $("#reportType").val();
if (!fromDate && !toDate) {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select From Date and To Date."
});
return;
}
if (fromDate && !toDate) {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select To Date."
});
return;
}
if (!fromDate && toDate) {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select From Date."
});
return;
}
if ((fromDate && toDate) && !filterBy) {
Swal.fire({
icon: "warning",
title: "Validation",
text: "Please select Filter By."
});
return;
}
$('#pageLoader').show();
$.ajax({
url: "/commissionerreview/api/coworkspace/performance",
type: "GET",
data: {
fromDate: $("#fromDate").val(),
toDate: $("#toDate").val()
},
success: function (response) {
$('#pageLoader').hide();
if ($.fn.DataTable.isDataTable("#performanceTable")) {
$("#performanceTable").DataTable().destroy();
}
$("#performanceTable").DataTable({
destroy: true,
paging: false,
searching: false,
ordering: false,
data: response,
columns: [
{
data: null,
render: function (data, type, row, meta) {
return meta.row + 1;
}
},
{
data: "building_name"
},
{
data: "inauguration_date",
render: function (data) {
return formatDate(data);
}
},
{
data: "coverage_days"
},
{
data: "desk_available_slots"
},
{
data: "desk_booked_slots"
},
{
data: "learning_available_slots"
},
{
data: "learning_booked_slots"
},
{
data: "meeting_available_slots"
},
{
data: "meeting_booked_slots"
}
],
dom: 'Bfrtip',
buttons: [
'excel',
'pdf'
]
});
},
error: function () {
$('#pageLoader').hide();
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Unable to load Performance Report.'
});
}
});
}
/*$('#bookingModal').on('hidden.bs.modal', function () {
window.location.reload();
});*/
@ -1100,9 +1521,11 @@
$("#fromDate").val("");
$("#toDate").val("");
$("#filterBy").val("");
$("#reportType").val("");
loadReport();
loadDetailReport();
$("#detailReportDiv").show();
$("#performanceReportDiv").hide();
});
</script>

Loading…
Cancel
Save