Add ‘Refresh Data’ option on cron error popup
This commit is contained in:
parent
e7ab8accae
commit
27898eccd0
|
|
@ -440,14 +440,16 @@ Future handleCreditAction(
|
|||
showMessageDialog(
|
||||
context: context,
|
||||
message: localization.clientEmailNotSet,
|
||||
secondaryAction: FlatButton(
|
||||
secondaryActions: [
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
editEntity(
|
||||
context: context,
|
||||
entity: state.clientState.get(credit.clientId));
|
||||
},
|
||||
child: Text(localization.editClient.toUpperCase())));
|
||||
child: Text(localization.editClient.toUpperCase()))
|
||||
]);
|
||||
return;
|
||||
}
|
||||
if (creditIds.length == 1) {
|
||||
|
|
|
|||
|
|
@ -539,14 +539,16 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
showMessageDialog(
|
||||
context: context,
|
||||
message: localization.clientEmailNotSet,
|
||||
secondaryAction: FlatButton(
|
||||
secondaryActions: [
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
editEntity(
|
||||
context: context,
|
||||
entity: state.clientState.get(invoice.clientId));
|
||||
},
|
||||
child: Text(localization.editClient.toUpperCase())));
|
||||
child: Text(localization.editClient.toUpperCase()))
|
||||
]);
|
||||
return;
|
||||
}
|
||||
if (invoiceIds.length == 1) {
|
||||
|
|
|
|||
|
|
@ -463,14 +463,16 @@ Future handleQuoteAction(
|
|||
showMessageDialog(
|
||||
context: context,
|
||||
message: localization.clientEmailNotSet,
|
||||
secondaryAction: FlatButton(
|
||||
secondaryActions: [
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
editEntity(
|
||||
context: context,
|
||||
entity: state.clientState.get(quote.clientId));
|
||||
},
|
||||
child: Text(localization.editClient.toUpperCase())));
|
||||
child: Text(localization.editClient.toUpperCase()))
|
||||
]);
|
||||
return;
|
||||
}
|
||||
if (quoteIds.length == 1) {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ class MessageDialog extends StatelessWidget {
|
|||
this.onDismiss,
|
||||
this.onDiscard,
|
||||
this.dismissLabel,
|
||||
this.secondaryAction,
|
||||
this.secondaryActions,
|
||||
});
|
||||
|
||||
final String message;
|
||||
final String dismissLabel;
|
||||
final FlatButton secondaryAction;
|
||||
final List<FlatButton> secondaryActions;
|
||||
final Function onDismiss;
|
||||
final Function onDiscard;
|
||||
|
||||
|
|
@ -50,10 +50,14 @@ class MessageDialog extends StatelessWidget {
|
|||
onDiscard();
|
||||
}),
|
||||
),
|
||||
if (secondaryAction != null)
|
||||
Padding(
|
||||
if (secondaryActions != null)
|
||||
Row(
|
||||
children: secondaryActions
|
||||
.map((action) => Padding(
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
child: secondaryAction,
|
||||
child: action,
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ class SidebarFooter extends StatelessWidget {
|
|||
Expanded(child: SizedBox())
|
||||
] else ...[
|
||||
if (!Config.DEMO_MODE && !state.isDemo)
|
||||
if (!account.isCronEnabled)
|
||||
if (true || !account.isCronEnabled)
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.warning,
|
||||
|
|
@ -510,14 +510,22 @@ class SidebarFooter extends StatelessWidget {
|
|||
onPressed: () => showMessageDialog(
|
||||
context: context,
|
||||
message: localization.cronsNotEnabled,
|
||||
secondaryAction: FlatButton(
|
||||
secondaryActions: [
|
||||
FlatButton(
|
||||
child: Text(localization.learnMore.toUpperCase()),
|
||||
onPressed: () {
|
||||
launch(kCronsHelpUrl,
|
||||
forceSafariVC: false, forceWebView: false);
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(localization.refreshData.toUpperCase()),
|
||||
onPressed: () {
|
||||
store.dispatch(RefreshData());
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
]),
|
||||
)
|
||||
else if (state.credentials.token.isEmpty)
|
||||
IconButton(
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ void showErrorDialog({
|
|||
void showMessageDialog({
|
||||
@required BuildContext context,
|
||||
@required String message,
|
||||
FlatButton secondaryAction,
|
||||
List<FlatButton> secondaryActions,
|
||||
}) {
|
||||
showDialog<MessageDialog>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return MessageDialog(
|
||||
message,
|
||||
secondaryAction: secondaryAction,
|
||||
secondaryActions: secondaryActions,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue