change icons, css, add routing to merchandise, add mail templater, fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-12 23:34:48 +01:00
parent 8313e25f2e
commit f2f4788ce1
71 changed files with 1486 additions and 154 deletions

View File

@@ -0,0 +1,38 @@
@extends('layout.index', [
'title' => __('Admin.mail_logs.title'),
'subtitle' => __('Admin.mail_logs.list'),
])
@section('content')
@component('components.card')
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailLog.index'),
'model' => 'mail_logs',
'with_add' => false,
'with_print' => false,
'with_filters' => true,
'show_callback' => 'MailLogShow(id);',
])
@endcomponent
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_logs-filters'])
@include('admin.Core.Mail.MailLog.partials.filters', ['model' => 'mail_logs'])
@endcomponent
@endsection
@include('load.form.select2')
@push('js')
<script>
function MailLogShow(id) {
var url_open = "{{ route('Admin.Core.Mail.MailLog.show') }}/" + id;
openModal("{{ __('admin.Core.MailLog.modal') }}", '#mail_log-form', url_open, false, false, "xl");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,16 @@
<div class="row">
<div class="col-6">
<strong>@lang('from') : </strong>
{{ $message['from'] }}<br/>
<strong>@lang('subject') : </strong>
{{ $message['subject'] }}<br/>
<strong class="text-uppercase">@lang('to') : </strong>
{{ $message['to_name'] }} {{ $message['to_email'] }}<br/>
</div>
</div>
<div class="row mb-3">
<div class="col-12 text-dark">
{!! $message['content'] !!}
</div>
</div>

View File

@@ -0,0 +1,28 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
<label class="col-4 text-right">{{ __('application') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_id',
'list' => $applications ?? [],
'value' => $filters['application_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
<div class="row mb-3">
<label class="col-4 text-right">{{ __('module') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_module_id',
'list' => $application_modules ?? [],
'value' => $filters['application_module_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
</form>

View File

@@ -0,0 +1,63 @@
@extends('layout.index', [
'title' => __('Core.mail_templates.title'),
'subtitle' => __('Core.mail_templates.list'),
'breadcrumb' => [
]
])
@section('content')
<x-card>
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailTemplate.index'),
'model' => 'mail_templates',
'with_add' => true,
'with_print' => false,
'with_filters' => true,
'create_callback' => 'MailTemplateCreate();',
'edit_callback' => 'MailTemplateEdit(id);',
'show_callback' => 'MailTemplateView(id)',
])
</x-card>
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_templates-filters'])
@include('admin.Core.Mail.MailTemplate.partials.filters', ['model' => 'mail_templates'])
@endcomponent
@endsection
@include('load.form.datepicker')
@include('load.form.select2')
@include('load.form.editor')
@include('load.form.upload.fileinput')
@push('js')
<script>
function MailTemplateCreate() {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalCreate') }}";
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.add') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateEdit(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalEdit') }}/" + id;
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.edit') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateView(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalPreview') }}/" + id;
openModal("{{ __('Core.preview') }}", '#preview_template-form', url_open);
}
function MailTemplateRefresh()
{
reloadDatatable("mail_templates");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,123 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'mail_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" id="id" name="id" value="{{ $mail_template['id'] ?? null }}">
<div class="row mb-3">
<div class="col-3">
@include('components.form.input', [
'name' => 'name',
'value' => $mail_template['name'] ?? '',
'label' => __('Core.name'),
'required' => true,
])
</div>
<div class="col-3">
@include('components.form.select', [
'name' => 'mailable',
'value' => $mail_template['mailable'] ?? '',
'list' => $mailables ?? [],
'label' => __('Core.mailables'),
'with_empty' => '',
'required' => true,
])
</div>
<div class="col-4">
<div id="mail_template-vars">
@include('admin.Core.Mail.MailTemplate.partials.vars', ['vars' => $mail_template['vars'] ?? []])
</div>
</div>
<div class="col-2 text-right">
<label>@lang('Core.change_to')</label><br/>
<img id="lang_en" class="lang" data-lang="en" role="button" src="{{ asset('vendor/blade-flags/language-en.svg') }}" width="32" height="32"/>
<img id="lang_fr" class="lang d-none" data-lang="fr" role="button" src="{{ asset('vendor/blade-flags/language-fr.svg') }}" width="32" height="32"/>
</div>
</div>
<div id="mode_fr" class="">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[fr]',
'value' => $mail_template['subject_translations']['fr'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[fr]',
'value' => $mail_template['html_template_translations']['fr'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[fr]',
'value' => $mail_template['text_template_translations']['fr'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
<div id="mode_en" class="d-none">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[en]',
'value' => $mail_template['subject_translations']['en'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
<div class ="col-6">
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[en]',
'value' => $mail_template['html_template_translations']['en'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[en]',
'value' => $mail_template['text_template_translations']['en'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
{{ Form::close() }}
<script>
$(function() {
initSelect2();
initEditor();
$('.lang').click(function() {
var lang = $(this).data('lang');
$('#mode_en').toggleClass('d-none');
$('#mode_fr').toggleClass('d-none');
$('#lang_en').toggleClass('d-none');
$('#lang_fr').toggleClass('d-none');
});
});
</script>

View File

@@ -0,0 +1,3 @@
<form id="{{ $model }}-filters">
</form>

View File

@@ -0,0 +1,37 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'preview_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" name="id" id="template_id" value="{{ $id ?? null }}">
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
'id_name' => 'user_id',
'name' => 'user_id',
'list' => $users,
'class' => 'select2',
'with_empty' => '',
'label' => __('Core.users.name'),
])
</div>
</div>
<x-card title="Preview">
<div id="previewTemplate"></div>
</x-card>
{{ Form::close() }}
<script>
initSelect2();
$('#user_id').change(function() {
console.log('ici');
var user_id = $(this).find(":selected").val();
var template_id = $('#template_id').val();
console.log(user_id);
console.log(template_id);
var url = "{{ route('Admin.Core.Mail.MailTemplate.preview') }}/" + template_id + '/' + user_id;
$.get(url, function(data) {
$('#previewTemplate').html(data);
});
})
</script>

View File

@@ -0,0 +1,8 @@
@if ($vars)
<label>
@lang('Core.variables')
</label><br>
@foreach ($vars as $var)
<span class="badge badge-pill badge-light mr-2">{{ $var }}</span>
@endforeach
@endif