Compare commits
No commits in common. "700a9261a8591dcc7af5a3fbeb16c1708f435824" and "2afefc74425b36bc4d2a396a112cab4b51d25c24" have entirely different histories.
700a9261a8
...
2afefc7442
@ -51,6 +51,5 @@
|
|||||||
"create": "बनाएं",
|
"create": "बनाएं",
|
||||||
"operation": "ऑपरेशन",
|
"operation": "ऑपरेशन",
|
||||||
"next": "अगला",
|
"next": "अगला",
|
||||||
"select": "चुनें",
|
"select": "चुनें"
|
||||||
"productCode": "प्रोडक्ट कोड"
|
|
||||||
}
|
}
|
@ -2,10 +2,8 @@ import PropTypes from "prop-types";
|
|||||||
import { AnimatePresence } from "motion/react";
|
import { AnimatePresence } from "motion/react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import FieldError from "./FieldError";
|
import FieldError from "./FieldError";
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
|
|
||||||
function FormSelect({ props, valid = true, className = "", options }) {
|
function FormSelect({ props, valid = true, className = "", options }) {
|
||||||
const { t } = useTranslation();
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<select
|
<select
|
||||||
@ -16,7 +14,7 @@ function FormSelect({ props, valid = true, className = "", options }) {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<option disabled value="">
|
<option disabled value="">
|
||||||
{t("select")}
|
Select
|
||||||
</option>
|
</option>
|
||||||
{options?.map(({ value, label }) => (
|
{options?.map(({ value, label }) => (
|
||||||
<option key={value} value={value}>
|
<option key={value} value={value}>
|
||||||
|
@ -166,7 +166,10 @@ function ChargeEdit() {
|
|||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{notification.message !== "" && <Notification {...notification} />}
|
{notification.message !== "" && <Notification {...notification} />}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
<div className="relative">
|
||||||
|
{notification.type === "success" && (
|
||||||
|
<div className="absolute inset-0 bg-[#fff]/50 z-10 rounded-3xl" />
|
||||||
|
)}
|
||||||
<FormBox title={t("chargeEdit")}>
|
<FormBox title={t("chargeEdit")}>
|
||||||
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
||||||
<Button
|
<Button
|
||||||
@ -178,6 +181,7 @@ function ChargeEdit() {
|
|||||||
/>
|
/>
|
||||||
</FormBox>
|
</FormBox>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,11 @@ import FieldsWrapper from "../components/FieldsWrapper";
|
|||||||
|
|
||||||
function CheckInOutManagement() {
|
function CheckInOutManagement() {
|
||||||
const [accountNumber, setAccountNumber] = useState("");
|
const [accountNumber, setAccountNumber] = useState("");
|
||||||
const [notification, setNotification] = useState({ message: "", type: "" });
|
const [notification, setNotification] = useState({
|
||||||
|
visible: false,
|
||||||
|
message: "",
|
||||||
|
type: "",
|
||||||
|
});
|
||||||
|
|
||||||
const showToast = useToast();
|
const showToast = useToast();
|
||||||
const { setIsLoading } = useLoading();
|
const { setIsLoading } = useLoading();
|
||||||
@ -60,7 +64,7 @@ function CheckInOutManagement() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{ notification.message !== "" && <Notification {...notification} /> }
|
{notification.visible && <Notification notification={notification} />}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<FormBox title="Check In/Out">
|
<FormBox title="Check In/Out">
|
||||||
<FieldsWrapper>
|
<FieldsWrapper>
|
||||||
|
@ -166,11 +166,16 @@ function KeySwap() {
|
|||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{notification.message !== "" && <Notification {...notification} />}
|
{notification.message !== "" && <Notification {...notification} />}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
<div className="relative">
|
||||||
|
{notification.type === "success" && (
|
||||||
|
<div className="absolute inset-0 bg-[#fff]/50 z-10 rounded-3xl" />
|
||||||
|
)}
|
||||||
<FormBox title={t("lockerStatus")}>
|
<FormBox title={t("lockerStatus")}>
|
||||||
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
||||||
<Button text={t("submit")} onClick={handleKeySwap} />
|
<Button text={t("submit")} onClick={handleKeySwap} />
|
||||||
</FormBox>
|
</FormBox>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,8 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import FormBox from "../components/FormBox";
|
import FormBox from "../components/FormBox";
|
||||||
import Button from "../components/Button";
|
import Button from "../components/Button";
|
||||||
import FormField from "../components/FormField";
|
import { motion, AnimatePresence } from "motion/react";
|
||||||
import FormInput from "../components/FormInput";
|
import clsx from "clsx";
|
||||||
import FormSelect from "../components/FormSelect";
|
|
||||||
import FieldsWrapper from "../components/FieldsWrapper";
|
|
||||||
|
|
||||||
function LockerMaintenance() {
|
function LockerMaintenance() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -21,44 +19,48 @@ function LockerMaintenance() {
|
|||||||
navigate(operation.value);
|
navigate(operation.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formFields = [
|
|
||||||
{
|
|
||||||
name: "value",
|
|
||||||
label: t("operation"),
|
|
||||||
options: [
|
|
||||||
{ label: t("status"), value: "status" },
|
|
||||||
{ label: t("keySwap"), value: "key-swap" },
|
|
||||||
],
|
|
||||||
type: "select",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const renderField = (field) => {
|
|
||||||
const commonProps = {
|
|
||||||
value: operation[field.name],
|
|
||||||
onChange: (e) => {
|
|
||||||
const newValues = { ...operation };
|
|
||||||
newValues[field.name] = e.target.value;
|
|
||||||
newValues[`${field.name}Valid`] = true;
|
|
||||||
setOperation(newValues);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const options = field.options;
|
|
||||||
return (
|
|
||||||
<FormField label={field.label}>
|
|
||||||
{field.type === "input" ? (
|
|
||||||
<FormInput props={commonProps} />
|
|
||||||
) : (
|
|
||||||
<FormSelect props={commonProps} options={options} />
|
|
||||||
)}
|
|
||||||
</FormField>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FormBox title={t("lockerMaintenance")}>
|
<FormBox title={t("cabinetMaintenance")}>
|
||||||
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
<div className="p-2 pt-7">
|
||||||
|
<div className="flex">
|
||||||
|
<label className="mr-4 text-lg text-black dark:text-primary-dark w-[10%]">
|
||||||
|
{t("operation")}
|
||||||
|
</label>
|
||||||
|
<div className="w-full">
|
||||||
|
<select
|
||||||
|
className={clsx(
|
||||||
|
"w-1/5 h-10 px-2 rounded-full dark:bg-grey dark:text-primary-dark border-2 focus:outline-grey border-grey",
|
||||||
|
!operation.valid && "border-error"
|
||||||
|
)}
|
||||||
|
onChange={(e) =>
|
||||||
|
setOperation({ value: e.target.value, valid: true })
|
||||||
|
}
|
||||||
|
defaultValue={operation.value}
|
||||||
|
value={operation.value}
|
||||||
|
>
|
||||||
|
<option value="" disabled>
|
||||||
|
{t("select")}
|
||||||
|
</option>
|
||||||
|
<option value="status">{t("changeStatus")}</option>
|
||||||
|
<option value="key-swap">{t("keySwap")}</option>
|
||||||
|
</select>
|
||||||
|
<AnimatePresence initial={false}>
|
||||||
|
{!operation.valid && (
|
||||||
|
<motion.div
|
||||||
|
className="w-1/5 text-sm text-error ml-3 pt-1"
|
||||||
|
initial={{ opacity: 0, scale: 0 }}
|
||||||
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
|
exit={{ opacity: 0, scale: 0 }}
|
||||||
|
key="cabinetIdError"
|
||||||
|
>
|
||||||
|
Invalid Operation
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<Button text={t("next")} onClick={(e) => handleNext(e)} />
|
<Button text={t("next")} onClick={(e) => handleNext(e)} />
|
||||||
</FormBox>
|
</FormBox>
|
||||||
</div>
|
</div>
|
||||||
|
@ -125,12 +125,18 @@ function LockerStatus() {
|
|||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{notification.message !== "" && <Notification {...notification} />}
|
{notification.message !== "" && <Notification {...notification} />}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
<div className="relative">
|
||||||
|
{notification.type === "success" && (
|
||||||
|
<div className="absolute inset-0 bg-[#fff]/50 z-10 rounded-3xl" />
|
||||||
|
)}
|
||||||
<FormBox title={t("lockerStatus")}>
|
<FormBox title={t("lockerStatus")}>
|
||||||
<FieldsWrapper>{formFields.map(renderField)}</FieldsWrapper>
|
<FieldsWrapper>
|
||||||
|
{formFields.map(renderField)}
|
||||||
|
</FieldsWrapper>
|
||||||
<Button text={t("submit")} onClick={handleSubmit} />
|
<Button text={t("submit")} onClick={handleSubmit} />
|
||||||
</FormBox>
|
</FormBox>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user