2023-09-18 22:24:07 +08:00
|
|
|
/* global PrintModalComponent RepositoryDatatable HelperModule MyModuleRepositories */
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
$(document).on('click', '.record-info-link', function(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
|
2023-09-22 22:08:43 +08:00
|
|
|
const repositoryRowURL = $(this).attr('href');
|
|
|
|
window.repositoryItemSidebarComponent.toggleShowHideSidebar(repositoryRowURL);
|
2023-09-18 22:24:07 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '.print-label-button', function(e) {
|
|
|
|
var selectedRows = $(this).data('rows');
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
if (typeof PrintModalComponent !== 'undefined') {
|
|
|
|
PrintModalComponent.showModal = true;
|
|
|
|
if (selectedRows && selectedRows.length) {
|
|
|
|
$('#modal-info-repository-row').modal('hide');
|
|
|
|
PrintModalComponent.row_ids = selectedRows;
|
|
|
|
} else {
|
|
|
|
PrintModalComponent.row_ids = [...RepositoryDatatable.selectedRows()];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '.assign-inventory-button', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
let assignUrl = $(this).data('assignUrl');
|
|
|
|
let repositoryRowId = $(this).data('repositoryRowId');
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: assignUrl,
|
|
|
|
type: 'POST',
|
|
|
|
data: { repository_row_id: repositoryRowId },
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
HelperModule.flashAlertMsg(data.flash, 'success');
|
|
|
|
$('#modal-info-repository-row').modal('hide');
|
|
|
|
if (typeof MyModuleRepositories !== 'undefined') {
|
|
|
|
MyModuleRepositories.reloadRepositoriesList(repositoryRowId);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(error) {
|
|
|
|
HelperModule.flashAlertMsg(error.responseJSON.flash, 'danger');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}());
|