lms/bootstrap/ssr/assets/sslcommerz-LWcEncmX.js
2025-12-15 12:26:23 +01:00

111 lines
5.7 KiB
JavaScript

import { jsxs, jsx } from "react/jsx-runtime";
import { I as InputError } from "./input-error-D1JIzedA.js";
import { L as LoadingButton } from "./loading-button-CCIxhJrY.js";
import { S as Switch } from "./switch-ad-BDGs-.js";
import { C as Card } from "./card-B-gBwpxd.js";
import { I as Input } from "./input-BsvJqbcd.js";
import { L as Label } from "./label-0rIIfpX0.js";
import { S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem } from "./select-BYx0MCUK.js";
import { i as sslcommerzCurrency } from "./utils-DLCPGU0v.js";
import { o as onHandleChange } from "./inertia-BtwbgBI3.js";
import { usePage, useForm } from "@inertiajs/react";
import "lucide-react";
import "react";
import "./button-CdJZJLGw.js";
import "@radix-ui/react-slot";
import "class-variance-authority";
import "./switch-CEzDpTwE.js";
import "@radix-ui/react-switch";
import "@radix-ui/react-label";
import "@radix-ui/react-select";
import "clsx";
import "tailwind-merge";
const SSLCommerz = ({ payment }) => {
const { props } = usePage();
const { translate } = props;
const { settings, input, button, common } = translate;
const { data, setData, post, errors, processing } = useForm({
...payment.fields,
type: "sslcommerz"
});
const handleSubmit = (e) => {
e.preventDefault();
post(route("settings.payment.update", { id: payment.id }));
};
return /* @__PURE__ */ jsxs(Card, { className: "p-4 sm:p-6", children: [
/* @__PURE__ */ jsxs("div", { className: "mb-6 flex items-center justify-between", children: [
/* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: settings.sslcommerz_settings }),
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: settings.configure_payment_gateway.replace(":gateway", "SSLCommerz") })
] }),
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
/* @__PURE__ */ jsx(Label, { htmlFor: "status", children: data.active ? common.enabled : common.disabled }),
/* @__PURE__ */ jsx(Switch, { id: "status", checked: data.active, onCheckedChange: (checked) => setData("active", checked) })
] })
] }),
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [
/* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx(Label, { children: input.currency }),
/* @__PURE__ */ jsxs(Select, { value: data.currency, onValueChange: (value) => setData("currency", value), children: [
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: input.currency }) }),
/* @__PURE__ */ jsx(SelectContent, { children: sslcommerzCurrency.map((currency) => /* @__PURE__ */ jsxs(SelectItem, { value: currency.value, children: [
currency.label,
" (",
currency.value,
")"
] }, currency.value)) })
] }),
/* @__PURE__ */ jsx(InputError, { message: errors.currency })
] }),
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
/* @__PURE__ */ jsxs("span", { className: "text-sm font-medium", children: [
settings.test_mode,
":"
] }),
/* @__PURE__ */ jsx(Switch, { id: "status", checked: data.test_mode, onCheckedChange: (checked) => setData("test_mode", checked) }),
/* @__PURE__ */ jsx(Label, { htmlFor: "status", className: "text-gray-500", children: data.test_mode ? settings.using_test_environment : settings.using_live_environment })
] })
] }),
/* @__PURE__ */ jsxs("div", { className: "border-b pb-6", children: [
/* @__PURE__ */ jsx("h3", { className: "mb-4 text-lg font-medium", children: settings.api_credentials }),
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [
/* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx(Label, { children: input.store_id }),
/* @__PURE__ */ jsx(
Input,
{
name: "store_id",
value: data.store_id || "",
onChange: (e) => onHandleChange(e, setData),
placeholder: input.store_id_placeholder
}
),
/* @__PURE__ */ jsx(InputError, { message: errors.store_id }),
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-500", children: data.test_mode ? settings.use_test_mode_key.replace(":key", "store ID") : settings.use_live_mode_key.replace(":key", "store ID") })
] }),
/* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx(Label, { children: input.store_password }),
/* @__PURE__ */ jsx(
Input,
{
name: "store_password",
value: data.store_password || "",
onChange: (e) => onHandleChange(e, setData),
placeholder: input.store_password_placeholder,
type: "password"
}
),
/* @__PURE__ */ jsx(InputError, { message: errors.store_password }),
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-500", children: data.test_mode ? settings.use_test_mode_key.replace(":key", "store password") : settings.use_live_mode_key.replace(":key", "store password") })
] })
] })
] }),
/* @__PURE__ */ jsx(LoadingButton, { loading: processing, type: "submit", className: "w-full", children: button.save_changes })
] })
] });
};
export {
SSLCommerz as default
};