fixed export and save to selection
This commit is contained in:
@@ -555,6 +555,14 @@ $(document).ready(function () {
|
||||
// ===================
|
||||
|
||||
function getVisiblePartsRecordList() {
|
||||
// Se i filtri sono attivi, usa la regola selezione/visibili di gridFilter.
|
||||
if (typeof window.getTargetGridIds === "function") {
|
||||
const target = window.getTargetGridIds();
|
||||
if (target && target.size > 0) {
|
||||
return [...target].map((v) => parseInt(v, 10)).filter(Boolean);
|
||||
}
|
||||
}
|
||||
|
||||
const listFromModal = $("#partsModal").data("visible-iddatadb-list");
|
||||
|
||||
if (Array.isArray(listFromModal) && listFromModal.length > 0) {
|
||||
@@ -2265,8 +2273,11 @@ $(document).ready(function () {
|
||||
|
||||
const sourceIddatadb =
|
||||
parseInt($("#partsModal").data("iddatadb"), 10) || null;
|
||||
const visibleListRaw =
|
||||
$("#partsModal").data("visible-iddatadb-list") || [];
|
||||
// Target = selezione/visibili secondo gridFilter, con fallback alla lista del modal
|
||||
let visibleListRaw =
|
||||
typeof getVisiblePartsRecordList === "function"
|
||||
? getVisiblePartsRecordList()
|
||||
: $("#partsModal").data("visible-iddatadb-list") || [];
|
||||
|
||||
if (!sourceIddatadb) {
|
||||
const errorMsg = $(
|
||||
@@ -2308,6 +2319,7 @@ $(document).ready(function () {
|
||||
);
|
||||
$("#cloneNotesCheckbox").prop("checked", true);
|
||||
$("#cloneAnalysesCheckbox").prop("checked", false);
|
||||
$("#cloneOverwriteCheckbox").prop("checked", true);
|
||||
|
||||
const modalInstance = new bootstrap.Modal(
|
||||
document.getElementById("cloneConfirmModal"),
|
||||
@@ -2323,6 +2335,7 @@ $(document).ready(function () {
|
||||
const targetIds = $("#cloneConfirmModal").data("target-ids") || [];
|
||||
const cloneNotes = $("#cloneNotesCheckbox").is(":checked");
|
||||
const cloneAnalyses = $("#cloneAnalysesCheckbox").is(":checked");
|
||||
const cloneOverwrite = $("#cloneOverwriteCheckbox").is(":checked");
|
||||
|
||||
if (!sourceIddatadb || !targetIds.length) {
|
||||
return;
|
||||
@@ -2351,6 +2364,7 @@ $(document).ready(function () {
|
||||
target_iddatadb_list: targetIds,
|
||||
clone_notes: cloneNotes,
|
||||
clone_analyses: cloneAnalyses,
|
||||
overwrite: cloneOverwrite,
|
||||
}),
|
||||
success: function (response) {
|
||||
$btn.prop("disabled", false).html(originalHtml);
|
||||
|
||||
Reference in New Issue
Block a user