correct spelling mis.

This commit is contained in:
pramod.mahajan 2025-12-08 10:26:10 +05:30
parent e5fa6bb6ea
commit f7975b4fb2

View File

@ -6,7 +6,7 @@ const OPERATORS = {
{ key: "neq", label: "Not Equal" }, { key: "neq", label: "Not Equal" },
{ key: "gt", label: "Greater Than" }, { key: "gt", label: "Greater Than" },
{ key: "gte", label: "Greater or Equal" }, { key: "gte", label: "Greater or Equal" },
{ key: "less than", label: "Less Than" }, { key: "lt", label: "Less Than" },
{ key: "lte", label: "Less or Equal" }, { key: "lte", label: "Less or Equal" },
{ key: "between", label: "Between" }, { key: "between", label: "Between" },
], ],
@ -25,24 +25,24 @@ const OPERATORS = {
// ----------- FILTER UI COMPONENT ---------- // ----------- FILTER UI COMPONENT ----------
function AdvanceFilter({ type = "number", onApply, onClear }) { function AdvanceFilter({ type = "number", onApply, onClear }) {
const [operator, setOperator] = useState(""); const [operation, setOperator] = useState("");
const [value1, setValue1] = useState(""); const [value1, setValue1] = useState("");
const [value2, setValue2] = useState(""); const [value2, setValue2] = useState("");
const ops = OPERATORS[type]; const ops = OPERATORS[type];
const apply = () => { const apply = () => {
if (!operator) return; if (!operation) return;
if (operator === "between") { if (operation === "between") {
onApply({ onApply({
operator, operation,
from: value1, from: value1,
to: value2, to: value2,
}); });
} else { } else {
onApply({ onApply({
operator, operation,
value: value1, value: value1,
}); });
} }
@ -50,7 +50,7 @@ function AdvanceFilter({ type = "number", onApply, onClear }) {
return ( return (
<div <div
className="dropdown p-3" className="dropdown p-3 "
onClick={(e) => e.stopPropagation()} // prevent closing menu onClick={(e) => e.stopPropagation()} // prevent closing menu
style={{ width: 240 }} style={{ width: 240 }}
> >
@ -59,7 +59,7 @@ function AdvanceFilter({ type = "number", onApply, onClear }) {
<label className="form-label">Condition</label> <label className="form-label">Condition</label>
<select <select
className="form-select form-select-sm" className="form-select form-select-sm"
value={operator} value={operation}
onChange={(e) => setOperator(e.target.value)} onChange={(e) => setOperator(e.target.value)}
> >
<option value="">Select</option> <option value="">Select</option>
@ -72,11 +72,11 @@ function AdvanceFilter({ type = "number", onApply, onClear }) {
</div> </div>
{/* Values */} {/* Values */}
{operator && ( {operation && (
<div> <div className="text-decoration-none">
<label className="form-label">Value</label> <label className="form-label">Value</label>
{operator !== "between" ? ( {operation !== "between" ? (
<input <input
type={type === "date" ? "date" : "number"} type={type === "date" ? "date" : "number"}
className="form-control form-control-sm" className="form-control form-control-sm"
@ -165,7 +165,7 @@ const PmsHeaderOption = ({
<li className="p-0"> <li className="p-0">
<AdvanceFilter <AdvanceFilter
type="number" type="number"
onApply={(f) => onAdvancedFilter({...f,column})} onApply={(f) => onAdvancedFilter({ ...f, column })}
onClear={() => onAdvancedFilter(null)} onClear={() => onAdvancedFilter(null)}
/> />
</li> </li>