Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -11,7 +11,7 @@ class TicketForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = MsgGroup
|
model = MsgGroup
|
||||||
exclude = [
|
exclude = [
|
||||||
'files'
|
'files', 'status', 'owner', 'manager'
|
||||||
# 'name', 'name_plural', 'order', 'createDT', 'modifiedDT', 'enable', 'json_data',
|
# 'name', 'name_plural', 'order', 'createDT', 'modifiedDT', 'enable', 'json_data',
|
||||||
# 'receive_msg_by_sms', 'owner', 'owner_type'
|
# 'receive_msg_by_sms', 'owner', 'owner_type'
|
||||||
]
|
]
|
||||||
@@ -14,13 +14,13 @@ from django.urls import reverse
|
|||||||
|
|
||||||
@login_required(login_url='/profile/login/')
|
@login_required(login_url='/profile/login/')
|
||||||
def support_create_ticket_form_ajax(request):
|
def support_create_ticket_form_ajax(request):
|
||||||
from ChatServiceApp.forms import CreateTicketForm
|
from ChatServiceApp.forms import TicketForm
|
||||||
|
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
Dict = {
|
Dict = {
|
||||||
'forms': CreateTicketForm()
|
'form': TicketForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
html = render_to_string('blocks/profile/b_create_ticket.html', Dict, request=request)
|
html = render_to_string('blocks/profile/b_create_ticket.html', Dict, request=request)
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Generated by Django 4.2.2 on 2023-08-01 17:57
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('ChatServiceApp', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='msggroup',
|
||||||
|
name='manager',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='rel_msgGroups_for_manager', to=settings.AUTH_USER_MODEL, verbose_name='Менеджер'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='msggroup',
|
||||||
|
name='owner',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='rel_msgGroups_for_owner', to=settings.AUTH_USER_MODEL, verbose_name='Владелец'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from BaseModels.base_models import BaseModel
|
from BaseModels.base_models import BaseModel
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
msg_type_choices = (
|
msg_type_choices = (
|
||||||
('support', 'техподдержка'),
|
('support', 'техподдержка'),
|
||||||
@@ -26,9 +26,16 @@ grp_msg_department = (
|
|||||||
|
|
||||||
|
|
||||||
class MsgGroup(BaseModel):
|
class MsgGroup(BaseModel):
|
||||||
|
from AuthApp.models import User
|
||||||
|
|
||||||
department = models.CharField(verbose_name='Отдел', default='support', choices=grp_msg_department)
|
department = models.CharField(verbose_name='Отдел', default='support', choices=grp_msg_department)
|
||||||
status = models.CharField(verbose_name='Статус', default='open', choices=grp_msg_status)
|
status = models.CharField(verbose_name='Статус', default='open', choices=grp_msg_status)
|
||||||
|
|
||||||
|
owner = models.ForeignKey(User, verbose_name=_('Владелец'), related_name='rel_msgGroups_for_owner',
|
||||||
|
on_delete=models.SET_NULL, null=True)
|
||||||
|
manager = models.ForeignKey(User, verbose_name=_('Менеджер'), related_name='rel_msgGroups_for_manager',
|
||||||
|
on_delete=models.SET_NULL, null=True)
|
||||||
|
|
||||||
class Message(BaseModel):
|
class Message(BaseModel):
|
||||||
from AuthApp.models import User
|
from AuthApp.models import User
|
||||||
|
|
||||||
|
|||||||
@@ -86,17 +86,38 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-form-create-ticket-select{
|
||||||
.el-form-create-ticket{
|
height: 62px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
|
||||||
filter: drop-shadow(-1px 4px 10px rgba(198, 199, 203, 0.20)) drop-shadow(0px -1px 10px rgba(198, 199, 203, 0.20));
|
filter: drop-shadow(-1px 4px 10px rgba(198, 199, 203, 0.20)) drop-shadow(0px -1px 10px rgba(198, 199, 203, 0.20));
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 5px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-create-ticket-select:focus-visible{
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-create-ticket-select > option {
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-webkit-border-radius: 0;
|
||||||
|
outline-offset: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-create-ticket{
|
||||||
|
width: calc(100% - 40px);
|
||||||
|
height: 20px;
|
||||||
|
filter: drop-shadow(-1px 4px 10px rgba(198, 199, 203, 0.20)) drop-shadow(0px -1px 10px rgba(198, 199, 203, 0.20));
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 5px;
|
||||||
/*min-width: unset;*/
|
/*min-width: unset;*/
|
||||||
/*max-width: unset;*/
|
/*max-width: unset;*/
|
||||||
/*min-height: unset;*/
|
/*min-height: unset;*/
|
||||||
/*padding: 10px;*/
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.el-form-create-ticket:last-child{*/
|
/*.el-form-create-ticket:last-child{*/
|
||||||
@@ -110,9 +131,14 @@
|
|||||||
|
|
||||||
.el-form-create-ticket-textarea{
|
.el-form-create-ticket-textarea{
|
||||||
min-height: 200px;
|
min-height: 200px;
|
||||||
min-width: 100%;
|
min-width: calc(100% - 40px);
|
||||||
max-width: 100%;
|
max-width: calc(100% - 40px);
|
||||||
resize: none;
|
resize: none;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-input-form-create-ticket{
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-form-create-ticket-textarea:focus-visible{
|
.el-form-create-ticket-textarea:focus-visible{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function createTicketShow () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countLetters () {
|
function countLetters () {
|
||||||
let area = document.querySelector("textarea[name=enter-message]")
|
let area = document.querySelector(".el-form-create-ticket-textarea")
|
||||||
let count = area.value.length
|
let count = area.value.length
|
||||||
if (count <= 500) {
|
if (count <= 500) {
|
||||||
let ins_area = document.querySelector(".letrs-count-span")
|
let ins_area = document.querySelector(".letrs-count-span")
|
||||||
@@ -46,11 +46,13 @@ function inputQuest (){
|
|||||||
|
|
||||||
|
|
||||||
function attachFileCreateTicket () {
|
function attachFileCreateTicket () {
|
||||||
event.preventDefault()
|
let input = inputQuest()
|
||||||
let input = document.querySelector(".create-ticket-file")
|
let file = input.files[0]
|
||||||
input.click()
|
// let file_url = URL.createObjectURL(file)
|
||||||
console.log("asd")
|
|
||||||
let data = input.value
|
|
||||||
|
|
||||||
|
let data = file
|
||||||
$.ajax({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/ru/user_account/support_create_ticket_ajax/',
|
url: '/ru/user_account/support_create_ticket_ajax/',
|
||||||
@@ -98,11 +100,12 @@ function attachFilemeassge () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createTicket (el) {
|
function createTicket (el) {
|
||||||
|
event.preventDefault()
|
||||||
let form = el.form
|
let form = el.form
|
||||||
let formData = new formData (form)
|
var formData = new FormData(form);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/ru/user_account/support_create_ticket_ajax/',
|
url: '/ru/messages/create_ticket/',
|
||||||
type: "POST",
|
type: "POST",
|
||||||
// async: true,
|
// async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
@@ -115,5 +118,10 @@ function createTicket (el) {
|
|||||||
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
error: function (data){
|
||||||
|
|
||||||
|
document.querySelector(".insert-tech-place").innerHTML = data.responseJSON.html;
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,32 +4,39 @@
|
|||||||
{% if errors.all__ %}<div class="errors_all" style="margin-bottom: 12px;width: 100%;font-size: 16px;">{{ errors.all__ }}</div>{% endif %}
|
{% if errors.all__ %}<div class="errors_all" style="margin-bottom: 12px;width: 100%;font-size: 16px;">{{ errors.all__ }}</div>{% endif %}
|
||||||
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<select name="department"
|
<div class="container-input-form-create-ticket">
|
||||||
id="id_department"
|
<select name="department"
|
||||||
class="el-form-create-ticket">
|
id="id_department"
|
||||||
<option>Отдел: Техническая поддержка</option>
|
class="el-form-create-ticket-select">
|
||||||
</select>
|
{# <option>Отдел: Техническая поддержка</option>#}
|
||||||
{% if form.errors.department %}<div class="errors">{{ form.errors.department }}</div>{% endif %}
|
{% for choice in form.fields.department.choices %}
|
||||||
<input type="text"
|
<option title="{{ choice.1 }}" value="{{ choice.0 }}"{% if choice.0 == form.initial.department %} selected{% endif %}>{{ choice.1 }}</option>
|
||||||
class="el-form-create-ticket"
|
{% endfor %}
|
||||||
name="name"
|
</select>
|
||||||
id="id_name"
|
{% if form.errors.department %}<div class="errors">{{ form.errors.department }}</div>{% endif %}
|
||||||
placeholder="Тема запроса"
|
</div>
|
||||||
value="{% if form.adding_machine.name %}{{ form.adding_machine.name }}{% endif %}"
|
<div class="container-input-form-create-ticket">
|
||||||
>
|
<input type="text"
|
||||||
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
|
class="el-form-create-ticket"
|
||||||
|
name="name"
|
||||||
<div class="letrs-count" style="color: #27242499;position: relative;top: 20px;left: 780px;display: inline-block;"><span class="letrs-count-span">0</span><span>/500</span></div>
|
id="id_name"
|
||||||
<textarea name="text"
|
placeholder="Тема запроса"
|
||||||
id="id_text"
|
value="{% if form.adding_machine.name %}{{ form.initial.name }}{% endif %}"
|
||||||
class="el-form-create-ticket-textarea"
|
>
|
||||||
placeholder="Введите сообщение..."
|
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
|
||||||
value="{% if form.adding_machine.text %}{{ form.adding_machine.text }}{% endif %}"
|
</div>
|
||||||
onkeyup="countLetters()"></textarea>
|
<div class="container-input-form-create-ticket">
|
||||||
{% if form.errors.text %}<div class="errors">{{ form.errors.text }}</div>{% endif %}
|
<div class="letrs-count" style="color: #27242499;position: relative;top: 39px;left: 760px;display: inline-block;"><span class="letrs-count-span">0</span><span>/500</span></div>
|
||||||
|
<textarea name="text"
|
||||||
|
id="id_text"
|
||||||
|
class="el-form-create-ticket-textarea"
|
||||||
|
placeholder="Введите сообщение..."
|
||||||
|
value="{% if form.adding_machine.text %}{{ form.initial.text }}{% endif %}"
|
||||||
|
onkeyup="countLetters()"></textarea>
|
||||||
|
{% if form.errors.text %}<div class="errors">{{ form.errors.text }}</div>{% endif %}
|
||||||
|
</div>
|
||||||
<div class="form-create-tickets-btns">
|
<div class="form-create-tickets-btns">
|
||||||
<button class="create-ticket-btn" onclick="createTicket()">Создать тикет</button>
|
<button class="create-ticket-btn" onclick="createTicket(this)">Создать тикет</button>
|
||||||
<button class="attach-file-btn" onclick="attachFileCreateTicket()"></button>
|
<button class="attach-file-btn" onclick="attachFileCreateTicket()"></button>
|
||||||
{# <input class="create-ticket-file" type="file" value="">#}
|
{# <input class="create-ticket-file" type="file" value="">#}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user