mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
EZQMS-1069: Fix request model (#6131)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
+6
-8
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
// Copyright © 2023 Hardcore Engineering Inc.
|
||||
// Copyright © 2023, 2024 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
|
||||
@@ -17,7 +17,7 @@
|
||||
import { Label, Scroller } from '@hcengineering/ui'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import documents, { DocumentApprovalRequest, DocumentReviewRequest } from '@hcengineering/controlled-documents'
|
||||
import { employeeByIdStore, personAccountByIdStore } from '@hcengineering/contact-resources'
|
||||
import { employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import { Employee, Person, formatName } from '@hcengineering/contact'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
|
||||
@@ -98,13 +98,12 @@
|
||||
|
||||
if (reviewRequest !== undefined) {
|
||||
reviewRequest.approved.forEach((reviewer, idx) => {
|
||||
const rAcc = $personAccountByIdStore.get(reviewer)
|
||||
const date = reviewRequest.approvedDates?.[idx]
|
||||
|
||||
signers.push({
|
||||
id: rAcc?.person,
|
||||
id: reviewer,
|
||||
role: 'reviewer',
|
||||
name: getNameByEmployeeId(rAcc?.person),
|
||||
name: getNameByEmployeeId(reviewer),
|
||||
date: formatSignatureDate(date ?? reviewRequest.modifiedOn)
|
||||
})
|
||||
})
|
||||
@@ -112,13 +111,12 @@
|
||||
|
||||
if (approvalRequest !== undefined) {
|
||||
approvalRequest.approved.forEach((approver, idx) => {
|
||||
const aAcc = $personAccountByIdStore.get(approver)
|
||||
const date = approvalRequest.approvedDates?.[idx]
|
||||
|
||||
signers.push({
|
||||
id: aAcc?.person,
|
||||
id: approver,
|
||||
role: 'approver',
|
||||
name: getNameByEmployeeId(aAcc?.person),
|
||||
name: getNameByEmployeeId(approver),
|
||||
date: formatSignatureDate(date ?? approvalRequest.modifiedOn)
|
||||
})
|
||||
})
|
||||
|
||||
+6
-10
@@ -2,8 +2,8 @@
|
||||
import { slide } from 'svelte/transition'
|
||||
import documents, { DocumentRequest } from '@hcengineering/controlled-documents'
|
||||
import chunter from '@hcengineering/chunter'
|
||||
import { type Person, type PersonAccount } from '@hcengineering/contact'
|
||||
import { PersonAccountRefPresenter, personAccountByIdStore } from '@hcengineering/contact-resources'
|
||||
import { type Person } from '@hcengineering/contact'
|
||||
import { PersonRefPresenter, personAccountByIdStore } from '@hcengineering/contact-resources'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Chevron, Label, tooltip } from '@hcengineering/ui'
|
||||
@@ -20,7 +20,6 @@
|
||||
export let initiallyExpanded: boolean = false
|
||||
|
||||
interface PersonalApproval {
|
||||
account: Ref<PersonAccount>
|
||||
person?: Ref<Person>
|
||||
approved: 'approved' | 'rejected' | 'cancelled' | 'waiting'
|
||||
timestamp?: number
|
||||
@@ -61,16 +60,14 @@
|
||||
req.rejected !== undefined
|
||||
? [
|
||||
{
|
||||
account: req.rejected,
|
||||
person: accountById.get(req.rejected)?.person,
|
||||
person: req.rejected,
|
||||
approved: 'rejected',
|
||||
timestamp: req.modifiedOn
|
||||
}
|
||||
]
|
||||
: []
|
||||
const approvedBy: PersonalApproval[] = req.approved.map((id, idx) => ({
|
||||
account: id,
|
||||
person: accountById.get(id)?.person,
|
||||
person: id,
|
||||
approved: 'approved',
|
||||
timestamp: req.approvedDates?.[idx] ?? req.modifiedOn
|
||||
}))
|
||||
@@ -79,8 +76,7 @@
|
||||
.filter((p) => !(req?.approved as string[]).includes(p))
|
||||
.map(
|
||||
(id): PersonalApproval => ({
|
||||
account: id,
|
||||
person: accountById.get(id)?.person,
|
||||
person: id,
|
||||
approved: req?.rejected !== undefined ? 'cancelled' : 'waiting'
|
||||
})
|
||||
)
|
||||
@@ -125,7 +121,7 @@
|
||||
<div class="section" transition:slide|local>
|
||||
{#each approvals as approver}
|
||||
<div class="approver">
|
||||
<PersonAccountRefPresenter value={approver.account} avatarSize="x-small" />
|
||||
<PersonRefPresenter value={approver.person} avatarSize="x-small" />
|
||||
{#key approver.timestamp}
|
||||
<!-- For some reason tooltip is not interactive w/o remount -->
|
||||
<span
|
||||
|
||||
Reference in New Issue
Block a user