Some estimation reporting fixes (#2265)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-08-30 17:11:46 +07:00 committed by GitHub
parent ff0258c7e1
commit 43b59c9fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 99 additions and 53 deletions

View File

@ -485,6 +485,7 @@ input.search {
.h-14 { height: 3.5rem; }
.h-16 { height: 4rem; }
.h-18 { height: 4.5rem; }
.h-50 { height: 12.5rem; }
.w-full { width: 100%; }
.w-2 { width: .5rem; }
.w-9 { width: 2.25rem; }
@ -504,6 +505,7 @@ input.search {
.min-h-0 { min-height: 0; }
.min-h-7 { min-height: 1.75rem; }
.max-h-125 { max-height: 31.25rem; }
.max-h-30 { max-height: 7.5rem; }
.max-h-60 { max-height: 15rem; }
.max-w-60 { max-width: 15rem; }
.max-w-240 { max-width: 60rem; }

View File

@ -147,7 +147,6 @@
.small {
height: 1.5rem;
font-size: 0.75rem;
line-height: 0.75rem;
&.only-icon {
width: 1.5rem;
}

View File

@ -201,7 +201,7 @@
"Estimation": "Estimation",
"ReportedTime": "Reported Time",
"TimeSpendReports": "Time spend reports",
"TimeSpendReport": "Time spend report",
"TimeSpendReport": "Time",
"TimeSpendReportAdd": "Add time report",
"TimeSpendReportDate": "Date",
"TimeSpendReportValue": "Reported time",

View File

@ -201,7 +201,7 @@
"Estimation": "Оценка",
"ReportedTime": "Использовано",
"TimeSpendReports": "Отчеты по времени",
"TimeSpendReport": "Отчет по времени",
"TimeSpendReport": "Время",
"TimeSpendReportAdd": "Добавить завтраченное время",
"TimeSpendReportDate": "Дата",
"TimeSpendReportValue": "Затраченное время",

View File

@ -16,10 +16,12 @@
import type { Issue } from '@anticrm/tracker'
export let value: Issue | undefined
export let maxWidth = ''
</script>
{#if value}
<div class="root">
<div class="root" style:max-width={maxWidth}>
<span class="names">
{#each value.parents as parentInfo}
<span class="name">{parentInfo.parentTitle}</span>

View File

@ -24,6 +24,7 @@
import tracker from '../../../plugin'
import IssuePresenter from '../IssuePresenter.svelte'
import ParentNamesPresenter from '../ParentNamesPresenter.svelte'
import EstimationPresenter from './EstimationPresenter.svelte'
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
export let value: string | number | undefined
@ -73,32 +74,45 @@
</div>
</div>
<Label label={tracker.string.ChildEstimation} />:
<Scroller tableFade>
<TableBrowser
showFilterBar={false}
_class={tracker.class.Issue}
query={{ _id: { $in: childIds } }}
config={['', { key: '$lookup.attachedTo', presenter: ParentNamesPresenter }, 'estimation']}
{options}
/>
</Scroller>
<div class="h-50">
<Scroller tableFade>
<TableBrowser
showFilterBar={false}
_class={tracker.class.Issue}
query={{ _id: { $in: childIds } }}
config={[
'',
{ key: 'estimation', presenter: EstimationPresenter, label: tracker.string.Estimation },
{ key: '', presenter: ParentNamesPresenter, props: { maxWidth: '20rem' }, label: tracker.string.Title }
]}
{options}
/>
</Scroller>
</div>
<Label label={tracker.string.ReportedTime} />:
<Scroller tableFade>
<TableBrowser
_class={tracker.class.TimeSpendReport}
query={{ attachedTo: { $in: [object._id, ...childIds] } }}
showFilterBar={false}
config={[
'$lookup.attachedTo',
{ key: '$lookup.attachedTo', presenter: ParentNamesPresenter },
'',
'$lookup.employee',
'date',
'description'
]}
{options}
/>
</Scroller>
<div class="h-50">
<Scroller tableFade>
<TableBrowser
_class={tracker.class.TimeSpendReport}
query={{ attachedTo: { $in: [object._id, ...childIds] } }}
showFilterBar={false}
config={[
'$lookup.attachedTo',
'',
'$lookup.employee',
{
key: '$lookup.attachedTo',
presenter: ParentNamesPresenter,
props: { maxWidth: '20rem' },
label: tracker.string.Title
},
'date',
'description'
]}
{options}
/>
</Scroller>
</div>
<svelte:fragment slot="buttons">
<Button
icon={IconAdd}
@ -106,7 +120,7 @@
on:click={(event) => {
showPopup(
TimeSpendReportPopup,
{ issueId: object._id, issueClass: object._class, space: object.space },
{ issueId: object._id, issueClass: object._class, space: object.space, assignee: object.assignee },
eventToHTMLElement(event)
)
}}

View File

@ -0,0 +1,20 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
export let value: number
</script>
<span class="lines-limit-2 select-text">{value}d</span>

View File

@ -29,7 +29,7 @@
function addTimeReport (event: MouseEvent): void {
showPopup(
TimeSpendReportPopup,
{ issueId: object._id, issueClass: object._class, space: object.space },
{ issueId: object._id, issueClass: object._class, space: object.space, assignee: object.assignee },
eventToHTMLElement(event)
)
}

View File

@ -21,6 +21,7 @@
import { TableBrowser } from '@anticrm/view-resources'
import tracker from '../../../plugin'
import IssuePresenter from '../IssuePresenter.svelte'
import ParentNamesPresenter from '../ParentNamesPresenter.svelte'
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
export let issue: Issue
@ -36,7 +37,7 @@
function addReport (event: MouseEvent): void {
showPopup(
TimeSpendReportPopup,
{ issueId: issue._id, issueClass: issue._class, space: issue.space },
{ issueId: issue._id, issueClass: issue._class, space: issue.space, assignee: issue.assignee },
eventToHTMLElement(event)
)
}
@ -52,24 +53,29 @@
<svelte:fragment slot="header">
<IssuePresenter value={issue} disableClick />
</svelte:fragment>
<Scroller tableFade>
<TableBrowser
showFilterBar={false}
_class={tracker.class.TimeSpendReport}
query={{ attachedTo: { $in: [issue._id, ...issue.childInfo.map((it) => it.childId)] } }}
config={[
'$lookup.attachedTo',
'$lookup.attachedTo.title',
'',
'$lookup.employee',
'description',
'date',
'modifiedOn',
'modifiedBy'
]}
{options}
/>
</Scroller>
<div class="h-50">
<Scroller tableFade>
<TableBrowser
showFilterBar={false}
_class={tracker.class.TimeSpendReport}
query={{ attachedTo: { $in: [issue._id, ...issue.childInfo.map((it) => it.childId)] } }}
config={[
'$lookup.attachedTo',
'',
'$lookup.employee',
{
key: '$lookup.attachedTo',
presenter: ParentNamesPresenter,
props: { maxWidth: '20rem' },
label: tracker.string.Title
},
'date',
'description'
]}
{options}
/>
</Scroller>
</div>
<svelte:fragment slot="buttons">
<Button icon={IconAdd} size={'large'} on:click={addReport} />
</svelte:fragment>

View File

@ -34,7 +34,7 @@
function editSpendReport (event: MouseEvent): void {
showPopup(
TimeSpendReportPopup,
{ issue: value.attachedTo, issueClass: value.attachedToClass, value: value },
{ issue: value.attachedTo, issueClass: value.attachedToClass, value: value, assignee: value.employee },
eventToHTMLElement(event)
)
}

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import contact from '@anticrm/contact'
import contact, { Employee } from '@anticrm/contact'
import { AttachedData, Class, DocumentUpdate, Ref, Space } from '@anticrm/core'
import type { IntlString } from '@anticrm/platform'
import presentation, { Card, getClient, UserBox } from '@anticrm/presentation'
@ -24,6 +24,7 @@
export let issueId: Ref<Issue>
export let issueClass: Ref<Class<Issue>>
export let space: Ref<Space>
export let assignee: Ref<Employee> | undefined
export let value: TimeSpendReport | undefined
export let placeholder: IntlString = tracker.string.TimeSpendReportValue
@ -37,7 +38,7 @@
date: value?.date ?? Date.now(),
description: value?.description ?? '',
value: value?.value,
employee: value?.employee ?? null
employee: value?.employee ?? assignee ?? null
}
async function create (): Promise<void> {
if (value === undefined) {

View File

@ -562,6 +562,8 @@ export function getSprintDays (value: Sprint): string {
}
export function getDayOfSprint (startDate: number, now: number): number {
startDate = new Date(startDate).setHours(0, 0)
now = new Date(now).setHours(0, 0)
const days = Math.floor(Math.abs((1 + now - startDate) / 1000 / 60 / 60 / 24))
const stDate = new Date(startDate)
const stDateDate = stDate.getDate()