2023-09-18 22:24:07 +08:00
|
|
|
/* global PrintModalComponent RepositoryDatatable HelperModule MyModuleRepositories */
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
$(document).on('click', '.record-info-link', function(e) {
|
2023-10-19 22:35:23 +08:00
|
|
|
const myModuleId = $('.my-module-content').data('task-id');
|
2023-10-12 21:46:13 +08:00
|
|
|
const repositoryRowURL = $(this).attr('href');
|
|
|
|
|
2023-09-18 22:24:07 +08:00
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
|
2023-10-12 21:46:13 +08:00
|
|
|
window.repositoryItemSidebarComponent.toggleShowHideSidebar(repositoryRowURL, myModuleId);
|
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') {
|
2023-11-21 20:39:21 +08:00
|
|
|
PrintModalComponent.openModal();
|
2023-09-18 22:24:07 +08:00
|
|
|
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();
|
2023-10-12 21:46:13 +08:00
|
|
|
const assignUrl = $(this).attr('data-assign-url');
|
|
|
|
const repositoryRowId = $(this).attr('data-repository-row-id');
|
2023-09-18 22:24:07 +08:00
|
|
|
|
|
|
|
$.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);
|
|
|
|
}
|
2023-10-12 21:46:13 +08:00
|
|
|
window.repositoryItemSidebarComponent.reload();
|
2023-09-18 22:24:07 +08:00
|
|
|
},
|
|
|
|
error: function(error) {
|
|
|
|
HelperModule.flashAlertMsg(error.responseJSON.flash, 'danger');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2023-10-12 20:43:17 +08:00
|
|
|
|
|
|
|
$(document).on('click', '.export-consumption-button', function(e) {
|
|
|
|
const selectedRows = $(this).data('rows') || RepositoryDatatable.selectedRows();
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
window.initExportStockConsumptionModal();
|
|
|
|
|
|
|
|
if (window.exportStockConsumptionModalComponent) {
|
|
|
|
window.exportStockConsumptionModalComponent.fetchRepositoryData(
|
|
|
|
selectedRows,
|
|
|
|
{ repository_id: $(this).data('objectId') },
|
|
|
|
);
|
|
|
|
$('#modal-info-repository-row').modal('hide');
|
|
|
|
}
|
|
|
|
});
|
2023-09-18 22:24:07 +08:00
|
|
|
}());
|