Skip to content

Commit 33cbaac

Browse files
committed
Email templates
1 parent 51ba055 commit 33cbaac

File tree

3 files changed

+88
-2
lines changed

3 files changed

+88
-2
lines changed

lib/data/models/entities.dart

+15
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ class EntityState extends EnumClass {
5454
static EntityState valueOf(String name) => _$valueOf(name);
5555
}
5656

57+
class EmailTemplate extends EnumClass {
58+
59+
const EmailTemplate._(String name) : super(name);
60+
61+
static Serializer<EmailTemplate> get serializer => _$emailTemplateSerializer;
62+
63+
static const EmailTemplate initial = _$initial;
64+
static const EmailTemplate reminder1 = _$reminder1;
65+
static const EmailTemplate reminder2 = _$reminder2;
66+
static const EmailTemplate reminder3 = _$reminder3;
67+
68+
static BuiltSet<EmailTemplate> get values => _$templateValues;
69+
static EmailTemplate valueOf(String name) => _$templateValueOf(name);
70+
}
71+
5772
abstract class EntityStatus {
5873
int get id;
5974
String get name;

lib/data/models/entities.g.dart

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ui/app/invoice/email_invoice_dialog.dart

+26-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@ class EmailInvoiceView extends StatefulWidget {
1919
}
2020

2121
class _EmailInvoiceViewState extends State<EmailInvoiceView> {
22-
String selectedTemplate = 'First Reminder';
22+
String selectedTemplate;
23+
String emailSubject;
24+
String emailBody;
25+
26+
@override
27+
void didChangeDependencies() {
28+
super.didChangeDependencies();
29+
final localization = AppLocalization.of(context);
30+
final company = widget.viewModel.company;
31+
32+
selectedTemplate = localization.initialEmail;
33+
emailSubject = company.emailSubjectInvoice;
34+
emailBody = company.emailBodyInvoice;
35+
}
2336

2437
Widget _buildSend(BuildContext context) {
2538
final localization = AppLocalization.of(context);
@@ -36,7 +49,17 @@ class _EmailInvoiceViewState extends State<EmailInvoiceView> {
3649
value: selectedTemplate,
3750
onChanged: (value) {
3851
setState(() {
52+
final localization = AppLocalization.of(context);
53+
final company = widget.viewModel.company;
3954
selectedTemplate = value;
55+
56+
switch (value) {
57+
//case const :
58+
}
59+
selectedTemplate = localization.initialEmail;
60+
emailSubject = company.emailSubjectInvoice;
61+
emailBody = company.emailBodyInvoice;
62+
4063
});
4164
},
4265
items: [
@@ -77,7 +100,8 @@ class _EmailInvoiceViewState extends State<EmailInvoiceView> {
77100
child: Container(
78101
color: Colors.white,
79102
child: HtmlView(
80-
data: widget.viewModel.company.emailBodyInvoice,
103+
//data: widget.viewModel.company.emailBodyInvoice,
104+
data: emailBody,
81105
),
82106
),
83107
),

0 commit comments

Comments
 (0)