diff --git a/co-workspaceDocuments/bid_1.jpg b/co-workspaceDocuments/bid_1.jpg new file mode 100644 index 0000000..9423c1d Binary files /dev/null and b/co-workspaceDocuments/bid_1.jpg differ diff --git a/co-workspaceDocuments/bid_2.jpg b/co-workspaceDocuments/bid_2.jpg new file mode 100644 index 0000000..6149810 Binary files /dev/null and b/co-workspaceDocuments/bid_2.jpg differ diff --git a/co-workspaceDocuments/bid_3.jpeg b/co-workspaceDocuments/bid_3.jpeg new file mode 100644 index 0000000..9b857e3 Binary files /dev/null and b/co-workspaceDocuments/bid_3.jpeg differ diff --git a/co-workspaceDocuments/coming_soon.jpeg b/co-workspaceDocuments/coming_soon.jpeg new file mode 100644 index 0000000..8351c02 Binary files /dev/null and b/co-workspaceDocuments/coming_soon.jpeg differ diff --git a/src/main/java/com/gcc/coworkspace/configuration/DataSourceConfig.java b/src/main/java/com/gcc/coworkspace/configuration/DataSourceConfig.java index 44eabd0..a9b025d 100644 --- a/src/main/java/com/gcc/coworkspace/configuration/DataSourceConfig.java +++ b/src/main/java/com/gcc/coworkspace/configuration/DataSourceConfig.java @@ -25,13 +25,12 @@ public class DataSourceConfig { // pass - Bonton#2K24 // DB:- coworkspace - // private static String host = "13.232.20.48"; - // private static String dbpassword = "Bonton#2K24"; + // private static String host = "13.232.20.48"; + // private static String dbpassword = "Bonton#2K24"; // AWS - // private static String host = - // "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; - // private static String dbpassword = "gcc-facial-password"; + // private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; + // private static String dbpassword = "gcc-facial-password"; private static String host = "localhost:3306"; private static String dbpassword = "root"; diff --git a/src/main/java/com/gcc/coworkspace/constants/AppConstants.java b/src/main/java/com/gcc/coworkspace/constants/AppConstants.java index 2cdf543..8a9d5fb 100644 --- a/src/main/java/com/gcc/coworkspace/constants/AppConstants.java +++ b/src/main/java/com/gcc/coworkspace/constants/AppConstants.java @@ -1,8 +1,8 @@ package com.gcc.coworkspace.constants; public final class AppConstants { - // public static String key_id="rzp_live_ySI5Ns54Y7qOcJ"; - // public static String key_secret="Nwf1TjhUtaskof8vePkRR8Sb"; + // public static String key_id="rzp_live_ySI5Ns54Y7qOcJ"; + // public static String key_secret="Nwf1TjhUtaskof8vePkRR8Sb"; // uncomment for testing payment public static String key_id = "rzp_test_tDkHFEqWXmuEi8"; diff --git a/src/main/java/com/gcc/coworkspace/controller/BookingController.java b/src/main/java/com/gcc/coworkspace/controller/BookingController.java index 12395ee..a638d08 100644 --- a/src/main/java/com/gcc/coworkspace/controller/BookingController.java +++ b/src/main/java/com/gcc/coworkspace/controller/BookingController.java @@ -143,6 +143,19 @@ public class BookingController { return bookingService.checkAvailabilityByBdate(bid, cid, bDate, scid, noOfPerson, slotId); } + @GetMapping("/checkAvailslots") +public Integer checkAvailability( + @RequestParam int bid, + @RequestParam int cid, + @RequestParam LocalDate bDate, + @RequestParam int scid, + @RequestParam int slotId) { + + System.out.println("Check availability API called"); + + return bookingService.getAvailableSeats(bid, cid, bDate, scid, slotId); +} + @GetMapping("/hasTodayAttendance") public ResponseEntity> hasTodayAttendance( @RequestParam("buildingid") int buildingid) { diff --git a/src/main/java/com/gcc/coworkspace/controller/BuildingController.java b/src/main/java/com/gcc/coworkspace/controller/BuildingController.java index b1474fd..d77ec6e 100644 --- a/src/main/java/com/gcc/coworkspace/controller/BuildingController.java +++ b/src/main/java/com/gcc/coworkspace/controller/BuildingController.java @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.gcc.coworkspace.service.BuildingService; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -61,10 +62,28 @@ public class BuildingController { // public List> getBuildingCategoryDetails(@RequestParam int categoryId) { // return buildingService.getBuildingCategoryDetailsById(categoryId); // } - +/* @GetMapping("/getSlotBySid") public List> showSlotBySubCatId(@RequestParam int scid) { + return calendarService.getCalendarBasedOnSubCatId(scid); // Replace with the actual view name + }*/ + @GetMapping("/getSlotBySid") +public List> showSlotBySubCatId( + @RequestParam(required = false) Integer scid) { + + if (scid == null) { + return Collections.emptyList(); } + + return calendarService.getCalendarBasedOnSubCatId(scid); +} + + + //ak dynamic + @GetMapping("/getSubCategoryByCid") +public List> getSubCategoryByCid(@RequestParam int cid) { + return buildingService.getSubCategoryByCid(cid); +} } diff --git a/src/main/java/com/gcc/coworkspace/controller/controller.java b/src/main/java/com/gcc/coworkspace/controller/controller.java index 625fcc4..d2c186d 100644 --- a/src/main/java/com/gcc/coworkspace/controller/controller.java +++ b/src/main/java/com/gcc/coworkspace/controller/controller.java @@ -291,10 +291,17 @@ public class controller { : (spaces.isEmpty() ? null : (Integer) spaces.get(0).get("cid")); // Pricing details + //ak dynamic + System.out.println("trete"); + + System.out.println(cid); List> readingZoneDetails = homeService.getPricingDetailsByCid(cid); List> deskSpaceDetails = homeService.getPricingDetailsByCid(cid); List> conferenceHallDetails = homeService.getPricingDetailsByCid(cid); - + System.out.println("Reading Zone Details: " + readingZoneDetails); + System.out.println("Desk Space Details: " + deskSpaceDetails); + System.out.println("Conference Hall Details: " + conferenceHallDetails); + // Images List> homeImg = (cid != null) ? homeService.getImgByCid(cid) @@ -325,6 +332,15 @@ public class controller { public List> getPricingDetails(@RequestParam int cid) { return homeService.getPricingDetailsByCid(cid); } +/* @GetMapping("/api/pricing") +@ResponseBody +public List> getPricingDetails( + @RequestParam int cid, + + @RequestParam int bid) { + + return homeService.getPricingDetailsByCidAndBid(cid, bid); +}*/ // @GetMapping("/book") // public String showCategoryPage(@RequestParam int buildingId,@RequestParam int diff --git a/src/main/java/com/gcc/coworkspace/service/AttendanceService.java b/src/main/java/com/gcc/coworkspace/service/AttendanceService.java index 3ff01be..fe8c81e 100644 --- a/src/main/java/com/gcc/coworkspace/service/AttendanceService.java +++ b/src/main/java/com/gcc/coworkspace/service/AttendanceService.java @@ -286,6 +286,10 @@ public class AttendanceService { sql.append("AND cat.name = ? "); params.add(type); } + if (bid != null && !bid.isEmpty()) { + sql.append(" AND c.bid = ? "); + params.add(bid); +} if (typeName != null && !typeName.isEmpty()) { sql.append("AND cat.display_name = ? "); diff --git a/src/main/java/com/gcc/coworkspace/service/BookingService.java b/src/main/java/com/gcc/coworkspace/service/BookingService.java index 9dc7494..6fe66e7 100644 --- a/src/main/java/com/gcc/coworkspace/service/BookingService.java +++ b/src/main/java/com/gcc/coworkspace/service/BookingService.java @@ -231,7 +231,7 @@ public class BookingService { System.out.println("count======================: " + count1); System.out.println("count: " + count); - if (cid == 2 && LocalDate.now().equals(Bdate)) // Allow only Disc Work Space and today date + if (cid == 2 || cid== 6 || cid ==16 && LocalDate.now().equals(Bdate)) // Allow only Disc Work Space and today date { int acount = getacountfromtable(bid); System.out.println("acount: " + acount); @@ -254,6 +254,40 @@ public class BookingService { return false; } + + //ak + public int getAvailableSeats(int bid, int cid, LocalDate bDate, int scid, int slotId) { + + System.out.println("bid: " + bid); + System.out.println("cid: " + cid); + System.out.println("bDate: " + bDate); + System.out.println("scid: " + scid); + System.out.println("slotId: " + slotId); + + Map calendar = getCalendarBySlotId(bid, cid, bDate, slotId); + Map capacity = getCapacity(scid, cid); + + int capacityint = Integer.parseInt(capacity.get("capacity").toString()); + + int bookedSeats = 0; + + if (!calendar.isEmpty()) { + bookedSeats = Integer.parseInt(calendar.get("filed").toString()); + } + + int availableSeats = capacityint - bookedSeats; + + if (availableSeats < 0) { + availableSeats = 0; + } + + System.out.println("Total capacity: " + capacityint); + System.out.println("Booked seats: " + bookedSeats); + System.out.println("Available seats: " + availableSeats); + + return availableSeats; +} + public Map getCapacity(int sId, int catId) { System.out.println("sid" + sId); System.out.println("catId" + catId); @@ -272,8 +306,78 @@ public class BookingService { public Map getCalendarBySlotId(int bid, int cid, LocalDate Bdate, int slotId) { String sql = ""; + if (cid == 2 || cid == 6 || cid == 16) { + + boolean isHalfDay = false; + String slotCondition = ""; + + if (cid == 2) { + // Deskspace group + if (slotId == 6 || slotId == 7) { + isHalfDay = true; + } + slotCondition = "slotId IN (?,8,9)"; + } + + else if (cid == 6) { + if (slotId == 59 || slotId == 60) { + isHalfDay = true; + } + slotCondition = "slotId IN (?,61,62)"; + } - if (cid == 2) { + else if (cid == 16) { + if (slotId == 108 || slotId == 109) { + isHalfDay = true; + } + slotCondition = "slotId IN (?,110,111)"; + } + + if (isHalfDay) { + + sql = "SELECT SUM(bcount) AS filed, bdate " + + "FROM calendar " + + "WHERE bdate = ? AND cid = ? AND bid = ? " + + "AND " + slotCondition + " " + + "GROUP BY bdate"; + + System.out.println("SELECT SUM(bcount) AS filed, bdate FROM calendar " + + "WHERE bdate = '" + Bdate + "' AND cid = " + cid + + " AND bid = " + bid + + " AND " + slotCondition + + " GROUP BY bdate"); + + } else { + + sql = "SELECT SUM(bcount) AS filed, bdate " + + "FROM calendar " + + "WHERE bdate = ? AND cid = ? AND bid = ? AND slotId = ? " + + "GROUP BY bdate"; + + System.out.println("SELECT SUM(bcount) AS filed, bdate FROM calendar " + + "WHERE bdate = '" + Bdate + "' AND cid = " + cid + + " AND bid = " + bid + + " AND slotId = " + slotId + + " GROUP BY bdate"); + } + + } else { + + sql = "SELECT SUM(bcount) AS filed, bdate " + + "FROM calendar " + + "WHERE bdate = ? AND cid = ? AND bid = ? AND slotId = ? " + + "GROUP BY bdate"; + + System.out.println("SELECT SUM(bcount) AS filed, bdate FROM calendar " + + "WHERE bdate = '" + Bdate + "' AND cid = " + cid + + " AND bid = " + bid + + " AND slotId = " + slotId + + " GROUP BY bdate"); + } + + + + /* if (cid == 2) { if (slotId == 6 || slotId == 7) { sql = "select sum(bcount) as filed, bdate " + "from calendar where bdate = ? and cid = ? and bid = ? and slotId IN (?,8,9) " @@ -302,7 +406,7 @@ public class BookingService { + "from calendar where bdate = '" + Bdate + "' and cid = '" + cid + "' and bid = '" + bid + "' and slotId = '" + slotId + "' " + "group by bdate"); - } + }*/ // Using query() instead of queryForMap to handle no results List> result = jdbcTemplate.query(sql, (rs, rowNum) -> { @@ -696,12 +800,14 @@ public class BookingService { * whatsAppService.sendTConfeNmsg(mobile, from_date, slottxt, amount,bookingId); * } */ - if (cid.equals("1") || cid.equals("4")) { + System.out.println("cid"+cid); + if (cid.equals("1") || cid.equals("4") || cid.equals("5") || cid.equals("7") || cid.equals("8") || cid.equals("9") || cid.equals("10") || cid.equals("11") || cid.equals("12") || cid.equals("13") || cid.equals("14") || cid.equals("15") || cid.equals("17")) { + whatsAppService.sendELearnNmsg(mobile, no_of_person, fromDateFormatted, slottxt, smsename, amount, bookingId); whatsAppService.sendTLearnNmsg(mobile, no_of_person, fromDateFormatted, slottxt, amount, bookingId); - } else if (cid.equals("2")) { - if (sid.equals("4")) { + } else if (cid.equals("2") || cid.equals("6") || cid.equals("16") ) { + if (sid.equals("4") || sid.equals("12") || sid.equals("24")) { whatsAppService.sendEMonthDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, toDateFormatted, slottxt, smsename, amount, bookingId); whatsAppService.sendTMonthDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, toDateFormatted, @@ -1162,9 +1268,9 @@ public class BookingService { String sql = "SELECT " + "b.bid, " + "COALESCE(SUM(b.amount), 0) AS overall_amount_collected, " + - "COALESCE(SUM(CASE WHEN b.sid IN (1,8) THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, " + "COALESCE(SUM(CASE WHEN b.sid IN (1,8,9,13,14,15,16,17,18,19,20,21,25) THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, " + - "COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, " + "COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4,10,11,12,22,23,24) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, " + "COALESCE(SUM(CASE WHEN b.sid IN (5, 6, 7) THEN b.amount ELSE 0 END), 0) AS meeting_room_amount_collected " + @@ -1264,16 +1370,16 @@ public class BookingService { * "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN 1 ELSE 0 END), 0) AS slotId_5_count, " * + */ - "COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (1,49) THEN 1 ELSE 0 END), 0) AS slotId_1_count, " + "COALESCE(SUM(CASE WHEN sid in (1,8,9,13,14,15,16,17,18,19,20,21,25) AND slotids in (1,49,54,63,68,73,78,83,88,93,98,103,112) THEN 1 ELSE 0 END), 0) AS slotId_1_count, " + - "COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (2,50) THEN 1 ELSE 0 END), 0) AS slotId_2_count, " + - "COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (3,51) THEN 1 ELSE 0 END), 0) AS slotId_3_count, " + - "COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (4,52) THEN 1 ELSE 0 END), 0) AS slotId_4_count, " + - "COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (5,53) THEN 1 ELSE 0 END), 0) AS slotId_5_count, " + + "COALESCE(SUM(CASE WHEN sid in (1,8,9,13,14,15,16,17,18,19,20,21,25) AND slotids in (2,50,55,64,69,74,79,84,89,94,99,104,113) THEN 1 ELSE 0 END), 0) AS slotId_2_count, " + + "COALESCE(SUM(CASE WHEN sid in (1,8,9,13,14,15,16,17,18,19,20,21,25) AND slotids in (3,51,56,65,70,75,80,85,90,95,100,105,114) THEN 1 ELSE 0 END), 0) AS slotId_3_count, " + + "COALESCE(SUM(CASE WHEN sid in (1,8,9,13,14,15,16,17,18,19,20,21,25) AND slotids in (4,52,57,66,71,76,81,86,91,96,101,106,115) THEN 1 ELSE 0 END), 0) AS slotId_4_count, " + + "COALESCE(SUM(CASE WHEN sid in (1,8,9,13,14,15,16,17,18,19,20,21,25) AND slotids in (5,53,58,67,72,77,82,87,92,97,102,107,116) THEN 1 ELSE 0 END), 0) AS slotId_5_count, " + - "COALESCE(SUM(CASE WHEN sid = 2 AND slotids IN (6,7) THEN 1 ELSE 0 END), 0) AS half_day_count, " + - "COALESCE(SUM(CASE WHEN sid = 3 AND slotids = 8 THEN 1 ELSE 0 END), 0) AS full_day_count, " + - "COALESCE(SUM(CASE WHEN sid = 4 AND slotids = 9 THEN 1 ELSE 0 END), 0) AS monthly_count, " + + "COALESCE(SUM(CASE WHEN sid in (2,10,22) AND slotids IN (6,7,59,60,108,109) THEN 1 ELSE 0 END), 0) AS half_day_count, " + + "COALESCE(SUM(CASE WHEN sid in (3,11,23) AND slotids IN (8,61,110) THEN 1 ELSE 0 END), 0) AS full_day_count, " + + "COALESCE(SUM(CASE WHEN sid in (4,12,24) AND slotids IN (9,62,111) THEN 1 ELSE 0 END), 0) AS monthly_count, " + "COALESCE(SUM(CASE WHEN sid = 5 AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN 1 ELSE 0 END), 0) AS RoomNo1_Count, " + @@ -1311,8 +1417,8 @@ public class BookingService { String sql = "SELECT " + "COUNT(booking_id) AS Total_booking_count, " + - "SUM(CASE WHEN cid in (1,4) THEN 1 ELSE 0 END) AS Learning_zone_count, " + - "SUM(CASE WHEN cid = 2 THEN 1 ELSE 0 END) AS Desk_space_count, " + + "SUM(CASE WHEN cid in (1,4,5,7,8,9,10,11,12,13,14,15,17) THEN 1 ELSE 0 END) AS Learning_zone_count, " + + "SUM(CASE WHEN cid in (2,6,16) THEN 1 ELSE 0 END) AS Desk_space_count, " + "SUM(CASE WHEN cid = 3 THEN 1 ELSE 0 END) AS Meeting_room_count " + "FROM booking " + "WHERE booking_status = 'success' " + diff --git a/src/main/java/com/gcc/coworkspace/service/BuildingService.java b/src/main/java/com/gcc/coworkspace/service/BuildingService.java index c915633..a99f957 100644 --- a/src/main/java/com/gcc/coworkspace/service/BuildingService.java +++ b/src/main/java/com/gcc/coworkspace/service/BuildingService.java @@ -167,4 +167,13 @@ public List> getBuildingDetails() { return jdbcTemplate.queryForList(sql,categoryId); } + + //ak dynamic + public List> getSubCategoryByCid(int categoryId) { + String sql = "SELECT * FROM subcategory where cid = ?"; + return jdbcTemplate.queryForList(sql,categoryId); + } + + + } diff --git a/src/main/java/com/gcc/coworkspace/service/HomeService.java b/src/main/java/com/gcc/coworkspace/service/HomeService.java index cdca7ef..db33b8b 100644 --- a/src/main/java/com/gcc/coworkspace/service/HomeService.java +++ b/src/main/java/com/gcc/coworkspace/service/HomeService.java @@ -141,6 +141,7 @@ public List> getActiveCoWorkingSpacesByBuilding(int bid) { public List> getPricingDetailsByCid(int cid) { + System.out.println("Fetching pricing details for CID: " + cid); // Debugging line to check the input parameter String sql = """ SELECT sc.scid, sc.name, sc.display_name, sc.cid, sc.orderby, sc.cdate, sc.isactive, sc.isdelete, sc.limits, sc.capacity, c.description @@ -150,6 +151,31 @@ public List> getActiveCoWorkingSpacesByBuilding(int bid) { """; return jdbcTemplate.queryForList(sql, cid); } + /* public List> getPricingDetailsByCidAndBid(int cid, int bid) { + + String sql = """ + SELECT sc.scid, + sc.name, + sc.display_name, + sc.cid, + sc.orderby, + sc.cdate, + sc.isactive, + sc.isdelete, + sc.limits, + sc.capacity, + c.description + FROM subcategory sc + JOIN category c ON sc.cid = c.cid + WHERE sc.cid = ? + AND c.bid = ? -- 🔥 CRITICAL FIX + AND sc.isactive = 1 + AND sc.isdelete = 0 + ORDER BY sc.orderby + """; + + return jdbcTemplate.queryForList(sql, cid, bid); +}*/ public List> getImgByCid(int cid) { String sql = """ diff --git a/src/main/resources/templates/fragments/caretaker-navmenu.html b/src/main/resources/templates/fragments/caretaker-navmenu.html index 969f9f6..e73e9af 100644 --- a/src/main/resources/templates/fragments/caretaker-navmenu.html +++ b/src/main/resources/templates/fragments/caretaker-navmenu.html @@ -35,14 +35,14 @@
  • - + Attendance
  • - + Attendance Report diff --git a/src/main/resources/templates/user/book-Conferance.html b/src/main/resources/templates/user/book-Conferance.html index e7c1937..5011bef 100644 --- a/src/main/resources/templates/user/book-Conferance.html +++ b/src/main/resources/templates/user/book-Conferance.html @@ -347,7 +347,9 @@
    +
    + + +
    @@ -547,6 +549,7 @@ + +