0.0.20 form mover

This commit is contained in:
SBD
2025-01-14 16:52:29 +03:00
parent 9280025f1c
commit 1db2b0edb9
2 changed files with 45 additions and 3 deletions

View File

@@ -56,10 +56,28 @@ function updateCargoTypeInForm(el, type_transport) {
getCargoTypesWTypeTransport({
type_transport: type_transport,
owner_type: getFormOwnerType(el),
success_callback: function (res) {
}
success_callback: success_callback_func,
})
function success_callback_func(res) {
let cargo_types = res.cargo_types
if (!cargo_types) return;
resetWRadioInputs('cargo_type');
let $widget = getWRadioInputsWidget('cargo_type');
for (let cargo_type of cargo_types) {
let obj = {
name: cargo_type[0],
title: cargo_type[1],
}
let html = generateRadioInput(obj)
if ($widget.firstElementChild){
$(html).insertAfter($($widget.firstElementChild))
} else {
$widget.innerHTML = html
}
}
}
}