Tasks
This commit is contained in:
parent
8d409b7faf
commit
1a3914bb69
|
|
@ -63,12 +63,20 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
|
|||
} else {
|
||||
var item = (entity as ConvertToInvoiceItem).asInvoiceItem;
|
||||
if (entity.entityType == EntityType.task) {
|
||||
final project = state.projectState.map[(entity as TaskEntity).projectId];
|
||||
var notes = item.notes;
|
||||
final task = entity as TaskEntity;
|
||||
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
|
||||
..notes = notes
|
||||
..cost = taskRateSelector(company: state.selectedCompany, project: project)
|
||||
);
|
||||
..notes = notes
|
||||
..cost = taskRateSelector(
|
||||
company: state.selectedCompany, project: project));
|
||||
}
|
||||
items.add(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ String formatDateRange(String startDate, String endDate, 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) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -248,7 +248,9 @@ String formatDate(String value, BuildContext context,
|
|||
if (showTime) {
|
||||
String format;
|
||||
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 {
|
||||
final dateFormats = state.staticState.datetimeFormatMap;
|
||||
final dateFormatId = company.datetimeFormatId > 0
|
||||
|
|
@ -256,7 +258,9 @@ String formatDate(String value, BuildContext context,
|
|||
: kDefaultDateTimeFormat;
|
||||
format = dateFormats[dateFormatId].format;
|
||||
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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue