2022-09-22 17:07:08 +08:00
|
|
|
/* global bwipjs PrintModalComponent RepositoryDatatable */
|
2021-07-22 03:32:42 +08:00
|
|
|
|
2018-02-27 23:21:46 +08:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
$(document).on('click', '.record-info-link', function(e) {
|
|
|
|
var that = $(this);
|
|
|
|
$.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: that.attr('href'),
|
|
|
|
dataType: 'json'
|
|
|
|
}).done(function(xhr, settings, data) {
|
2022-07-06 17:44:30 +08:00
|
|
|
if ($('#modal-info-repository-row').length) {
|
|
|
|
$('#modal-info-repository-row').find('.modal-body #repository_row-info-table').DataTable().destroy();
|
|
|
|
$('#modal-info-repository-row').remove();
|
|
|
|
$('.modal-backdrop').remove();
|
|
|
|
}
|
2018-02-27 23:21:46 +08:00
|
|
|
$('body').append($.parseHTML(data.responseJSON.html));
|
|
|
|
$('#modal-info-repository-row').modal('show', {
|
|
|
|
backdrop: true,
|
|
|
|
keyboard: false
|
|
|
|
}).on('hidden.bs.modal', function() {
|
2018-03-02 21:14:27 +08:00
|
|
|
$(this).find('.modal-body #repository_row-info-table').DataTable().destroy();
|
2018-02-27 23:21:46 +08:00
|
|
|
$(this).remove();
|
|
|
|
});
|
2021-07-22 03:32:42 +08:00
|
|
|
|
|
|
|
let barCodeCanvas = bwipjs.toCanvas('bar-code-canvas', {
|
|
|
|
bcid: 'qrcode',
|
|
|
|
text: $('#modal-info-repository-row #bar-code-canvas').data('id').toString(),
|
|
|
|
scale: 3
|
|
|
|
});
|
|
|
|
$('#modal-info-repository-row #bar-code-image').attr('src', barCodeCanvas.toDataURL('image/png'));
|
|
|
|
|
|
|
|
|
2018-03-02 21:14:27 +08:00
|
|
|
$('#repository_row-info-table').DataTable({
|
2018-02-27 23:21:46 +08:00
|
|
|
dom: 'RBltpi',
|
|
|
|
stateSave: false,
|
|
|
|
buttons: [],
|
|
|
|
processing: true,
|
|
|
|
colReorder: {
|
|
|
|
fixedColumnsLeft: 1000000 // Disable reordering
|
|
|
|
},
|
|
|
|
columnDefs: [{
|
|
|
|
targets: 0,
|
|
|
|
searchable: false,
|
|
|
|
orderable: false
|
|
|
|
}],
|
|
|
|
fnDrawCallback: function(settings, json) {
|
|
|
|
animateSpinner(this, false);
|
|
|
|
},
|
|
|
|
preDrawCallback: function(settings) {
|
|
|
|
animateSpinner(this);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
});
|
2021-07-22 03:32:42 +08:00
|
|
|
|
2022-09-22 17:07:08 +08:00
|
|
|
$(document).on('click', '.print-label-button', function() {
|
2022-09-29 20:43:06 +08:00
|
|
|
var selectedRows = $(this).data('rows');
|
2022-09-22 17:07:08 +08:00
|
|
|
PrintModalComponent.showModal = true;
|
2022-09-29 20:43:06 +08:00
|
|
|
if (selectedRows.length) {
|
|
|
|
$('#modal-info-repository-row').modal('hide');
|
|
|
|
PrintModalComponent.row_ids = selectedRows;
|
|
|
|
} else {
|
|
|
|
PrintModalComponent.row_ids = RepositoryDatatable.selectedRows();
|
|
|
|
}
|
2022-09-22 17:07:08 +08:00
|
|
|
});
|
2022-07-06 17:44:30 +08:00
|
|
|
}());
|