+
+ {/* Formula Info Popover / Panel for Monthly Maintenance */}
+ {key === "monthly-maintenance" && formulaOpen && report?.formula_info && (
+
+ {(key === "monthly-maintenance" ||
+ key === "monthly-department" ||
+ key === "pm-compliance") && (
+
+
+ Month
+
+ setMonth(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ />
+
+ )}
+
+ {(key === "daily-visit" ||
+ key === "breakdown-complaints" ||
+ key === "pm-compliance" ||
+ key === "demo-equipment") && (
+ <>
+
+
+ From Date
+
+ setDateFrom(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ />
+
+
+
+ To Date
+
+ setDateTo(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ />
+
+ >
+ )}
+
+ {key === "calibration-due" && (
+ <>
+
+
+ Due From
+
+ setDueFrom(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ />
+
+
+
+ Due To
+
+ setDueTo(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ />
+
+ >
+ )}
+
+ {!isDeptUser && (
+
+
+ Department
+
+ setDepartmentId(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Departments
+ {departments.map((d) => (
+
+ {d.name}
+
+ ))}
+
+
+ )}
+
+ {key === "breakdown-complaints" && (
+ <>
+
+
+ Priority
+
+ setPriority(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Priorities
+ Critical
+ Non-Critical
+
+
+
+
+ Call Status
+
+ setCallStatus(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Statuses
+ Open
+ In Progress
+ Closed
+
+
+ >
+ )}
+
+ {key === "pm-compliance" && (
+
+
+ Service Mode
+
+ setServiceMode(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Modes
+ In-House
+ Outsourced
+
+
+ )}
+
+ {key === "calibration-due" && (
+ <>
+
+
+ Calibration Agency
+
+ setAgencyId(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Agencies
+ {(agencies.length ? agencies : allVendors).map((v) => (
+
+ {v.name}
+
+ ))}
+
+
+
+
+ Status
+
+ setStatusFilter(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Statuses
+ Upcoming
+ Due
+ Overdue
+ Completed
+
+
+ >
+ )}
+
+ {key === "contracts-warranty" && (
+ <>
+
+
+ Record Kind
+
+ setRecordKind(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ Contracts & Warranties
+ Contracts Only
+ Warranties Only
+
+
+
+
+ Contract Type
+
+ setContractType(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Types
+ AMC
+ CMC
+
+
+
+
+ Status
+
+ setStatusFilter(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Statuses
+ Active
+ Expiring
+ Expired
+ Superseded
+
+
+ >
+ )}
+
+ {key === "demo-equipment" && (
+ <>
+
+
+ Supplier
+
+ setSupplierId(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Suppliers
+ {(suppliers.length ? suppliers : allVendors).map((v) => (
+
+ {v.name}
+
+ ))}
+
+
+
+
+ Status
+
+ setStatusFilter(e.target.value)}
+ className="px-2.5 py-1.5 text-xs border border-gray-200 rounded-md bg-white"
+ >
+ All Statuses
+ On Demo
+ Overdue Return
+ Returned
+
+
+ >
+ )}
+
+ )}
+
+ {/* Monthly Maintenance Charts */}
+ {key === "monthly-maintenance" &&
+ report?.chart_data &&
+ report.chart_data.length > 0 && (
+