✨ feat: Add original price display option and enhance inventory messages in subscription components
This commit is contained in:
@@ -69,7 +69,7 @@ export default function SystemVersionCard() {
|
||||
queryFn: async () => {
|
||||
const { data } = await basicCheckServiceVersion(
|
||||
{
|
||||
service_name: "admin",
|
||||
service_name: "admin-web-with-api",
|
||||
secret: moduleConfig!.secret,
|
||||
},
|
||||
{ skipErrorHandler: true }
|
||||
@@ -105,13 +105,13 @@ export default function SystemVersionCard() {
|
||||
setIsUpdatingWeb(true);
|
||||
try {
|
||||
await basicUpdateService({
|
||||
service_name: "admin",
|
||||
service_name: "admin-web-with-api",
|
||||
secret: moduleConfig.secret,
|
||||
});
|
||||
toast.success(t("adminUpdateSuccess", "Admin updated successfully"));
|
||||
|
||||
await basicUpdateService({
|
||||
service_name: "user",
|
||||
service_name: "user-web-with-api",
|
||||
secret: moduleConfig.secret,
|
||||
});
|
||||
toast.success(t("userUpdateSuccess", "User updated successfully"));
|
||||
|
||||
@@ -120,6 +120,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
allow_deduction: z.boolean().optional(),
|
||||
reset_cycle: z.number().optional(),
|
||||
renewal_reset: z.boolean().optional(),
|
||||
show_original_price: z.boolean().optional(),
|
||||
});
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
@@ -444,16 +445,18 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
<FormLabel>{t("form.inventory")}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
min={0}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
placeholder={t("form.noLimit")}
|
||||
placeholder={t("form.unlimitedInventory")}
|
||||
step={1}
|
||||
type="number"
|
||||
value={field.value}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
{t("form.inventoryDescription")}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
@@ -864,6 +867,33 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="show_original_price"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
<FormLabel>
|
||||
{t("form.showOriginalPrice")}
|
||||
</FormLabel>
|
||||
<FormDescription>
|
||||
{t("form.showOriginalPriceDescription")}
|
||||
</FormDescription>
|
||||
</div>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={!!field.value}
|
||||
onCheckedChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
|
||||
@@ -208,15 +208,14 @@ export default function SubscribeTable() {
|
||||
{
|
||||
accessorKey: "inventory",
|
||||
header: t("inventory"),
|
||||
cell: ({ row }) => (
|
||||
<Display
|
||||
type="number"
|
||||
unlimited
|
||||
value={
|
||||
row.getValue("inventory") === -1 ? 0 : row.getValue("inventory")
|
||||
}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }) => {
|
||||
const inventory = row.getValue("inventory") as number;
|
||||
return inventory === -1 ? (
|
||||
t("unlimited")
|
||||
) : (
|
||||
<Display type="number" unlimited value={inventory} />
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "quota",
|
||||
|
||||
Reference in New Issue
Block a user