Koha/koha-tmpl/intranet-tmpl/prog/js/resolve_claim_modal.js
Jérémy Breuillard 6498c5835c Bug 22490: Some strings in JavaScript files are untranslatable
Javascript function `_` works only if used in template file (.tt or
.inc).
In .js files we should use `__`

This patch updates .js files to use `__` instead of `_`

Test Plan:
1. Do not apply the patch yet
2. Run `npx gulp po:update --lang fr-FR` (choose another language
   if you prefer)
3. Open misc/translator/po/fr-FR-messages-js.po and search "Please
   select a CSV (.csv) or ODS (.ods) spreadsheet file"
4. Notice that the references above only mention biblio_framework.js
5. If not already translated, translate it
6. Run misc/translator/translate install fr-FR
7. Go to staff interface and change language to fr-FR
8. Go to Administration » Authority types and click on "Actions ->
   Import"
9. In the modal window, click on "Import" without selecting a file. You
   should see an alert with the non-translated text
10. Apply the patch
11. Run `npx gulp po:update --lang fr-FR`
12. Open misc/translator/po/fr-FR-messages-js.po and search "Please
    select a CSV (.csv) or ODS (.ods) spreadsheet file"
13. Notice that the references above now also mention authtype.js
14. If the translation is marked as fuzzy, remove the fuzzy flag
15. Run misc/translator/translate install fr-FR
16. Go to staff interface again
17. Go to Administration » Authority types and click on "Actions ->
    Import"
18. In the modal window, click on "Import" without selecting a file. You
    should see an alert, this time with the translated text

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-24 16:41:31 -03:00

42 lines
1.6 KiB
JavaScript

$('body').on('click', '.return-claim-tools-resolve', function() {
let id = $(this).data('return-claim-id');
let current_lost_status = $(this).data('current-lost-status');
$('#claims-returned-resolved-modal-id').val(id);
$("#new_lost_status").val(current_lost_status);
let selected_option = $("#new_lost_status option:selected");
$(selected_option).text(__("%s (current status)").format($(selected_option).text()));
$('#claims-returned-resolved-modal').modal()
});
$(document).on('click', '#claims-returned-resolved-modal-btn-submit', function(e) {
let resolution = $('#claims-returned-resolved-modal-resolved-code').val();
let new_lost_status = $('#new_lost_status').val();
let id = $('#claims-returned-resolved-modal-id').val();
$('#claims-returned-resolved-modal-btn-submit-spinner').show();
$('#claims-returned-resolved-modal-btn-submit-icon').hide();
params = {
resolution: resolution,
resolved_by: logged_in_user_borrowernumber,
new_lost_status: new_lost_status
};
$.ajax({
url: '/api/v1/return_claims/' + id + '/resolve',
type: 'PUT',
data: JSON.stringify(params),
success: function(data) {
$('#claims-returned-resolved-modal-btn-submit-spinner').hide();
$('#claims-returned-resolved-modal-btn-submit-icon').show();
$('#claims-returned-resolved-modal').modal('hide');
if ( $.fn.dataTable.isDataTable("#return-claims-table") ) {
$("#return-claims-table").DataTable().ajax.reload();
}
},
contentType: "json"
});
});