Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+12
-4
@@ -24,7 +24,7 @@ import OrderListButtons from "~/components/ui/sort/OrderListButtons";
|
||||
import InputText from "~/components/ui/input/InputText";
|
||||
import PlanFeatureDescription from "~/components/core/settings/subscription/PlanFeatureDescription";
|
||||
import LoadingButton from "~/components/ui/buttons/LoadingButton";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import SlideOverWideEmpty from "~/components/ui/slideOvers/SlideOverWideEmpty";
|
||||
import ButtonSecondary from "~/components/ui/buttons/ButtonSecondary";
|
||||
import InputCombobox from "~/components/ui/input/InputCombobox";
|
||||
@@ -39,6 +39,7 @@ import { clearAllSubscriptionsCache } from "~/utils/services/.server/subscriptio
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { isManagedBillingCatalogProduct } from "~/application/pricing/adminCatalogPolicy";
|
||||
|
||||
export const meta: MetaFunction<typeof loader> = ({ data }) => data?.metatags || [];
|
||||
|
||||
@@ -76,6 +77,9 @@ export const action = async ({ request }: ActionFunctionArgs) => {
|
||||
if (plans.length === 0) {
|
||||
return Response.json({ error: t("admin.pricing.features.errors.noPlansFound") }, { status: 400 });
|
||||
}
|
||||
if (plans.some(isManagedBillingCatalogProduct)) {
|
||||
return Response.json({ error: t("admin.pricing.errors.managedCatalogProduct") }, { status: 400 });
|
||||
}
|
||||
const featuresInPlans = JSON.parse(form.get("features")?.toString() ?? "[]") as SubscriptionFeatureInPlansDto[];
|
||||
await Promise.all(
|
||||
plans.map(async (plan) => {
|
||||
@@ -169,7 +173,8 @@ export default function () {
|
||||
const [items, setItems] = useState<SubscriptionFeatureInPlansDto[]>([]);
|
||||
const [headers, setHeaders] = useState<RowHeaderDisplayDto<SubscriptionFeatureInPlansDto>[]>([]);
|
||||
|
||||
const [selectedPlans, setSelectedPlans] = useState<SubscriptionProductDto[]>(data.items);
|
||||
const editablePlans = data.items.filter((plan) => !isManagedBillingCatalogProduct(plan));
|
||||
const [selectedPlans, setSelectedPlans] = useState<SubscriptionProductDto[]>(editablePlans);
|
||||
|
||||
useEffect(() => {
|
||||
if (actionData?.success) {
|
||||
@@ -472,7 +477,10 @@ export default function () {
|
||||
<div>{t("shared.preview")}</div>
|
||||
</ButtonSecondary>
|
||||
<ButtonSecondary onClick={() => setItems(getInitialItems(selectedPlans))}>{t("shared.reset")}</ButtonSecondary>
|
||||
<LoadingButton disabled={getErrors().length > 0 || !getUserHasPermission(adminData, "admin.pricing.update")} onClick={onSave}>
|
||||
<LoadingButton
|
||||
disabled={selectedPlans.length === 0 || getErrors().length > 0 || !getUserHasPermission(adminData, "admin.pricing.update")}
|
||||
onClick={onSave}
|
||||
>
|
||||
{t("shared.save")}
|
||||
</LoadingButton>
|
||||
</>
|
||||
@@ -488,7 +496,7 @@ export default function () {
|
||||
const ids = e as string[];
|
||||
setSelectedPlans(data.items.filter((p) => ids.includes(p.id ?? "")));
|
||||
}}
|
||||
options={data.items.map((p) => ({ name: t(p.title), value: p.id }))}
|
||||
options={editablePlans.map((p) => ({ name: t(p.title), value: p.id }))}
|
||||
minDisplayCount={4}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user