|
Lines 26-31
Link Here
|
| 26 |
[% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] |
26 |
[% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] |
| 27 |
<!-- koha core js --> |
27 |
<!-- koha core js --> |
| 28 |
[% Asset.js("js/staff-global.js") | $raw %] |
28 |
[% Asset.js("js/staff-global.js") | $raw %] |
|
|
29 |
[% INCLUDE 'js-date-format.inc' %] |
| 30 |
[% INCLUDE 'js-patron-get-age.inc' %] |
| 31 |
[% Asset.js("js/patron-autocomplete.js") | $raw %] |
| 29 |
|
32 |
|
| 30 |
[% INCLUDE 'validator-strings.inc' %] |
33 |
[% INCLUDE 'validator-strings.inc' %] |
| 31 |
[% IF ( IntranetUserJS ) %] |
34 |
[% IF ( IntranetUserJS ) %] |
|
Lines 65-171
Link Here
|
| 65 |
</script> |
68 |
</script> |
| 66 |
[% END %] |
69 |
[% END %] |
| 67 |
|
70 |
|
| 68 |
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] |
|
|
| 69 |
[% IF ( PatronAutoComplete ) %] |
| 70 |
<script> |
| 71 |
// PatronAutoComplete && CAN_user_circulate_circulate_remaining_permissions |
| 72 |
var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; |
| 73 |
var loggedInClass = ""; |
| 74 |
$(document).ready(function(){ |
| 75 |
var obj = $( "#findborrower" ).autocomplete({ |
| 76 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
| 77 |
minLength: 3, |
| 78 |
select: function( event, ui ) { |
| 79 |
window.location.href = ui.item.link; |
| 80 |
} |
| 81 |
}).data( "ui-autocomplete" ); |
| 82 |
if( obj ) { |
| 83 |
obj._renderItem = function( ul, item ) { |
| 84 |
item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber; |
| 85 |
var cardnumber = ""; |
| 86 |
if( item.cardnumber != "" ){ |
| 87 |
// Display card number in parentheses if it exists |
| 88 |
cardnumber = " (" + item.cardnumber + ") "; |
| 89 |
} |
| 90 |
var itemString = "<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + ( item.firstname ? item.firstname.escapeHtml() : "" ) + cardnumber.escapeHtml() + " <small>"; |
| 91 |
|
| 92 |
if( item.branchcode == loggedInLibrary ){ |
| 93 |
loggedInClass = "ac-currentlibrary"; |
| 94 |
} else { |
| 95 |
loggedInClass = ""; |
| 96 |
} |
| 97 |
|
| 98 |
if( item.dateofbirth ) { |
| 99 |
itemString += ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) |
| 100 |
+ "<span class=\"age_years\"> (" + ( item.age ? item.age.escapeHtml() : "" ) + " " + _("years") + ")</span>, "; |
| 101 |
} |
| 102 |
itemString += ( item.address ? item.address.escapeHtml() : "" ) + " " |
| 103 |
+ ( item.city ? item.city.escapeHtml() : "" ) + " " |
| 104 |
+ ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " |
| 105 |
+ ( item.country ? item.country.escapeHtml() : "" ) |
| 106 |
+ "</small></a>"; |
| 107 |
[% UNLESS ( singleBranchMode ) %] |
| 108 |
itemString += " <span class=\"ac-library\">" + item.branchname + "</span> " + "</a>"; |
| 109 |
[% END %] |
| 110 |
return $( "<li></li>" ) |
| 111 |
.addClass( loggedInClass ) |
| 112 |
.data( "ui-autocomplete-item", item ) |
| 113 |
.append( itemString ) |
| 114 |
.appendTo( ul ); |
| 115 |
}; |
| 116 |
} |
| 117 |
}); |
| 118 |
</script> |
| 119 |
[% END %] |
| 120 |
[% END %] |
| 121 |
[% IF ( PatronAutoComplete ) %] |
71 |
[% IF ( PatronAutoComplete ) %] |
| 122 |
<script> |
72 |
<script> |
| 123 |
// PatronAutoComplete |
73 |
// PatronAutoComplete |
| 124 |
var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; |
74 |
var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; |
|
|
75 |
var singleBranchMode = '[% singleBranchMode | html %]'; |
| 125 |
var loggedInClass = ""; |
76 |
var loggedInClass = ""; |
| 126 |
$(document).ready(function(){ |
77 |
$(document).ready(function(){ |
| 127 |
var obj = $( "#searchmember" ).autocomplete({ |
78 |
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] |
| 128 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
79 |
if ( $("#findborrower").length ) { |
| 129 |
minLength: 3, |
80 |
patron_autocomplete($("#findborrower"), { 'on-select': 'link-to-circ' }); |
| 130 |
select: function( event, ui ) { |
|
|
| 131 |
window.location.href = ui.item.link; |
| 132 |
} |
81 |
} |
| 133 |
}).data( "ui-autocomplete" ); |
82 |
[% END %] |
| 134 |
if( obj ) { |
83 |
if ( $("#searchmember").length ) { |
| 135 |
obj._renderItem = function( ul, item ) { |
84 |
patron_autocomplete($("#searchmember"), { 'on-select': 'link-to-patron' }); |
| 136 |
item.link = "/cgi-bin/koha/members/moremember.pl?borrowernumber=" + item.borrowernumber; |
|
|
| 137 |
var cardnumber = ""; |
| 138 |
if( item.cardnumber != "" ){ |
| 139 |
// Display card number in parentheses if it exists |
| 140 |
cardnumber = " (" + item.cardnumber + ") "; |
| 141 |
} |
| 142 |
if( item.branchcode == loggedInLibrary ){ |
| 143 |
loggedInClass = "ac-currentlibrary"; |
| 144 |
} else { |
| 145 |
loggedInClass = ""; |
| 146 |
} |
| 147 |
return $( "<li></li>" ) |
| 148 |
.addClass( loggedInClass ) |
| 149 |
.data( "ui-autocomplete-item", item ) |
| 150 |
.append( |
| 151 |
"<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " |
| 152 |
+ ( item.firstname ? item.firstname.escapeHtml() : "" ) |
| 153 |
+ cardnumber.escapeHtml() |
| 154 |
+ " <small>" |
| 155 |
+ ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) + " " |
| 156 |
+ ( item.address ? item.address.escapeHtml() : "" ) + " " |
| 157 |
+ ( item.city ? item.city.escapeHtml() : "" ) + " " |
| 158 |
+ ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " |
| 159 |
+ ( item.country ? item.country.escapeHtml() : "" ) + " " |
| 160 |
[% UNLESS ( singleBranchMode ) %] |
| 161 |
+ "<span class=\"ac-library\">" |
| 162 |
+ ( item.branchname ? item.branchname.escapeHtml() : "" ) |
| 163 |
+ "</span>" |
| 164 |
[% END %] |
| 165 |
+ "</small>" |
| 166 |
+ "</a>" ) |
| 167 |
.appendTo( ul ); |
| 168 |
}; |
| 169 |
} |
85 |
} |
| 170 |
}); |
86 |
}); |
| 171 |
</script> |
87 |
</script> |