Tasks
This commit is contained in:
parent
07ac06fb31
commit
a9d70c4172
|
|
@ -77,6 +77,44 @@ double taskRateSelector({CompanyEntity company, ProjectEntity project}) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var memoizedTaskStatsForClient = memo4((int clientId,
|
||||||
|
BuiltMap<int, TaskEntity> taskMap,
|
||||||
|
String activeLabel,
|
||||||
|
String archivedLabel) =>
|
||||||
|
taskStatsForClient(clientId, taskMap, activeLabel, archivedLabel));
|
||||||
|
|
||||||
|
String taskStatsForClient(
|
||||||
|
int clientId,
|
||||||
|
BuiltMap<int, TaskEntity> taskMap,
|
||||||
|
String activeLabel,
|
||||||
|
String archivedLabel) {
|
||||||
|
int countActive = 0;
|
||||||
|
int countArchived = 0;
|
||||||
|
taskMap.forEach((taskId, task) {
|
||||||
|
if (task.clientId == clientId) {
|
||||||
|
if (task.isActive) {
|
||||||
|
countActive++;
|
||||||
|
} else if (task.isArchived) {
|
||||||
|
countArchived++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
String str = '';
|
||||||
|
if (countActive > 0) {
|
||||||
|
str = '$countActive $activeLabel';
|
||||||
|
if (countArchived > 0) {
|
||||||
|
str += ' • ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (countArchived > 0) {
|
||||||
|
str += '$countArchived $archivedLabel';
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var memoizedTaskStatsForProject = memo4((int projectId,
|
var memoizedTaskStatsForProject = memo4((int projectId,
|
||||||
BuiltMap<int, TaskEntity> taskMap,
|
BuiltMap<int, TaskEntity> taskMap,
|
||||||
String activeLabel,
|
String activeLabel,
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/project/project_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/project/project_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/task/task_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/quote/quote_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/quote/quote_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/client/view/client_view_vm.dart';
|
import 'package:invoiceninja_flutter/ui/client/view/client_view_vm.dart';
|
||||||
|
|
@ -114,6 +115,19 @@ class ClientOverview extends StatelessWidget {
|
||||||
localization.archived),
|
localization.archived),
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
|
company.isModuleEnabled(EntityType.task)
|
||||||
|
? EntityListTile(
|
||||||
|
icon: getEntityIcon(EntityType.task),
|
||||||
|
title: localization.tasks,
|
||||||
|
onTap: () =>
|
||||||
|
viewModel.onEntityPressed(context, EntityType.task),
|
||||||
|
subtitle: memoizedTaskStatsForClient(
|
||||||
|
client.id,
|
||||||
|
state.taskState.map,
|
||||||
|
localization.active,
|
||||||
|
localization.archived),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
|
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
|
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/client/client_screen.dart';
|
import 'package:invoiceninja_flutter/ui/client/client_screen.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||||
|
|
@ -105,6 +106,11 @@ class ClientViewVM {
|
||||||
entityId: client.id, entityType: EntityType.client));
|
entityId: client.id, entityType: EntityType.client));
|
||||||
store.dispatch(ViewProjectList(context));
|
store.dispatch(ViewProjectList(context));
|
||||||
break;
|
break;
|
||||||
|
case EntityType.task:
|
||||||
|
store.dispatch(FilterTasksByEntity(
|
||||||
|
entityId: client.id, entityType: EntityType.client));
|
||||||
|
store.dispatch(ViewTaskList(context));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRefreshed: (context, loadActivities) =>
|
onRefreshed: (context, loadActivities) =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue