7 changed files with 3543 additions and 6 deletions
-
20src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
108src/main/java/com/gcc/commissionerreview/controller/CommunityHallController.java
-
19src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
726src/main/java/com/gcc/commissionerreview/service/CommunityHallService.java
-
742src/main/resources/templates/modules/community.html
-
928src/main/resources/templates/modules/communitycaretaker.html
-
1006src/main/resources/templates/modules/communityrefund.html
@ -0,0 +1,108 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
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.RestController; |
|||
|
|||
import com.gcc.commissionerreview.service.CommunityHallService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/communityhall") |
|||
public class CommunityHallController { |
|||
|
|||
@Autowired |
|||
private CommunityHallService communityHallService; |
|||
|
|||
// ak |
|||
@GetMapping("/zones") |
|||
public List<Map<String, Object>> getZones() { |
|||
return communityHallService.getZones(); |
|||
} |
|||
|
|||
@GetMapping("/halls") |
|||
public List<Map<String, Object>> getHalls() { |
|||
|
|||
return communityHallService.getHalls(); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/booking-report") |
|||
public List<Map<String, Object>> getReport( |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate, |
|||
@RequestParam(required = false) String zone, |
|||
@RequestParam(required = false) String hallId, |
|||
@RequestParam(required = false) String region, |
|||
@RequestParam(required = false) String status) { |
|||
|
|||
return communityHallService.getBookingReport( |
|||
fromDate, toDate, zone, hallId, region, status); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/refund-review-report") |
|||
public List<Map<String, Object>> getRefundReviewReport( |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate, |
|||
@RequestParam(required = false) String zone, |
|||
@RequestParam(required = false) String hallId, |
|||
@RequestParam(required = false) String region, |
|||
@RequestParam(required = false) String status) { |
|||
|
|||
return communityHallService.getRefundReviewReport( |
|||
fromDate, |
|||
toDate, |
|||
zone, |
|||
hallId, |
|||
region, |
|||
status); |
|||
} |
|||
|
|||
@GetMapping("/refund-pending-details") |
|||
public List<Map<String, Object>> getRefundPendingDetails( |
|||
|
|||
@RequestParam String type, |
|||
@RequestParam(required = false) String hallId, |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate, |
|||
@RequestParam(required = false) String zone, |
|||
@RequestParam(required = false) String region, |
|||
@RequestParam(required = false) String status) { |
|||
|
|||
return communityHallService.getRefundPendingDetails( |
|||
type, |
|||
hallId, |
|||
fromDate, |
|||
toDate, |
|||
zone, |
|||
region, |
|||
status); |
|||
} |
|||
|
|||
@GetMapping("/caretaker-report") |
|||
public List<Map<String, Object>> getCaretakerReport( |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate, |
|||
@RequestParam(required = false) String zone, |
|||
@RequestParam(required = false) String hallId, |
|||
@RequestParam(required = false) String region, |
|||
@RequestParam(required = false) String status) { |
|||
|
|||
return communityHallService.getCaretakerReport( |
|||
fromDate, |
|||
toDate, |
|||
zone, |
|||
hallId, |
|||
region, |
|||
status); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,726 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
public class CommunityHallService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
public void setFeedbackDataSource(@Qualifier("mysqlCommunityHallDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getBookingReport( |
|||
String fromDate, |
|||
String toDate, |
|||
String zone, |
|||
String hallId, |
|||
String region, |
|||
String status) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append(""" |
|||
SELECT |
|||
hd.zone, |
|||
hd.division, |
|||
hd.hall_id, |
|||
hd.hall_name, |
|||
|
|||
DATE_FORMAT( |
|||
hd.c_date, |
|||
'%d-%m-%Y' |
|||
) AS hall_created_date, |
|||
|
|||
CASE |
|||
WHEN hd.is_active=1 |
|||
THEN 'Active Hall' |
|||
ELSE 'Deactivated Hall' |
|||
END AS hall_status, |
|||
|
|||
hd.hall_incharge_name caretaker_name, |
|||
|
|||
hd.hall_incharge_no caretaker_no, |
|||
|
|||
DATEDIFF( |
|||
CURRENT_DATE, |
|||
DATE(hd.c_date) |
|||
) booking_available_days, |
|||
|
|||
COUNT(bd.booking_id) |
|||
total_no_of_bookings, |
|||
|
|||
SUM( |
|||
CASE |
|||
WHEN bd.no_of_days=0.5 |
|||
THEN 1 |
|||
ELSE 0 |
|||
END |
|||
) half_day_booking_count, |
|||
|
|||
SUM( |
|||
CASE |
|||
WHEN bd.no_of_days=1 |
|||
THEN 1 |
|||
ELSE 0 |
|||
END |
|||
) full_day_booking_count, |
|||
|
|||
SUM( |
|||
CASE |
|||
WHEN bd.no_of_days=1.5 |
|||
THEN 1 |
|||
ELSE 0 |
|||
END |
|||
) one_point_five_days_booking_count, |
|||
|
|||
SUM( |
|||
CASE |
|||
WHEN bd.no_of_days=2 |
|||
THEN 1 |
|||
ELSE 0 |
|||
END |
|||
) two_days_booking_count |
|||
|
|||
FROM hall_details hd |
|||
|
|||
LEFT JOIN booking_details bd |
|||
ON hd.hall_id=bd.hall_details_hall_id |
|||
AND bd.booking_status NOT IN |
|||
('PENDING', |
|||
'REFUNDED', |
|||
'GCC_BLOCKED', |
|||
'GCC_UNBLOCKED') |
|||
|
|||
WHERE 1=1 |
|||
"""); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromDate != null && !fromDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.booking_date)>=? |
|||
"""); |
|||
|
|||
params.add(fromDate); |
|||
} |
|||
|
|||
if (toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.booking_date)<=? |
|||
"""); |
|||
|
|||
params.add(toDate); |
|||
} |
|||
|
|||
if (zone != null && !zone.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) = ? |
|||
"""); |
|||
|
|||
params.add(zone); |
|||
} |
|||
|
|||
if (hallId != null && !hallId.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND hd.hall_id=? |
|||
"""); |
|||
|
|||
params.add(hallId); |
|||
} |
|||
if (status != null && !status.isBlank()) { |
|||
|
|||
if ("Active Hall".equals(status)) { |
|||
sql.append(""" |
|||
AND hd.is_active = 1 |
|||
"""); |
|||
} |
|||
|
|||
if ("Deactivated Hall".equals(status)) { |
|||
sql.append(""" |
|||
AND hd.is_active = 0 |
|||
"""); |
|||
} |
|||
} |
|||
|
|||
if (region != null && !region.isBlank()) { |
|||
|
|||
if (region.equals("North")) { |
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 1 AND 5 |
|||
"""); |
|||
} |
|||
|
|||
if (region.equals("Center")) { |
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 6 AND 10 |
|||
"""); |
|||
} |
|||
|
|||
if (region.equals("South")) { |
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 11 AND 15 |
|||
"""); |
|||
} |
|||
} |
|||
|
|||
sql.append(""" |
|||
GROUP BY |
|||
hd.zone, |
|||
hd.division, |
|||
hd.hall_id |
|||
|
|||
ORDER BY |
|||
CAST(hd.zone AS UNSIGNED), |
|||
CAST(hd.division AS UNSIGNED), |
|||
hd.hall_id |
|||
"""); |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
} |
|||
|
|||
public List<Map<String, Object>> getHalls() { |
|||
|
|||
String sql = """ |
|||
SELECT hall_id, |
|||
hall_name, |
|||
date_format(c_date,'%d-%m-%Y') as hall_created_date |
|||
FROM hall_details |
|||
ORDER BY hall_id |
|||
"""; |
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
|
|||
} |
|||
|
|||
public List<Map<String, Object>> getZones() { |
|||
|
|||
String sql = """ |
|||
SELECT id, |
|||
zone_name |
|||
FROM gcc_street_vendor.zone_master |
|||
ORDER BY id |
|||
"""; |
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getRefundReviewReport( |
|||
String fromDate, |
|||
String toDate, |
|||
String zone, |
|||
String hallId, |
|||
String region, |
|||
String status) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append( |
|||
""" |
|||
select hd.zone, hd.division, hd.hall_id, hd.hall_name, date_format(hd.c_date, '%d-%m-%Y') as hall_Created_date, |
|||
case when hd.is_active = 1 then 'Active Hall' else 'Deactivated Hall' end as Hall_Status, |
|||
hd.hall_incharge_name as caretaker_name, hd.hall_incharge_no as caretake_no, |
|||
count(bd.booking_id) as total_no_of_bookings, |
|||
sum( case when bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS cancelled_bookings, |
|||
sum( case when bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_bookings, |
|||
sum( case when date(bd.end_date)<CURRENT_DATE and bd.booking_status not in ('CANCELED','REJECTED') then 1 else 0 end) as event_completed_count, |
|||
sum(case when bd.refund_status != 'COMPLETED' and bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) cancelled_settlement_pending, |
|||
sum(case when bd.refund_status != 'COMPLETED' and bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) rejected_settlement_pending, |
|||
SUM(CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE then 1 else 0 end) as refund_pending_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status = 'CANCELED' then 1 else 0 end) as cancelled_completed_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status = 'REJECTED' then 1 else 0 end) as rejected_completed_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE then 1 else 0 end) as refund_completed_count, |
|||
|
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 0 AND 5 THEN 1 ELSE 0 END ) AS settlement_Pending_0_3_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 6 AND 15 THEN 1 ELSE 0 END ) AS settlement_Pending_6_15_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 16 AND 30 THEN 1 ELSE 0 END ) AS settlement_Pending_16_30_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) >30 THEN 1 ELSE 0 END ) AS settlement_Pending_more_than_30_days |
|||
|
|||
from hall_details hd |
|||
left join booking_details bd on hd.hall_id = bd.hall_details_hall_id and bd.booking_status NOT IN ('PENDING', 'REFUNDED', 'GCC_BLOCKED','GCC_UNBLOCKED') and bd.booking_status IS NOT NULL |
|||
WHERE 1=1 |
|||
"""); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromDate != null && !fromDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) >= ? |
|||
"""); |
|||
|
|||
params.add(fromDate); |
|||
} |
|||
|
|||
if (toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) <= ? |
|||
"""); |
|||
|
|||
params.add(toDate); |
|||
} |
|||
|
|||
if (zone != null && !zone.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) = ? |
|||
"""); |
|||
|
|||
params.add(zone); |
|||
} |
|||
|
|||
if (hallId != null && !hallId.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND hd.hall_id = ? |
|||
"""); |
|||
|
|||
params.add(hallId); |
|||
} |
|||
|
|||
if (status != null && !status.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND ( |
|||
CASE |
|||
WHEN hd.is_active = 1 |
|||
THEN 'Active Hall' |
|||
ELSE 'Deactivated Hall' |
|||
END |
|||
) = ? |
|||
"""); |
|||
|
|||
params.add(status); |
|||
} |
|||
|
|||
if (region != null && !region.isBlank()) { |
|||
|
|||
if ("North".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 1 AND 5 |
|||
"""); |
|||
} |
|||
|
|||
if ("Center".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 6 AND 10 |
|||
"""); |
|||
} |
|||
|
|||
if ("South".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 11 AND 15 |
|||
"""); |
|||
} |
|||
} |
|||
|
|||
sql.append(""" |
|||
GROUP BY |
|||
hd.zone, |
|||
hd.division, |
|||
hd.hall_id |
|||
|
|||
ORDER BY |
|||
CAST(hd.zone AS UNSIGNED), |
|||
CAST(hd.division AS UNSIGNED), |
|||
hd.hall_id |
|||
"""); |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getCaretakerReport( |
|||
String fromDate, |
|||
String toDate, |
|||
String zone, |
|||
String hallId, |
|||
String region, |
|||
String status) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append( |
|||
""" |
|||
select hd.zone, hd.division, hd.hall_id, hd.hall_name, date_format(hd.c_date, '%d-%m-%Y') as hall_Created_date, |
|||
case when hd.is_active = 1 then 'Active Hall' else 'Deactivated Hall' end as Hall_Status, |
|||
hd.hall_incharge_name as caretaker_name, hd.hall_incharge_no as caretake_no, |
|||
count(bd.booking_id) as total_no_of_bookings, |
|||
sum( case when bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS cancelled_bookings, |
|||
sum( case when bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_bookings, |
|||
sum( case when date(bd.end_date)<CURRENT_DATE and bd.booking_status not in ('CANCELED','REJECTED') then 1 else 0 end) as event_completed_count, |
|||
sum(case when bd.refund_status != 'COMPLETED' and bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) cancelled_settlement_pending, |
|||
sum(case when bd.refund_status != 'COMPLETED' and bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) rejected_settlement_pending, |
|||
SUM(CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE then 1 else 0 end) as refund_pending_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status = 'CANCELED' then 1 else 0 end) as cancelled_completed_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status = 'REJECTED' then 1 else 0 end) as rejected_completed_count, |
|||
SUM(CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE then 1 else 0 end) as refund_completed_count, |
|||
|
|||
SUM( CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 0 AND 5 THEN 1 ELSE 0 END ) AS settlement_Completed_0_5_days, |
|||
SUM( CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 6 AND 15 THEN 1 ELSE 0 END ) AS settlement_Completed_6_15_days, |
|||
SUM( CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 16 AND 30 THEN 1 ELSE 0 END ) AS settlement_Completed_16_30_days, |
|||
SUM( CASE WHEN bd.refund_status = 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) >30 THEN 1 ELSE 0 END ) AS settlement_Completed_more_than_30_days, |
|||
|
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 0 AND 5 THEN 1 ELSE 0 END ) AS settlement_Pending_0_5_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 6 AND 15 THEN 1 ELSE 0 END ) AS settlement_Pending_6_15_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) BETWEEN 16 AND 30 THEN 1 ELSE 0 END ) AS settlement_Pending_16_30_days, |
|||
SUM( CASE WHEN bd.refund_status != 'COMPLETED' and bd.booking_status not in ('CANCELED','REJECTED') and date(bd.end_date)< CURRENT_DATE AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) >30 THEN 1 ELSE 0 END ) AS settlement_Pending_more_than_30_days |
|||
|
|||
from hall_details hd |
|||
left join booking_details bd on hd.hall_id = bd.hall_details_hall_id and bd.booking_status NOT IN ('PENDING', 'REFUNDED', 'GCC_BLOCKED','GCC_UNBLOCKED') and bd.booking_status IS NOT NULL |
|||
WHERE 1=1 |
|||
"""); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromDate != null && !fromDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) >= ? |
|||
"""); |
|||
|
|||
params.add(fromDate); |
|||
} |
|||
|
|||
if (toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) <= ? |
|||
"""); |
|||
|
|||
params.add(toDate); |
|||
} |
|||
|
|||
if (zone != null && !zone.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) = ? |
|||
"""); |
|||
|
|||
params.add(zone); |
|||
} |
|||
|
|||
if (hallId != null && !hallId.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND hd.hall_id = ? |
|||
"""); |
|||
|
|||
params.add(hallId); |
|||
} |
|||
|
|||
if (status != null && !status.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND ( |
|||
CASE |
|||
WHEN hd.is_active = 1 |
|||
THEN 'Active Hall' |
|||
ELSE 'Deactivated Hall' |
|||
END |
|||
) = ? |
|||
"""); |
|||
|
|||
params.add(status); |
|||
} |
|||
|
|||
if (region != null && !region.isBlank()) { |
|||
|
|||
if ("North".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 1 AND 5 |
|||
"""); |
|||
} |
|||
|
|||
if ("Center".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 6 AND 10 |
|||
"""); |
|||
} |
|||
|
|||
if ("South".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 11 AND 15 |
|||
"""); |
|||
} |
|||
} |
|||
|
|||
sql.append(""" |
|||
GROUP BY |
|||
hd.zone, |
|||
hd.division, |
|||
hd.hall_id |
|||
|
|||
ORDER BY |
|||
CAST(hd.zone AS UNSIGNED), |
|||
CAST(hd.division AS UNSIGNED), |
|||
hd.hall_id |
|||
"""); |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getRefundPendingDetails( |
|||
String type, |
|||
String hallId, |
|||
String fromDate, |
|||
String toDate, |
|||
String zone, |
|||
String region, |
|||
String status) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append( |
|||
""" |
|||
SELECT |
|||
bd.booking_id, |
|||
us.name AS user_name, |
|||
us.mobile_no, |
|||
hd.hall_incharge_name, |
|||
hd.hall_incharge_no, |
|||
DATE_FORMAT(bd.end_date,'%d-%m-%Y') AS event_date, |
|||
|
|||
CASE |
|||
WHEN ed.updated_date IS NULL THEN 'EB Not entered' |
|||
ELSE DATEDIFF(current_date, bd.end_date) |
|||
END AS care_taker_pending_days, |
|||
|
|||
DATE_FORMAT(ed.updated_date,'%d-%m-%Y %r') AS caretaker_updated_date, |
|||
|
|||
CASE |
|||
WHEN ed.updated_date IS NULL THEN 'Action not taken' |
|||
ELSE DATEDIFF(st.approved_flag_date, ed.updated_date) |
|||
END AS ARO_pending_days, |
|||
|
|||
DATE_FORMAT(st.approved_flag_date,'%d-%m-%Y %r') AS ARO_action_taken_date |
|||
|
|||
FROM hall_details hd |
|||
LEFT JOIN booking_details bd |
|||
ON hd.hall_id = bd.hall_details_hall_id |
|||
AND bd.booking_status NOT IN ('PENDING','REFUNDED','GCC_BLOCKED','GCC_UNBLOCKED') |
|||
AND bd.booking_status IS NOT NULL |
|||
|
|||
LEFT JOIN users us |
|||
ON bd.users_user_id = us.user_id |
|||
|
|||
LEFT JOIN eb_details ed |
|||
ON bd.booking_id = ed.booking_details_booking_id |
|||
|
|||
LEFT JOIN settlement st |
|||
ON bd.booking_id = st.booking_details_booking_id |
|||
|
|||
WHERE 1=1 |
|||
"""); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
// -------------------------------------------------- |
|||
// TYPE CONDITIONS |
|||
// -------------------------------------------------- |
|||
|
|||
if ("PENDING_0_5".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status NOT IN ('CANCELED','REJECTED') |
|||
AND DATE(bd.end_date) < CURRENT_DATE |
|||
AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) |
|||
BETWEEN 0 AND 5 |
|||
"""); |
|||
|
|||
} else if ("PENDING_6_15".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status NOT IN ('CANCELED','REJECTED') |
|||
AND DATE(bd.end_date) < CURRENT_DATE |
|||
AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) |
|||
BETWEEN 6 AND 15 |
|||
"""); |
|||
|
|||
} else if ("PENDING_16_30".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status NOT IN ('CANCELED','REJECTED') |
|||
AND DATE(bd.end_date) < CURRENT_DATE |
|||
AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) |
|||
BETWEEN 16 AND 30 |
|||
"""); |
|||
|
|||
} else if ("PENDING_GT_30".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status NOT IN ('CANCELED','REJECTED') |
|||
AND DATE(bd.end_date) < CURRENT_DATE |
|||
AND DATEDIFF(CURRENT_DATE, DATE(bd.end_date)) |
|||
> 30 |
|||
"""); |
|||
|
|||
} else if ("CANCELLED_PENDING".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status = 'CANCELED' |
|||
"""); |
|||
|
|||
} else if ("REJECTED_PENDING".equals(type)) { |
|||
|
|||
sql.append(""" |
|||
AND bd.refund_status != 'COMPLETED' |
|||
AND bd.booking_status = 'REJECTED' |
|||
"""); |
|||
} |
|||
|
|||
// -------------------------------------------------- |
|||
// DATE FILTERS |
|||
// -------------------------------------------------- |
|||
|
|||
if (fromDate != null && !fromDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) >= ? |
|||
"""); |
|||
|
|||
params.add(fromDate); |
|||
} |
|||
|
|||
if (toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND DATE(bd.end_date) <= ? |
|||
"""); |
|||
|
|||
params.add(toDate); |
|||
} |
|||
|
|||
// -------------------------------------------------- |
|||
// ZONE FILTER |
|||
// -------------------------------------------------- |
|||
|
|||
if (zone != null && !zone.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) = ? |
|||
"""); |
|||
|
|||
params.add(zone); |
|||
} |
|||
|
|||
// -------------------------------------------------- |
|||
// HALL FILTER |
|||
// -------------------------------------------------- |
|||
|
|||
if (hallId != null && !hallId.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND hd.hall_id = ? |
|||
"""); |
|||
|
|||
params.add(hallId); |
|||
} |
|||
|
|||
// -------------------------------------------------- |
|||
// STATUS FILTER |
|||
// -------------------------------------------------- |
|||
|
|||
if (status != null && !status.isBlank()) { |
|||
|
|||
sql.append(""" |
|||
AND ( |
|||
CASE |
|||
WHEN hd.is_active = 1 |
|||
THEN 'Active Hall' |
|||
ELSE 'Deactivated Hall' |
|||
END |
|||
) = ? |
|||
"""); |
|||
|
|||
params.add(status); |
|||
} |
|||
|
|||
// -------------------------------------------------- |
|||
// REGION FILTER |
|||
// -------------------------------------------------- |
|||
|
|||
if (region != null && !region.isBlank()) { |
|||
|
|||
if ("North".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 1 AND 5 |
|||
"""); |
|||
} |
|||
|
|||
else if ("Center".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 6 AND 10 |
|||
"""); |
|||
} |
|||
|
|||
else if ("South".equals(region)) { |
|||
|
|||
sql.append(""" |
|||
AND CAST(hd.zone AS UNSIGNED) |
|||
BETWEEN 11 AND 15 |
|||
"""); |
|||
} |
|||
} |
|||
|
|||
sql.append(""" |
|||
ORDER BY |
|||
CAST(hd.zone AS UNSIGNED), |
|||
CAST(hd.division AS UNSIGNED), |
|||
hd.hall_id, |
|||
bd.booking_id |
|||
"""); |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
} |
|||
} |
|||
@ -0,0 +1,742 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head> |
|||
<title>Community Hall Booking 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; |
|||
} |
|||
|
|||
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:not(:nth-child(4)), |
|||
#hallBookingTable td:not(:nth-child(4)) { |
|||
white-space: nowrap; |
|||
} |
|||
|
|||
/* 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 Popularity Report</h4> |
|||
</div> |
|||
|
|||
<!-- Filter Section --> |
|||
<div class="filter-section row"> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>From Date</label> |
|||
<input type="date" id="fromDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>To Date</label> |
|||
<input type="date" id="toDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Region</label> |
|||
<select id="region" class="form-control"> |
|||
<option value="">All</option> |
|||
<option value="North">North Region</option> |
|||
<option value="Center">Center Region</option> |
|||
<option value="South">South Region</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Zone</label> |
|||
<select id="zone" class="form-control"> |
|||
<option value="">All</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Hall</label> |
|||
<select id="hallId" class="form-control"> |
|||
<option value="">All</option> |
|||
</select> |
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label>Status</label> |
|||
<select id="status" class="form-control"> |
|||
<option value="">All</option> |
|||
<option value="Active Hall">Active Hall</option> |
|||
<option value="Deactivated Hall">Deactivated Hall</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-12 d-flex justify-content-center gap-2 mt-3"> |
|||
<button id="searchBtn" class="btn btn-primary"> |
|||
Search |
|||
</button> |
|||
|
|||
<button id="resetBtn" class="btn btn-primary"> |
|||
Reset |
|||
</button> |
|||
</div> |
|||
|
|||
<!--<div class="col-md-2 mt-4"> |
|||
<button class="btn btn-primary" id="searchBtn"> |
|||
Search |
|||
</button> |
|||
<button class="btn btn-primary" id="resetBtn"> |
|||
Reset |
|||
</button> |
|||
|
|||
</div>--> |
|||
|
|||
</div> |
|||
|
|||
<div class="report-container"> |
|||
<table id="hallBookingTable" class="table table-bordered table-striped nowrap" width="100%"> |
|||
|
|||
<thead> |
|||
|
|||
<tr> |
|||
<th>S.No</th> |
|||
<th>Zone</th> |
|||
<th>Division</th> |
|||
<th>Hall Id</th> |
|||
<th class="text-wrap">Hall Name</th> |
|||
<th class="text-center">Created Date</th> |
|||
<th class="text-center">Status</th> |
|||
<th class="text-center">Caretaker Name</th> |
|||
<th class="text-center">Caretaker No</th> |
|||
|
|||
<th>Booking Available Days</th> |
|||
<th>Total Bookings</th> |
|||
<th>Half Day</th> |
|||
<th>Full Day</th> |
|||
<th>1.5 Days</th> |
|||
<th>2 Days</th> |
|||
|
|||
</tr> |
|||
|
|||
</thead> |
|||
|
|||
<tbody></tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
<!-- Details Modal --> |
|||
<div class="modal fade" id="detailModal" tabindex="-1" aria-labelledby="detailModalLabel" aria-hidden="true" |
|||
data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl modal-dialog-centered"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailModalLabel">Compliance Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<table id="modalDataTable" class="table table-bordered table-striped"> |
|||
<thead class="table-dark"> |
|||
<tr> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Audit Date</th> |
|||
<th class="text-center">Shift</th> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Ward</th> |
|||
<th class="text-center">Address</th> |
|||
<th class="text-center">Audit Category</th> |
|||
<th class="text-center">Question</th> |
|||
<th class="text-center">Answer</th> |
|||
<th class="text-center">Kitchen SI Name</th> |
|||
<th class="text-center">Raised By</th> |
|||
<th class="text-center">PMC Remarks</th> |
|||
<th class="text-center">PMC Image/Video Viewer</th> |
|||
<th class="text-center">FS Status</th> |
|||
<th class="text-center">FS Challenged By</th> |
|||
<th class="text-center">FS Remarks</th> |
|||
<th class="text-center">FS Image/Video Viewer</th> |
|||
<th class="text-center">CE Status</th> |
|||
<th class="text-center">CE Remarks</th> |
|||
<th class="text-center">CE Updated By</th> |
|||
<th class="text-center">Penalty Amount</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="modalTableBody"> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</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> |
|||
|
|||
<!-- 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"> |
|||
function loadZones() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/zones", function (data) { |
|||
|
|||
$('#zone').empty(); |
|||
|
|||
$('#zone').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#zone').append( |
|||
'<option value="' + row.id + '">' + |
|||
row.zone_name + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
let table; |
|||
|
|||
function initializeTable() { |
|||
|
|||
table = $('#hallBookingTable').DataTable({ |
|||
|
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
|
|||
'excel', |
|||
/* { |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
orientation: 'landscape', |
|||
pageSize: 'A3', |
|||
title: 'Community Hall Booking Report', |
|||
|
|||
customize: function (doc) { |
|||
|
|||
doc.defaultStyle.fontSize = 7; |
|||
doc.styles.tableHeader.fontSize = 8; |
|||
|
|||
doc.content[1].table.widths = |
|||
Array(doc.content[1].table.body[0].length).fill('*'); |
|||
|
|||
doc.pageMargins = [10, 10, 10, 10]; |
|||
} |
|||
},*/ { |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
orientation: 'landscape', |
|||
pageSize: 'A3', |
|||
title: 'Community Hall Popularity Report', |
|||
|
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
|
|||
customize: function (doc) { |
|||
|
|||
doc.pageMargins = [5, 5, 5, 5]; |
|||
|
|||
doc.defaultStyle.fontSize = 8; |
|||
doc.styles.tableHeader.fontSize = 9; |
|||
|
|||
// Reduce unwanted columns |
|||
doc.content[1].table.widths = [ |
|||
30, // S.No |
|||
30, // Zone |
|||
50, // Division |
|||
30, // Hall Id |
|||
130, // Hall Name |
|||
60, // Created Date |
|||
70, // Status |
|||
70, // Caretaker Name |
|||
70, // Caretaker No |
|||
|
|||
80, // Booking Available Days |
|||
80, // Total Bookings |
|||
80, // Half Day |
|||
80, // Full Day |
|||
80, // 1.5 Day |
|||
80 // 2 Days |
|||
]; |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.alignment = 'center'; |
|||
} |
|||
} |
|||
|
|||
], |
|||
|
|||
/*buttons: [ |
|||
'copy', |
|||
'csv', |
|||
'excel', |
|||
'pdf' |
|||
],*/ |
|||
|
|||
scrollX: true, |
|||
scrollCollapse: true, |
|||
|
|||
autoWidth: false, |
|||
paging: false, |
|||
|
|||
fixedColumns: { |
|||
leftColumns: 9 |
|||
}, |
|||
|
|||
|
|||
|
|||
/* columns: [ |
|||
{ data: 'zone' }, |
|||
{ data: 'division' }, |
|||
{ data: 'hall_id' }, |
|||
{ data: 'hall_name' }, |
|||
{ data: 'hall_created_date' }, |
|||
{ data: 'hall_status' }, |
|||
{ data: 'caretaker_name' }, |
|||
{ data: 'caretaker_no' }, |
|||
{ data: 'booking_available_days' }, |
|||
{ data: 'total_no_of_bookings' }, |
|||
{ data: 'half_day_booking_count' }, |
|||
{ data: 'full_day_booking_count' }, |
|||
{ data: 'one_point_five_days_booking_count' }, |
|||
{ data: 'two_days_booking_count' } |
|||
]*/ |
|||
columns: [ |
|||
{ data: 'sno', width: '50px' }, |
|||
{ data: 'zone', width: '60px' }, |
|||
{ data: 'division', width: '70px' }, |
|||
{ data: 'hall_id', width: '60px' }, |
|||
{ data: 'hall_name', width: '220px' }, |
|||
{ data: 'hall_created_date', width: '100px' }, |
|||
{ data: 'hall_status', width: '120px' }, |
|||
{ data: 'caretaker_name', width: '150px' }, |
|||
{ data: 'caretaker_no', width: '120px' }, |
|||
|
|||
{ data: 'booking_available_days', width: '120px' }, |
|||
{ data: 'total_no_of_bookings', width: '100px' }, |
|||
{ data: 'half_day_booking_count', width: '80px' }, |
|||
{ data: 'full_day_booking_count', width: '80px' }, |
|||
{ data: 'one_point_five_days_booking_count', width: '90px' }, |
|||
{ data: 'two_days_booking_count', width: '80px' } |
|||
] |
|||
}); |
|||
} |
|||
$('#region').change(function () { |
|||
|
|||
var region = $(this).val(); |
|||
|
|||
$('#zone').val(''); |
|||
|
|||
if (region == 'North') { |
|||
loadRegionZones([1, 2, 3, 4, 5]); |
|||
} |
|||
else if (region == 'Center') { |
|||
loadRegionZones([6, 7, 8, 9, 10]); |
|||
} |
|||
else if (region == 'South') { |
|||
loadRegionZones([11, 12, 13, 14, 15]); |
|||
} |
|||
else { |
|||
loadZones(); |
|||
} |
|||
|
|||
}); |
|||
function loadRegionZones(zoneIds) { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/zones", function (data) { |
|||
|
|||
$('#zone').empty(); |
|||
|
|||
$('#zone').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
if (zoneIds.includes(row.id)) { |
|||
|
|||
$('#zone').append( |
|||
'<option value="' + row.id + '">' + |
|||
row.zone_name + |
|||
'</option>' |
|||
); |
|||
|
|||
} |
|||
|
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
$('#searchBtn').click(function () { |
|||
|
|||
loadReport(false); |
|||
|
|||
}); |
|||
$('#resetBtn').click(function () { |
|||
|
|||
$('#fromDate').val(''); |
|||
$('#toDate').val(''); |
|||
$('#region').val(''); |
|||
$('#zone').val(''); |
|||
$('#hallId').val(''); |
|||
$('#hallId').trigger('change'); |
|||
$('#status').val(''); |
|||
loadReport(true); |
|||
|
|||
}); |
|||
function loadReport(isInitialLoad) { |
|||
let zone = $("#zone").val(); |
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
let region = $("#region").val(); |
|||
let hallId = $("#hallId").val(); |
|||
let status = $('#status').val(); |
|||
|
|||
if (!isInitialLoad && |
|||
zone == '' && |
|||
region == '' && |
|||
hallId == '' && |
|||
fromDate == '' && |
|||
toDate == '' && |
|||
status == '') { |
|||
|
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select at least one filter.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
if (fromDate != '') { |
|||
if (toDate == '') { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select both from date and to date.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
if (toDate != '') { |
|||
if (fromDate == '') { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select both from date and to date.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/communityhall/booking-report', |
|||
type: 'GET', |
|||
data: { |
|||
fromDate: $('#fromDate').val(), |
|||
toDate: $('#toDate').val(), |
|||
region: $('#region').val(), |
|||
zone: $('#zone').val(), |
|||
hallId: $('#hallId').val(), |
|||
status: $('#status').val() |
|||
}, |
|||
success: function (response) { |
|||
|
|||
table.clear(); |
|||
|
|||
|
|||
response.forEach(function (row, index) { |
|||
row.sno = index + 1; |
|||
}); |
|||
table.rows.add(response); |
|||
table.draw(); |
|||
|
|||
setTimeout(function () { |
|||
table.columns.adjust(); |
|||
}, 200); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
/* $(document).ready(function () { |
|||
|
|||
loadZones(); |
|||
loadHalls(); |
|||
|
|||
initializeTable(); |
|||
|
|||
// Loads complete report |
|||
loadReport(); |
|||
|
|||
});*/ |
|||
$(document).ready(function () { |
|||
|
|||
$("#fromDate").on("change", function () { |
|||
|
|||
let fromDate = $(this).val(); |
|||
|
|||
// Set minimum selectable date for To Date |
|||
$("#toDate").attr("min", fromDate); |
|||
|
|||
// If current To Date is less than From Date, clear it |
|||
if ($("#toDate").val() < fromDate) { |
|||
$("#toDate").val(''); |
|||
} |
|||
}); |
|||
|
|||
loadZones(); |
|||
loadHalls(); |
|||
initializeTable(); |
|||
loadReport(true); |
|||
}); |
|||
/*function loadHalls() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/halls", function (data) { |
|||
|
|||
$('#hallId').empty(); |
|||
|
|||
$('#hallId').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#hallId').append( |
|||
'<option value="' + row.hall_id + '">' + |
|||
row.hall_id + " - " + row.hall_name + " - " + row.hall_created_date + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
}).fail(function () { |
|||
alert("Failed to load halls"); |
|||
}); |
|||
|
|||
}*/ |
|||
|
|||
function loadHalls() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/halls", function (data) { |
|||
|
|||
$('#hallId').empty(); |
|||
|
|||
$('#hallId').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#hallId').append( |
|||
'<option value="' + row.hall_id + '">' + |
|||
row.hall_id + ' - ' + row.hall_name + ' - ' + row.hall_created_date + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
// Destroy existing Select2 if already initialized |
|||
if ($('#hallId').hasClass('select2-hidden-accessible')) { |
|||
$('#hallId').select2('destroy'); |
|||
} |
|||
|
|||
// Initialize Select2 |
|||
$('#hallId').select2({ |
|||
placeholder: 'Search Hall', |
|||
allowClear: true, |
|||
width: '100%' |
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
// if (true) { |
|||
// var a = 5; |
|||
|
|||
// } |
|||
// console.log(a); |
|||
|
|||
// Error |
|||
// Recalculate precisely after Bootstrap entirely finishes destroying modal padding |
|||
</script> |
|||
|
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,928 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head> |
|||
<title>Community Hall CareTaker Performance 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; |
|||
}*/ |
|||
|
|||
|
|||
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; |
|||
} |
|||
|
|||
|
|||
|
|||
/* #hallBookingTable th:not(:nth-child(4)), |
|||
#hallBookingTable td:not(:nth-child(4)) { |
|||
white-space: nowrap; |
|||
}*/ |
|||
|
|||
/* Wrap selected columns */ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/* 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 CareTaker Performance Report</h4> |
|||
</div> |
|||
|
|||
<!-- Filter Section --> |
|||
<div class="filter-section row"> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>From Date</label> |
|||
<input type="date" id="fromDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>To Date</label> |
|||
<input type="date" id="toDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Region</label> |
|||
<select id="region" class="form-control"> |
|||
<option value="">All</option> |
|||
<option value="North">North Region</option> |
|||
<option value="Center">Center Region</option> |
|||
<option value="South">South Region</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Zone</label> |
|||
<select id="zone" class="form-control"> |
|||
<option value="">All</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label>Hall</label> |
|||
<select id="hallId" class="form-control"> |
|||
<option value="">All</option> |
|||
</select> |
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label>Status</label> |
|||
<select id="status" class="form-control"> |
|||
<option value="">All</option> |
|||
<option value="Active Hall">Active Hall</option> |
|||
<option value="Deactivated Hall">Deactivated Hall</option> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-md-12 d-flex justify-content-center gap-2 mt-3"> |
|||
<button id="searchBtn" class="btn btn-primary"> |
|||
Search |
|||
</button> |
|||
|
|||
<button id="resetBtn" class="btn btn-primary"> |
|||
Reset |
|||
</button> |
|||
</div> |
|||
|
|||
<!--<div class="col-md-2 mt-4"> |
|||
<button class="btn btn-primary" id="searchBtn"> |
|||
Search |
|||
</button> |
|||
<button class="btn btn-primary" id="resetBtn"> |
|||
Reset |
|||
</button> |
|||
|
|||
</div>--> |
|||
|
|||
</div> |
|||
|
|||
<div class="report-container"> |
|||
<table id="hallBookingTable" class="table table-bordered table-striped nowrap" width="100%"> |
|||
|
|||
<thead> |
|||
|
|||
<tr> |
|||
<th rowspan="2">S.No</th> |
|||
<th rowspan="2">Zone</th> |
|||
<th rowspan="2">Division</th> |
|||
<th rowspan="2">Hall Id</th> |
|||
<th rowspan="2">Hall Name</th> |
|||
<th rowspan="2">Hall Created On</th> |
|||
<th rowspan="2">Hall Status</th> |
|||
<th rowspan="2">Caretaker Name</th> |
|||
<th rowspan="2">Mobile No</th> |
|||
|
|||
<th rowspan="2">Total Booking</th> |
|||
<th rowspan="2" class="wrap-text">Cancelled<br> Bookings</th> |
|||
<th rowspan="2" class="wrap-text">Rejected<br> Booking</th> |
|||
<th rowspan="2" class="wrap-text">Event Completed<br> Bookings</th> |
|||
<th rowspan="2" class="wrap-text">Cancelled Refund<br> Completed</th> |
|||
<th rowspan="2" class="wrap-text">Rejected Refund<br> Completed</th> |
|||
|
|||
<th class="text-center" colspan="5">Refund Completed</th> |
|||
|
|||
<th class="text-center" colspan="7">Refund Pending</th> |
|||
</tr> |
|||
|
|||
<tr> |
|||
|
|||
<!-- Refund Completed --> |
|||
|
|||
|
|||
<th>0-5 Days</th> |
|||
<th>6-15 Days</th> |
|||
<th>16-30 Days</th> |
|||
<th class="wrap-text">More than <br> 30 Days</th> |
|||
<th class="wrap-text">Total Refund <br> Completed</th> |
|||
|
|||
<!-- Refund Pending --> |
|||
<th>0-5 Days</th> |
|||
<th>6-15 Days</th> |
|||
<th class="wrap-text">16-30 Days</th> |
|||
<th class="wrap-text">More than <br> 30 Days</th> |
|||
<th class="wrap-text">Cancelled <br> Booking</th> |
|||
<th class="wrap-text">Rejected <br> Booking</th> |
|||
<th class="wrap-text">Total Refund<br> Pending</th> |
|||
|
|||
|
|||
</tr> |
|||
|
|||
</thead> |
|||
|
|||
<tbody></tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
<!-- Details Modal --> |
|||
<div class="modal fade" id="detailModal" tabindex="-1" aria-labelledby="detailModalLabel" aria-hidden="true" |
|||
data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl modal-dialog-centered"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailModalLabel">Compliance Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<table id="modalDataTable" class="table table-bordered table-striped"> |
|||
<thead class="table-dark"> |
|||
<tr> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Audit Date</th> |
|||
<th class="text-center">Shift</th> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Ward</th> |
|||
<th class="text-center">Address</th> |
|||
<th class="text-center">Audit Category</th> |
|||
<th class="text-center">Question</th> |
|||
<th class="text-center">Answer</th> |
|||
<th class="text-center">Kitchen SI Name</th> |
|||
<th class="text-center">Raised By</th> |
|||
<th class="text-center">PMC Remarks</th> |
|||
<th class="text-center">PMC Image/Video Viewer</th> |
|||
<th class="text-center">FS Status</th> |
|||
<th class="text-center">FS Challenged By</th> |
|||
<th class="text-center">FS Remarks</th> |
|||
<th class="text-center">FS Image/Video Viewer</th> |
|||
<th class="text-center">CE Status</th> |
|||
<th class="text-center">CE Remarks</th> |
|||
<th class="text-center">CE Updated By</th> |
|||
<th class="text-center">Penalty Amount</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="modalTableBody"> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</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> |
|||
|
|||
<!-- 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"> |
|||
function loadZones() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/zones", function (data) { |
|||
|
|||
$('#zone').empty(); |
|||
|
|||
$('#zone').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#zone').append( |
|||
'<option value="' + row.id + '">' + |
|||
row.zone_name + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
let table; |
|||
|
|||
function initializeTable() { |
|||
|
|||
table = $('#hallBookingTable').DataTable({ |
|||
|
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
|
|||
'excel', |
|||
/* { |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
orientation: 'landscape', |
|||
pageSize: 'A3', |
|||
title: 'Community Hall Booking Report', |
|||
|
|||
customize: function (doc) { |
|||
|
|||
doc.defaultStyle.fontSize = 7; |
|||
doc.styles.tableHeader.fontSize = 8; |
|||
|
|||
doc.content[1].table.widths = |
|||
Array(doc.content[1].table.body[0].length).fill('*'); |
|||
|
|||
doc.pageMargins = [10, 10, 10, 10]; |
|||
} |
|||
},*/ |
|||
/*{ |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
orientation: 'landscape', |
|||
pageSize: 'A2', |
|||
title: 'Community Hall Refund Review Report', |
|||
|
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
|
|||
customize: function (doc) { |
|||
|
|||
doc.pageMargins = [5, 5, 5, 5]; |
|||
|
|||
doc.defaultStyle.fontSize = 8; |
|||
doc.styles.tableHeader.fontSize = 9; |
|||
|
|||
doc.content[1].table.widths = [ |
|||
|
|||
20, // S.No |
|||
20, // Zone |
|||
25, // Division |
|||
25, // Hall Id |
|||
130, // Hall Name |
|||
65, // Hall Created On |
|||
65, // Hall Status |
|||
80, // Caretaker Name |
|||
50, // Mobile No |
|||
|
|||
55, // Total Booking |
|||
55, // Cancelled Booking |
|||
55, // Rejected Booking |
|||
65, // Event Completed |
|||
|
|||
55, // Cancelled Completed |
|||
55, // Rejected Completed |
|||
60, // Settlement Completed |
|||
|
|||
50, // 0-5 Days |
|||
50, // 6-15 Days |
|||
50, // 16-30 Days |
|||
55, // More Than 30 Days |
|||
|
|||
55, // Cancelled Pending |
|||
55, // Rejected Pending |
|||
55 // Total Pending |
|||
]; |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.alignment = 'center'; |
|||
|
|||
doc.content[0].margin = [0, 0, 0, 10]; |
|||
|
|||
// Hall Name wrap |
|||
doc.content[1].table.body.forEach(function (row, index) { |
|||
|
|||
if (index > 0) { |
|||
|
|||
row[4].alignment = 'left'; // Hall Name |
|||
row[7].alignment = 'left'; // Caretaker Name |
|||
} |
|||
}); |
|||
|
|||
}*/ |
|||
|
|||
|
|||
|
|||
|
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
orientation: 'landscape', |
|||
pageSize: 'A3', |
|||
title: 'Community Hall Caretaker Report', |
|||
|
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
|
|||
customize: function (doc) { |
|||
|
|||
doc.pageMargins = [5, 5, 5, 5]; |
|||
|
|||
doc.defaultStyle.fontSize = 8; |
|||
doc.styles.tableHeader.fontSize = 9; |
|||
|
|||
// Reduce unwanted columns |
|||
doc.content[1].table.widths = [ |
|||
10, // S.No |
|||
25, // Zone |
|||
35, // Division |
|||
25, // Hall Id |
|||
80, // Hall Name |
|||
50, // Hall Created On |
|||
50, // Hall Status |
|||
60, // Caretaker Name |
|||
50, // Mobile No |
|||
|
|||
35, // Total Booking |
|||
45, // Cancelled Booking |
|||
35, // Rejected Booking |
|||
45, // Event Completed |
|||
|
|||
45, // Cancelled Completed |
|||
45, // Rejected Completed |
|||
|
|||
|
|||
25, // 0-5 Days |
|||
25, // 6-15 Days |
|||
25, // 16-30 Days |
|||
25, // More Than 30 Days |
|||
45, // Settlement Completed |
|||
|
|||
25, // Pending 0-5 |
|||
25, // Pending 6-15 |
|||
25, // Pending 16-30 |
|||
25, // Pending >30 |
|||
30, // Pending Cancelled |
|||
30, // Pending Rejected |
|||
35 // Total Pending |
|||
]; |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.alignment = 'center'; |
|||
} |
|||
} |
|||
|
|||
], |
|||
|
|||
/*buttons: [ |
|||
'copy', |
|||
'csv', |
|||
'excel', |
|||
'pdf' |
|||
],*/ |
|||
|
|||
scrollX: true, |
|||
scrollCollapse: true, |
|||
|
|||
autoWidth: false, |
|||
paging: false, |
|||
|
|||
fixedColumns: { |
|||
leftColumns: 9 |
|||
}, |
|||
|
|||
|
|||
|
|||
/* columns: [ |
|||
{ data: 'zone' }, |
|||
{ data: 'division' }, |
|||
{ data: 'hall_id' }, |
|||
{ data: 'hall_name' }, |
|||
{ data: 'hall_created_date' }, |
|||
{ data: 'hall_status' }, |
|||
{ data: 'caretaker_name' }, |
|||
{ data: 'caretaker_no' }, |
|||
{ data: 'booking_available_days' }, |
|||
{ data: 'total_no_of_bookings' }, |
|||
{ data: 'half_day_booking_count' }, |
|||
{ data: 'full_day_booking_count' }, |
|||
{ data: 'one_point_five_days_booking_count' }, |
|||
{ data: 'two_days_booking_count' } |
|||
]*/ |
|||
columns: [ |
|||
|
|||
{ |
|||
data: null, |
|||
render: function (data, type, row, meta) { |
|||
return meta.row + 1; |
|||
} |
|||
|
|||
}, |
|||
|
|||
{ data: 'zone' }, |
|||
{ data: 'division' }, |
|||
{ data: 'hall_id' }, |
|||
{ data: 'hall_name' }, |
|||
{ data: 'hall_Created_date' }, |
|||
{ data: 'Hall_Status' }, |
|||
{ data: 'caretaker_name' }, |
|||
{ data: 'caretake_no' }, |
|||
|
|||
{ data: 'total_no_of_bookings' }, |
|||
{ data: 'cancelled_bookings' }, |
|||
{ data: 'rejected_bookings' }, |
|||
{ data: 'event_completed_count' }, |
|||
|
|||
/* Refund Completed */ |
|||
|
|||
{ data: 'cancelled_completed_count' }, |
|||
{ data: 'rejected_completed_count' }, |
|||
|
|||
|
|||
{ data: 'settlement_Completed_0_5_days' }, |
|||
{ data: 'settlement_Completed_6_15_days' }, |
|||
{ data: 'settlement_Completed_16_30_days' }, |
|||
{ data: 'settlement_Completed_more_than_30_days' }, |
|||
{ data: 'refund_completed_count' }, |
|||
|
|||
/* Refund Pending */ |
|||
|
|||
{ data: 'settlement_Pending_0_5_days' }, |
|||
{ data: 'settlement_Pending_6_15_days' }, |
|||
{ data: 'settlement_Pending_16_30_days' }, |
|||
{ data: 'settlement_Pending_more_than_30_days' }, |
|||
|
|||
{ data: 'cancelled_settlement_pending' }, |
|||
{ data: 'rejected_settlement_pending' }, |
|||
{ data: 'total_bookings' } |
|||
|
|||
], |
|||
columnDefs: [ |
|||
{ |
|||
targets: 4, // Hall Name column (0-based index) |
|||
className: 'hall-name-wrap' |
|||
} |
|||
] |
|||
|
|||
}); |
|||
} |
|||
$('#region').change(function () { |
|||
|
|||
var region = $(this).val(); |
|||
|
|||
$('#zone').val(''); |
|||
|
|||
if (region == 'North') { |
|||
loadRegionZones([1, 2, 3, 4, 5]); |
|||
} |
|||
else if (region == 'Center') { |
|||
loadRegionZones([6, 7, 8, 9, 10]); |
|||
} |
|||
else if (region == 'South') { |
|||
loadRegionZones([11, 12, 13, 14, 15]); |
|||
} |
|||
else { |
|||
loadZones(); |
|||
} |
|||
|
|||
}); |
|||
function loadRegionZones(zoneIds) { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/zones", function (data) { |
|||
|
|||
$('#zone').empty(); |
|||
|
|||
$('#zone').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
if (zoneIds.includes(row.id)) { |
|||
|
|||
$('#zone').append( |
|||
'<option value="' + row.id + '">' + |
|||
row.zone_name + |
|||
'</option>' |
|||
); |
|||
|
|||
} |
|||
|
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
$('#searchBtn').click(function () { |
|||
|
|||
loadReport(false); |
|||
|
|||
}); |
|||
$('#resetBtn').click(function () { |
|||
|
|||
$('#fromDate').val(''); |
|||
$('#toDate').val(''); |
|||
$('#region').val(''); |
|||
$('#zone').val(''); |
|||
$('#hallId').val(''); |
|||
$('#hallId').trigger('change'); |
|||
$('#status').val(''); |
|||
loadReport(true); |
|||
|
|||
}); |
|||
function loadReport(isInitialLoad) { |
|||
let zone = $("#zone").val(); |
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
let region = $("#region").val(); |
|||
let hallId = $("#hallId").val(); |
|||
let status = $('#status').val(); |
|||
|
|||
if (!isInitialLoad && |
|||
zone == '' && |
|||
region == '' && |
|||
hallId == '' && |
|||
fromDate == '' && |
|||
toDate == '' && |
|||
status == '') { |
|||
|
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select at least one filter.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
if (fromDate != '') { |
|||
if (toDate == '') { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select both from date and to date.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
if (toDate != '') { |
|||
if (fromDate == '') { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Warning', |
|||
text: 'Please select both from date and to date.', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/communityhall/caretaker-report', |
|||
type: 'GET', |
|||
data: { |
|||
fromDate: $('#fromDate').val(), |
|||
toDate: $('#toDate').val(), |
|||
region: $('#region').val(), |
|||
zone: $('#zone').val(), |
|||
hallId: $('#hallId').val(), |
|||
status: $('#status').val() |
|||
}, |
|||
success: function (response) { |
|||
|
|||
table.clear(); |
|||
|
|||
|
|||
response.forEach(function (row, index) { |
|||
row.sno = index + 1; |
|||
}); |
|||
response.forEach(function (row, index) { |
|||
var total_bookings = row.settlement_Pending_0_5_days + row.settlement_Pending_6_15_days + row.settlement_Pending_16_30_days + row.settlement_Pending_more_than_30_days + row.cancelled_settlement_pending + row.rejected_settlement_pending; |
|||
row.total_bookings = total_bookings; |
|||
}); |
|||
|
|||
table.rows.add(response); |
|||
table.draw(); |
|||
|
|||
setTimeout(function () { |
|||
table.columns.adjust(); |
|||
}, 200); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
/* $(document).ready(function () { |
|||
|
|||
loadZones(); |
|||
loadHalls(); |
|||
|
|||
initializeTable(); |
|||
|
|||
// Loads complete report |
|||
loadReport(); |
|||
|
|||
});*/ |
|||
$(document).ready(function () { |
|||
|
|||
$("#fromDate").on("change", function () { |
|||
|
|||
let fromDate = $(this).val(); |
|||
|
|||
// Set minimum selectable date for To Date |
|||
$("#toDate").attr("min", fromDate); |
|||
|
|||
// If current To Date is less than From Date, clear it |
|||
if ($("#toDate").val() < fromDate) { |
|||
$("#toDate").val(''); |
|||
} |
|||
}); |
|||
|
|||
loadZones(); |
|||
loadHalls(); |
|||
initializeTable(); |
|||
loadReport(true); |
|||
}); |
|||
/*function loadHalls() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/halls", function (data) { |
|||
|
|||
$('#hallId').empty(); |
|||
|
|||
$('#hallId').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#hallId').append( |
|||
'<option value="' + row.hall_id + '">' + |
|||
row.hall_id + " - " + row.hall_name + " - " + row.hall_created_date + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
}).fail(function () { |
|||
alert("Failed to load halls"); |
|||
}); |
|||
|
|||
}*/ |
|||
|
|||
function loadHalls() { |
|||
|
|||
$.get("/commissionerreview/api/communityhall/halls", function (data) { |
|||
|
|||
$('#hallId').empty(); |
|||
|
|||
$('#hallId').append( |
|||
'<option value="">All</option>' |
|||
); |
|||
|
|||
$.each(data, function (i, row) { |
|||
|
|||
$('#hallId').append( |
|||
'<option value="' + row.hall_id + '">' + |
|||
row.hall_id + ' - ' + row.hall_name + ' - ' + row.hall_created_date + |
|||
'</option>' |
|||
); |
|||
|
|||
}); |
|||
|
|||
// Destroy existing Select2 if already initialized |
|||
if ($('#hallId').hasClass('select2-hidden-accessible')) { |
|||
$('#hallId').select2('destroy'); |
|||
} |
|||
|
|||
// Initialize Select2 |
|||
$('#hallId').select2({ |
|||
placeholder: 'Search Hall', |
|||
allowClear: true, |
|||
width: '100%' |
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
// if (true) { |
|||
// var a = 5; |
|||
|
|||
// } |
|||
// console.log(a); |
|||
|
|||
// Error |
|||
// Recalculate precisely after Bootstrap entirely finishes destroying modal padding |
|||
</script> |
|||
|
|||
</body> |
|||
|
|||
</html> |
|||
1006
src/main/resources/templates/modules/communityrefund.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue