芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/resources/js/Admin/Pages/PricingPlan/Create.jsx
import AdminLayouts from "@/Admin/Layouts/AdminLayouts"; import TextInput from "@/Admin/Components/Inputs/TextInput.jsx"; import { useForm, Head } from "@inertiajs/react"; import { IonIcon } from "@ionic/react"; import { closeOutline } from "ionicons/icons"; import FromValidationError from "@/Admin/Components/Validation/FromValidationError"; export default function Create({ currencies }) { const { data, setData, errors, post, processing } = useForm({ name: "", price: "", select_currency: "", plan: "", plan_details: [], }); // handle add new feature const addNewFeature = () => { const currentFeature = [...data.plan_details, ""]; setData("plan_details", currentFeature); } // remove feature const removeFeature = (index) => { const deletedFeature = [...data.plan_details]; deletedFeature.splice(index, 1); setData("plan_details", deletedFeature); } // handle publish const handlePublish = (e) => { e.preventDefault(); post(route("admin.pricing.plans.store")); }; return (
Create Pricing Plan
Pricing Plan Details
setData("name", e.target.value) } />
setData("price", e.target.value) } />
setData( "select_currency", e.target.value ) } >
Select Currency
{currencies.map((currency, index) => (
{currency.name}{" "}({" "}{currency.code}{" "})
))}
setData( "plan", e.target.value ) } value={data.plan} >
Select plan
Monthly
Yearly
Plan details:
{data.plan_details.map((item, fIndex) => (
{ let currentFeature = [...data.plan_details]; currentFeature[fIndex] = e.target.value; setData("plan_details", currentFeature); }} value={item}/>
removeFeature(fIndex)}>
))}
Add new{" "}
+
Submit
); }