Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| baf3f6da32 | |||
| 6e465e3010 | |||
| 8b08969c69 |
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
try {
|
||||
$api = VisualLimsApiClient::getInstance();
|
||||
|
||||
// Endpoint per recuperare le Matrici
|
||||
$endpoint = 'Matrice';
|
||||
|
||||
// (Opzionale) aggiungi parametri, ad esempio $top per limitare i risultati
|
||||
$options = []; // oppure ad esempio: ['$top' => 100]
|
||||
|
||||
// Debug: salva URL usato
|
||||
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||
$query = http_build_query($options);
|
||||
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||
|
||||
// Chiamata API
|
||||
$data = $api->get($endpoint, $options);
|
||||
|
||||
// Salva il JSON in locale
|
||||
file_put_contents(__DIR__ . '/matrici_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
||||
|
||||
echo json_encode($data);
|
||||
} catch (Exception $e) {
|
||||
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
@@ -190,4 +190,38 @@
|
||||
box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Stile per il selettore personalizzato dei colori */
|
||||
.color-picker-container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.color-picker {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
z-index: 1002;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||
flex-wrap: wrap;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.color-option {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 3px;
|
||||
border: 1px solid #000;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.color-option:hover {
|
||||
border: 2px solid #000;
|
||||
margin: 2px;
|
||||
}
|
||||
</style>
|
||||
+58
-14
@@ -457,14 +457,6 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("change", ".part-color", function () {
|
||||
const partNumber = $(this).closest("li").data("part-number");
|
||||
const partColor = $(this).val();
|
||||
partColors[partNumber] = partColor;
|
||||
updateMarkers();
|
||||
markUnsaved();
|
||||
});
|
||||
|
||||
function loadExistingParts(iddatadb) {
|
||||
$.ajax({
|
||||
url: "load_parts.php",
|
||||
@@ -517,6 +509,19 @@ $(document).ready(function () {
|
||||
function updatePartsList() {
|
||||
const showMixParts = $("#showMixParts").is(":checked");
|
||||
$("#partsList").empty();
|
||||
|
||||
// Definizione di 8 colori predefiniti
|
||||
const predefinedColors = [
|
||||
"#ff0000", // Rosso
|
||||
"#0000ff", // Blu
|
||||
"#00ff00", // Verde
|
||||
"#01832cff", // Giallo
|
||||
"#ff00ff", // Magenta
|
||||
"#00ffff", // Ciano
|
||||
"#800080", // Viola
|
||||
"#ffa500", // Arancione
|
||||
];
|
||||
|
||||
$("#partsTableBody tr").each(function () {
|
||||
const partNumber = $(this).find(".part-number").val();
|
||||
const partDescription = $(this).find(".part-description").val();
|
||||
@@ -528,17 +533,56 @@ $(document).ready(function () {
|
||||
partDescription &&
|
||||
(showMixParts || !partDescription.startsWith("Mix"))
|
||||
) {
|
||||
const colorOptions = predefinedColors
|
||||
.map(
|
||||
(color) =>
|
||||
`<div class="color-option" style="background-color: ${color};" data-color="${color}"></div>`,
|
||||
)
|
||||
.join("");
|
||||
|
||||
const listItem = `
|
||||
<li class="list-group-item" data-part-number="${partNumber}">
|
||||
${partNumber} - ${partDescription}
|
||||
<div style="display: flex; align-items: center;">
|
||||
<button type="button" class="btn btn-success btn-sm add-to-mix-btn" style="padding: 0.1rem 0.3rem; font-size: 0.8rem;"><i class="fas fa-plus fa-xs"></i></button>
|
||||
<input type="color" class="part-color" value="${partColor}" style="margin-left: 5px;">
|
||||
<li class="list-group-item" data-part-number="${partNumber}">
|
||||
${partNumber} - ${partDescription}
|
||||
<div style="display: flex; align-items: center;">
|
||||
<button type="button" class="btn btn-success btn-sm add-to-mix-btn" style="padding: 0.1rem 0.3rem; font-size: 0.8rem;"><i class="fas fa-plus fa-xs"></i></button>
|
||||
<div class="color-picker-container">
|
||||
<div class="color-option selected-color" style="background-color: ${partColor}; margin-left: 5px;"></div>
|
||||
<div class="color-picker">${colorOptions}</div>
|
||||
</div>
|
||||
</li>`;
|
||||
</div>
|
||||
</li>`;
|
||||
$("#partsList").append(listItem);
|
||||
}
|
||||
});
|
||||
|
||||
// Gestione del selettore colori personalizzato
|
||||
$(".selected-color").on("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const $picker = $(this).siblings(".color-picker");
|
||||
$(".color-picker").not($picker).hide(); // Chiude altri selettori aperti
|
||||
$picker.toggle();
|
||||
});
|
||||
|
||||
$(".color-option").on("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const $this = $(this);
|
||||
const color = $this.data("color");
|
||||
const $listItem = $this.closest("li");
|
||||
const partNumber = $listItem.data("part-number");
|
||||
partColors[partNumber] = color;
|
||||
$listItem.find(".selected-color").css("background-color", color);
|
||||
$this.closest(".color-picker").hide(); // Chiude il selettore dopo la scelta
|
||||
updateMarkers();
|
||||
markUnsaved();
|
||||
});
|
||||
|
||||
// Chiude il selettore se si clicca fuori
|
||||
$(document).on("click", function (e) {
|
||||
if (!$(e.target).closest(".color-picker-container").length) {
|
||||
$(".color-picker").hide();
|
||||
}
|
||||
});
|
||||
|
||||
updateMarkers();
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ $result->saveToFile($qrCodeFile);
|
||||
<button id="addToCanvasBtn">Aggiungi Selezionate al Canvas</button>
|
||||
|
||||
<!-- Canvas per editing -->
|
||||
<canvas id="collageCanvas" width="800" height="600" style="border: 1px solid #ccc; margin-top: 20px;"></canvas>
|
||||
<canvas id="collageCanvas" width="960" height="720" style="border: 1px solid #ccc; margin-top: 20px;"></canvas>
|
||||
|
||||
<!-- Pannello dei livelli -->
|
||||
<div id="layersPanel" style="width: 120px; max-height: 600px; overflow-y: auto; background: #f8f9fa; padding: 10px; position: absolute; right: 0; top: 60px;">
|
||||
|
||||
Reference in New Issue
Block a user