|
|
@@ -28,6 +28,7 @@ MENU_CODE_MAINT_PROCESS = "pl:vehicle-maintenance-process:list"
|
|
|
MENU_CODE_UREA_DISBURSE = "pl:vehicle-urea-disburse:list"
|
|
|
MENU_CODE_PLAN_CERT = "pl:plan-cert:list"
|
|
|
MENU_CODE_PLAN_ARCHIVE = "pl:plan-archive:list"
|
|
|
+MENU_CODE_PLAN_CONTRACT = "pl:plan-contract:list"
|
|
|
|
|
|
SUPPORTED_MENU_CODES = {
|
|
|
MENU_CODE_DOCUMENT,
|
|
|
@@ -38,6 +39,7 @@ SUPPORTED_MENU_CODES = {
|
|
|
MENU_CODE_UREA_DISBURSE,
|
|
|
MENU_CODE_PLAN_CERT,
|
|
|
MENU_CODE_PLAN_ARCHIVE,
|
|
|
+ MENU_CODE_PLAN_CONTRACT,
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -128,6 +130,19 @@ def count_plan_archive_pending(db: Session, tenant_no: str, user) -> int:
|
|
|
return query.count()
|
|
|
|
|
|
|
|
|
+def count_plan_contract_gaps(db: Session, tenant_no: str, user) -> int:
|
|
|
+ from app.services.pl_plan_contract_gap import plan_has_contract_gap_exists
|
|
|
+
|
|
|
+ query = db.query(PlPlan).filter(
|
|
|
+ PlPlan.tenant_no == tenant_no,
|
|
|
+ PlPlan.del_flag == 0,
|
|
|
+ PlPlan.follow_status != "cancelled",
|
|
|
+ plan_has_contract_gap_exists(tenant_no),
|
|
|
+ )
|
|
|
+ query = apply_pl_scope(query, PlPlan, user, db, tenant_no)
|
|
|
+ return query.count()
|
|
|
+
|
|
|
+
|
|
|
def count_freight_disburse_pending(db: Session, tenant_no: str, user) -> int:
|
|
|
query = db.query(PlFreightSettlement).filter(
|
|
|
PlFreightSettlement.tenant_no == tenant_no,
|
|
|
@@ -174,4 +189,6 @@ def build_menu_badge_counts(
|
|
|
counts[MENU_CODE_PLAN_CERT] = count_plan_cert_pending(db, tenant_no, user)
|
|
|
if MENU_CODE_PLAN_ARCHIVE in requested:
|
|
|
counts[MENU_CODE_PLAN_ARCHIVE] = count_plan_archive_pending(db, tenant_no, user)
|
|
|
+ if MENU_CODE_PLAN_CONTRACT in requested:
|
|
|
+ counts[MENU_CODE_PLAN_CONTRACT] = count_plan_contract_gaps(db, tenant_no, user)
|
|
|
return counts
|