mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
Allow to set a due date for selected issues (#2336)
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
fd13e7f446
commit
a5fbf5b59e
@ -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} />
|
||||
|
Loading…
Reference in New Issue
Block a user