Timesheet: Update quantity placeholder when duration changes

This commit is contained in:
nathan 2023-03-20 14:55:16 -06:00
parent 59ea901cf9
commit 250beda64e
2 changed files with 22 additions and 6 deletions

View File

@ -192,6 +192,21 @@ class TimesheetApp extends EgwApp
} }
} }
/**
* If editing a timesheet and no quantity is set, update the placeholder text when duration changes
*
* This is for display only
*/
update_quantity(event, widget)
{
const quantity = this.et2.getWidgetById("ts_quantity");
if(quantity)
{
// Duration is in minutes, round to hours with 1 decimal
quantity.placeholder = Math.round(parseInt(widget.value) / 6) / 10;
}
}
/** /**
* Get title in order to set it as document title * Get title in order to set it as document title
* @returns {string} * @returns {string}

View File

@ -137,12 +137,13 @@
<et2-date-timeonly id="start_time"></et2-date-timeonly> <et2-date-timeonly id="start_time"></et2-date-timeonly>
</row> </row>
<row class="row dialogHeader3"> <row class="row dialogHeader3">
<et2-description value="Duration" for="ts_duration"></et2-description> <et2-description value="Duration" for="ts_duration"></et2-description>
<et2-date-duration id="ts_duration" displayFormat="hm"></et2-date-duration> <et2-date-duration id="ts_duration" displayFormat="hm"
<et2-description></et2-description> onchange="app.timesheet.update_quantity"></et2-date-duration>
<et2-description value="or endtime" class="et2_noWrap"></et2-description> <et2-description></et2-description>
<et2-date-timeonly id="end_time"></et2-date-timeonly> <et2-description value="or endtime" class="et2_noWrap"></et2-description>
</row> <et2-date-timeonly id="end_time"></et2-date-timeonly>
</row>
<row> <row>
<et2-tabbox id="tabs" class="et2_nowrap" width="100%" span="all" tabHeight="200"> <et2-tabbox id="tabs" class="et2_nowrap" width="100%" span="all" tabHeight="200">
<tabs> <tabs>