various improvements

This commit is contained in:
2021-12-04 01:13:55 +01:00
parent 6c1a946608
commit 063ceb2c53
17 changed files with 163 additions and 69 deletions

View File

@@ -1,21 +1,39 @@
<template>
<template v-if="templates.length > 0">
<slot name="title">
<h2>{{ $t('Generate document from template')}}</h2>
</slot>
<select class="form-select form-select-sm" v-model="template">
<option disabled value="">{{ $t('evaluation_choose_a_template') }}</option>
<template v-for="t in templates">
<option v-bind:value="t.id">{{ t.name.fr }}</option>
</template>
</select>
<button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button>
<button v-else class="btn btn-update btn-sm change-icon" type="button" disabled ><i class="fa fa-fw fa-cog"></i></button>
<div>
<template v-if="templates.length > 0">
<slot name="title">
<h2>{{ $t('generate_document')}}</h2>
</slot>
<div v-if="hasDescription">
<p>{{ getDescription }}</p>
</div>
</template>
<div class="container">
<div class="row">
<div class="col-md-4">
<slot name="label">
<label>{{ $t('select_a_template') }}</label>
</slot>
</div>
<div class="col-md-8">
<div class="input-group mb-3">
<select class="form-select" v-model="template">
<option disabled selected value="">{{ $t('choose_a_template') }}</option>
<template v-for="t in templates">
<option v-bind:value="t.id">{{ t.name.fr }}</option>
</template>
</select>
<button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button>
<button v-else class="btn btn-update btn-sm change-icon" type="button" disabled ><i class="fa fa-fw fa-cog"></i></button>
</div>
</div>
</div>
<div class="row" v-if="hasDescription">
<div class="col-md-8 align-self-end">
<p>{{ getDescription }}</p>
</div>
</div>
</div>
</template>
</div>
</template>
@@ -106,6 +124,15 @@ export default {
window.location.assign(url);
},
},
i18n: {
messages: {
fr: {
generate_document: 'Générer un document',
select_a_template: 'Choisir un gabarit',
choose_a_template: 'Choisir',
}
}
}
}
</script>

View File

@@ -1,11 +1,15 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block title 'docgen.Edit template'|trans %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ 'docgen.Edit template'|trans }}</h1>
<h2>{{ 'docgen.With context %name%'|trans({'%name%': context.name|trans }) }}</h2>
{% endblock crud_content_header %}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}

View File

@@ -1,12 +1,17 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block title 'docgen.New template'|trans %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ 'docgen.New template'|trans }}</h1>
<h2>{{ 'docgen.With context %name%'|trans({'%name%': context.name|trans }) }}</h2>
{% endblock crud_content_header %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,10 +1,11 @@
{% extends 'ChillMainBundle::layout.html.twig' %}
{% block title 'Generate document'|trans %}
{% block title 'docgen.Generate a document'|trans %}
{% block content %}
<div class="col-md-10 col-xxl">
<h1>{{ block('title') }}</h1>
<h2>{{ template.name|localize_translatable_string }}</h2>
{{ form_start(form, { 'attr': { 'id': 'generate_doc_form' }}) }}
{{ form(form) }}
@@ -12,8 +13,8 @@
<ul class="record_actions sticky-form-buttons">
<li>
<button type="submit" class="btn btn-edit" form="generate_doc_form">
<i class="fa fa-cog"></i> {{ 'Generate'|trans }}
<button type="submit" class="btn btn-edit change-icon" form="generate_doc_form">
<i class="fa fa-cog"></i> {{ 'docgen.Generate'|trans }}
</button>
</li>
</ul>