Tasks
This commit is contained in:
parent
8d409b7faf
commit
1a3914bb69
|
|
@ -63,12 +63,20 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
|
||||||
} else {
|
} else {
|
||||||
var item = (entity as ConvertToInvoiceItem).asInvoiceItem;
|
var item = (entity as ConvertToInvoiceItem).asInvoiceItem;
|
||||||
if (entity.entityType == EntityType.task) {
|
if (entity.entityType == EntityType.task) {
|
||||||
final project = state.projectState.map[(entity as TaskEntity).projectId];
|
final task = entity as TaskEntity;
|
||||||
var notes = item.notes;
|
final project = state.projectState.map[task.projectId];
|
||||||
|
var notes = item.notes + '\n';
|
||||||
|
task.taskTimes.forEach((time) {
|
||||||
|
final start = formatDate(time.startDate.toIso8601String(), context,
|
||||||
|
showTime: true);
|
||||||
|
final end = formatDate(time.endDate.toIso8601String(), context,
|
||||||
|
showTime: true, showDate: false, showSeconds: false);
|
||||||
|
notes += '\n### $start - $end';
|
||||||
|
});
|
||||||
item = item.rebuild((b) => b
|
item = item.rebuild((b) => b
|
||||||
..notes = notes
|
..notes = notes
|
||||||
..cost = taskRateSelector(company: state.selectedCompany, project: project)
|
..cost = taskRateSelector(
|
||||||
);
|
company: state.selectedCompany, project: project));
|
||||||
}
|
}
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ String formatDateRange(String startDate, String endDate, BuildContext context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String formatDate(String value, BuildContext context,
|
String formatDate(String value, BuildContext context,
|
||||||
{bool showDate = true, bool showTime = false}) {
|
{bool showDate = true, bool showTime = false, bool showSeconds = true}) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +248,9 @@ String formatDate(String value, BuildContext context,
|
||||||
if (showTime) {
|
if (showTime) {
|
||||||
String format;
|
String format;
|
||||||
if (!showDate) {
|
if (!showDate) {
|
||||||
format = company.enableMilitaryTime ? 'H:mm:ss' : 'h:mm:ss a';
|
format = showSeconds
|
||||||
|
? company.enableMilitaryTime ? 'H:mm:ss' : 'h:mm:ss a'
|
||||||
|
: company.enableMilitaryTime ? 'H:mm' : 'h:mm a';
|
||||||
} else {
|
} else {
|
||||||
final dateFormats = state.staticState.datetimeFormatMap;
|
final dateFormats = state.staticState.datetimeFormatMap;
|
||||||
final dateFormatId = company.datetimeFormatId > 0
|
final dateFormatId = company.datetimeFormatId > 0
|
||||||
|
|
@ -256,7 +258,9 @@ String formatDate(String value, BuildContext context,
|
||||||
: kDefaultDateTimeFormat;
|
: kDefaultDateTimeFormat;
|
||||||
format = dateFormats[dateFormatId].format;
|
format = dateFormats[dateFormatId].format;
|
||||||
if (company.enableMilitaryTime) {
|
if (company.enableMilitaryTime) {
|
||||||
format = format.replaceFirst('h:mm:ss a', 'H:mm:ss');
|
format = showSeconds
|
||||||
|
? format.replaceFirst('h:mm:ss a', 'H:mm:ss')
|
||||||
|
: format.replaceFirst('h:mm a', 'H:mm');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final formatter = DateFormat(format, localeSelector(state));
|
final formatter = DateFormat(format, localeSelector(state));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue