mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
import Ajax from '../../components/ajax.js';
|
|
import AlbaranComponent from '../../components/albaranComponent.js';
|
|
|
|
$(() => {
|
|
|
|
const dropdown = document.querySelector(".dropdown-language");
|
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
|
let locale = 'es';
|
|
if (activeItem) {
|
|
locale = activeItem.getAttribute("data-language");
|
|
}
|
|
|
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Albaran'] }, {},
|
|
function (translations) {
|
|
window.language = JSON.parse(translations);
|
|
new Ajax(
|
|
'/albaranes/getAlbaran',
|
|
{
|
|
id: $('#id').val()
|
|
},
|
|
{},
|
|
function (data, headers, success, error, type) {
|
|
if (success) {
|
|
const albaran = new AlbaranComponent(data.data, '/logistica/listAlbaranes');
|
|
albaran.mount('#albaranContainer');
|
|
$('.accordion-button').trigger('click');
|
|
|
|
} else {
|
|
popErrorAlert(error);
|
|
}
|
|
},
|
|
function (data, headers, success, error, type) {
|
|
popErrorAlert(error);
|
|
}
|
|
).get();
|
|
},
|
|
function (error) {
|
|
console.log("Error getting translations:", error);
|
|
}
|
|
).post();
|
|
|
|
|
|
}); |