Bug 3534 (QA Followup) Rebase and change floating save

Bug 3534 - (QA Followup) Use single toolbar for regular/quickadd forms

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2016-06-28 12:57:00 -04:00 committed by Kyle M Hall
parent a8ebff202d
commit 5595e92ec7

View file

@ -62,14 +62,19 @@ $(document).ready(function() {
$(".toggler").toggle(); $(".toggler").toggle();
}); });
$(".save_quick_add").click(function(){ $("#save_quick_add").click(function(){
$("#quick_add_form").validate(); $("#quick_add_form").validate();
if( $("#quick_add_form").valid()){ if( $("#quick_add_form").valid()){
$('.toggle_quick_add').click(); $('.toggle_quick_add').click();
$('#entryform button[name="save"]').click(); $('#saverecord').click();
} }
else {return false;} else {return false;}
}); });
$("#saverecord").click(function(){
if( check_form_borrowers() ){
$("#entryform").submit();
}
});
}); });
@ -201,6 +206,22 @@ $(document).ready(function() {
[% END %] [% END %]
<div id="toolbar" class="btn-toolbar">
[% UNLESS ( check_member ) %]
[% IF quickadd && opadd %]
<button class="btn btn-small toggler" id="save_quick_add" name="save"><i class="fa fa-save"></i> Save</button>
[% END %]
<button class="btn btn-small toggler" id="saverecord" name="save" ><i class="fa fa-save"></i> Save</button>
[% IF opadd %]
<a class="btn btn-small" href="/cgi-bin/koha/members/member.pl" class="toggler save_entryform">
[% ELSE %]
<a class="btn btn-small" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
[% END %]
<i class="fa fa-times"></i> Cancel
</a>
[% END %]
</div>
[% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" > [% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" >
<input type="hidden" name="nodouble" value="[% nodouble %]" /> [% END %] <input type="hidden" name="nodouble" value="[% nodouble %]" /> [% END %]
<!-- field always hidden in different form (1,2,3) --> <!-- field always hidden in different form (1,2,3) -->
@ -224,18 +245,6 @@ $(document).ready(function() {
[% END %] [% END %]
[% END %] [% END %]
[% END %] [% END %]
<div id="toolbar" class="btn-toolbar">
[% UNLESS ( check_member ) %]
<button class="btn btn-small" id="saverecord" type="submit" name="save" onclick="return check_form_borrowers();"><i class="fa fa-save"></i> Save</button>
[% IF opadd %]
<a class="btn btn-small" href="/cgi-bin/koha/members/member.pl">
[% ELSE %]
<a class="btn btn-small" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
[% END %]
<i class="fa fa-times"></i> Cancel
</a>
[% END %]
</div>
[% IF ( step_1 ) %] [% IF ( step_1 ) %]
[%UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %] [%UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
@ -1096,19 +1105,10 @@ $(document).ready(function() {
<ol id="quick_add_list"> <ol id="quick_add_list">
</ol> </ol>
</fieldset> </fieldset>
<fieldset class="rows" id="qa-save">
<fieldset class="action">
<button type="button" class="save_quick_add" name="QA-Save">
<i class="fa fa-save"></i> Save
</button>
<a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
</fieldset>
</fieldset>
</form> </form>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#entryform").hide(); $("#entryform,#saverecord").hide();
[% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field %]",[% END %]]; var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field %]",[% END %]];
var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields