Mock data
This commit is contained in:
parent
33edf51460
commit
350e11c310
|
|
@ -36,7 +36,8 @@ abstract class ProjectItemResponse
|
||||||
|
|
||||||
class ProjectFields {
|
class ProjectFields {
|
||||||
static const String name = 'name';
|
static const String name = 'name';
|
||||||
static const String clientId = 'clientAt';
|
static const String clientId = 'clientId';
|
||||||
|
static const String client = 'client';
|
||||||
static const String taskRate = 'taskRate';
|
static const String taskRate = 'taskRate';
|
||||||
static const String dueDate = 'due_date';
|
static const String dueDate = 'due_date';
|
||||||
static const String privateNotes = 'privateNotes';
|
static const String privateNotes = 'privateNotes';
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ class TaskFields {
|
||||||
static const String description = 'description';
|
static const String description = 'description';
|
||||||
static const String duration = 'duration';
|
static const String duration = 'duration';
|
||||||
static const String invoiceId = 'invoiceId';
|
static const String invoiceId = 'invoiceId';
|
||||||
|
static const String client = 'client';
|
||||||
static const String clientId = 'clientId';
|
static const String clientId = 'clientId';
|
||||||
|
static const String project = 'project';
|
||||||
static const String projectId = 'projectId';
|
static const String projectId = 'projectId';
|
||||||
static const String timeLog = 'timeLog';
|
static const String timeLog = 'timeLog';
|
||||||
static const String isRunning = 'isRunning';
|
static const String isRunning = 'isRunning';
|
||||||
|
|
|
||||||
|
|
@ -221,12 +221,14 @@ class MenuDrawer extends StatelessWidget {
|
||||||
icon: getEntityIcon(EntityType.payment),
|
icon: getEntityIcon(EntityType.payment),
|
||||||
title: localization.payments,
|
title: localization.payments,
|
||||||
),
|
),
|
||||||
DrawerTile(
|
// TODO remove this
|
||||||
company: company,
|
if (!Config.DEMO_MODE)
|
||||||
entityType: EntityType.quote,
|
DrawerTile(
|
||||||
icon: getEntityIcon(EntityType.quote),
|
company: company,
|
||||||
title: localization.quotes,
|
entityType: EntityType.quote,
|
||||||
),
|
icon: getEntityIcon(EntityType.quote),
|
||||||
|
title: localization.quotes,
|
||||||
|
),
|
||||||
DrawerTile(
|
DrawerTile(
|
||||||
company: company,
|
company: company,
|
||||||
entityType: EntityType.project,
|
entityType: EntityType.project,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
|
|
||||||
class ProjectPresenter extends EntityPresenter {
|
class ProjectPresenter extends EntityPresenter {
|
||||||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||||
return [
|
return [
|
||||||
ProjectFields.name,
|
ProjectFields.name,
|
||||||
|
ProjectFields.client,
|
||||||
|
ProjectFields.taskRate,
|
||||||
|
ProjectFields.dueDate,
|
||||||
|
ProjectFields.privateNotes,
|
||||||
|
ProjectFields.budgetedHours,
|
||||||
EntityFields.state,
|
EntityFields.state,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -13,10 +21,22 @@ class ProjectPresenter extends EntityPresenter {
|
||||||
@override
|
@override
|
||||||
Widget getField({String field, BuildContext context}) {
|
Widget getField({String field, BuildContext context}) {
|
||||||
final project = entity as ProjectEntity;
|
final project = entity as ProjectEntity;
|
||||||
|
final state = StoreProvider.of<AppState>(context).state;
|
||||||
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case ProjectFields.name:
|
case ProjectFields.name:
|
||||||
return Text(project.name);
|
return Text(project.name);
|
||||||
|
case ProjectFields.client:
|
||||||
|
return Text(state.clientState.map[project.clientId] ?? '');
|
||||||
|
case ProjectFields.taskRate:
|
||||||
|
return Text(formatNumber(project.taskRate, context));
|
||||||
|
case ProjectFields.dueDate:
|
||||||
|
return Text(formatDate(project.dueDate, context));
|
||||||
|
case ProjectFields.privateNotes:
|
||||||
|
return Text(project.privateNotes);
|
||||||
|
case ProjectFields.budgetedHours:
|
||||||
|
return Text(formatNumber(project.budgetedHours, context,
|
||||||
|
formatNumberType: FormatNumberType.double));
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getField(field: field, context: context);
|
return super.getField(field: field, context: context);
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,36 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/task_model.dart';
|
import 'package:invoiceninja_flutter/data/models/task_model.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
|
|
||||||
class TaskPresenter extends EntityPresenter {
|
class TaskPresenter extends EntityPresenter {
|
||||||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||||
return [
|
return [
|
||||||
|
TaskFields.client,
|
||||||
|
TaskFields.project,
|
||||||
TaskFields.description,
|
TaskFields.description,
|
||||||
|
TaskFields.duration,
|
||||||
EntityFields.state,
|
EntityFields.state,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget getField({String field, BuildContext context}) {
|
Widget getField({String field, BuildContext context}) {
|
||||||
|
final state = StoreProvider.of<AppState>(context).state;
|
||||||
final task = entity as TaskEntity;
|
final task = entity as TaskEntity;
|
||||||
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
|
case TaskFields.client:
|
||||||
|
return Text(state.clientState.map[task.clientId] ?? '');
|
||||||
|
case TaskFields.project:
|
||||||
|
return Text(state.productState.map[task.projectId] ?? '');
|
||||||
case TaskFields.description:
|
case TaskFields.description:
|
||||||
return Text(task.description);
|
return Text(task.description);
|
||||||
|
case TaskFields.duration:
|
||||||
|
return Text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getField(field: field, context: context);
|
return super.getField(field: field, context: context);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue