mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 13:21:57 +00: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 },
|
props: { mondayStart: true, withTime: false },
|
||||||
element: 'top',
|
element: 'top',
|
||||||
fillProps: {
|
fillProps: {
|
||||||
_object: 'value'
|
_objects: 'value'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
label: tracker.string.SetDueDate,
|
label: tracker.string.SetDueDate,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import { Issue } from '@hcengineering/tracker'
|
import { Issue } from '@hcengineering/tracker'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
|
|
||||||
export let value: Issue | AttachedData<Issue>
|
export let value: Issue | AttachedData<Issue> | Issue[]
|
||||||
export let mondayStart = true
|
export let mondayStart = true
|
||||||
export let withTime = false
|
export let withTime = false
|
||||||
|
|
||||||
@ -29,14 +29,17 @@
|
|||||||
async function onUpdate ({ detail }: CustomEvent<Date | null | undefined>) {
|
async function onUpdate ({ detail }: CustomEvent<Date | null | undefined>) {
|
||||||
const newDueDate = detail && detail?.getTime()
|
const newDueDate = detail && detail?.getTime()
|
||||||
|
|
||||||
if ('_id' in value && newDueDate !== undefined && newDueDate !== value.dueDate) {
|
const vv = Array.isArray(value) ? value : [value]
|
||||||
await client.update(value, { dueDate: newDueDate })
|
for (const docValue of vv) {
|
||||||
|
if ('_id' in docValue && newDueDate !== undefined && newDueDate !== docValue.dueDate) {
|
||||||
|
await client.update(docValue, { dueDate: newDueDate })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch('update', 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>
|
</script>
|
||||||
|
|
||||||
<DatePopup {currentDate} {mondayStart} {withTime} on:close on:update={onUpdate} />
|
<DatePopup {currentDate} {mondayStart} {withTime} on:close on:update={onUpdate} />
|
||||||
|
Loading…
Reference in New Issue
Block a user