Lines 55-61
Link Here
|
55 |
|
55 |
|
56 |
<div id="toolbar" class="btn-toolbar"> |
56 |
<div id="toolbar" class="btn-toolbar"> |
57 |
<a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a> |
57 |
<a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a> |
58 |
<a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&edit_field=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a> |
58 |
<a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&suggestionid=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a> |
59 |
</div> |
59 |
</div> |
60 |
|
60 |
|
61 |
<fieldset class="rows"> |
61 |
<fieldset class="rows"> |
Lines 439-445
Link Here
|
439 |
<ul class="ui-tabs-nav"> |
439 |
<ul class="ui-tabs-nav"> |
440 |
[% FOREACH suggestion IN suggestions %] |
440 |
[% FOREACH suggestion IN suggestions %] |
441 |
<li> |
441 |
<li> |
442 |
<a href="#[% suggestion.suggestiontype | uri %]"> |
442 |
<a href="#tab_[% loop.count %]"> |
443 |
[% IF ( suggestion.suggestiontypelabel ) %] |
443 |
[% IF ( suggestion.suggestiontypelabel ) %] |
444 |
[% IF (suggestion.suggestiontypelabel == "Pending") %]Pending |
444 |
[% IF (suggestion.suggestiontypelabel == "Pending") %]Pending |
445 |
[% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted |
445 |
[% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted |
Lines 463-474
Link Here
|
463 |
[% END %] |
463 |
[% END %] |
464 |
|
464 |
|
465 |
[% FOREACH suggestion IN suggestions %] |
465 |
[% FOREACH suggestion IN suggestions %] |
466 |
<div id="[% suggestion.suggestiontype | html %]"> |
466 |
<div id="tab_[% loop.count %]"> |
467 |
<form class="update_suggestions" name="f[% suggestion.suggestiontype | html %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype | html %]"> |
467 |
<form class="update_suggestions" name="f" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#tab_[% loop.count %]"> |
468 |
|
468 |
|
469 |
[% IF ( suggestion.suggestions_loop ) %] |
469 |
[% IF ( suggestion.suggestions_loop ) %] |
470 |
<p><a id="CheckAll[% suggestion.suggestiontype | html %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype | html %]" href="#">Uncheck all</a></p> |
470 |
<p><a class="checkall" href="#">Check all</a> | <a name="uncheckall" href="#">Uncheck all</a></p> |
471 |
<table id="[% suggestion.suggestiontype | html %]t" class="sorted"> |
471 |
<table id="table_[% loop.count %]" class="sorted"> |
472 |
<thead> |
472 |
<thead> |
473 |
<tr> |
473 |
<tr> |
474 |
<th class="NoSort"> </th> |
474 |
<th class="NoSort"> </th> |
Lines 485-491
Link Here
|
485 |
[% FOREACH suggestions_loo IN suggestion.suggestions_loop %] |
485 |
[% FOREACH suggestions_loo IN suggestion.suggestions_loop %] |
486 |
<tr> |
486 |
<tr> |
487 |
<td> |
487 |
<td> |
488 |
<input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid | html %]" /> |
488 |
<input type="checkbox" name="suggestionid" value="[% suggestions_loo.suggestionid | html %]" /> |
489 |
</td> |
489 |
</td> |
490 |
<td> |
490 |
<td> |
491 |
<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&op=show" title="suggestion" > |
491 |
<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&op=show" title="suggestion" > |
Lines 534-613
Link Here
|
534 |
</td> |
534 |
</td> |
535 |
<td class="actions"> |
535 |
<td class="actions"> |
536 |
<a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&op=edit"><i class="fa fa-pencil"></i> Edit</a> |
536 |
<a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&op=edit"><i class="fa fa-pencil"></i> Edit</a> |
537 |
<a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&edit_field=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a> |
537 |
<a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a> |
538 |
</td> |
538 |
</td> |
539 |
</tr> |
539 |
</tr> |
540 |
[% END %]</tbody> |
540 |
[% END %]</tbody> |
541 |
</table> <fieldset> |
541 |
</table> |
542 |
<div id="select-reason[% suggestion.suggestiontype | html %]"> |
|
|
543 |
<div id="status[% suggestion.suggestiontype | html %]"> |
544 |
<label for="STATUS[% suggestion.suggestiontype | html %]">Mark selected as: </label> |
545 |
<select name="STATUS" id="STATUS[% suggestion.suggestiontype | html %]"> |
546 |
<option value=""> -- Choose a status --</option> |
547 |
|
548 |
[% IF (statusselected_ASKED ) %] |
549 |
<option value="ASKED" selected="selected">Pending</option> |
550 |
[% ELSE %] |
551 |
<option value="ASKED">Pending</option> |
552 |
[% END %] |
553 |
|
554 |
[% IF (statusselected_ACCEPTED ) %] |
555 |
<option value="ACCEPTED" selected="selected">Accepted</option> |
556 |
[% ELSE %] |
557 |
<option value="ACCEPTED">Accepted</option> |
558 |
[% END %] |
559 |
|
560 |
[% IF (statusselected_CHECKED ) %] |
561 |
<option value="CHECKED" selected="selected">Checked</option> |
562 |
[% ELSE %] |
563 |
<option value="CHECKED">Checked</option> |
564 |
[% END %] |
565 |
|
566 |
[% IF ( statusselected_REJECTED ) %] |
567 |
<option value="REJECTED" selected="selected">Rejected</option> |
568 |
[% ELSE %] |
569 |
<option value="REJECTED">Rejected</option> |
570 |
[% END %] |
571 |
|
572 |
[% FOREACH s IN SuggestionStatuses %] |
573 |
<option value="[% s.authorised_value | html %]">[% s.lib | html %]</option> |
574 |
[% END %] |
575 |
</select> |
576 |
|
577 |
<label for="reason[% suggestion.suggestiontype | html %]">with this reason:</label> |
578 |
<select id="reason[% suggestion.suggestiontype | html %]" name="reason[% suggestion.suggestiontype | html %]"> |
579 |
<option value=""> -- Choose a reason -- </option> |
580 |
[% FOREACH reasonsloo IN suggestion.reasonsloop %] |
581 |
<option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option> |
582 |
[% END %] |
583 |
<option value="other">Others...</option> |
584 |
</select> |
585 |
|
586 |
<span id="other_reason[% suggestion.suggestiontype | html %]"> |
587 |
<input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype | html %]" name="other_reason[% suggestion.suggestiontype | html %]" placeholder="please note your reason here..." /> |
588 |
<a href="#back[% suggestion.suggestiontype | uri %]">Cancel</a> |
589 |
</span> |
590 |
|
542 |
|
591 |
<strong style="padding: 0 1em;">OR:</strong> |
543 |
<div class="row"> |
|
|
544 |
<h2 style="padding-left:1em;">Change selected suggestions</h3> |
545 |
<div class="col-sm-4"> |
546 |
<fieldset> |
547 |
<div id="select-reason"> |
548 |
<label for="STATUS">Mark selected as: </label> |
549 |
<select name="STATUS" id="STATUS"> |
550 |
<option value=""> -- Choose a status --</option> |
551 |
|
552 |
[% IF (statusselected_ASKED ) %] |
553 |
<option value="ASKED" selected="selected">Pending</option> |
554 |
[% ELSE %] |
555 |
<option value="ASKED">Pending</option> |
556 |
[% END %] |
557 |
|
558 |
[% IF (statusselected_ACCEPTED ) %] |
559 |
<option value="ACCEPTED" selected="selected">Accepted</option> |
560 |
[% ELSE %] |
561 |
<option value="ACCEPTED">Accepted</option> |
562 |
[% END %] |
563 |
|
564 |
[% IF (statusselected_CHECKED ) %] |
565 |
<option value="CHECKED" selected="selected">Checked</option> |
566 |
[% ELSE %] |
567 |
<option value="CHECKED">Checked</option> |
568 |
[% END %] |
569 |
|
570 |
[% IF ( statusselected_REJECTED ) %] |
571 |
<option value="REJECTED" selected="selected">Rejected</option> |
572 |
[% ELSE %] |
573 |
<option value="REJECTED">Rejected</option> |
574 |
[% END %] |
575 |
|
576 |
[% FOREACH s IN SuggestionStatuses %] |
577 |
<option value="[% s.authorised_value | html %]">[% s.lib | html %]</option> |
578 |
[% END %] |
579 |
</select> |
580 |
|
581 |
<label for="reason">with this reason:</label> |
582 |
<select name="reason"> |
583 |
<option value=""> -- Choose a reason -- </option> |
584 |
[% FOREACH reasonsloo IN suggestion.reasonsloop %] |
585 |
<option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option> |
586 |
[% END %] |
587 |
<option value="other">Others...</option> |
588 |
</select> |
589 |
|
590 |
<span class="other_reason"> |
591 |
<input type="text" size="31" name="other_reason" placeholder="please note your reason here..." /> |
592 |
<a href="#" class="cancel_note">Cancel</a> |
593 |
</span> |
594 |
</div> |
595 |
|
596 |
<input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> |
597 |
<fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset> |
598 |
</fieldset> |
599 |
</div> |
600 |
<div class="col-sm-4"> |
601 |
<fieldset> |
602 |
<label for="itemtype">Update item types with: </label> |
603 |
[% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20 %] |
604 |
<input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> |
605 |
<fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset> |
606 |
</fieldset> |
607 |
</div> |
592 |
|
608 |
|
593 |
<label for="[% suggestion.suggestiontype | html %]delete">Delete selected</label> |
609 |
<div class="col-sm-4"> |
594 |
<input type="checkbox" name="op" id="[% suggestion.suggestiontype | html %]delete" /> |
610 |
<fieldset> |
|
|
611 |
<label for="delete_[% loop.count %]">Delete selected</label> |
612 |
<input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> |
613 |
<fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset> |
614 |
</fieldset> |
615 |
</div> |
595 |
</div> |
616 |
</div> |
596 |
</div> |
|
|
597 |
|
617 |
|
598 |
<input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> |
|
|
599 |
<input type="hidden" name="tabcode" value="[% suggestion.suggestiontype | html %]" /> |
600 |
<input type="hidden" name="op" value="change" /> |
601 |
</fieldset> |
602 |
<fieldset class="action"> |
603 |
<input type="submit" value="Submit" /></fieldset> |
604 |
</form> |
605 |
[% ELSE %] |
618 |
[% ELSE %] |
606 |
<b>No results.</b> |
619 |
<b>No results.</b> |
607 |
[% END %] |
620 |
[% END %] |
|
|
621 |
</form> |
608 |
</div> |
622 |
</div> |
609 |
[% END %] |
623 |
[% END %] |
610 |
</div> |
|
|
611 |
[% END %] |
624 |
[% END %] |
612 |
|
625 |
|
613 |
[% UNLESS ( op_save ) %] |
626 |
[% UNLESS ( op_save ) %] |
Lines 786-799
Link Here
|
786 |
[% INCLUDE 'datatables.inc' %] |
799 |
[% INCLUDE 'datatables.inc' %] |
787 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
800 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
788 |
<script type="text/javascript"> |
801 |
<script type="text/javascript"> |
789 |
/** |
|
|
790 |
* displayOther. |
791 |
* This function display the select or an textaera to write a reason. |
792 |
*/ |
793 |
function displayOther(id,show,hide){ |
794 |
$("#"+hide+id).hide(); |
795 |
$("#"+show+id).show(); |
796 |
} |
797 |
$(document).ready(function() { |
802 |
$(document).ready(function() { |
798 |
$('#suggestiontabs').tabs({ |
803 |
$('#suggestiontabs').tabs({ |
799 |
// Correct table sizing for tables hidden in tabs |
804 |
// Correct table sizing for tables hidden in tabs |
Lines 809-844
Link Here
|
809 |
], |
814 |
], |
810 |
"sPaginationType": "full" |
815 |
"sPaginationType": "full" |
811 |
})); |
816 |
})); |
812 |
[% FOREACH suggestion IN suggestions %] |
817 |
$(".checkall").click(function(e){ |
813 |
// functions for [% suggestion.suggestiontype | html %] interactions |
818 |
$(this).parent(form).checkCheckboxes(); |
814 |
$("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){ |
819 |
return false; |
815 |
$("#[% suggestion.suggestiontype | html %]t").checkCheckboxes(); |
|
|
816 |
e.preventDefault(); |
817 |
}); |
820 |
}); |
818 |
$("#UncheckAll[% suggestion.suggestiontype | html %]").click(function(e){ |
821 |
$(".uncheckall").click(function(e){ |
819 |
$("#[% suggestion.suggestiontype | html %]t").unCheckCheckboxes(); |
822 |
$(this).parent(form).unCheckCheckboxes(); |
820 |
e.preventDefault(); |
823 |
return false; |
821 |
}); |
824 |
}); |
822 |
$("#other_reason[% suggestion.suggestiontype | html %]").hide(); |
825 |
$(".other_reason").hide(); |
823 |
$("#reason[% suggestion.suggestiontype | html %]").change(function(){ |
826 |
$("select[name='reason']").change(function(){ |
824 |
if($(this).val() == "other"){ |
827 |
if($(this).val() == "other"){ |
825 |
$(this).hide(); |
828 |
$(this).hide(); |
826 |
$("#other_reason[% suggestion.suggestiontype | html %]").show(); |
829 |
$(this).siblings(".other_reason").show(); |
827 |
} |
|
|
828 |
}); |
829 |
$("#[% suggestion.suggestiontype | html %]delete").change(function(){ |
830 |
if(this.checked){ |
831 |
$("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","delete"); |
832 |
} else { |
833 |
$("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","change"); |
834 |
} |
830 |
} |
835 |
}); |
831 |
}); |
836 |
|
832 |
|
837 |
[% END %] |
833 |
$("a.cancel_note").click(function(e) { |
838 |
$("a[href*=back]").click(function(){ |
834 |
$(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected"); |
839 |
var sid = $(this).attr("href").replace(/#back/,""); |
835 |
$(this).siblings("input[name='other_reason']").hide(); |
840 |
$("#reason"+sid).show().find("option[value='']").attr("selected","selected"); |
836 |
e.preventDefault(); |
841 |
$("#other_reason"+sid).hide(); |
|
|
842 |
}); |
837 |
}); |
843 |
$("h4.local_collapse a").click(function(){ |
838 |
$("h4.local_collapse a").click(function(){ |
844 |
$(this).parent().parent().find("ol").toggle(); |
839 |
$(this).parent().parent().find("ol").toggle(); |
Lines 885-911
Link Here
|
885 |
} |
880 |
} |
886 |
}); |
881 |
}); |
887 |
|
882 |
|
888 |
$("form.update_suggestions").on("submit", function(e){ |
883 |
$("button[type='submit']").on("click", function(e) { |
889 |
var form = this; |
884 |
var form = $(this).parents("form"); |
890 |
var action_delete_selected = $(this).find("input[value='delete']").is(":checked"); |
885 |
var action = $(this).val(); |
891 |
if ( action_delete_selected ) { |
886 |
var selected_suggestions = $(form).find("input[name='suggestionid']:checked"); |
892 |
var suggestions_to_delete = $(this).find("input[name='edit_field']:checked"); |
887 |
if ( selected_suggestions.length == 0 ) { |
893 |
if ( suggestions_to_delete.length == 0 ) { |
888 |
alert(_("Please select at least one suggestion")); |
894 |
alert(_("Please select at least one suggestion to delete")); |
889 |
e.preventDefault(); |
895 |
e.preventDefault(); |
890 |
return false; |
896 |
return false; |
891 |
} |
897 |
} else if ( suggestions_to_delete.length == 1 ) { |
892 |
if ( action == "delete" ) { |
|
|
893 |
if ( selected_suggestions.length == 1 ) { |
898 |
if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) { |
894 |
if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) { |
899 |
e.preventDefault(); |
895 |
e.preventDefault(); |
900 |
return false; |
896 |
return false; |
901 |
} |
897 |
} |
902 |
} else if ( suggestions_to_delete.length > 1 ) { |
898 |
} else if ( selected_suggestions.length > 1 ) { |
903 |
if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) { |
899 |
if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) { |
904 |
e.preventDefault(); |
900 |
e.preventDefault(); |
905 |
return false; |
901 |
return false; |
906 |
} |
902 |
} |
907 |
} |
903 |
} |
908 |
} |
904 |
} |
|
|
905 |
|
906 |
$('<input />').attr('type', 'hidden') |
907 |
.attr('name', "op") |
908 |
.attr('value', action) |
909 |
.appendTo(form); |
909 |
return true; |
910 |
return true; |
910 |
}); |
911 |
}); |
911 |
}); |
912 |
}); |