diff --git a/dashboard/public/locales/en.json b/dashboard/public/locales/en.json index 84469e9..21360a7 100644 --- a/dashboard/public/locales/en.json +++ b/dashboard/public/locales/en.json @@ -105,7 +105,9 @@ "data_limit_reset_strategy": "Data Limit Reset Strategy", "online_at": "Online At", "expire_date": "Expire Date", + "unlimited": "Unlimited", "determined_expire": "Determined", + "expire_method": "Expiration method", "onhold_expire": "On Hold", "on_hold_expire_duration": "On Hold", "on_hold_timeout": "On Hold Timeout", diff --git a/dashboard/src/features/users/components/date-field.tsx b/dashboard/src/features/users/components/date-field.tsx index 26da423..7db3077 100644 --- a/dashboard/src/features/users/components/date-field.tsx +++ b/dashboard/src/features/users/components/date-field.tsx @@ -48,7 +48,7 @@ export const DateField: FC = ({ name, label }) => { )} > {field.value ? ( - format(field.value, "PPP") + format(field.value + 'Z', "PPP") ) : ( Pick a date )} diff --git a/dashboard/src/features/users/dialogs/mutation/index.tsx b/dashboard/src/features/users/dialogs/mutation/index.tsx index ed03687..9087c0b 100644 --- a/dashboard/src/features/users/dialogs/mutation/index.tsx +++ b/dashboard/src/features/users/dialogs/mutation/index.tsx @@ -8,7 +8,8 @@ import { Button, Tabs, TabsTrigger, - TabsContent + TabsContent, + FormLabel } from '@marzneshin/components'; import { useTranslation } from 'react-i18next'; import { @@ -70,13 +71,21 @@ export const UsersMutationDialog: FC = ({ }, [services, form]) - const [selectedTab, setSelectedTab] = useState<'determined' | 'onhold' | string>('determined'); + const [selectedTab, setSelectedTab] = useState<'determined' | 'onhold' | 'unlimited' | string>('determined'); useEffect(() => { if (selectedTab === 'onhold') { form.setValue("status", "on_hold") form.setValue("expire", null); form.clearErrors("expire"); + } else if (selectedTab === "unlimited") { + form.setValue("status", "active") + form.setValue("expire", 0); + form.setValue("on_hold_expire_duration", 0); + form.setValue("on_hold_timeout", null); + form.clearErrors("expire"); + form.clearErrors("on_hold_expire_duration"); + form.clearErrors("on_hold_timeout"); } else { form.setValue("status", "active") form.setValue("on_hold_expire_duration", 0); @@ -88,7 +97,7 @@ export const UsersMutationDialog: FC = ({ return ( - + {entity @@ -105,6 +114,9 @@ export const UsersMutationDialog: FC = ({ {form.watch().data_limit !== 0 && } + + {t('page.users.expire_method')} + = ({ value="onhold"> {t('page.users.onhold_expire')} + + {t('page.users.unlimited')} +