Files
apimacro/resources/views/mylinkspao.blade.php

100 lines
3.3 KiB
PHP
Raw Normal View History

2024-05-20 22:57:08 +02:00
<!DOCTYPE html>
<html lang="en">
2024-05-21 01:06:25 +02:00
2024-05-20 22:57:08 +02:00
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link Page</title>
2024-05-21 01:06:25 +02:00
<style>
#loading {
display: none;
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
2024-05-20 22:57:08 +02:00
</head>
2024-05-21 01:06:25 +02:00
2024-05-20 22:57:08 +02:00
<body>
<h1>Links</h1>
2024-05-20 23:22:38 +02:00
<form id="articleForm">
2024-06-13 15:04:02 +02:00
<pre>
Per vedere la lista -> "LIBRI IN PREVENDITA"
in <span style="color: green;">VERDE</span> quelli in PreOrdine
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
</pre>
2024-05-20 23:38:06 +02:00
<label for="article_id">ID Articolo:</label>
2024-06-13 14:21:47 +02:00
<input type="text" id="article_id" name="id" value="{{$id}}" />
<input type="text" id="action" name="action" value="{{$action}}" hidden />
2024-05-20 23:46:21 +02:00
<br>
2024-05-20 23:38:06 +02:00
<button type="button" data-action="search">Cerca Articolo</button>
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
2024-05-21 01:22:23 +02:00
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
<br><br>
2024-06-13 14:21:47 +02:00
2024-05-21 00:42:31 +02:00
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
2024-05-22 14:29:58 +02:00
<button type="button" data-action="showOrdini">Mostra Ordini</button>
2024-06-13 12:46:33 +02:00
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
2024-05-20 23:20:37 +02:00
</form>
2024-05-20 23:33:00 +02:00
<div id="result"></div>
2024-05-21 01:06:25 +02:00
<div id="loading"></div>
2024-05-20 23:22:38 +02:00
<script>
2024-05-20 23:38:06 +02:00
const form = document.getElementById('articleForm');
const result = document.getElementById('result');
2024-05-21 01:06:25 +02:00
const loading = document.getElementById('loading');
2024-05-20 23:22:38 +02:00
2024-05-20 23:38:06 +02:00
const buttons = form.querySelectorAll('button');
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
2024-05-20 23:22:38 +02:00
2024-05-20 23:38:06 +02:00
function handleButtonClick(event) {
2024-06-13 14:21:47 +02:00
let action = event.target.dataset.action;
2024-06-13 14:15:30 +02:00
let id = '0';
2024-06-13 14:14:53 +02:00
try {
id = form.querySelector('input[name="id"]').value;
2024-06-13 14:21:47 +02:00
if (!action) {
action = form.querySelector('input[name="action"]').value;
}
} catch (e) {
id = 0;
2024-06-13 14:14:53 +02:00
}
2024-06-13 14:16:18 +02:00
if (!id) {
id = 0;
}
2024-06-13 14:21:47 +02:00
2024-05-21 01:06:25 +02:00
loading.style.display = 'block'; // Mostra la clessidra
2024-05-20 23:38:06 +02:00
2024-05-20 23:43:17 +02:00
let baseUrl = window.location.href;
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
2024-05-20 23:38:06 +02:00
.then(response => response.text())
2024-05-21 01:06:25 +02:00
.then(data => {
result.innerHTML = data;
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
});
2024-05-20 23:38:06 +02:00
}
2024-05-20 23:22:38 +02:00
</script>
2024-05-20 22:57:08 +02:00
</body>
2024-06-13 14:21:47 +02:00
</html>