2021-04-14 22:56:59 +02:00
|
|
|
import { html } from "lit";
|
2021-09-17 12:17:43 +02:00
|
|
|
import { __ } from 'i18n';
|
2020-01-23 10:18:41 +01:00
|
|
|
|
|
|
|
|
2023-02-15 14:19:48 +01:00
|
|
|
const tplField = (f) => html`
|
2020-01-31 22:49:05 +01:00
|
|
|
<div class="form-group">
|
2020-04-14 17:18:58 +02:00
|
|
|
<label>
|
|
|
|
${f.label || ''}
|
|
|
|
<input type="text"
|
|
|
|
name="${f.name}"
|
|
|
|
class="${(f.challenge_failed) ? 'error' : ''} form-control form-control--labeled"
|
|
|
|
?required="${f.required}"
|
|
|
|
placeholder="${f.placeholder}" />
|
|
|
|
</label>
|
2020-01-31 22:49:05 +01:00
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
export default (el) => {
|
|
|
|
return html`
|
|
|
|
<form class="converse-form converse-form--modal confirm" action="#" @submit=${ev => el.onConfimation(ev)}>
|
|
|
|
<div class="form-group">
|
|
|
|
${ el.model.get('messages')?.map(message => html`<p>${message}</p>`) }
|
|
|
|
</div>
|
2023-02-15 14:19:48 +01:00
|
|
|
${ el.model.get('fields')?.map(f => tplField(f)) }
|
2022-08-21 13:03:32 +02:00
|
|
|
<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>`;
|
|
|
|
}
|