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