Schedules

This commit is contained in:
Hillel Coren 2023-02-15 16:33:42 +02:00
parent 6ca9b429fe
commit b875b4cb16
3 changed files with 26 additions and 1 deletions

View File

@ -796,6 +796,12 @@ const kMonthsOfTheYear = {
const kFrequencyMonthly = '5'; const kFrequencyMonthly = '5';
const kScheduleTemplates = {
kSchduleEmailStatement: 'email_statement',
};
const kSchduleEmailStatement = 'client_statement';
const kFrequencies = { const kFrequencies = {
'1': 'freq_daily', '1': 'freq_daily',
'2': 'freq_weekly', '2': 'freq_weekly',

View File

@ -104,11 +104,24 @@ class _ScheduleEditState extends State<ScheduleEdit> {
validator: (value) => validator: (value) =>
value.isEmpty ? localization.pleaseEnterAName : null, value.isEmpty ? localization.pleaseEnterAName : null,
), ),
AppDropdownButton<String>(
labelText: localization.template,
value: schedule.template,
onChanged: (dynamic value) {
viewModel.onChanged(
schedule.rebuild((b) => b..template = value));
},
items: kScheduleTemplates.entries
.map((entry) => DropdownMenuItem(
value: entry.key,
child: Text(localization.lookup(entry.value)),
))
.toList()),
AppDropdownButton<String>( AppDropdownButton<String>(
labelText: localization.frequency, labelText: localization.frequency,
value: schedule.template,
showBlank: true, showBlank: true,
blankLabel: localization.once, blankLabel: localization.once,
value: schedule.frequencyId,
onChanged: (dynamic value) { onChanged: (dynamic value) {
viewModel.onChanged( viewModel.onChanged(
schedule.rebuild((b) => b..frequencyId = value)); schedule.rebuild((b) => b..frequencyId = value));

View File

@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = { static final Map<String, Map<String, String>> _localizedValues = {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'email_statement': 'Email Statement',
'once': 'Once', 'once': 'Once',
'schedule': 'Schedule', 'schedule': 'Schedule',
'schedules': 'Schedules', 'schedules': 'Schedules',
@ -94509,6 +94510,11 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['once'] ?? _localizedValues[localeCode]['once'] ??
_localizedValues['en']['once']; _localizedValues['en']['once'];
String get emailStatement =>
_localizedValues[localeCode]['email_statement'] ??
_localizedValues['en']['email_statement'];
// STARTER: lang field - do not remove comment // STARTER: lang field - do not remove comment
String lookup(String key) { String lookup(String key) {