芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/resources/js/Admin/Pages/PricingPlan/Edit.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({ edited_pricingPlan, currencies }) { const { data, setData, errors, put, processing } = useForm({ name: edited_pricingPlan.name, price: edited_pricingPlan.price, select_currency: edited_pricingPlan.currency_id, plan: edited_pricingPlan.plan, plan_details: edited_pricingPlan.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(); put(route("admin.pricing.plans.update", edited_pricingPlan)); }; return (
Update 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{" "}
+
Update
); }