✨ feat(imei): Add IMEI related internationalization support and menu items
This commit is contained in:
@@ -28,11 +28,10 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
trigger={t('add')}
|
||||
title={t('createSubscription')}
|
||||
loading={loading}
|
||||
userId={userId}
|
||||
onSubmit={async (values) => {
|
||||
setLoading(true);
|
||||
await createUserSubscribe({
|
||||
user_id: userId,
|
||||
user_id: Number(userId),
|
||||
...values,
|
||||
});
|
||||
toast.success(t('createSuccess'));
|
||||
@@ -121,12 +120,11 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
trigger={t('edit')}
|
||||
title={t('editSubscription')}
|
||||
loading={loading}
|
||||
userId={userId}
|
||||
initialData={row}
|
||||
onSubmit={async (values) => {
|
||||
setLoading(true);
|
||||
await updateUserSubscribe({
|
||||
user_id: userId,
|
||||
user_id: Number(userId),
|
||||
user_subscribe_id: row.id,
|
||||
...values,
|
||||
});
|
||||
|
||||
@@ -35,7 +35,6 @@ interface Props {
|
||||
trigger: ReactNode;
|
||||
title: string;
|
||||
loading?: boolean;
|
||||
userId: number;
|
||||
initialData?: API.UserSubscribe;
|
||||
onSubmit: (values: any) => Promise<boolean>;
|
||||
}
|
||||
@@ -48,21 +47,13 @@ const formSchema = z.object({
|
||||
expired_at: z.number().nullish().optional(),
|
||||
});
|
||||
|
||||
export function SubscriptionForm({
|
||||
trigger,
|
||||
title,
|
||||
loading,
|
||||
userId,
|
||||
initialData,
|
||||
onSubmit,
|
||||
}: Props) {
|
||||
export function SubscriptionForm({ trigger, title, loading, initialData, onSubmit }: Props) {
|
||||
const t = useTranslations('user');
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const form = useForm({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
user_id: userId,
|
||||
subscribe_id: initialData?.subscribe_id || 0,
|
||||
traffic: initialData?.traffic || 0,
|
||||
upload: initialData?.upload || 0,
|
||||
|
||||
@@ -80,11 +80,7 @@ export default function Page() {
|
||||
const method = row.original.auth_methods?.[0];
|
||||
return (
|
||||
<div>
|
||||
<Badge
|
||||
variant={method?.verified ? 'default' : 'destructive'}
|
||||
className='mr-1 uppercase'
|
||||
title={method?.verified ? t('verified') : ''}
|
||||
>
|
||||
<Badge className='mr-1 uppercase' title={method?.verified ? t('verified') : ''}>
|
||||
{method?.auth_type}
|
||||
</Badge>
|
||||
{method?.auth_identifier}
|
||||
|
||||
Reference in New Issue
Block a user