|
85 | 85 | @endif |
86 | 86 | $('#complete-ticket-form').submit(); |
87 | 87 | }); |
88 | | -
|
89 | | - // When opening a comment modal, |
90 | | - $('.comment-modal').on('show.bs.modal', function (e) { |
91 | | - $('.comment-modal .alert-danger').hide(); |
92 | | - $(this).find('.fieldset-for-comment').show(); |
93 | | - $(this).find('.fieldset-for-attachment').hide(); |
94 | | - }); |
95 | | -
|
96 | | - $('.comment-modal').on('shown.bs.modal', function (e) { |
97 | | - $(this).find('.modal-title').text($(e.relatedTarget).text()); |
98 | | - if ($(e.relatedTarget).data('add-comment') == 'no') $(this).find('#comment-type-buttons').hide(); |
99 | | -
|
100 | | - $(this).find("textarea.modal-summernote-editor").summernote(summernote_options); |
101 | | - }); |
102 | | -
|
103 | | - $('.comment-modal').on('hidden.bs.modal', function (e) { |
104 | | - $(this).find("textarea.modal-summernote-editor").summernote('destroy'); |
105 | | - }); |
106 | | -
|
107 | | - // Comment form: Click on response type buttons (reply or note) |
108 | | - $('.response_type').click(function(){ |
109 | | - var type = $(this).attr('data-type'); |
110 | | - $('#modal-comment-new #response_type').val(type); |
111 | | - $(this).addClass($(this).attr('data-active-class')); |
112 | | -
|
113 | | - if (type == 'reply'){ |
114 | | - $('#add_in_user_notification_text, #add_to_intervention').prop('disabled', false); |
115 | | - $('#add_in_user_notification_text, #add_to_intervention').closest('div').show(); |
116 | | - }else{ |
117 | | - $('#add_in_user_notification_text, #add_to_intervention').prop('disabled', true); |
118 | | - $('#add_in_user_notification_text, #add_to_intervention').closest('div').hide(); |
119 | | - } |
120 | | -
|
121 | | - var alt = type == 'note' ? 'reply' : 'note'; |
122 | | - $('#popup_comment_btn_'+alt).removeClass($('#popup_comment_btn_'+alt).attr('data-active-class')); |
123 | | - }); |
124 | | -
|
125 | | - // Highlight related comment when showing related modal |
126 | | - $('.jquery_panel_hightlight').on('show.bs.modal', function (e) { |
127 | | - $(e.relatedTarget).closest('div.card').addClass('card-highlight'); |
128 | | - }); |
129 | | -
|
130 | | - $('.jquery_panel_hightlight').on('hidden.bs.modal', function (e) { |
131 | | - $('div.card').removeClass('card-highlight'); |
132 | | - }); |
133 | | -
|
134 | | - $('#new_comment_submit').click(function(e){ |
135 | | - e.preventDefault(); |
136 | | -
|
137 | | - @if($u->currentLevel() > 1 && !$ticket->intervention_html != "") |
138 | | - if ($(this).closest('form').find('input[name="add_to_intervention"]').is(':checked') == false && $(this).closest('form').find('input[name="complete_ticket"]').is(':checked')){ |
139 | | - if(!confirm('{!! trans('panichd::lang.add-comment-confirm-blank-intervention') !!}')) return false; |
140 | | - } |
141 | | - @endif |
142 | | -
|
143 | | - ajax_form_submit($(this)); |
144 | | - }); |
145 | | -
|
146 | | - // Click "X" to delete comment |
147 | | - $('#modal-comment-delete').on('show.bs.modal', function (e) { |
148 | | - if ($('#delete-comment-form').attr('data-default-action') == ''){ |
149 | | - $('#delete-comment-form').attr('data-default-action',$('#delete-comment-form').attr('action')); |
150 | | - } |
151 | | -
|
152 | | - // Add value to form |
153 | | - $('#delete-comment-form').attr('action',$('#delete-comment-form').attr('action').replace('action_comment_id',$(e.relatedTarget).attr('data-id'))); |
154 | | - }); |
155 | | -
|
156 | | - // Dismiss comment deletion |
157 | | - $('#modal-comment-delete').on('hidden.bs.modal', function (e) { |
158 | | - $('#delete-comment-form').attr('action',$('#delete-comment-form').attr('data-default-action')); |
159 | | - }); |
160 | | -
|
161 | | - // Comment confirm delete |
162 | | - $( "#delete-comment-submit" ).click(function( event ) { |
163 | | - event.preventDefault(); |
164 | | - $("#delete-comment-form").submit(); |
165 | | - }); |
166 | | -
|
167 | | -
|
168 | | - // Comment (reply) notifications resend modal |
169 | | - $( "#email-resend-modal" ).on('show.bs.modal', function (e) { |
170 | | - var button = $(e.relatedTarget); |
171 | | - $(this).find('#owner').text($(button).attr('data-owner')); |
172 | | - $(this).find('#comment_id').val($(button).attr('data-id')) |
173 | | - }); |
174 | 88 | }); |
175 | 89 | </script> |
0 commit comments