2020-01-23 10:18:41 +01:00
|
|
|
|
import { html } from "lit-html";
|
2020-09-10 07:33:00 +02:00
|
|
|
|
import { __ } from '../i18n';
|
2020-01-23 10:18:41 +01:00
|
|
|
|
|
|
|
|
|
|
2020-04-14 17:18:58 +02:00
|
|
|
|
const tpl_field = (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>
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 10:18:41 +01:00
|
|
|
|
export default (o) => html`
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<div class="modal-content">
|
2020-04-14 17:18:58 +02:00
|
|
|
|
<div class="modal-header ${o.level || ''}">
|
2020-01-23 10:18:41 +01:00
|
|
|
|
<h5 class="modal-title">${o.title}</h5>
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<span class="modal-alert"></span>
|
|
|
|
|
<form class="converse-form converse-form--modal confirm" action="#">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
${ o.messages.map(message => html`<p>${message}</p>`) }
|
|
|
|
|
</div>
|
2020-04-14 17:18:58 +02:00
|
|
|
|
${ o.fields.map(f => tpl_field(f)) }
|
2020-01-23 10:18:41 +01:00
|
|
|
|
<div class="form-group">
|
2020-08-16 23:33:17 +02:00
|
|
|
|
<button type="submit" class="btn btn-primary">${__('OK')}</button>
|
|
|
|
|
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${__('Cancel')}"/>
|
2020-01-23 10:18:41 +01:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|