Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions models/process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ export class TApproveRequest extends TProcessToDo implements ApproveRequest {
group!: string

card!: Ref<Card>

@Prop(TypeString(), process.string.ActionType)
actionType?: 'approve' | 'review'
}

@Model(process.class.Method, core.class.Doc, DOMAIN_MODEL)
Expand Down Expand Up @@ -478,7 +481,17 @@ export function createModel (builder: Builder): void {
strict: true
},
config: [
{
key: 'execution',
label: process.string.Process,
presenter: process.component.ExecutionRefPresenter
},
'user',
{
key: 'actionType',
label: process.string.ActionType,
presenter: process.component.ActionTypePresenter
},
{
key: '',
presenter: view.component.GrowPresenter,
Expand All @@ -495,6 +508,10 @@ export function createModel (builder: Builder): void {
process.viewlet.CardRequests
)

builder.mixin(process.class.ApproveRequest, core.class.Class, view.mixin.IgnoreActions, {
actions: [view.action.Delete]
})

builder.createDoc(
view.class.Viewlet,
core.space.Model,
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@
"CancelToDo": "Zrušit akční položku",
"Export": "Exportovat",
"Import": "Importovat",
"CancelProcess": "Zrušit proces"
"CancelProcess": "Zrušit proces",
"SyncWithField": "Synchronizovat s polem",
"ActionType": "Typ",
"ApproveAction": "Schválit",
"ReviewAction": "Zkontrolovat",
"Review": "Zkontrolovat"
},
"error": {
"MethodNotFound": "Metoda nenalezena: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@
"CancelToDo": "Action Item abbrechen",
"Export": "Exportieren",
"Import": "Importieren",
"CancelProcess": "Prozess abbrechen"
"CancelProcess": "Prozess abbrechen",
"SyncWithField": "Synchronisieren mit Feld",
"ActionType": "Typ",
"ApproveAction": "Genehmigen",
"ReviewAction": "Prüfen",
"Review": "Prüfen"
},
"error": {
"MethodNotFound": "Methode nicht gefunden: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Cancel Action item",
"Export": "Export",
"Import": "Import",
"CancelProcess": "Cancel process"
"CancelProcess": "Cancel process",
"SyncWithField": "Sync with field",
"ActionType": "Type",
"ApproveAction": "Approve",
"ReviewAction": "Review",
"Review": "Review"
},
"error": {
"MethodNotFound": "Method not found: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Cancelar acción",
"Export": "Exportar",
"Import": "Importar",
"CancelProcess": "Cancelar proceso"
"CancelProcess": "Cancelar proceso",
"SyncWithField": "Sincronizar con campo",
"ActionType": "Tipo",
"ApproveAction": "Aprobar",
"ReviewAction": "Revisar",
"Review": "Revisar"
},
"error": {
"MethodNotFound": "Método no encontrado: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Annuler l'action",
"Export": "Exporter",
"Import": "Importer",
"CancelProcess": "Annuler le processus"
"CancelProcess": "Annuler le processus",
"SyncWithField": "Synchroniser avec le champ",
"ActionType": "Type",
"ApproveAction": "Approuver",
"ReviewAction": "Revoir",
"Review": "Revoir"
},
"error": {
"MethodNotFound": "Méthode introuvable : {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Annulla azione",
"Export": "Esporta",
"Import": "Importa",
"CancelProcess": "Annulla processo"
"CancelProcess": "Annulla processo",
"SyncWithField": "Sincronizza con campo",
"ActionType": "Tipo",
"ApproveAction": "Approva",
"ReviewAction": "Revisa",
"Review": "Revisa"
},
"error": {
"MethodNotFound": "Metodo non trovato: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@
"CancelToDo": "アクションをキャンセル",
"Export": "エクスポート",
"Import": "インポート",
"CancelProcess": "プロセスをキャンセル"
"CancelProcess": "プロセスをキャンセル",
"SyncWithField": "フィールドと同期",
"ActionType": "タイプ",
"ApproveAction": "承認",
"ReviewAction": "レビュー",
"Review": "レビュー"
},
"error": {
"MethodNotFound": "メソッドが見つかりません: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@
"CancelToDo": "Cancelar ação",
"Export": "Exportar",
"Import": "Importar",
"CancelProcess": "Cancelar processo"
"CancelProcess": "Cancelar processo",
"SyncWithField": "Sincronizar com campo",
"ActionType": "Tipo",
"ApproveAction": "Aprovar",
"ReviewAction": "Revisar",
"Review": "Revisar"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Cancelar ação",
"Export": "Exportar",
"Import": "Importar",
"CancelProcess": "Cancelar processo"
"CancelProcess": "Cancelar processo",
"SyncWithField": "Sincronizar com campo",
"ActionType": "Tipo",
"ApproveAction": "Aprovar",
"ReviewAction": "Revisar",
"Review": "Revisar"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "Отменить задачу",
"Export": "Экспорт",
"Import": "Импорт",
"CancelProcess": "Отменить процесс"
"CancelProcess": "Отменить процесс",
"SyncWithField": "Синхронизировать с полем",
"ActionType": "Тип",
"ApproveAction": "Утверждение",
"ReviewAction": "Рецензирование",
"Review": "Рецензировать"
},
"error": {
"MethodNotFound": "Метод не найден: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@
"CancelToDo": "Eylem öğesini iptal et",
"Export": "Dışa aktar",
"Import": "İçe aktar",
"CancelProcess": "Süreci iptal et"
"CancelProcess": "Süreci iptal et",
"SyncWithField": "Alan ile senkronize et",
"ActionType": "Tür",
"ApproveAction": "Onayla",
"ReviewAction": "Gözden geçir",
"Review": "Gözden geçir"
},
"error": {
"MethodNotFound": "Metod bulunamadı: {methodId}",
Expand Down
7 changes: 6 additions & 1 deletion plugins/process-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
"CancelToDo": "取消任务",
"Export": "导出",
"Import": "导入",
"CancelProcess": "取消过程"
"CancelProcess": "取消过程",
"SyncWithField": "字段同步",
"ActionType": "类型",
"ApproveAction": "批准",
"ReviewAction": "审查",
"Review": "审查"
},
"error": {
"MethodNotFound": "找不到方法:{methodId}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
// Copyright © 2026 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">
import { Label } from '@hcengineering/ui'
import plugin from '../plugin'

export let value: 'approve' | 'review' | undefined
</script>

<Label label={value === 'review' ? plugin.string.ReviewAction : plugin.string.ApproveAction} />
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

async function changeApprovalRequestState (ev: MouseEvent, isRejection: boolean): Promise<void> {
showPopup(SignatureDialog, { isRejection }, eventToHTMLElement(ev), async (res) => {
if (!res) return

Check warning on line 31 in plugins/process-resources/src/components/ApproveRequestButtons.svelte

View workflow job for this annotation

GitHub Actions / formatting

Unexpected any value in conditional. An explicit comparison or type cast is required

const { rejectionNote } = res

Expand All @@ -45,5 +45,9 @@
}
</script>

<Button label={process.string.Approve} kind="positive" on:click={(ev) => changeApprovalRequestState(ev, false)} />
<Button
label={todo.actionType === 'review' ? process.string.Review : process.string.Approve}
kind="positive"
on:click={(ev) => changeApprovalRequestState(ev, false)}
/>
<Button label={process.string.Reject} kind="negative" on:click={(ev) => changeApprovalRequestState(ev, true)} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
// Copyright © 2026 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">
import { Ref } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { Execution } from '@hcengineering/process'
import plugin from '../plugin'

export let value: Ref<Execution>

const client = getClient()

const query = createQuery()

let execution: Execution | undefined

$: query.query(plugin.class.Execution, { _id: value }, (res) => {
execution = res[0]
})

$: process = execution !== undefined ? client.getModel().findObject(execution.process) : undefined
</script>

{#if process}
{process.name}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import contact from '@hcengineering/contact'
import core, { AnyAttribute } from '@hcengineering/core'
import { getAttributeEditor, getAttributePresenterClass, getClient } from '@hcengineering/presentation'
import { ApproveRequest, Process, Step } from '@hcengineering/process'
import { AnySvelteComponent } from '@hcengineering/ui'
import { ApproveRequest, parseContext, Process, Step } from '@hcengineering/process'
import { AnySvelteComponent, Label, Toggle } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin'
import { getContext, getMockAttribute } from '../../utils'
Expand Down Expand Up @@ -78,6 +78,33 @@
}

getBaseEditor(attribute)

$: contextValue = typeof params.user === 'string' ? parseContext(params.user) : undefined
$: userContext = contextValue?.type === 'attribute'

$: if (!userContext && params.field) {
delete (params as any).field
step.params = params
dispatch('change', step)
}

function toggleField (e: CustomEvent<boolean>): void {
if (e.detail) {
if (contextValue?.type === 'attribute') {
params.field = contextValue.key
}
} else {
delete (params as any).field
}
step.params = params
dispatch('change', step)
}

function toggleActionType (e: CustomEvent<any>): void {
params.actionType = e.detail ? 'review' : 'approve'
step.params = params
dispatch('change', step)
}
</script>

<div class="grid">
Expand All @@ -93,6 +120,14 @@
on:remove
on:change={onChange}
/>
<div>
<Label label={plugin.string.SyncWithField} />
</div>
<Toggle disabled={!userContext} on={params.field !== undefined} on:change={toggleField} />
<div>
<Label label={plugin.string.ReviewAction} />
</div>
<Toggle on={params.actionType === 'review'} on:change={toggleActionType} />
</div>
<ParamsEditor _class={plugin.class.ApproveRequest} {process} {keys} {params} on:change={changeParams} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Process, ProcessToDo, Step, UserResult } from '@hcengineering/process'
import { parseContext, Process, ProcessToDo, Step, UserResult } from '@hcengineering/process'
import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin'
import ParamsEditor from './ParamsEditor.svelte'
Expand Down Expand Up @@ -43,6 +43,27 @@
}

const keys = ['title', 'user', 'dueDate']

$: contextValue = typeof params.user === 'string' ? parseContext(params.user) : undefined
$: userContext = contextValue?.type === 'attribute'

$: if (!userContext && params.field) {
delete (params as any).field
step.params = params
dispatch('change', step)
}

function toggleField (e: CustomEvent<boolean>): void {
if (e.detail) {
if (contextValue?.type === 'attribute') {
params.field = contextValue.key
}
} else {
delete (params as any).field
}
step.params = params
dispatch('change', step)
}
</script>

<ParamsEditor _class={plugin.class.ProcessToDo} {process} {keys} {params} on:change={changeParams} />
Expand All @@ -60,6 +81,12 @@
}}
/>
</div>
<div class="grid">
<div>
<Label label={plugin.string.SyncWithField} />
</div>
<Toggle disabled={!userContext} on={params.field !== undefined} on:change={toggleField} />
</div>
<div class="divider" />
<ResultsEditor {process} result={step.results} on:change={changeResults} />

Expand Down
Loading
Loading