Recurring invoices

This commit is contained in:
Hillel Coren 2020-09-17 17:38:55 +03:00
parent da2b91ebdf
commit de1f2ab18a
3 changed files with 40 additions and 1 deletions

View File

@ -169,7 +169,8 @@ abstract class InvoiceEntity extends Object
lastSentDate: '', lastSentDate: '',
nextSendDate: '', nextSendDate: '',
frequencyId: kFrequencyMonthly, frequencyId: kFrequencyMonthly,
remainingCycles: 0, remainingCycles: -1,
dueDateDays: '',
); );
} }

View File

@ -270,6 +270,29 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
.toList() .toList()
], ],
), ),
AppDropdownButton<String>(
labelText: localization.dueDate,
value: invoice.dueDateDays ?? '',
onChanged: (dynamic value) => viewModel.onChanged(
invoice.rebuild((b) => b..dueDateDays = value)),
items: [
DropdownMenuItem(
child: Text(localization.usePaymentTerms),
value: 'terms',
),
...List<int>.generate(31, (i) => i + 1)
.map((value) => DropdownMenuItem(
child: Text(value == 1
? localization.firstDayOfTheMonth
: value == 31
? localization.lastDayOfTheMonth
: localization.dayCount.replaceFirst(
':count', '$value')),
value: '$value',
))
.toList()
],
),
] else ...[ ] else ...[
DatePicker( DatePicker(
validator: (String val) => val.trim().isEmpty validator: (String val) => val.trim().isEmpty

View File

@ -15,6 +15,10 @@ 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
'day_count': 'Day :count',
'first_day_of_the_month': 'First Day of the Month',
'last_day_of_the_month': 'Last Day of the Month',
'use_payment_terms': 'Use Payment Terms',
'endless': 'Endless', 'endless': 'Endless',
'next_send_date': 'Next Send Date', 'next_send_date': 'Next Send Date',
'remaining_cycles': 'Remaining Cycles', 'remaining_cycles': 'Remaining Cycles',
@ -4545,6 +4549,17 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get endless => _localizedValues[localeCode]['endless'] ?? ''; String get endless => _localizedValues[localeCode]['endless'] ?? '';
String get usePaymentTerms =>
_localizedValues[localeCode]['use_payment_terms'] ?? '';
String get firstDayOfTheMonth =>
_localizedValues[localeCode]['first_day_of_the_month'] ?? '';
String get lastDayOfTheMonth =>
_localizedValues[localeCode]['last_day_of_the_month'] ?? '';
String get dayCount => _localizedValues[localeCode]['day_count'] ?? '';
String lookup(String key) { String lookup(String key) {
final lookupKey = toSnakeCase(key); final lookupKey = toSnakeCase(key);