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
* @returns {string}

View File

@ -138,7 +138,8 @@
</row>
<row class="row dialogHeader3">
<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"
onchange="app.timesheet.update_quantity"></et2-date-duration>
<et2-description></et2-description>
<et2-description value="or endtime" class="et2_noWrap"></et2-description>
<et2-date-timeonly id="end_time"></et2-date-timeonly>