|
111 | 111 | $test_steps = $_POST['test_steps']; |
112 | 112 | $approximate_time = (int)($_POST['approximate_time']) ? $_POST['approximate_time'] : 0; |
113 | 113 | $expected_results = $_POST['expected_results']; |
| 114 | + $tags = empty($_POST['tags']) ? [] : $_POST['tags']; |
114 | 115 |
|
115 | 116 | // Update a framework control test |
116 | | - update_framework_control_test($test_id, $tester, $test_frequency, $name, $objective, $test_steps, $approximate_time, $expected_results, $last_date, $next_date, false, $additional_stakeholders, $teams); |
| 117 | + update_framework_control_test($test_id, $tester, $test_frequency, $name, $objective, $test_steps, $approximate_time, $expected_results, $last_date, $next_date, false, $additional_stakeholders, $teams, $tags); |
117 | 118 |
|
118 | 119 | set_alert(true, "good", $escaper->escapeHtml($lang['TestSuccessUpdated'])); |
119 | 120 |
|
|
168 | 169 |
|
169 | 170 | display_bootstrap_javascript(); |
170 | 171 | ?> |
| 172 | + <script src="../js/pages/compliance.js?<?php echo current_version("app"); ?>"></script> |
171 | 173 | <script src="../js/bootstrap-multiselect.js?<?php echo current_version("app"); ?>"></script> |
172 | 174 |
|
173 | 175 | <title>SimpleRisk: Enterprise Risk Management Simplified</title> |
|
182 | 184 | <link rel="stylesheet" href="../vendor/components/font-awesome/css/fontawesome.min.css?<?php echo current_version("app"); ?>"> |
183 | 185 | <link rel="stylesheet" href="../css/theme.css?<?php echo current_version("app"); ?>"> |
184 | 186 | <link rel="stylesheet" href="../css/side-navigation.css?<?php echo current_version("app"); ?>"> |
| 187 | + <link rel="stylesheet" href="../css/selectize.bootstrap3.css?<?php echo current_version("app"); ?>"> |
| 188 | + <script src="../js/selectize.min.js?<?php echo current_version("app"); ?>"></script> |
185 | 189 | <?php |
186 | 190 | setup_favicon(".."); |
187 | 191 | setup_alert_requirements(".."); |
|
317 | 321 | $('[name=approximate_time]', modal).val(data['approximate_time']); |
318 | 322 | $('[name=expected_results]', modal).val(data['expected_results']); |
319 | 323 | $(".datepicker" , modal).datepicker(); |
| 324 | + $.each(data['tags'], function (i, item) { |
| 325 | + $('[name=\'tags[]\']', modal).append($('<option>', { |
| 326 | + value: item, |
| 327 | + text : item, |
| 328 | + selected : true, |
| 329 | + })); |
| 330 | + }); |
| 331 | + var select = $('[name=\'tags[]\']', modal).selectize(); |
| 332 | + var selectize = select[0].selectize; |
| 333 | + selectize.setValue(data['tags']); |
320 | 334 |
|
321 | 335 | modal.modal(); |
322 | 336 | } |
|
332 | 346 | }else if($(this).hasClass("initiate-test-btn")){ |
333 | 347 | var type = "test"; |
334 | 348 | } |
| 349 | + var modal = $('#tags--edit'); |
| 350 | + $('[name=audit_type]', modal).val(type); |
| 351 | + $('[name=id]', modal).val($(this).data('id')); |
| 352 | + modal.modal(); |
| 353 | + return; |
| 354 | + }); |
| 355 | + // Event when clicks Initiate Framework, Control, Test Audit button |
| 356 | + $("#tags--edit").on("click", "[name=continue_add_tags], [name=cancel_add_tags]", function(){ |
| 357 | + var type = $("#tags--edit [name=audit_type]").val(); |
| 358 | + var id = $("#tags--edit [name=id]").val(); |
| 359 | + var tags = $("#tags--edit [name='tags[]']").val(); |
| 360 | + if($(this).attr("name") == "continue_add_tags") { |
| 361 | + var tags = $("#tags--edit [name='tags[]']").val(); |
| 362 | + } else { |
| 363 | + var tags = []; |
| 364 | + } |
| 365 | + var select = $("#tags--edit [name='tags[]']").selectize(); |
| 366 | + var selectize = select[0].selectize; |
| 367 | + selectize.clear(); |
335 | 368 |
|
336 | 369 | $.ajax({ |
337 | 370 | url: BASE_URL + '/api/compliance/audit_initiation/initiate', |
338 | 371 | type: 'POST', |
339 | 372 | data: { |
340 | | - type: type,// control, test |
341 | | - id: $(this).data('id'), |
| 373 | + type: type, // control, test |
| 374 | + tags: tags, // selected tags |
| 375 | + id: id, |
342 | 376 | }, |
343 | 377 | success : function (res){ |
344 | 378 | if(res.status_message){ |
|
480 | 514 | <label for=""><?php echo $escaper->escapeHtml($lang['ExpectedResults']); ?></label> |
481 | 515 | <textarea name="expected_results" class="form-control" rows="6" style="width:100%;"></textarea> |
482 | 516 |
|
| 517 | + <label for=""><?php echo $escaper->escapeHtml($lang['Tags']); ?></label> |
| 518 | + <select class="test_tags" readonly name="tags[]" multiple placeholder="<?php echo $escaper->escapeHtml($lang['TagsWidgetPlaceholder']);?>"></select> |
| 519 | + <div class="tag-max-length-warning" style="margin-top:-10px"><?php echo $escaper->escapeHtml($lang['MaxTagLengthWarning']);?></div> |
| 520 | + |
483 | 521 | <input type="hidden" name="test_id" value=""> |
484 | 522 |
|
485 | 523 | </div> |
|
490 | 528 | </div> |
491 | 529 | </form> |
492 | 530 | </div> |
| 531 | + |
| 532 | + <!-- MODEL WINDOW FOR ADD TAGS TO TEST --> |
| 533 | + <div id="tags--edit" class="modal hide" tabindex="-1" role="dialog" aria-hidden="true"> |
| 534 | + <form class="" id="tags-edit-form" method="post" autocomplete="off"> |
| 535 | + <div class="modal-header"> |
| 536 | + <button type="button" class="close" data-dismiss="modal">×</button> |
| 537 | + <h4 class="modal-title"><?php echo $escaper->escapeHtml($lang['AddTagsToTestAudit']); ?></h4> |
| 538 | + </div> |
| 539 | + <div class="modal-body"> |
| 540 | + <div class="form-group" style="margin-bottom: 100px;"> |
| 541 | + <label for=""><?php echo $escaper->escapeHtml($lang['Tags']); ?></label> |
| 542 | + <select class="test_tags" readonly name="tags[]" multiple placeholder="<?php echo $escaper->escapeHtml($lang['TagsWidgetPlaceholder']);?>"></select> |
| 543 | + <div class="tag-max-length-warning" style="margin-top:-10px"><?php echo $escaper->escapeHtml($lang['MaxTagLengthWarning']);?></div> |
| 544 | + |
| 545 | + <input type="hidden" name="audit_type" value=""> |
| 546 | + <input type="hidden" name="id" value=""> |
| 547 | + </div> |
| 548 | + </div> |
| 549 | + <div class="modal-footer"> |
| 550 | + <button name="cancel_add_tags" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><?php echo $escaper->escapeHtml($lang['Cancel']); ?></button> |
| 551 | + <button name="continue_add_tags" class="btn btn-danger" data-dismiss="modal" aria-hidden="true"><?php echo $escaper->escapeHtml($lang['Continue']); ?></button> |
| 552 | + </div> |
| 553 | + </form> |
| 554 | + </div> |
| 555 | + |
493 | 556 | <script> |
494 | 557 | $( document ).ready(function() { |
495 | 558 | $("#additional_stakeholders").multiselect(); |
|
0 commit comments