2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-05-12 16:45:51 +00:00
|
|
|
import { html } from 'lit'
|
|
|
|
import { repeat } from 'lit/directives/repeat.js'
|
|
|
|
import { __ } from 'i18n'
|
|
|
|
|
|
|
|
export default function (el) {
|
|
|
|
const muc = el.muc
|
|
|
|
if (!muc?.tasklists?.length) {
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
const i18nEmpty = __(LOC_task_list_pick_empty)
|
|
|
|
return html`<p class="error">${i18nEmpty}</p>`
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
const i18nMessage = __(LOC_task_list_pick_message)
|
|
|
|
|
|
|
|
return html`
|
|
|
|
<form class="converse-form converse-form--modal confirm" action="#" @submit=${ev => el.onPick(ev)}>
|
|
|
|
<div class="form-group">
|
|
|
|
<select class="form-control" name="tasklist">
|
|
|
|
${
|
|
|
|
repeat(muc.tasklists, (tasklist) => tasklist.get('id'), (tasklist) => {
|
|
|
|
return html`<option value="${tasklist.get('id')}">${tasklist.get('name')}</option>`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</select>
|
|
|
|
<small class="form-text text-muted">
|
|
|
|
${i18nMessage}
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<button type="submit" class="btn btn-primary">${__('OK')}</button>
|
|
|
|
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${__('Cancel')}"/>
|
|
|
|
</div>
|
|
|
|
</form>`
|
|
|
|
}
|