55@include (' panichd::shared.common' )
66
77@section (' content' )
8- @include (' panichd::tickets.partials.ticket_body' )
9- @include (' panichd::tickets.partials.modal_complete' )
8+ @include (' panichd::tickets.show.body' )
9+ @if ($u -> isAdmin () )
10+ @include (' panichd::tickets.show.modal_delete' )
11+ @endif
12+ @include (' panichd::tickets.show.modal_complete' )
1013
1114 @if ($u -> canCommentTicket ($ticket -> id ) || ( ! $comments -> isEmpty () && $ticket -> comments -> forLevel (1 )-> count () ) )
1215 <div style =" margin-top : 2em ;" >
1720 </h2 >
1821 </div >
1922 @endif
20- @include (' panichd::tickets.partials.comments' )
21- {!! $comments -> render () ! !}
22- @include (' panichd::tickets.partials.modal_comment_new' )
23+ @if (! $comments -> isEmpty () )
24+ @include (' panichd::tickets.show.comments' )
25+ @endif
26+ {!! $comments -> render () ! !}
27+ @include (' panichd::tickets.show.modal_comment_new' )
2328 @if ($setting -> grab (' ticket_attachments_feature' ) )
2429 @include (' panichd::shared.attach_files_script' )
2530 @endif
2934@include (' panichd::shared.jcrop_files' )
3035
3136@section (' footer' )
32- <script >
33- // PhotoSwipe items array (load before jQuery .pwsp_gallery_link click selector)
34- var pswpItems = [
35- @foreach ($ticket -> allAttachments ()-> images ()-> get () as $attachment )
36- @if ($attachment -> image_sizes != " " )
37- <?php
38- $sizes = explode (' x' , $attachment -> image_sizes );
39- ? >
40- {
41- src: ' {{ URL:: route ($setting -> grab (' main_route' ). ' .view-attachment' , [$attachment -> id ]) } }' ,
42- w: {{ $sizes [0 ] } } ,
43- h: {{ $sizes [1 ] } } ,
44- pid: {{ $attachment -> id } } ,
45- title: ' {{ $attachment -> new_filename . ($attachment -> description == " " ? ' ' : trans (' panichd::lang.colon' ). $attachment -> description ) } }'
46- },
47- @endif
48- @endforeach
49- ];
50-
51- var category_id= <?= $ticket -> category_id ;? > ;
52- $ (document ).ready (function () {
53- $ ( " .deleteit" ).click (function ( event ) {
54- event .preventDefault ();
55- if (confirm (" {!! trans (' panichd::lang.show-ticket-js-delete' ) ! !}" + $ (this ).attr (" node" ) + " ?" ))
56- {
57- var form = $ (this ).attr (" form" );
58- $ (" #" + form).submit ();
59- }
60-
61- });
62- $ (' #category_id' ).change (function (){
63- // Update agent list
64- var loadpage = " {!! route ($setting -> grab (' main_route' ). ' agentselectlist' ) ! !} /" + $ (this ).val () + " /{{ $ticket -> id } }" ;
65- $ (' #agent_id' ).load (loadpage);
66-
67- // Update tag list
68- $ (' #jquery_select2_container .select2-container' ).hide ();
69- $ (' #jquery_tag_category_' + $ (this ).val ()).next ().show ();
70- });
71-
72- $ (' #agent_id' ).change (function (){
73- if ($ (' #status_id' ).val ()== " {!! $setting -> grab (' default_status_id' ) ! !}" ){
74- $ (' #status_id' ).val (" {!! $setting -> grab (' default_reopen_status_id' ) ! !}" )
75- }
76- });
77- $ (' #confirmDelete' ).on (' show.bs.modal' , function (e ) {
78- $message = $ (e .relatedTarget ).attr (' data-message' );
79- $ (this ).find (' .modal-body p' ).text ($message);
80- $title = $ (e .relatedTarget ).attr (' data-title' );
81- $ (this ).find (' .modal-title' ).text ($title);
82-
83- // Pass form reference to modal for submission on yes/ok
84- var form = $ (e .relatedTarget ).closest (' form' );
85- $ (this ).find (' .modal-footer #confirm' ).data (' form' , form);
86- });
87-
88- <!-- Form confirm (yes/ ok) handler, submits form -->
89- $ (' #confirmDelete' ).find (' .modal-footer #confirm' ).on (' click' , function (){
90- $ (this ).data (' form' ).submit ();
91- });
92-
93- // Complete modal submit button
94- $ (' #complete_form_submit' ).click (function (e ){
95- @if ($u -> currentLevel () > 1 && $u -> canManageTicket ($ticket -> id ) )
96- // Agent / Admin
97- @if (! $ticket -> intervention_html )
98- if (! $ (' #blank_intervention_check' ).prop (' checked' )){
99- alert (' {{ trans (' panichd::lang.show-ticket-complete-blank-intervention-alert' ) } }' );
100- return false ;
101- }
102- @endif
103- @else
104- // User Level
105- if (! $ (" #complete-ticket-form input[name='reason_id']:checked" ).val ()) {
106- alert (' {{ trans (' panichd::lang.show-ticket-modal-complete-blank-reason-alert' ) } }' );
107- return false ;
108- }
109- @endif
110- $ (' #complete-ticket-form' ).submit ();
111- });
112-
113- // When opening a comment modal,
114- $ (' .comment-modal' ).on (' show.bs.modal' , function (e ) {
115- $ (' .comment-modal .alert-danger' ).hide ();
116- $ (this ).find (' .fieldset-for-comment' ).show ();
117- $ (this ).find (' .fieldset-for-attachment' ).hide ();
118- });
119-
120- $ (' #modal-comment-new' ).on (' show.bs.modal' , function (e ) {
121- $ (this ).find (' .modal-title' ).text ($ (e .relatedTarget ).text ());
122- if ($ (e .relatedTarget ).data (' add-comment' ) == ' no' ) $ (this ).find (' #comment-type-buttons' ).hide ();
123- });
124-
125- // Comment form: Click on response type buttons (reply or note)
126- $ (' .response_type' ).click (function (){
127- var type = $ (this ).attr (' data-type' );
128- $ (' #modal-comment-new #response_type' ).val (type);
129- $ (this ).addClass ($ (this ).attr (' data-active-class' ));
130-
131- if (type == ' reply' ){
132- $ (' #add_to_intervention' ).prop (' disabled' , false );
133- $ (' #add_to_intervention' ).closest (' div' ).show ();
134- }else {
135- $ (' #add_to_intervention' ).prop (' disabled' , true );
136- $ (' #add_to_intervention' ).closest (' div' ).hide ();
137- }
138-
139- var alt = type == ' note' ? ' reply' : ' note' ;
140- $ (' #popup_comment_btn_' + alt).removeClass ($ (' #popup_comment_btn_' + alt).attr (' data-active-class' ));
141- });
142-
143- // Highlight related comment when showing related modal
144- $ (' .jquery_panel_hightlight' ).on (' show.bs.modal' , function (e ) {
145- $ (e .relatedTarget ).closest (' div.panel' ).addClass (' panel-highlight' );
146- });
147-
148- $ (' .jquery_panel_hightlight' ).on (' hidden.bs.modal' , function (e ) {
149- $ (' div.panel' ).removeClass (' panel-highlight' );
150- });
151-
152- $ (' #new_comment_submit' ).click (function (e ){
153- e .preventDefault ();
154-
155- @if ($u -> currentLevel () > 1 && ! $ticket -> intervention_html != " " )
156- if ($ (this ).closest (' form' ).find (' input[name="add_to_intervention"]' ).is (' :checked' ) == false && $ (this ).closest (' form' ).find (' input[name="complete_ticket"]' ).is (' :checked' )){
157- if (! confirm (' {!! trans (' panichd::lang.add-comment-confirm-blank-intervention' ) ! !}' )) return false ;
158- }
159- @endif
160-
161- ajax_form_submit ($ (this ));
162- });
163-
164- // Click "X" to delete comment
165- $ (' #modal-comment-delete' ).on (' show.bs.modal' , function (e ) {
166- if ($ (' #delete-comment-form' ).attr (' data-default-action' ) == ' ' ){
167- $ (' #delete-comment-form' ).attr (' data-default-action' ,$ (' #delete-comment-form' ).attr (' action' ));
168- }
169-
170- // Add value to form
171- $ (' #delete-comment-form' ).attr (' action' ,$ (' #delete-comment-form' ).attr (' action' ).replace (' action_comment_id' ,$ (e .relatedTarget ).attr (' data-id' )));
172- });
173-
174- // Dismiss comment deletion
175- $ (' #modal-comment-delete' ).on (' hidden.bs.modal' , function (e ) {
176- $ (' #delete-comment-form' ).attr (' action' ,$ (' #delete-comment-form' ).attr (' data-default-action' ));
177- });
178-
179- // Comment confirm delete
180- $ ( " #delete-comment-submit" ).click (function ( event ) {
181- event .preventDefault ();
182- $ (" #delete-comment-form" ).submit ();
183- });
184-
185-
186- // Comment (reply) notifications resend modal
187- $ ( " #email-resend-modal" ).on (' show.bs.modal' , function (e ) {
188- var button = $ (e .relatedTarget );
189- $ (this ).find (' #owner' ).text ($ (button).attr (' data-owner' ));
190- $ (this ).find (' #comment_id' ).val ($ (button).attr (' data-id' ))
191- });
192- });
193- </script >
37+ @include (' panichd::tickets.show.script' )
19438 @include (' panichd::tickets.partials.summernote' )
19539 @include (' panichd::tickets.partials.tags_footer_script' )
196- @append
40+ @append
0 commit comments