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-04-30 15:11:10 +00:00
|
|
|
import { html } from 'lit'
|
|
|
|
import { repeat } from 'lit/directives/repeat.js'
|
|
|
|
import { __ } from 'i18n'
|
|
|
|
|
2024-05-02 15:53:08 +00:00
|
|
|
export default function tplMucTaskLists (el, tasklists) {
|
2024-04-30 15:11:10 +00:00
|
|
|
if (!tasklists) { // if user losed rights
|
|
|
|
return html`` // FIXME: add a message like "you dont have access"?
|
|
|
|
}
|
|
|
|
|
|
|
|
const i18nAdd = __('Add')
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
const i18nCreateTaskList = __(LOC_task_list_create)
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
const i18nTaskListName = __(LOC_task_list_name)
|
|
|
|
|
|
|
|
return html`
|
2024-05-06 10:29:25 +00:00
|
|
|
${
|
|
|
|
repeat(tasklists, (tasklist) => tasklist.get('id'), (tasklist) => {
|
|
|
|
return html`<livechat-converse-muc-task-list .model=${tasklist}></livechat-converse-muc-task-list>`
|
|
|
|
})
|
|
|
|
}
|
2024-05-02 15:53:08 +00:00
|
|
|
<form class="converse-form" @submit=${el.submitCreateTaskList}>
|
2024-08-05 13:54:03 +00:00
|
|
|
<fieldset>
|
2024-04-30 15:11:10 +00:00
|
|
|
<label>
|
|
|
|
${i18nCreateTaskList}
|
2024-05-06 13:57:42 +00:00
|
|
|
<input type="text" value="" class="form-control" name="name" placeholder="${i18nTaskListName}" />
|
2024-04-30 15:11:10 +00:00
|
|
|
</label>
|
|
|
|
<input type="submit" value="${i18nAdd}" class="btn btn-primary" />
|
2024-05-02 15:53:08 +00:00
|
|
|
${!el.create_tasklist_error_message
|
|
|
|
? ''
|
|
|
|
: html`<div class="invalid-feedback d-block">${el.create_tasklist_error_message}</div>`
|
|
|
|
}
|
2024-08-05 13:54:03 +00:00
|
|
|
</fieldset>
|
2024-05-05 22:13:20 +00:00
|
|
|
</form>`
|
2024-04-30 15:11:10 +00:00
|
|
|
}
|