Better formatting for total hours table in the modal. Include the project identifier in the total hour computation.
This commit is contained in:
parent
fea2964395
commit
6498a181c8
2 changed files with 9 additions and 11 deletions
|
|
@ -21,8 +21,9 @@ type Entry struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Project struct {
|
type Project struct {
|
||||||
Id string
|
Id string
|
||||||
Name string
|
Identifier string
|
||||||
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -75,7 +76,7 @@ func main() {
|
||||||
projects_map = make(map[string]string)
|
projects_map = make(map[string]string)
|
||||||
|
|
||||||
for _, e := range projects {
|
for _, e := range projects {
|
||||||
projects_map[e.Id] = e.Name
|
projects_map[e.Id] = fmt.Sprintf("(%s) %s", e.Identifier, e.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hours map[string]float64
|
var hours map[string]float64
|
||||||
|
|
|
||||||
|
|
@ -58,18 +58,15 @@ async function showModalTotalHours() {
|
||||||
<Button label=">" @click="setDate(1)" style="margin-left: 3px;" />
|
<Button label=">" @click="setDate(1)" style="margin-left: 3px;" />
|
||||||
<Button label="total hours" @click="showModalTotalHours" style="margin-left: 20px;" />
|
<Button label="total hours" @click="showModalTotalHours" style="margin-left: 20px;" />
|
||||||
<Dialog v-model:visible="modalTotalHours.visible" modal header="Total hours">
|
<Dialog v-model:visible="modalTotalHours.visible" modal header="Total hours">
|
||||||
<table>
|
<table style="width: 100%; border-collapse: collapse; border: 1px solid #ccc; font-family: Arial, sans-serif; font-size: 14px;">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="project in Object.keys(modalTotalHours.hours)">
|
<tr v-for="project in Object.keys(modalTotalHours.hours)">
|
||||||
<td>{{ project }}</td>
|
<td style="border: 1px solid #ccc; padding: 8px;">{{ project }}</td>
|
||||||
<td>{{ modalTotalHours.hours[project] }}</td>
|
<td style="border: 1px solid #ccc; padding: 8px;">{{ modalTotalHours.hours[project] }}</td>
|
||||||
</tr>
|
|
||||||
<tr v-if="modalTotalHours.total > 0">
|
|
||||||
<td colspan="2"><hr /></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total hours</td>
|
<td style="border: 1px solid #ccc; padding: 8px; background: #f4f4f4; font-weight: bold;">Total hours</td>
|
||||||
<td>{{ modalTotalHours.total }}</td>
|
<td style="border: 1px solid #ccc; padding: 8px; background: #f4f4f4; font-weight: bold;">{{ modalTotalHours.total }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue