Tasks
This commit is contained in:
parent
db695d929e
commit
3c7da9933b
|
|
@ -102,6 +102,7 @@ class _InvoiceViewState extends State<InvoiceView> {
|
||||||
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
||||||
trailing: Icon(Icons.navigate_next),
|
trailing: Icon(Icons.navigate_next),
|
||||||
onTap: () => viewModel.onClientPressed(context),
|
onTap: () => viewModel.onClientPressed(context),
|
||||||
|
onLongPress: () => viewModel.onClientPressed(context, true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|
@ -125,6 +126,8 @@ class _InvoiceViewState extends State<InvoiceView> {
|
||||||
leading: Icon(FontAwesomeIcons.creditCard, size: 18.0),
|
leading: Icon(FontAwesomeIcons.creditCard, size: 18.0),
|
||||||
trailing: Icon(Icons.navigate_next),
|
trailing: Icon(Icons.navigate_next),
|
||||||
onTap: () => viewModel.onPaymentPressed(context, payment),
|
onTap: () => viewModel.onPaymentPressed(context, payment),
|
||||||
|
onLongPress: () =>
|
||||||
|
viewModel.onPaymentPressed(context, payment, true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ class EntityViewVM {
|
||||||
final bool isDirty;
|
final bool isDirty;
|
||||||
final Function(BuildContext, EntityAction) onActionSelected;
|
final Function(BuildContext, EntityAction) onActionSelected;
|
||||||
final Function(BuildContext, [InvoiceItemEntity]) onEditPressed;
|
final Function(BuildContext, [InvoiceItemEntity]) onEditPressed;
|
||||||
final Function(BuildContext) onClientPressed;
|
final Function(BuildContext, [bool]) onClientPressed;
|
||||||
final Function(BuildContext) onPaymentsPressed;
|
final Function(BuildContext) onPaymentsPressed;
|
||||||
final Function(BuildContext, PaymentEntity) onPaymentPressed;
|
final Function(BuildContext, PaymentEntity, [bool]) onPaymentPressed;
|
||||||
final Function(BuildContext) onRefreshed;
|
final Function(BuildContext) onRefreshed;
|
||||||
final Function onBackPressed;
|
final Function onBackPressed;
|
||||||
|
|
||||||
|
|
@ -94,8 +94,8 @@ class InvoiceViewVM extends EntityViewVM {
|
||||||
bool isDirty,
|
bool isDirty,
|
||||||
Function(BuildContext, EntityAction) onActionSelected,
|
Function(BuildContext, EntityAction) onActionSelected,
|
||||||
Function(BuildContext, [InvoiceItemEntity]) onEditPressed,
|
Function(BuildContext, [InvoiceItemEntity]) onEditPressed,
|
||||||
Function(BuildContext) onClientPressed,
|
Function(BuildContext, [bool]) onClientPressed,
|
||||||
Function(BuildContext, PaymentEntity) onPaymentPressed,
|
Function(BuildContext, PaymentEntity, [bool]) onPaymentPressed,
|
||||||
Function(BuildContext) onPaymentsPressed,
|
Function(BuildContext) onPaymentsPressed,
|
||||||
Function(BuildContext) onRefreshed,
|
Function(BuildContext) onRefreshed,
|
||||||
Function onBackPressed,
|
Function onBackPressed,
|
||||||
|
|
@ -154,10 +154,15 @@ class InvoiceViewVM extends EntityViewVM {
|
||||||
store.dispatch(UpdateCurrentRoute(InvoiceScreen.route));
|
store.dispatch(UpdateCurrentRoute(InvoiceScreen.route));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClientPressed: (BuildContext context) =>
|
onClientPressed: (BuildContext context, [bool longPress = false]) =>
|
||||||
store.dispatch(ViewClient(clientId: client.id, context: context)),
|
store.dispatch(longPress
|
||||||
onPaymentPressed: (BuildContext context, PaymentEntity payment) => store
|
? EditClient(client: client, context: context)
|
||||||
.dispatch(ViewPayment(paymentId: payment.id, context: context)),
|
: ViewClient(clientId: client.id, context: context)),
|
||||||
|
onPaymentPressed: (BuildContext context, PaymentEntity payment,
|
||||||
|
[bool longPress = false]) =>
|
||||||
|
store.dispatch(longPress
|
||||||
|
? EditPayment(payment: payment, context: context)
|
||||||
|
: ViewPayment(paymentId: payment.id, context: context)),
|
||||||
onPaymentsPressed: (BuildContext context) {
|
onPaymentsPressed: (BuildContext context) {
|
||||||
store.dispatch(FilterPaymentsByEntity(
|
store.dispatch(FilterPaymentsByEntity(
|
||||||
entityId: invoice.id, entityType: EntityType.invoice));
|
entityId: invoice.id, entityType: EntityType.invoice));
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
||||||
trailing: Icon(Icons.navigate_next),
|
trailing: Icon(Icons.navigate_next),
|
||||||
onTap: () => viewModel.onTapClient(context),
|
onTap: () => viewModel.onTapClient(context),
|
||||||
|
onLongPress: () => viewModel.onTapClient(context, true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|
@ -116,6 +117,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
leading: Icon(FontAwesomeIcons.filePdf, size: 18.0),
|
leading: Icon(FontAwesomeIcons.filePdf, size: 18.0),
|
||||||
trailing: Icon(Icons.navigate_next),
|
trailing: Icon(Icons.navigate_next),
|
||||||
onTap: () => viewModel.onTapInvoice(context),
|
onTap: () => viewModel.onTapInvoice(context),
|
||||||
|
onLongPress: () => viewModel.onTapInvoice(context, true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,16 @@ class PaymentViewVM {
|
||||||
onEditPressed: (BuildContext context) {
|
onEditPressed: (BuildContext context) {
|
||||||
store.dispatch(EditPayment(payment: payment, context: context));
|
store.dispatch(EditPayment(payment: payment, context: context));
|
||||||
},
|
},
|
||||||
onTapClient: (context) =>
|
onTapClient: (context, [bool longPress = false]) => store.dispatch(
|
||||||
store.dispatch(ViewClient(clientId: client.id, context: context)),
|
longPress
|
||||||
onTapInvoice: (context) => store.dispatch(
|
? EditClient(client: client, context: context)
|
||||||
ViewInvoice(invoiceId: payment.invoiceId, context: context)),
|
: ViewClient(clientId: client.id, context: context)),
|
||||||
|
onTapInvoice: (context, [bool longPress = false]) => store.dispatch(
|
||||||
|
longPress
|
||||||
|
? EditInvoice(
|
||||||
|
invoice: state.invoiceState.map[payment.invoiceId],
|
||||||
|
context: context)
|
||||||
|
: ViewInvoice(invoiceId: payment.invoiceId, context: context)),
|
||||||
onActionSelected: (BuildContext context, EntityAction action) {
|
onActionSelected: (BuildContext context, EntityAction action) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
@ -94,8 +100,8 @@ class PaymentViewVM {
|
||||||
final CompanyEntity company;
|
final CompanyEntity company;
|
||||||
final Function(BuildContext, EntityAction) onActionSelected;
|
final Function(BuildContext, EntityAction) onActionSelected;
|
||||||
final Function(BuildContext) onEditPressed;
|
final Function(BuildContext) onEditPressed;
|
||||||
final Function(BuildContext) onTapInvoice;
|
final Function(BuildContext, [bool]) onTapInvoice;
|
||||||
final Function(BuildContext) onTapClient;
|
final Function(BuildContext, [bool]) onTapClient;
|
||||||
final bool isSaving;
|
final bool isSaving;
|
||||||
final bool isLoading;
|
final bool isLoading;
|
||||||
final bool isDirty;
|
final bool isDirty;
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ class _ProjectViewState extends State<ProjectView> {
|
||||||
value1: formatDuration(
|
value1: formatDuration(
|
||||||
taskDurationForProject(project, viewModel.state.taskState.map)),
|
taskDurationForProject(project, viewModel.state.taskState.map)),
|
||||||
label2: localization.budgeted,
|
label2: localization.budgeted,
|
||||||
value2:
|
value2: formatDuration(Duration(hours: project.budgetedHours.toInt()),
|
||||||
formatDuration(Duration(hours: project.budgetedHours.toInt()), showSeconds: false),
|
showSeconds: false),
|
||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
color: Theme.of(context).canvasColor,
|
color: Theme.of(context).canvasColor,
|
||||||
|
|
@ -78,6 +78,7 @@ class _ProjectViewState extends State<ProjectView> {
|
||||||
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
||||||
trailing: Icon(Icons.navigate_next),
|
trailing: Icon(Icons.navigate_next),
|
||||||
onTap: () => viewModel.onClientPressed(context),
|
onTap: () => viewModel.onClientPressed(context),
|
||||||
|
onLongPress: () => viewModel.onClientPressed(context, true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class ProjectViewVM {
|
||||||
factory ProjectViewVM.fromStore(Store<AppState> store) {
|
factory ProjectViewVM.fromStore(Store<AppState> store) {
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final project = state.projectState.map[state.projectUIState.selectedId];
|
final project = state.projectState.map[state.projectUIState.selectedId];
|
||||||
|
final client = state.clientState.map[project.clientId];
|
||||||
|
|
||||||
Future<Null> _handleRefresh(BuildContext context) {
|
Future<Null> _handleRefresh(BuildContext context) {
|
||||||
final completer = snackBarCompleter(
|
final completer = snackBarCompleter(
|
||||||
|
|
@ -74,8 +75,10 @@ class ProjectViewVM {
|
||||||
store.dispatch(EditProject(project: project, context: context));
|
store.dispatch(EditProject(project: project, context: context));
|
||||||
},
|
},
|
||||||
onRefreshed: (context) => _handleRefresh(context),
|
onRefreshed: (context) => _handleRefresh(context),
|
||||||
onClientPressed: (BuildContext context) => store
|
onClientPressed: (BuildContext context, [bool longPress = false]) =>
|
||||||
.dispatch(ViewClient(clientId: project.clientId, context: context)),
|
store.dispatch(longPress
|
||||||
|
? EditClient(client: client, context: context)
|
||||||
|
: ViewClient(clientId: project.clientId, context: context)),
|
||||||
onTasksPressed: (BuildContext context) {
|
onTasksPressed: (BuildContext context) {
|
||||||
store.dispatch(FilterTasksByEntity(
|
store.dispatch(FilterTasksByEntity(
|
||||||
entityId: project.id, entityType: EntityType.project));
|
entityId: project.id, entityType: EntityType.project));
|
||||||
|
|
@ -120,7 +123,7 @@ class ProjectViewVM {
|
||||||
final CompanyEntity company;
|
final CompanyEntity company;
|
||||||
final Function(BuildContext, EntityAction) onActionSelected;
|
final Function(BuildContext, EntityAction) onActionSelected;
|
||||||
final Function(BuildContext) onEditPressed;
|
final Function(BuildContext) onEditPressed;
|
||||||
final Function(BuildContext) onClientPressed;
|
final Function(BuildContext, [bool]) onClientPressed;
|
||||||
final Function onBackPressed;
|
final Function onBackPressed;
|
||||||
final Function(BuildContext) onAddTaskPressed;
|
final Function(BuildContext) onAddTaskPressed;
|
||||||
final Function(BuildContext) onTasksPressed;
|
final Function(BuildContext) onTasksPressed;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue