Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -11,7 +11,7 @@ class TicketForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = MsgGroup
|
||||
exclude = [
|
||||
'files'
|
||||
'files', 'status', 'owner', 'manager'
|
||||
# 'name', 'name_plural', 'order', 'createDT', 'modifiedDT', 'enable', 'json_data',
|
||||
# 'receive_msg_by_sms', 'owner', 'owner_type'
|
||||
]
|
||||
@@ -14,13 +14,13 @@ from django.urls import reverse
|
||||
|
||||
@login_required(login_url='/profile/login/')
|
||||
def support_create_ticket_form_ajax(request):
|
||||
from ChatServiceApp.forms import CreateTicketForm
|
||||
from ChatServiceApp.forms import TicketForm
|
||||
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
Dict = {
|
||||
'forms': CreateTicketForm()
|
||||
'form': TicketForm()
|
||||
}
|
||||
|
||||
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 BaseModels.base_models import BaseModel
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
msg_type_choices = (
|
||||
('support', 'техподдержка'),
|
||||
@@ -26,9 +26,16 @@ grp_msg_department = (
|
||||
|
||||
|
||||
class MsgGroup(BaseModel):
|
||||
from AuthApp.models import User
|
||||
|
||||
department = models.CharField(verbose_name='Отдел', default='support', choices=grp_msg_department)
|
||||
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):
|
||||
from AuthApp.models import User
|
||||
|
||||
|
||||
@@ -86,17 +86,38 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.el-form-create-ticket{
|
||||
.el-form-create-ticket-select{
|
||||
height: 62px;
|
||||
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));
|
||||
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;*/
|
||||
/*max-width: unset;*/
|
||||
/*min-height: unset;*/
|
||||
/*padding: 10px;*/
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/*.el-form-create-ticket:last-child{*/
|
||||
@@ -110,9 +131,14 @@
|
||||
|
||||
.el-form-create-ticket-textarea{
|
||||
min-height: 200px;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: calc(100% - 40px);
|
||||
max-width: calc(100% - 40px);
|
||||
resize: none;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container-input-form-create-ticket{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.el-form-create-ticket-textarea:focus-visible{
|
||||
|
||||
@@ -18,7 +18,7 @@ function createTicketShow () {
|
||||
}
|
||||
|
||||
function countLetters () {
|
||||
let area = document.querySelector("textarea[name=enter-message]")
|
||||
let area = document.querySelector(".el-form-create-ticket-textarea")
|
||||
let count = area.value.length
|
||||
if (count <= 500) {
|
||||
let ins_area = document.querySelector(".letrs-count-span")
|
||||
@@ -46,11 +46,13 @@ function inputQuest (){
|
||||
|
||||
|
||||
function attachFileCreateTicket () {
|
||||
event.preventDefault()
|
||||
let input = document.querySelector(".create-ticket-file")
|
||||
input.click()
|
||||
console.log("asd")
|
||||
let data = input.value
|
||||
let input = inputQuest()
|
||||
let file = input.files[0]
|
||||
// let file_url = URL.createObjectURL(file)
|
||||
|
||||
|
||||
|
||||
let data = file
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/support_create_ticket_ajax/',
|
||||
@@ -98,11 +100,12 @@ function attachFilemeassge () {
|
||||
}
|
||||
|
||||
function createTicket (el) {
|
||||
event.preventDefault()
|
||||
let form = el.form
|
||||
let formData = new formData (form)
|
||||
var formData = new FormData(form);
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/support_create_ticket_ajax/',
|
||||
url: '/ru/messages/create_ticket/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
@@ -115,5 +118,10 @@ function createTicket (el) {
|
||||
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 %}
|
||||
|
||||
{% csrf_token %}
|
||||
<select name="department"
|
||||
id="id_department"
|
||||
class="el-form-create-ticket">
|
||||
<option>Отдел: Техническая поддержка</option>
|
||||
</select>
|
||||
{% if form.errors.department %}<div class="errors">{{ form.errors.department }}</div>{% endif %}
|
||||
<input type="text"
|
||||
class="el-form-create-ticket"
|
||||
name="name"
|
||||
id="id_name"
|
||||
placeholder="Тема запроса"
|
||||
value="{% if form.adding_machine.name %}{{ form.adding_machine.name }}{% endif %}"
|
||||
>
|
||||
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
|
||||
|
||||
<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>
|
||||
<textarea name="text"
|
||||
id="id_text"
|
||||
class="el-form-create-ticket-textarea"
|
||||
placeholder="Введите сообщение..."
|
||||
value="{% if form.adding_machine.text %}{{ form.adding_machine.text }}{% endif %}"
|
||||
onkeyup="countLetters()"></textarea>
|
||||
{% if form.errors.text %}<div class="errors">{{ form.errors.text }}</div>{% endif %}
|
||||
|
||||
<div class="container-input-form-create-ticket">
|
||||
<select name="department"
|
||||
id="id_department"
|
||||
class="el-form-create-ticket-select">
|
||||
{# <option>Отдел: Техническая поддержка</option>#}
|
||||
{% for choice in form.fields.department.choices %}
|
||||
<option title="{{ choice.1 }}" value="{{ choice.0 }}"{% if choice.0 == form.initial.department %} selected{% endif %}>{{ choice.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if form.errors.department %}<div class="errors">{{ form.errors.department }}</div>{% endif %}
|
||||
</div>
|
||||
<div class="container-input-form-create-ticket">
|
||||
<input type="text"
|
||||
class="el-form-create-ticket"
|
||||
name="name"
|
||||
id="id_name"
|
||||
placeholder="Тема запроса"
|
||||
value="{% if form.adding_machine.name %}{{ form.initial.name }}{% endif %}"
|
||||
>
|
||||
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
|
||||
</div>
|
||||
<div class="container-input-form-create-ticket">
|
||||
<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">
|
||||
<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>
|
||||
{# <input class="create-ticket-file" type="file" value="">#}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user