98 lines
3.6 KiB
JavaScript
98 lines
3.6 KiB
JavaScript
import { jsxs, jsx } from "react/jsx-runtime";
|
|
import { B as Button } from "./index-CY6fYws-.js";
|
|
import { I as Input } from "./input-DfkIsvXR.js";
|
|
import { L as Label } from "./label-DrpjkvJN.js";
|
|
import { A as AppLayout, d as dashboard } from "./app-layout-BFyUFda2.js";
|
|
import { useForm, Head } from "@inertiajs/react";
|
|
import FilePondPluginImageExifOrientation from "filepond-plugin-image-exif-orientation";
|
|
import FilePondPluginImagePreview from "filepond-plugin-image-preview";
|
|
/* empty css */
|
|
import { registerPlugin } from "react-filepond";
|
|
import { toast } from "sonner";
|
|
import "@radix-ui/react-slot";
|
|
import "class-variance-authority";
|
|
import "clsx";
|
|
import "tailwind-merge";
|
|
import "@radix-ui/react-label";
|
|
import "react";
|
|
import "lucide-react";
|
|
import "./sheet-Bq2cyJmx.js";
|
|
import "@radix-ui/react-dialog";
|
|
import "@radix-ui/react-tooltip";
|
|
import "@radix-ui/react-dropdown-menu";
|
|
import "@radix-ui/react-avatar";
|
|
import "./app-logo-icon-kpljnLMz.js";
|
|
registerPlugin(FilePondPluginImageExifOrientation, FilePondPluginImagePreview);
|
|
function FaqAdd() {
|
|
const { data, setData, post, processing, errors, wasSuccessful } = useForm({
|
|
question: "",
|
|
answer: ""
|
|
});
|
|
const handleSubmit = (e) => {
|
|
e.preventDefault();
|
|
post(dashboard.faq.addFaq().url, {
|
|
forceFormData: true
|
|
});
|
|
if (wasSuccessful) {
|
|
toast.success("Product added successfully");
|
|
}
|
|
};
|
|
return /* @__PURE__ */ jsxs(AppLayout, { children: [
|
|
/* @__PURE__ */ jsx(Head, { title: "Add FAQ Questions" }),
|
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-8 px-8 py-8", children: [
|
|
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold tracking-tight", children: "Add FAQ Questions" }),
|
|
/* @__PURE__ */ jsxs(
|
|
"form",
|
|
{
|
|
onSubmit: handleSubmit,
|
|
method: "POST",
|
|
encType: "multipart/formdata",
|
|
className: "flex flex-col items-start gap-4",
|
|
children: [
|
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
|
|
/* @__PURE__ */ jsx(Label, { htmlFor: "question", children: "Question" }),
|
|
/* @__PURE__ */ jsx(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
id: "question",
|
|
value: data.question,
|
|
onChange: (e) => setData("question", e.target.value),
|
|
className: "rounded border p-2"
|
|
}
|
|
),
|
|
errors.question && /* @__PURE__ */ jsx("span", { className: "text-red-600", children: errors.question })
|
|
] }),
|
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
|
|
/* @__PURE__ */ jsx(Label, { htmlFor: "answer", children: "Answer" }),
|
|
/* @__PURE__ */ jsx(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
id: "answer",
|
|
value: data.answer,
|
|
onChange: (e) => setData("answer", e.target.value),
|
|
className: "rounded border p-2"
|
|
}
|
|
),
|
|
errors.answer && /* @__PURE__ */ jsx("span", { className: "text-red-600", children: errors.answer })
|
|
] }),
|
|
/* @__PURE__ */ jsx(
|
|
Button,
|
|
{
|
|
type: "submit",
|
|
disabled: processing,
|
|
className: "cursor-pointer",
|
|
children: processing ? "submitting..." : "Submit"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
}
|
|
export {
|
|
FaqAdd as default
|
|
};
|