gitscope
← marzneshin / master / dashboard/src/modules/users/components/dialogs/mutation/fields/data-limit-reset-strategy.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/users/components/dialogs/mutation/fields/data-limit-reset-strategy.tsx · TypeScript
Blame Raw
 1import {
 2    FormControl,
 3    FormField,
 4    FormItem,
 5    FormLabel,
 6    FormMessage,
 7    Select,
 8    SelectTrigger,
 9    SelectContent,
10    SelectItem,
11    SelectValue,
12} from '@marzneshin/common/components';
13import { FC } from 'react'
14import { useFormContext } from 'react-hook-form';
15import { useTranslation } from 'react-i18next';
16
17interface DataLimitResetStrategyFieldProps { }
18
19export const DataLimitResetStrategyField: FC<DataLimitResetStrategyFieldProps> = () => {
20    const { t } = useTranslation()
21    const form = useFormContext()
22    return (
23        <FormField
24            control={form.control}
25            name="data_limit_reset_strategy"
26            render={({ field }) => (
27                <FormItem className="w-full">
28                    <FormLabel>{t('page.users.data_limit_reset_strategy')}</FormLabel>
29                    <Select onValueChange={field.onChange} defaultValue={field.value}>
30                        <FormControl>
31                            <SelectTrigger>
32                                <SelectValue placeholder="Pick a date" />
33                            </SelectTrigger>
34                        </FormControl>
35                        <SelectContent>
36                            <SelectItem value="no_reset">None</SelectItem>
37                            <SelectItem value="day">Daily</SelectItem>
38                            <SelectItem value="week">Weekly</SelectItem>
39                            <SelectItem value="month">Monthly</SelectItem>
40                            <SelectItem value="year">Yearly</SelectItem>
41                        </SelectContent>
42                    </Select>
43                    <FormMessage />
44                </FormItem>
45            )}
46        />
47    );
48}