|
Lines 48-54
Link Here
|
| 48 |
<thead> |
48 |
<thead> |
| 49 |
<tr> |
49 |
<tr> |
| 50 |
<th>Reported</th> |
50 |
<th>Reported</th> |
| 51 |
<th>Concern</th> |
51 |
<th>Details</th> |
| 52 |
<th>Title</th> |
52 |
<th>Title</th> |
| 53 |
<th>Status</th> |
53 |
<th>Status</th> |
| 54 |
<th data-class-name="actions noExport">Actions</th> |
54 |
<th data-class-name="actions noExport">Actions</th> |
|
Lines 98-103
Link Here
|
| 98 |
</div> <!-- /.modal-dialog --> |
98 |
</div> <!-- /.modal-dialog --> |
| 99 |
</div> <!-- /#addConcernModal --> |
99 |
</div> <!-- /#addConcernModal --> |
| 100 |
|
100 |
|
|
|
101 |
<!-- Resolve concern modal --> |
| 102 |
<div class="modal" id="resolveConcernModal" tabindex="-1" role="dialog" aria-labelledby="resolveConcernLabel"> |
| 103 |
<div class="modal-dialog" role="document"> |
| 104 |
<div class="modal-content"> |
| 105 |
<div class="modal-header"> |
| 106 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 107 |
<h4 class="modal-title" id="resolveConcernLabel">Resolve concern</h4> |
| 108 |
</div> |
| 109 |
<div class="modal-body"> |
| 110 |
<fieldset class="rows"> |
| 111 |
<ol> |
| 112 |
<li> |
| 113 |
<label for="notify">Notify: </label> |
| 114 |
<input type="checkbox" name="notify" id="resolve_notify"> |
| 115 |
</li> |
| 116 |
<li> |
| 117 |
<label for="message">Resolution: </label> |
| 118 |
<textarea id="resolve_message" name="message"></textarea> |
| 119 |
<p id="helpBlock" class="help-block">Optional message to include with the notification to the reporter</p> |
| 120 |
|
| 121 |
</li> |
| 122 |
</ol> |
| 123 |
</fieldset> |
| 124 |
</div> <!-- /.modal-body --> |
| 125 |
<div class="modal-footer"> |
| 126 |
<input type="hidden" name="concern_id" id="concern_id"> |
| 127 |
<button type="submit" class="btn btn-default" id="resolveConfirm">Confirm</button> |
| 128 |
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> |
| 129 |
</div> <!-- /.modal-footer --> |
| 130 |
</div> <!-- /.modal-content --> |
| 131 |
</div> <!-- /.modal-dialog --> |
| 132 |
</div> <!-- /#resolveConcernModal --> |
| 133 |
|
| 101 |
[% MACRO jsinclude BLOCK %] |
134 |
[% MACRO jsinclude BLOCK %] |
| 102 |
[% INCLUDE 'datatables.inc' %] |
135 |
[% INCLUDE 'datatables.inc' %] |
| 103 |
[% INCLUDE 'columns_settings.inc' %] |
136 |
[% INCLUDE 'columns_settings.inc' %] |
|
Lines 146-152
Link Here
|
| 146 |
"orderable": true |
179 |
"orderable": true |
| 147 |
}, |
180 |
}, |
| 148 |
{ |
181 |
{ |
| 149 |
"data": "message", |
182 |
"data": "message:resolution_message", |
|
|
183 |
"render": function(data, type, row, meta) { |
| 184 |
let result = '<span class="clearfix">'+row.message+'</span>'; |
| 185 |
if ( row.resolution_message ) { |
| 186 |
result += '<span class="clearfix">'+_('Resolution: %s').format(row.resolution_message)+'</spani>'; |
| 187 |
} |
| 188 |
return result; |
| 189 |
}, |
| 150 |
"searchable": true, |
190 |
"searchable": true, |
| 151 |
"orderable": true |
191 |
"orderable": true |
| 152 |
}, |
192 |
}, |
|
Lines 175-181
Link Here
|
| 175 |
}, |
215 |
}, |
| 176 |
{ |
216 |
{ |
| 177 |
"data": function( row, type, val, meta ) { |
217 |
"data": function( row, type, val, meta ) { |
| 178 |
var result = '<a class="btn btn-default btn-xs" role="button" class="resolve_concern" data-concern-id="'+ encodeURIComponent(row.concern_id) +'"><i class="fa fa-check" aria-hidden="true"></i> '+_("Resolve")+'</a>'; |
218 |
let result = ''; |
|
|
219 |
if ( !row.resolved_date ) { |
| 220 |
result += '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#resolveConcernModal" data-concern="'+ encodeURIComponent(row.concern_id) +'"><i class="fa fa-check" aria-hidden="true"></i> '+_("Resolve")+'</a>'; |
| 221 |
} |
| 179 |
return result; |
222 |
return result; |
| 180 |
}, |
223 |
}, |
| 181 |
"searchable": false, |
224 |
"searchable": false, |
|
Lines 193-214
Link Here
|
| 193 |
concerns.DataTable().columns('3').search('').draw(); |
236 |
concerns.DataTable().columns('3').search('').draw(); |
| 194 |
}); |
237 |
}); |
| 195 |
|
238 |
|
| 196 |
$('#table_concerns').on( "click", '.resolve_concern', function () { |
239 |
$('#resolveConcernModal').on('show.bs.modal', function (event) { |
| 197 |
var concern_id = decodeURIComponent($(this).data('concern-id')); |
240 |
let modal = $(this); |
| 198 |
|
241 |
let button = $(event.relatedTarget); |
| 199 |
$("#delete_confirm_modal_button").unbind("click").on( "click", function () { |
242 |
let concern = button.data('concern'); |
| 200 |
$.ajax({ |
243 |
|
| 201 |
method: "PUT", |
244 |
modal.find('.modal-footer input').val(concern) |
| 202 |
url: "/api/v1/catalog/concerns/"+concern_id |
245 |
}); |
| 203 |
}).success(function() { |
246 |
|
| 204 |
$("#delete_confirm_modal").modal('hide'); |
247 |
$('#resolveConcernModal').on('click', '#resolveConfirm', function(e) { |
| 205 |
concerns.api().ajax.reload(function (data) { |
248 |
let concern_id = $('#concern_id').val(); |
| 206 |
$("#concern_action_result_dialog").hide(); |
249 |
let params = { notify: $('#resolve_notify').is(":checked"), message: $('#resolve_message').val() }; |
| 207 |
$("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show(); |
250 |
|
| 208 |
}); |
251 |
$.ajax({ |
| 209 |
}).error(function () { |
252 |
url: "/api/v1/catalog/concerns/"+concern_id+"/resolve", |
| 210 |
$("#concern_delete_error").html(_("Error deleting concern #%s. Check the logs.").format(concern_id)).show(); |
253 |
method: "POST", |
|
|
254 |
data: JSON.stringify(params) |
| 255 |
}).success(function() { |
| 256 |
$("#resolveConcernModal").modal('hide'); |
| 257 |
concerns.DataTable().ajax.reload(function (data) { |
| 258 |
$("#concern_action_result_dialog").hide(); |
| 259 |
$("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show(); |
| 211 |
}); |
260 |
}); |
|
|
261 |
}).error(function () { |
| 262 |
$("#concern_resolve_error").html(_("Error resolving concern #%s. Check the logs.").format(concern_id)).show(); |
| 212 |
}); |
263 |
}); |
| 213 |
}); |
264 |
}); |
| 214 |
|
265 |
|
| 215 |
- |
|
|