[Magazzino Prod]

- Aggiunto popup di riepilogo prima di confermare Azzera Selezionati
- Aggiunto popup se non sono state selezionate righe
- Reso la riga con il pulsante fissa
- Modifiche minori e pulizia codice
This commit is contained in:
2023-11-14 15:21:25 +01:00
parent eeeb801c22
commit 80d114eae9
5 changed files with 160 additions and 132 deletions

View File

@@ -1 +1 @@
.card{position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125)}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-radius:.25rem}.card-body{flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-0.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link :hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:5px}#table_trasf tfoot{background:#f5f5f5}.selectedRow{background-color:#d1e9ff}/*# sourceMappingURL=main.css.map */
.card{position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125)}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-radius:.25rem}.card-body{flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-0.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link :hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:5px}#table_trasf tfoot{background:#f5f5f5}.selectedRow{background-color:#d1e9ff}.selectedRow:hover{background-color:#b5cce2 !important}/*# sourceMappingURL=main.css.map */

View File

@@ -7,68 +7,67 @@ if ($ret->is_KO()) {
$posizioni = $ret->get_data();
?>
<div>
<div class="row pb-10">
<div class="col-xs-12">
<button id="btAzzeraSelezionati" class="btn icbtn btn-primary btn-lg" type="button"
title="Azzera selezionati">
<i class="fab fa-creative-commons-zero"></i> Azzera come scarto
</button>
</div>
<div class="row"
style="padding: 1rem 0; position: fixed; right: 0; left: 10px; z-index: 1030; background-color: white;">
<div class="col-xs-12">
<button id="btAzzeraSelezionati" class="btn icbtn btn-primary btn-lg" type="button"
title="Azzera selezionati">
<i class="fab fa-creative-commons-zero"></i> Azzera come scarto
</button>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12">
<div class="panel icpanel panel-primary">
<?php foreach ($posizioni as $posizione => $articoli) { ?>
<div class="panel-heading cursor-pointer" data-toggle="collapse" href="#<?= $posizione ?>">
<h3 class="panel-title"><?= $posizione ?></h3>
</div>
<div data-posizione="<?= $posizione ?>" id="<?= $posizione ?>" class="rowPosizione collapse in">
<table class="table table-hover">
<thead>
<tr>
<th>Articolo</th>
<th>Lotto</th>
<th>Gruppo articolo</th>
<th>Qtà disponibili</th>
<th></th>
</div>
<div class="row" style="padding-top: 7rem;">
<div class="col-xs-12 col-sm-12">
<div class="panel icpanel panel-primary">
<?php foreach ($posizioni as $posizione => $articoli) { ?>
<div class="panel-heading cursor-pointer" data-toggle="collapse" href="#<?= $posizione ?>">
<h3 class="panel-title"><?= $posizione ?></h3>
</div>
<div data-posizione="<?= $posizione ?>" id="<?= $posizione ?>" class="rowPosizione collapse in">
<table class="table table-hover">
<thead>
<tr>
<th>Articolo</th>
<th>Lotto</th>
<th>Gruppo articolo</th>
<th>Qtà disponibili</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($articoli as $articolo) { ?>
<tr data-articolo="<?= $articolo["cod_mart"] ?>"
data-lotto="<?= $articolo["partita_mag"] ?>"
data-qta_col="<?= $articolo["qta_col"] ?>">
<td class="text-center">
<small class="text-grey"><?= $articolo["cod_mart"] ?></small> <?= $articolo["descrizione_art"] ?>
</td>
<td class="text-center">
<?= $articolo["partita_mag"] ?>
</td>
<td class="text-center">
<?= $articolo["descr_grup"] ?> /
<small class="text-grey"><?= $articolo["descr_sgrup"] ?></small>
</td>
<td class="text-center">
<b><?= number_format($articolo["qta_col"], 3, ",", "'") . " " . $articolo["unt_mis"] ?></b>
</td>
<td class="text-center">
<div class="btn-group">
<button class="btn icbtn btn-primary detailsBtn">
<i class="fa fa-fw fa-info"></i> Dettagli
</button>
<button class="btn icbtn btn-info correctionBtn">
<i class="fa fa-fw fa-pencil"></i> Rettifica
</button>
</div>
</td>
</tr>
</thead>
<tbody>
<?php foreach ($articoli as $articolo) { ?>
<tr data-articolo="<?= $articolo["cod_mart"] ?>"
data-lotto="<?= $articolo["partita_mag"] ?>"
data-qta_col="<?= $articolo["qta_col"] ?>">
<td class="text-center">
<small class="text-grey"><?= $articolo["cod_mart"] ?></small> <?= $articolo["descrizione_art"] ?>
</td>
<td class="text-center">
<?= $articolo["partita_mag"] ?>
</td>
<td class="text-center">
<?= $articolo["descr_grup"] ?> /
<small class="text-grey"><?= $articolo["descr_sgrup"] ?></small>
</td>
<td class="text-center">
<b><?= number_format($articolo["qta_col"], 3, ",", "'") . " " . $articolo["unt_mis"] ?></b>
</td>
<td class="text-center">
<div class="btn-group">
<button class="btn icbtn btn-primary detailsBtn">
<i class="fa fa-fw fa-info"></i> Dettagli
</button>
<button class="btn icbtn btn-info correctionBtn">
<i class="fa fa-fw fa-pencil"></i> Rettifica
</button>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
</div>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
</div>
</div>
</div>
</div>

View File

@@ -48,81 +48,103 @@ const _magazzinoProd = {
});
$("#btAzzeraSelezionati").on("click", async function () {
const selectedRows = $(".selectedRow");
const modalBox = new ModalBox();
modalBox
.yesNo()
.title("")
.content("Confermare l'operazione?")
.warning()
.show()
.then(async function (ret) {
if (ret) {
const selectedRows = $(".selectedRow");
const listErrori = [];
if (selectedRows.length > 0) {
let message = "L'azzeramento sarà fatto sui seguenti articoli:<br><br>";
for (const selectedRow of selectedRows) {
const $row = $(selectedRow);
const $posizione = $row.parents(".rowPosizione");
const codMart = $row.attr("data-articolo");
const partitaMag = $row.attr("data-lotto");
const posizione = $posizione.data("posizione");
_.each(selectedRows, function (selectedRow) {
const $row = $(selectedRow);
const $posizione = $row.parents(".rowPosizione");
const codMart = $row.attr("data-articolo");
const partitaMag = $row.attr("data-lotto");
const posizione = $posizione.data("posizione");
const dataInfoLotto = {
codMart,
partitaMag,
posizione
};
message += "<b>" + codMart + "</b> - " + partitaMag + " Linea: " + posizione + "<br>"
});
try {
const ajaxInfoLotto = new Ajax();
const ret = await ajaxInfoLotto
.get("getInfoLottoPosizione")
.data(dataInfoLotto)
.execute();
message += "<br>Confermare l'operazione?";
const infoLotto = ret.returnData;
const qtaCol = $row.attr("data-qta_col");
modalBox
.yesNo()
.title("")
.content(message)
.warning()
.show()
.then(async function (ret) {
if (ret) {
const listErrori = [];
const data = {
lotto: infoLotto,
scarti: qtaCol,
trasformazioni: [],
for (const selectedRow of selectedRows) {
const $row = $(selectedRow);
const $posizione = $row.parents(".rowPosizione");
const codMart = $row.attr("data-articolo");
const partitaMag = $row.attr("data-lotto");
const posizione = $posizione.data("posizione");
const dataInfoLotto = {
codMart,
partitaMag,
posizione
};
try {
const ajaxInfoLotto = new Ajax();
const ret = await ajaxInfoLotto
.get("getInfoLottoPosizione")
.data(dataInfoLotto)
.execute();
const infoLotto = ret.returnData;
const qtaCol = $row.attr("data-qta_col");
const data = {
lotto: infoLotto,
scarti: qtaCol,
trasformazioni: [],
}
const ajax = new Ajax();
await ajax
.post("transform")
.data(data)
.execute();
} catch (e) {
listErrori.push({
errorText: e.errorText,
data: dataInfoLotto
});
}
}
const ajax = new Ajax();
await ajax
.post("transform")
.data(data)
.execute();
} catch (e) {
listErrori.push({
errorText: e.errorText,
data: dataInfoLotto
if (listErrori.length > 0) {
let message = "Per i seguenti articoli non è stato possibile effettuare l'azzeramento:<br><br>";
_.each(listErrori, function (listErrore) {
const dataErr = listErrore.data;
message += "<b>" + dataErr.codMart + "</b> - " + dataErr.partitaMag + " Linea: " + dataErr.posizione + " <i>" + listErrore.errorText + "</i><br>"
});
message += "<br>Contattare l'amministratore del sistema.";
const modalBox = new ModalBox()
modalBox
.title("Attenzione")
.content(message)
.backhash().md().closeOnly().style("danger").show();
} else {
window.location.reload();
}
}
if (listErrori.length > 0) {
let message = "Per i seguenti articoli non è stato possibile effetuare l'azzeramento:<br><br>";
_.each(listErrori, function (listErrore) {
const dataErr = listErrore.data;
message += "<b>" + dataErr.codMart + "</b> - " + dataErr.partitaMag + " Linea: " + dataErr.posizione + " <i>" + listErrore.errorText + "</i><br>"
});
message += "<br>Contattare l'amministratore del sistema.";
const modalBox = new ModalBox()
modalBox
.title("Attenzione")
.content(message)
.backhash().md().closeOnly().style("danger").show();
} else {
window.location.reload();
}
}
});
});
} else {
modalBox
.closeOnly()
.title("")
.content("Per procedere con l'operazione è necessario selezionare una o più righe")
.danger()
.show()
}
});
},

View File

@@ -105,4 +105,8 @@
.selectedRow {
background-color: #d1e9ff;
&:hover {
background-color: #b5cce2 !important;
}
}

View File

@@ -1,4 +1,4 @@
<?
<?php
session_start();
include "functions.php";
require_once "include_login.php";
@@ -12,20 +12,23 @@ include Controller::current_gestpath_include("ajax.php");
<!--html manifest="manifest.appcache"-->
<html>
<head>
<? include pvm_tagHead; ?>
<?php include pvm_tagHead; ?>
</head>
<body>
<? include pvm_headerNavbar; ?>
<div id="content">
<div><?
<?php include pvm_headerNavbar; ?>
<div id="content" style="margin-top: 0px">
<div>
<?php
include pvm_navTab;
if (!PVM\CurrentModule::isAuthorizedToCurrentUser()) {
include pvm_unauthorized;
} else {
include Controller::current_gestpath_mainPage();
} ?>
}
?>
</div>
</div>
<? include pvm_footerMinimal; ?>
<?php include pvm_footerMinimal; ?>
</body>
</html>