Allow to set a due date for selected issues (#2336)

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
Ruslan Bayandinov
2022-10-28 19:45:47 +06:00
committed by GitHub
parent fd13e7f446
commit a5fbf5b59e
2 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -1131,7 +1131,7 @@ export function createModel (builder: Builder): void {
props: { mondayStart: true, withTime: false },
element: 'top',
fillProps: {
_object: 'value'
_objects: 'value'
}
},
label: tracker.string.SetDueDate,
@@ -19,7 +19,7 @@
import { Issue } from '@hcengineering/tracker'
import { createEventDispatcher } from 'svelte'
export let value: Issue | AttachedData<Issue>
export let value: Issue | AttachedData<Issue> | Issue[]
export let mondayStart = true
export let withTime = false
@@ -29,14 +29,17 @@
async function onUpdate ({ detail }: CustomEvent<Date | null | undefined>) {
const newDueDate = detail && detail?.getTime()
if ('_id' in value && newDueDate !== undefined && newDueDate !== value.dueDate) {
await client.update(value, { dueDate: newDueDate })
const vv = Array.isArray(value) ? value : [value]
for (const docValue of vv) {
if ('_id' in docValue && newDueDate !== undefined && newDueDate !== docValue.dueDate) {
await client.update(docValue, { dueDate: newDueDate })
}
}
dispatch('update', newDueDate)
}
$: currentDate = value.dueDate !== null ? new Date(value.dueDate) : null
$: currentDate = Array.isArray(value) || value.dueDate === null ? null : new Date(value.dueDate)
</script>
<DatePopup {currentDate} {mondayStart} {withTime} on:close on:update={onUpdate} />