-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadmin_ticket.ctp
More file actions
163 lines (160 loc) · 9.05 KB
/
admin_ticket.ctp
File metadata and controls
163 lines (160 loc) · 9.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php App::import('Controller', 'SupportController');
$Support = new SupportController(); ?>
<style>
.direct-chat-text:after,
.direct-chat-text:before {
position: absolute;
right: 100%;
top: 15px;
border: solid #e21c1c00;
border-right-color: #f39c12;
content: ' ';
height: 0;
width: 0;
pointer-events: none;
}
.direct-chat-text:before {
border-width: 6px;
margin-top: -6px;
border-right-color: #f39c12;
}
</style>
<section class="content">
<div class="container">
<div class="row">
<div class="col-sm-12">
<a class="btn btn-primary"
href="<?= $this->Html->url(array('controller' => 'Support', 'admin' => true, 'action' => 'index')) ?>"><i
class="fa fa-arrow-left"></i> <?= $Lang->get('SUPPORT_BACK_TO_LIST'); ?></a>
<?php if ($ticket['Ticket']['state'] == 0 || $ticket['Ticket']['state'] == 1) { ?>
<a class="btn btn-danger"
href="<?= $this->Html->url(array('plugin' => null, 'admin' => true, 'controller' => 'support', 'action' => 'closa_adm', '' . $ticket['Ticket']['id'] . '')) ?>"><i
class="fa fa-close"></i> <?= $Lang->get('SUPPORT__CLOSE'); ?></a>
<?php } ?>
<br/>
<br/>
<div class="card">
<div class="card-body">
<h3 style="margin-top: 6px;"><?= $Lang->get('SUPPORT__PROBLEMQUESTION', ['{ID_TICKET}' => $ticket['Ticket']['id']]); ?> <?= $Support->getUser('pseudo', $ticket['Ticket']['author']); ?></h3>
<h4><?= $Lang->get('SUPPORT__IN_A_CATEGORIE', ['{NAME}' => $Support->getCategorie($ticket['Ticket']['categorie'])]); ?></h4>
</div>
</div>
</div>
<hr style="border-top: 1px solid #dedede;">
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<div class="card-title">
<?= $Lang->get('SUPPORT__ANSWER'); ?>
</div>
</div>
<div class="card-body">
<div style="height: 450px;" class="direct-chat-messages">
<div class="direct-chat-msg">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name float-left"><?= $Support->getUser('pseudo', $ticket['Ticket']['author']); ?></span>
<span class="direct-chat-timestamp float-right"><?= date('d/m/Y à H:m:s', strtotime($ticket['Ticket']['created'])); ?></span>
</div>
<img class="direct-chat-img avatar-client"
data-pseudo="<?= $Support->getUser('pseudo', $ticket['Ticket']['author']); ?>"
src="<?= $this->Html->url(array('controller' => 'support', 'action' => 'img', 'admin' => false, 'plugin' => null, 'steve.png')); ?>"
alt="message user image">
<div style="word-wrap: break-word;background-color: #f39c12;border-color: #f39c12;color: white;"
class="direct-chat-text">
<?= $ticket['Ticket']['reponse_text']; ?>
</div>
</div>
<div class="clearfix"></div>
<?php foreach ($answers as $answer): ?>
<div class="direct-chat-msg <?php if ($answer['ReplyTicket']['type'] == 1) { ?>direct-chat-warning right<?php } ?>">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name float-left"><?= $Support->getUser('pseudo', $answer['ReplyTicket']['author']); ?></span>
<span class="direct-chat-timestamp float-right"><?= date('d/m/Y à H:m:s', strtotime($answer['ReplyTicket']['created'])); ?></span>
</div>
<img class="direct-chat-img avatar-client"
data-pseudo="<?= $Support->getUser('pseudo', $answer['ReplyTicket']['author']); ?>"
src="<?= $this->Html->url(array('controller' => 'support', 'action' => 'img', 'admin' => false, 'plugin' => null, 'steve.png')); ?>"
alt="message user image">
<div style="word-wrap: break-word;<?php if ($answer['ReplyTicket']['type'] != 1) { ?>background-color: #f39c12;border-color: #f39c12;color: white;<?php } ?>"
class="direct-chat-text">
<?= $answer['ReplyTicket']['reply']; ?>
</div>
</div>
<div class="clearfix"></div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<?php if ($Permissions->can('MANAGE_TICKETS') && $Permissions->can('ANSWER_TICKETS')) { ?>
<div class="card">
<div class="card-header">
<div class="card-title">
<?= $Lang->get('SUPPORT__REPLYTICKET') ?>
</div>
</div>
<div class="card-body">
<?php if ($ticket['Ticket']['state'] != 2) { ?>
<form method="post" class="form-horizontal" data-ajax="true" data-redirect-url="../"
action="<?= $this->Html->url(array('controller' => 'Support', 'action' => 'ajax_replya')) ?>">
<input type="hidden" name="idTicket" value="<?= $ticket['Ticket']['id']; ?>">
<?= $this->Html->script('admin/tinymce/tinymce.min.js') ?>
<script type="text/javascript">
tinymce.init({
selector: "textarea#editor",
height: 300,
width: '100%',
language: 'fr_FR',
plugins: "textcolor code image link",
toolbar: "fontselect fontsizeselect bold italic underline strikethrough link image forecolor backcolor alignleft aligncenter alignright alignjustify cut copy paste bullist numlist outdent indent blockquote code"
});
</script>
<textarea id="editor" name="reponse_text" cols="30" rows="10"></textarea>
<br>
<button class="btn btn-primary" type="submit">
<?= $Lang->get('SUPPORT__REPLY') ?>
</button>
</form>
<?php } else { ?>
<div class="alert alert-warning">
<?= $Lang->get('SUPPORT__CLOSTICKETWARNING') ?>
</div>
<?php } ?>
</div>
</div>
<?php } else { ?>
<div class="alert alert-danger">
<?= $Lang->get('SUPPORT__ERROR_PERMISSION_ANSWER'); ?>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
<script>
$(document).ready(function () {
$('.avatar-client').each(function () {
var pseudo = $(this).attr("data-pseudo");
var src = "<?= $this->Html->url('/'); ?>API/get_head_skin/" + pseudo + "/32";
$(this).attr("src", src);
});
AddTags("editor", "", "<br /><br /><hr>Cordialement,<br /><?= $user['pseudo']; ?>");
});
function AddTags(name, prefix, suffix) {
try {
var textArea = document.getElementById(name).value;
var i = 0;
var textArray = textArea.split("\n");
if (textArray === null) {
document.getElementById(name).value += prefix + suffix;
} else {
for (i = 0; i < textArray.length; i++) {
textArray[i] = prefix + textArray[i] + suffix;
}
document.getElementById(name).value = textArray.join("\n");
}
} catch (err) {
}
}
</script>