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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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