andpavlenko committed 2022-05-18 16:17:49 +00:00
1 parent 07aafb19fa
commit 89ed9f45a6
7 files changed
+391 -30

No files matched your search

@@ -359,6 +359,10 @@
<symbol id="sun">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
</symbol>
<symbol id="arrow-sm-left">
<path stroke-linecap="round" stroke-linejoin="round" d="M11 17l-5-5m0 0l5-5m-5 5h12" />
</symbol>
</svg>
<script>
@@ -22,20 +22,29 @@
{% block content %}
<div class="card">
<div class="card-body">
<h5>{{ group.title }}</h5>
<form method="post" action="{{ 'api/admin/client/group_update'|link }}" class="api-form" data-api-redirect="{{ 'client'|alink }}">
<div class="card-body">
<h5>{{ group.title }}</h5>
<form method="post" action="{{ 'api/admin/client/group_update'|link }}" class="api-form" data-api-redirect="{{ 'client'|alink }}">
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="title" value="{{ group.title }}" required>
</div>
</div>
</div>
<input type="hidden" name="id" value="{{ group.id }}">
<input type="hidden" name="id" value="{{ group.id }}">
<div class="card-footer d-flex gap-2">
<a href="{{ 'client'|alink }}" class="btn btn-secondary w-25">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#arrow-sm-left" />
</svg>
{{ 'Go back'|trans }}
</a>
<button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
</form>
</div>
</div>
</form>
</div>
{% endblock %}
@@ -155,10 +155,10 @@
{% block content %}
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="index-tab" data-bs-toggle="tab" data-bs-target="#tab-index" type="button" role="tab" aria-controls="index" aria-selected="true">{{ 'Clients'|trans }}</button>
<a class="nav-link active" href="#tab-index" data-bs-toggle="tab" role="tab">{{ 'Clients'|trans }}</a>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="new-tab" data-bs-toggle="tab" data-bs-target="#tab-new" type="button" role="tab" aria-controls="new" aria-selected="false">
<button class="nav-link" href="#tab-new" data-bs-toggle="tab" role="tab">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#plus" />
</svg>
@@ -166,10 +166,10 @@
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="groups-tab" data-bs-toggle="tab" data-bs-target="#tab-groups" type="button" role="tab" aria-controls="groups" aria-selected="false">{{ 'Groups'|trans }}</button>
<button class="nav-link" href="#tab-groups" data-bs-toggle="tab" role="tab">{{ 'Groups'|trans }}</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="new-group-tab" data-bs-toggle="tab" data-bs-target="#tab-new-group" type="button" role="tab" aria-controls="new-group" aria-selected="false">
<button class="nav-link" href="#tab-new-group" data-bs-toggle="tab" role="tab">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#plus" />
</svg>
@@ -238,28 +238,20 @@
<td>{{ client.created_at|date('Y-m-d') }}</td>
<td>
<a class="btn btn-icon" href="{{ 'client/manage'|alink }}/{{ client.id }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-edit" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path>
<path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path>
<path d="M16 5l3 3"></path>
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#edit" />
</svg>
</a>
<a class="btn btn-icon api-link" href="{{ 'api/admin/client/delete'|link({ 'id': client.id }) }}" data-api-confirm="{{ 'Are you sure?'|trans }}" data-api-reload="1">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-trash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<line x1="4" y1="7" x2="20" y2="7"></line>
<line x1="10" y1="11" x2="10" y2="17"></line>
<line x1="14" y1="11" x2="14" y2="17"></line>
<path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path>
<path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#delete" />
</svg>
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="7">{{ 'The list is empty'|trans }}</td>
<td class="text-muted" colspan="7">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
@@ -395,7 +387,9 @@
<tbody>
{% for id, group in admin.client_group_get_pairs %}
<tr>
<td>{{ group }}</td>
<td>
<a href="{{ 'client/group'|alink }}/{{ id }}">{{ group }}</a>
</td>
<td>
<a class="btn btn-icon" href="{{ 'client/group'|alink }}/{{ id }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -411,7 +405,7 @@
</tr>
{% else %}
<tr>
<td colspan="2">{{ 'The list is empty'|trans }}</td>
<td class="text-muted" colspan="2">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
@@ -0,0 +1,91 @@
{% extends 'layout_default.html.twig' %}
{% import 'macro_functions.html.twig' as mf %}
{% set active_menu = 'kb' %}
{% block meta_title %}{{ post.title }}{% endblock %}
{% block breadcrumbs %}
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ '/'|alink }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#home" />
</svg>
</a>
</li>
<li class="breadcrumb-item">
<a href="{{ 'kb'|alink }}">{{ 'Knowledge Base'|trans }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ post.title }}</li>
</ol>
{% endblock %}
{% block content %}
<div class="card">
<form method="post" action="{{ 'api/admin/kb/article_update'|link }}" class="api-form" data-api-msg="{{ 'Article updated'|trans }}">
<div class="card-body">
<h3>{{ post.title }}</h3>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Category'|trans }}:</label>
<div class="col">
{{ mf.selectbox('kb_article_category_id', admin.kb_category_get_pairs, post.kb_article_category_id, 1) }}
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="title" value="{{ post.title }}" required="required">
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Content'|trans }}:</label>
<div class="col">
<textarea name="content" rows="10" class="bb-textarea">{{ post.content }}</textarea>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Slug'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="slug" value="{{ post.slug }}" required="required">
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Views'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="views" value="{{ post.views }}" required="required">
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Status'|trans }}:</label>
<div class="col">
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioStatusDraft" type="radio" name="status" value="draft"{% if post.status == 'draft' %} checked{% endif %}>
<label class="form-check-label" for="radioStatusDraft">{{ 'Draft'|trans }}</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioStatusActive" type="radio" name="status" value="active"{% if post.status == 'active' %} checked{% endif %}>
<label class="form-check-label" for="radioStatusActive">{{ 'Active'|trans }}</label>
</div>
</div>
</div>
</div>
<input type="hidden" name="id" value="{{ post.id }}">
<div class="card-footer d-flex gap-2">
<a href="{{ 'kb'|alink }}" class="btn btn-secondary w-25">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#arrow-sm-left" />
</svg>
{{ 'Go back'|trans }}
</a>
<button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
</div>
</form>
</div>
{% endblock %}
{% block head %}{{ mf.bb_editor('.bb-textarea') }}{% endblock %}
@@ -0,0 +1,66 @@
{% extends 'layout_default.html.twig' %}
{% set active_menu = 'support' %}
{% block meta_title %}{{ category.title }}{% endblock %}
{% block breadcrumbs %}
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ '/'|alink }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#home" />
</svg>
</a>
</li>
<li class="breadcrumb-item">
<a href="{{ 'kb'|alink }}">{{ 'Knowledge Base'|trans }}</a>
</li>
<li class="breadcrumb-item">
<a href="{{ 'kb'|alink }}#tab-categories">{{ 'Categories'|trans }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ category.title}}</li>
</ol>
{% endblock %}
{% block content %}
<div class="card">
<form method="post" action="{{ 'api/admin/kb/category_update'|link }}" class="api-form" data-api-msg="{{ 'Category updated'|trans }}">
<div class="card-body">
<h3>{{ category.title}}</h3>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="title" value="{{ category.title }}" required>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Slug'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="slug" value="{{ category.slug }}" required>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Description'|trans }}:</label>
<div class="col">
<textarea class="form-control" name="description" rows="10">{{ category.description }}</textarea>
</div>
</div>
</div>
<input type="hidden" name="id" value="{{ category.id }}">
<div class="card-footer d-flex gap-2">
<a href="{{ 'kb'|alink }}" class="btn btn-secondary w-25">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#arrow-sm-left" />
</svg>
{{ 'Go back'|trans }}
</a>
<button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
</div>
</form>
</div>
{% endblock %}
@@ -0,0 +1,187 @@
{% extends request.ajax ? 'layout_blank.html.twig' : 'layout_default.html.twig' %}
{% import 'macro_functions.html.twig' as mf %}
{% block meta_title %}{{ 'Knowledge Base'|trans }}{% endblock %}
{% set active_menu = 'kb' %}
{% block content %}
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" href="#tab-index" data-bs-toggle="tab">{{ 'Articles'|trans }}</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" href="#tab-new-article" data-bs-toggle="tab">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#plus" />
</svg>
{{ 'New article'|trans }}
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" href="#tab-categories" data-bs-toggle="tab">{{ 'Manage categories'|trans }}</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" href="#tab-new-category" data-bs-toggle="tab">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#plus" />
</svg>
{{ 'New category'|trans }}
</a>
</li>
</ul>
<div class="card">
<div class="tab-content">
<div class="tab-pane fade show active" id="tab-index" role="tabpanel">
{% include '_search.html.twig' %}
<table class="table card-table table-vcenter table-striped text-nowrap">
<thead>
<tr>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Category'|trans }}</th>
<th>{{ 'Status'|trans }}</th>
<th class="text-center">{{ 'Views'|trans }}</th>
<th class="w-1"></th>
</tr>
</thead>
<tbody>
{% set posts = admin.kb_article_get_list({ 'per_page': 30, 'page': request.page }|merge(request)) %}
{% for i, post in posts.list %}
<tr>
<td>
<a href="{{ '/kb/article'|alink }}/{{ post.id }}">{{ post.title }}</a>
</td>
<td>
<a href="{{ '/kb/category'|alink }}/{{ post.category.id }}">{{ post.category.title }}</a>
</td>
<td>
{% if post.status == 'active' %}
<span class="badge bg-success me-1"></span>
{% endif %}
{% if post.status == 'draft' %}
<span class="badge bg-secondary me-1"></span>
{% endif %}
{{ mf.status_name(post.status) }}</td>
<td class="text-center">{{ post.views }}</td>
<td>
<a class="btn btn-icon" href="{{ '/kb/article'|alink }}/{{ post.id }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#edit" />
</svg>
</a>
<a class="btn btn-icon api-link" data-api-confirm="{{ 'Are you sure?'|trans }}" data-api-redirect="{{'kb'|alink}}" href="{{ 'api/admin/kb/article_delete'|link({ 'id': post.id }) }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#delete" />
</svg>
</a>
</td>
</tr>
{% else %}
<tr>
<td class="text-muted" colspan="4">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include '_pagination.html.twig' with { 'list': posts, 'url': 'kb' } %}
</div>
<div class="tab-pane fade" id="tab-new-article" role="tabpanel">
<div class="card-body">
<form method="post" action="{{ 'api/admin/kb/article_create'|link }}" class="api-form" data-api-reload="1">
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Category'|trans }}:</label>
<div class="col">
{{ mf.selectbox('kb_article_category_id', admin.kb_category_get_pairs, request.kb_article_category_id, 1) }}
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="title" value="{{request.title}}" required="required" placeholder=""/>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Status'|trans }}:</label>
<div class="col">
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioStatusDraft" type="radio" name="status" value="draft" checked>
<label class="form-check-label" for="radioStatusDraft">{{ 'Draft'|trans }}</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioStatusActive" type="radio" name="status" value="active">
<label class="form-check-label" for="radioStatusActive">{{ 'Active'|trans }}</label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Content'|trans }}:</label>
<div class="col">
<textarea class="form-control" name="content" rows="10">{{ request.content }}</textarea>
</div>
</div>
<button class="btn btn-primary w-100" type="submit">{{ 'Create'|trans }}</button>
</form>
</div>
</div>
<div class="tab-pane fade" id="tab-categories" role="tabpanel">
<table class="table card-table table-vcenter table-striped text-nowrap">
<tbody>
{% for cat_id, cat_title in admin.kb_category_get_pairs %}
<tr>
<td>
<a href="{{ '/kb/category'|alink }}/{{ cat_id }}">{{ cat_title }}</a>
</td>
<td class="w-1">
<a class="btn btn-icon" href="{{ '/kb/category'|alink }}/{{ cat_id }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#edit" />
</svg>
</a>
<a class="btn btn-icon api-link"
href="{{ 'api/admin/kb/category_delete'|link({ 'id': cat_id }) }}"
data-api-confirm="{{ 'Are you sure?'|trans }}"
data-api-redirect="{{ 'kb/new'|alink }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#delete" />
</svg>
</a>
</td>
</tr>
{% else %}
<tr>
<td class="text-muted" colspan="3">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="tab-pane fade" id="tab-new-category" role="tabpanel">
<div class="card-body">
<form method="post" action="{{ 'api/admin/kb/category_create'|link }}" class="api-form" data-api-reload="{{ 'Category created'|trans }}">
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
<input class="form-control" type="text" name="title" required>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Description'|trans }}:</label>
<div class="col">
<textarea class="form-control" name="description" rows="20"></textarea>
</div>
</div>
<button class="btn btn-primary w-100" type="submit">{{ 'Create'|trans }}</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -27,9 +27,10 @@
{% block content %}
<div class="card">
<div class="card-body">
<h5>{{ category.title }}</h5>
<form method="post" action="{{ 'api/admin/product/category_update'|link }}" class="api-form" data-api-msg="{{ 'Category updated'|trans }}">
<form method="post" action="{{ 'api/admin/product/category_update'|link }}" class="api-form" data-api-msg="{{ 'Category updated'|trans }}">
<div class="card-body">
<h3>{{ category.title }}</h3>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
<div class="col">
@@ -47,10 +48,19 @@
<div class="mb-3">
<textarea class="bb-textarea" name="description" rows="5">{{ category.description }}</textarea>
</div>
</div>
<input type="hidden" name="id" value="{{ category.id }}">
<input type="hidden" name="id" value="{{ category.id }}">
<div class="card-footer d-flex gap-2">
<a href="{{ 'product'|alink }}" class="btn btn-secondary w-25">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<use xlink:href="#arrow-sm-left" />
</svg>
{{ 'Go back'|trans }}
</a>
<button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
</fieldset>
</div>
</form>
</div>
{% endblock %}