Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
Mark Tompsett 370a10c512 Bug 6815: Capture member photo via webcam
This patch builds on a patch by Mark Tompsett, adding the option to take
a patron's picture using the computer's webcam. The photo can then be
saved to the patron's account.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Go to Administration -> System preferences and enable the
  'patronimages' preference.
- View a patron record. In the sidebar, hover your mouse over the blank
  patron image. Click the "Edit" button which appears.
- A modal window should appear with two sections, "Upload patron photo"
  and "Take patron photo."
  - If your computer has a webcam, your browser should ask permission to
    access it. Grant access.
  - You should see the view of your webcam shown under the "Take photo"
    button.
  - Click the "Take photo" button. The captured photo should be shown in
    place of the live video from the webcam.
  - You should now see three buttons: "Retake photo," "Download photo,"
    and "Upload photo."
    - Clicking "Retake photo" should hide those buttons and return you
      to a live video view.
    - Clicking "Download" should make your browser download the image.
    - Clicking "Upload" should cause the page to redirect back to the
      patron detail page where you should see the new patron image
      displayed in the sidebar.
    - Trigger the modal again and click the "cancel" button. The
      modal should disappear and camera access should stop.
- If your computer has no webcam the modal should appear correctly but
  there should be a banner at the bottom indicating that a camera is not
  available.
- Try the test again but this time deny your browser access to the
  webcam. You may need to reset the camera permissions in your browser's
  settings. When the modal appears you should see a message saying
  access to the camera is denied.
- The patron image edit modal should be available on all pages which
  show the patron image in the sidebar: Check out, Batch check out,
  Details, Accounting, Routing lists, Circulation history, Holds
  history, Modification log, Notices, Statistics, Files, Purchase
  suggestions, Discharges, Housebound, and ILL requests history.
- Test adding an image to a patron record using the "Upload photo"
  option. It should still work correctly.
- If the patron has an image attached, the "Upload photo" section should
  have a "Delete" button. Test that it works correctly.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-24 14:22:10 -10:00

450 lines
22 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Details for [% INCLUDE 'patron-title.inc' no_html = 1 %] &rsaquo; Housebound &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="housebound-home" class="housebound">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
[% BLOCK 'homebound-details' %]
<div class="rows">
<ol>
<li>
<span class="label" class="required"> Delivery day:</span>
[% hpd = housebound_profile.day %]
[% IF hpd == 'any' %]
Any
[% ELSIF hpd == 'monday' %]
Monday
[% ELSIF hpd == 'tuesday' %]
Tuesday
[% ELSIF hpd == 'wednesday' %]
Wednesday
[% ELSIF hpd == 'thursday' %]
Thursday
[% ELSIF hpd == 'friday' %]
Friday
[% ELSIF hpd == 'saturday' %]
Saturday
[% ELSIF hpd == 'sunday' %]
Sunday
[% END %]
</li>
<li>
<span class="label" class="required">Frequency:</span>
[% AuthorisedValues.GetByCode( 'HSBND_FREQ', housebound_profile.frequency, 0 ) || housebound_profile.frequency | html %]
</li>
<li>
<span class="label">Material:</span><br />
[% housebound_profile.fav_itemtypes | html | html_line_break %]
</li>
<li>
<span class="label">Subjects:</span><br />
[% housebound_profile.fav_subjects | html | html_line_break %]
</li>
<li>
<span class="label">Authors:</span><br />
[% housebound_profile.fav_authors | html | html_line_break %]
</li>
<li>
<span class="label">Referral:</span><br />
[% housebound_profile.referral | html | html_line_break %]
</li>
<li>
<span class="label">Notes:</span><br />
[% housebound_profile.notes | html | html_line_break %]
</li>
</ol>
</div>
[% END %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
</li>
<li>
<a href="#" aria-current="page">
Details for [% INCLUDE 'patron-title.inc' %]
</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'members-toolbar.inc' %]
<!-- Title -->
<h1>Housebound details for [% INCLUDE 'patron-title.inc' %]</h1>
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'error_on_profile_store' %]
An error occurred whilst updating this housebound profile.
[% CASE 'error_on_profile_create' %]
An error occurred whilst creating this housebound profile.
[% CASE 'error_on_visit_load' %]
An error occurred whilst loading the housebound visit.
[% CASE 'error_on_visit_delete' %]
An error occurred whilst deleting a housebound visit.
[% CASE 'error_on_visit_store' %]
An error occurred whilst updating a housebound visit.
[% CASE 'error_on_visit_create' %]
An error occurred whilst creating a new housebound visit.
[% CASE %]
[% m.code | html %]
[% END %]
Please try again later.
</div>
[% END %]
<!-- Create or edit housebound_profile -->
[% IF ( method == 'update_or_create' ) %]
<h4>Manage housebound profile</h4>
<form id="editform" method="post" name="editform"
action="/cgi-bin/koha/members/housebound.pl">
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
[% IF ( housebound_profile ) %]
<input type="hidden" name="method" value="updateconfirm" />
[% ELSE %]
<input type="hidden" name="method" value="createconfirm" />
[% END %]
<fieldset id="houseboundentry" class="rows">
<legend>Housebound details</legend>
<ol>
<li>
<label for="day" class="required">Delivery day:</label>
<select id="day" name="day" class="required" required="required">
<option value="">Select a day</option>
[% IF ( housebound_profile ) %]
[% IF ( housebound_profile.day == 'any' ) %]
<option value="any" selected='selected'>Any</option>
[% ELSE %]
<option value="any">Any</option>
[% END %]
[% IF ( housebound_profile.day == 'monday' ) %]
<option value="monday" selected='selected'>Monday</option>
[% ELSE %]
<option value="monday">Monday</option>
[% END %]
[% IF ( housebound_profile.day == 'tuesday' ) %]
<option value="tuesday" selected='selected'>Tuesday</option>
[% ELSE %]
<option value="tuesday">Tuesday</option>
[% END %]
[% IF ( housebound_profile.day == 'wednesday' ) %]
<option value="wednesday" selected='selected'>Wednesday</option>
[% ELSE %]
<option value="wednesday">Wednesday</option>
[% END %]
[% IF ( housebound_profile.day == 'thursday' ) %]
<option value="thursday" selected='selected'>Thursday</option>
[% ELSE %]
<option value="thursday">Thursday</option>
[% END %]
[% IF ( housebound_profile.day == 'friday' ) %]
<option value="friday" selected='selected'>Friday</option>
[% ELSE %]
<option value="friday">Friday</option>
[% END %]
[% IF ( housebound_profile.day == 'saturday' ) %]
<option value="saturday" selected='selected'>Saturday</option>
[% ELSE %]
<option value="saturday">Saturday</option>
[% END %]
[% IF ( housebound_profile.day == 'sunday' ) %]
<option value="sunday" selected='selected'>Sunday</option>
[% ELSE %]
<option value="sunday">Sunday</option>
[% END %]
[% ELSE %]
<option value="any">Any</option>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
[% END %]
</select>
<span class="required">Required</span>
</li>
<li>
<label for="frequency" class="required">Frequency:</label>
<select id="frequency" name="frequency" class="required" required="required">
<option value="">Select a frequency</option>
[% FOREACH frequency IN AuthorisedValues.GetAuthValueDropbox('HSBND_FREQ') %]
[% IF housebound_profile.frequency == frequency.authorised_value %]
<option value="[% frequency.authorised_value | html %]" selected="selected">[% frequency.lib | html %]</option>
[% ELSE %]
<option value="[% frequency.authorised_value | html %]">[% frequency.lib | html %]</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
<li>
<label for="fav_itemtypes">Preferred materials:</label>
[% IF ( housebound_profile ) %]
<textarea id="fav_itemtypes" name="fav_itemtypes" cols="110" rows="10">[% housebound_profile.fav_itemtypes | html %]</textarea>
[% ELSE %]
<textarea id="fav_itemtypes" name="fav_itemtypes" cols="110" rows="10"></textarea>
[% END %]
</li>
<li>
<label for="fav_subjects">Subjects:</label>
[% IF ( housebound_profile ) %]
<textarea id="fav_subjects" name="fav_subjects" cols="110" rows="10">[% housebound_profile.fav_subjects | html %]</textarea>
[% ELSE %]
<textarea id="fav_subjects" name="fav_subjects" cols="110" rows="10"></textarea>
[% END %]
</li>
<li>
<label for="fav_authors">Authors:</label>
[% IF ( housebound_profile ) %]
<textarea id="fav_authors" name="fav_authors" cols="110" rows="10">[% housebound_profile.fav_authors | html %]</textarea>
[% ELSE %]
<textarea id="fav_authors" name="fav_authors" cols="110" rows="10"></textarea>
[% END %]
</li>
<li>
<label for="referral">Referral:</label>
[% IF ( housebound_profile ) %]
<textarea id="referral" name="referral" cols="110" rows="10">[% housebound_profile.referral | html %]</textarea>
[% ELSE %]
<textarea id="referral" name="referral" cols="110" rows="10"></textarea>
[% END %]
</li>
<li>
<label for="notes">Notes:</label>
[% IF ( housebound_profile ) %]
<textarea id="notes" name="notes" cols="110" rows="10">[% housebound_profile.notes | html %]</textarea>
[% ELSE %]
<textarea id="notes" name="notes" cols="110" rows="10"></textarea>
[% END %]
</li>
</ol>
</fieldset>
<fieldset class="action">
<button type="submit" class="btn btn-default"><i class="fa fa-save"></i> Save changes</button>
<a class="cancel btn btn-link"
href="/cgi-bin/koha/members/housebound.pl?borrowernumber=[% patron.borrowernumber | html %]">
Cancel
</a>
</fieldset>
</form>
<!-- Create or edit housebound_visit -->
[% ELSIF ( method == 'visit_update_or_create' ) %]
<h4>Manage housebound deliveries</h4>
<form name="form" id="instance_form" method="post"
action="/cgi-bin/koha/members/housebound.pl">
[% IF ( visit ) %]
<input type="hidden" name="method" value="editvisitconfirm" />
<input type="hidden" name="visit_id" value="[% visit.id | html %]" />
[% ELSE %]
<input type="hidden" name="method" value="addvisitconfirm" />
[% END %]
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<fieldset class="rows" id="instance">
<legend>Delivery details</legend>
<ol>
<li>
<label for="date" class="required">Date: </label>
[% IF ( visit ) %]
<input type="text" id="date" class="flatpickr required"
value="[% visit.appointment_date | $KohaDates %]"
name="date" size="20" required="required"/>
[% ELSE %]
<input type="text" id="date" class="flatpickr required"
value="" name="date" size="20" required="required"/>
[% END %]
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="segment" class="required">Time:</label>
<select id="segment" name="segment" required="required"
class="required">
<option value="">Select a time</option>
[% IF ( visit ) %]
[% IF ( visit.day_segment == 'morning' ) %]
<option value="morning" selected="selected">
Morning
</option>
[% ELSE %]
<option value="morning">Morning</option>
[% END %]
[% IF ( visit.day_segment == 'afternoon' ) %]
<option value="afternoon" selected="selected">
Afternoon
</option>
[% ELSE %]
<option value="afternoon">Afternoon</option>
[% END %]
[% IF ( visit.day_segment == 'evening' ) %]
<option value="evening" selected="selected">
Evening
</option>
[% ELSE %]
<option value="evening">Evening</option>
[% END %]
[% ELSE %]
<option value="morning">Morning</option>
<option value="afternoon">Afternoon</option>
<option value="evening">Evening</option>
[% END %]
</select>
<span class="required">Required</span>
</li>
<li>
<label for="chooser" class="required"> Chooser:</label>
<select id="chooser" name="chooser" class="required" required="required">
<option value="">Select a chooser</option>
[% IF ( visit ) %]
[% FOREACH chooser IN choosers %]
[% IF ( visit.chooser_brwnumber == chooser.borrowernumber ) %]
<option value="[% chooser.borrowernumber | html %]" selected="selected">
[% INCLUDE 'patron-title.inc' patron = chooser invert_name = 0 %]
</option>
[% ELSE %]
<option value="[% chooser.borrowernumber | html %]">
[% INCLUDE 'patron-title.inc' patron = chooser invert_name = 0 %]
</option>
[% END %]
[% END %]
[% ELSE %]
[% FOREACH chooser IN choosers %]
<option value="[% chooser.borrowernumber | html %]">
[% INCLUDE 'patron-title.inc' patron = chooser invert_name = 0 %]
</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
<li>
<label for="deliverer" class="required">Deliverer:</label>
<select id="deliverer" name="deliverer" class="required" required="required">
<option value="">Select a deliverer</option>
[% IF ( visit ) %]
[% FOREACH deliverer IN deliverers %]
[% IF ( visit.deliverer_brwnumber == deliverer.borrowernumber ) %]
<option value="[% deliverer.borrowernumber | html %]" selected="selected">
[% INCLUDE 'patron-title.inc' patron = deliverer invert_name = 0 %]
</option>
[% ELSE %]
<option value="[% deliverer.borrowernumber | html %]">
[% INCLUDE 'patron-title.inc' patron = deliverer invert_name = 0 %]
</option>
[% END %]
[% END %]
[% ELSE %]
[% FOREACH deliverer IN deliverers %]
<option value="[% deliverer.borrowernumber | html %]">
[% INCLUDE 'patron-title.inc' patron = deliverer invert_name = 0 %]
</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-save"></i> Save</button>
<a class="cancel"
href="/cgi-bin/koha/members/housebound.pl?borrowernumber=[% patron.borrowernumber | html %]">
Cancel
</a>
</fieldset>
</form>
<h3>Housebound details</h3>
[% PROCESS 'homebound-details' %]
<!-- Display a housebound_profile -->
[% ELSIF ( housebound_profile ) %]
[% PROCESS 'homebound-details' %]
<div class="action">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?borrowernumber=[% patron.borrowernumber | html %]&method=update_or_create"><i class="fa fa-pencil"></i> Edit</a>
</div>
<div>
<h3>Deliveries</h3>
[% housebound_visits = housebound_profile.housebound_visits %]
[% IF housebound_visits.count > 0 %]
<table border="0" width="100%" cellpadding="3" cellspacing="0">
<tr>
<th>ID</th><th>Date</th><th>Chooser</th><th>Deliverer</th><th class="noExport">Actions</th>
</tr>
[% FOREACH entry IN housebound_visits %]
<tr>
<td>[% entry.id | html %]</td>
<td>[% entry.appointment_date | $KohaDates %] ([% entry.day_segment | html %])</td>
<td>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.chooser.borrowernumber | uri %]">
[% INCLUDE 'patron-title.inc' patron = entry.chooser invert_name = 0 %]
</a>
</td>
<td>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.deliverer.borrowernumber | uri %]">
[% INCLUDE 'patron-title.inc' patron = entry.deliverer invert_name = 0 %]
</a>
</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_update_or_create&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_delete&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</table>
[% END %]
<div class="action">
<a href="/cgi-bin/koha/members/housebound.pl?method=visit_update_or_create&borrowernumber=[% patron.borrowernumber | uri %]"
class="btn btn-default btn-sm">
<i class="fa fa-plus"></i> Add a new delivery
</a>
</div>
</div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'circ-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
$("a.delete").click(function(){
return confirm(_("Are you sure you want to delete this delivery?"));
});
});
</script>
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]