413 lines
11 KiB
JavaScript
413 lines
11 KiB
JavaScript
// javascript per gestione campi obbligatori///
|
|
|
|
function report() {
|
|
//FACCIO IL SUBMIT
|
|
var f = document.main;
|
|
f.flgReport.value = "S";
|
|
//f.action=webApp+"/tr/Pratica.abl";
|
|
f.cmd.value = "search";
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
function submitForm() {
|
|
//make sure hidden and iframe values are in sync before submitting form
|
|
//updateRTE('descrizioneTecnica_it'); //use this when syncing only 1 rich text editor ("rtel" is name of editor)
|
|
//updateRTE('descrizioneCommerciale_it'); //use this when syncing only 1 rich text editor ("rtel" is name of editor)
|
|
//updateRTEs(); //uncomment and call this line instead if there are multiple rich text editors inside the form
|
|
//alert("Submitted value 1: "+document.main.descrizioneTecnica.value) //alert submitted value
|
|
//alert("Submitted value 2: "+document.main.descrizioneCommercialeVal.value) //alert submitted value
|
|
return true; //Set to false to disable form submission, for easy debugging.
|
|
}
|
|
|
|
/////////////////////////////////////////////7
|
|
function checkFields()
|
|
/////////////////////////////////////////////7
|
|
{
|
|
return Ab.validateForm('nomeV', 'Nome Variante', 'R', 'id_articolo', 'Articolo', 'RisNum>0');
|
|
|
|
//,'codiceVariante','Codice Variante','R'
|
|
|
|
}
|
|
|
|
|
|
function checkBoxes()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
Ab.setChekBoxValue('main', 'flgNonOrdinabile', '1', '0');
|
|
|
|
}
|
|
|
|
function modArticolo() {
|
|
var f = document.main;
|
|
// FACCIO IL SUBMIT
|
|
//checkBoxes();
|
|
f.cmd.value = "md";
|
|
f.act.value = "";
|
|
f.act2.value = "";
|
|
f.currentTab.value = "#VAR";
|
|
//f.id_articoloVariante.value=id;
|
|
f.action = "../art/Articolo.abl";
|
|
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
function delImgScaled() {
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
// FACCIO IL SUBMIT
|
|
//checkBoxes();
|
|
f.cmd.value = "clearScaled";
|
|
f.act.value = "";
|
|
f.act2.value = "";
|
|
//f.id_articoloVariante.value=id;
|
|
f.action = "ArticoloVariante.abl";
|
|
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
function hideAll() {
|
|
popDown("DES");
|
|
popDown("IMG");
|
|
popDown("ACC");
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
function addAccessorio()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
var f = document.main;
|
|
//Ab.validateForm('id_articoloVariante','Fornitore','R'))
|
|
if (Ab.validateForm('id_articoloVariante', 'Articolo Variante Non salvato', 'RisNum>0', 'id_articoloVarianteAssociato', 'Articolo Variante Associato', 'RisNum>0', 'id_tipoAccessorio', 'Tipo Accessorio', 'RisNum>0')) {
|
|
if (f.id_articoloVarianteAssociato.value == f.id_articoloVariante.value)
|
|
alert("Impossibile associare l'articolo variante a se stesso");
|
|
else {
|
|
f.cmd.value = "gr";
|
|
f.act.value = "addAcce";
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
function delAccessorio(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "gr";
|
|
f.act.value = "delAcce";
|
|
f.id_accessorio.value = l_id;
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
|
|
function checkBoxesCR()
|
|
/////////////////////////////////////////////
|
|
{
|
|
//Ab.setChekBoxValue("ricerca","flgSommaCRL","1","0");
|
|
}
|
|
|
|
function checkRadioCR() { //Ab.setRadioButtonValue("ricerca","flgPlaAntPos");
|
|
}
|
|
|
|
function modDispo(id) {
|
|
var f = document.main;
|
|
var theSvlt = "Disponibilita.abl?cmd=md&id_disponibilita=" + id;
|
|
location.href = theSvlt;
|
|
|
|
}
|
|
|
|
//// rebuild vetrina
|
|
|
|
var descrizioneVetrinaVEditor;
|
|
|
|
|
|
function rebuildVet() {
|
|
var currentLang = document.main.currentLang.value;
|
|
var ct = document.main.currentTab.value;
|
|
|
|
if (ct == '#DESC') {
|
|
//
|
|
if (descrizioneVetrinaVEditor) {
|
|
descrizioneVetrinaVEditor.destroy();
|
|
}
|
|
var config = {};
|
|
descrizioneVetrinaVEditor = CKEDITOR.replace('descrizioneVetrinaV_' + currentLang);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function rebuildAllEditor() {
|
|
|
|
rebuildVet();
|
|
|
|
|
|
}
|
|
|
|
//////////////////////////////////////////////////
|
|
function addTaglia()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
if (checkFields()) {
|
|
var f = document.main;
|
|
if (Ab.validateForm('codiceAT', 'Barcode', 'R', 'id_taglia', 'Taglia', 'RisNum>0')) {
|
|
checkBoxes();
|
|
f.cmd.value = "gr";
|
|
f.act.value = "addArticoloTaglia";
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function delTaglia(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "gr";
|
|
f.act.value = "delArticoloTaglia";
|
|
f.id_articoloTaglia.value = l_id;
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
|
|
//////////////////////////////////////////////////
|
|
function addTaglie()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
if (checkFields()) {
|
|
var f = document.main;
|
|
checkBoxes();
|
|
f.cmd.value = "addTaglie";
|
|
f.act.value = "";
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////
|
|
function addListino()
|
|
/////////////////////////////////////////////
|
|
{
|
|
var f = document.main;
|
|
|
|
if (Ab.validateForm('id_listino', 'Listino', 'RisNum>0')) {
|
|
if (checkCampiListino()) {
|
|
checkBoxes();
|
|
f.cmd.value = "gr";
|
|
f.act.value = "addListinoArticolo";
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
}
|
|
|
|
function checkCampiListino() {
|
|
var f = document.main;
|
|
|
|
// alert(f.prezzoLA.value + " - " + f.percLA.value);
|
|
|
|
if ((f.prezzoLA.value != 0 && f.percLA.value != 0) || (f.prezzoLA.value == 0 && f.percLA.value == 0)) {
|
|
alert('Impossibile salvare! Inserire il prezzo o la percentuale!');
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function delListino(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "gr";
|
|
f.act.value = "delListinoArticolo";
|
|
f.id_listinoArticolo.value = l_id;
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
// RIALLINEA I PREZZI ARTICOLO VARIANTE CON
|
|
// QUELLI DI ARTICOLO
|
|
/////////////////////////////////////////////
|
|
function usaPrezziArticolo() {
|
|
if (confirm("Vuoi riallineare i prezzi con quelli dell'articolo?")) {
|
|
var f = document.main;
|
|
f.cmd.value = "allineaPrezziConArticolo";
|
|
f.act.value = "";
|
|
//f.cmd.value="md";
|
|
//f.act.value="refreshRivalutazione";
|
|
f.action = f.actionPage.value;
|
|
Ab.submitAj('main');
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
//stampa etichetta articolo variante
|
|
///////////////////////////////////////
|
|
function labelV() {
|
|
|
|
var f = document.main; {
|
|
var debug = false;
|
|
var wwD = "700";
|
|
var whD = "500";
|
|
|
|
var articoloV = document.getElementById('id_articoloVariante').value;
|
|
var articolo = document.getElementById('id_articolo').value;
|
|
|
|
//+"&xxx="+f.xxx.value
|
|
theAction = f.actionPage.value + "?cmd=print&act=lblArt" + "&id_articolo=" + articolo + "&id_articoloVariante=" + articoloV;
|
|
|
|
//
|
|
var numLabels = prompt("Numero di etichette da stampare", "1");
|
|
var blankLabels = prompt("Numero di etichette da saltare", "0");
|
|
theAction = theAction + "&blankLabels=" + blankLabels + "&numLabels=" + numLabels;
|
|
if (debug == false) {
|
|
window.open(theAction, "Stampa_Etichette_Articolo", "width=" + wwD + ",height=" + whD + ",status=no,resizable=yes,top=100,left=100,scrollbars=yes");
|
|
} else {
|
|
window.open(theAction);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
//override perché altrimenti mi prende quello di articolo
|
|
///////////////////////////////////////
|
|
function preSaveCommand(func, bool) {
|
|
|
|
|
|
saveCommand(func, bool);
|
|
|
|
|
|
//$('#summernote').summernote('code');
|
|
}
|
|
|
|
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/** COMANDI PER INSERIRE TESSUTO PER CONFEZIONI
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function addTessutoConfezioneVariante() {
|
|
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
if (Ab.validateForm('id_articoloTessuto', 'Tessuto', 'R', 'mmAtt', 'Millimetri necessari', 'RisNum>0')) {
|
|
f.cmd.value = "addTessutoConfezioneVariante";
|
|
f.act.value = "";
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
function delTessutoConfezioneVariante(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
Ab.confirmDelete4(function () {
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "delTessutoConfezioneVariante";
|
|
f.act.value = "";
|
|
f.id_articoloArticoloTessuto.value = l_id;
|
|
Ab.submitAj('main');
|
|
});
|
|
|
|
|
|
}
|
|
|
|
/************************************************/
|
|
/************************************************/
|
|
/* mostra la modal con il listino articolo/
|
|
/************************************************/
|
|
/************************************************/
|
|
function listinoArticoloVarianteMostra(l_id_listino) {
|
|
$("#modalLA").modal("show");
|
|
$("#id_listino").val(l_id_listino);
|
|
|
|
$(".mov-bodyLA").load("../art/ArticoloVariante.abl?cmd=listinoArticoloVarianteMostra&id_articoloVariante=" + $("#id_articoloVariante").val() + "&id_listino=" + l_id_listino);
|
|
}
|
|
|
|
/************************************************/
|
|
/************************************************/
|
|
/* salva il prezzo listino dal popup/
|
|
/************************************************/
|
|
/************************************************/
|
|
function salvaPrezzoListinoAV() {
|
|
|
|
$("#modalLA").modal("hide");
|
|
setTimeout(function () {
|
|
{
|
|
$("#main").attr("action", $("#actionPage").val());
|
|
//$("#flgReport").val("S");
|
|
$("#cmd").val("listinoSalvaPrezzoAV");
|
|
//
|
|
Ab.submitAj('main');
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
|
|
}
|
|
|
|
/************************************************/
|
|
/************************************************/
|
|
/* ripristina il prezzo del listino senza il dettaglio prezzo del listino.../
|
|
/************************************************/
|
|
/************************************************/
|
|
function listinoArticoloVarianteCancella(l_id_listino) {
|
|
Swal.fire({
|
|
title: "Ripristino Prezzo Listino",
|
|
text: "Verra' eliminato il prezzo particolare dell'articolo variante per questo listino. Vuoi Continuare?",
|
|
icon: "warning",
|
|
showDenyButton: true,
|
|
showCancelButton: false,
|
|
confirmButtonText: `Si`,
|
|
denyButtonText: `No`,
|
|
cancelButtonText: `Annulla`,
|
|
}).then((result) => {
|
|
/* Read more about isConfirmed, isDenied below */
|
|
if (result.isConfirmed) {
|
|
////////////////////////////////////////////////////////////////////
|
|
$("#main").attr("action", $("#actionPage").val());
|
|
$("#id_listino").val(l_id_listino);
|
|
//$("#flgReport").val("S");
|
|
$("#cmd").val("listinoArticoloVarianteCancella");
|
|
Ab.submitAj('main');
|
|
////////////////////////////////////////////////////////////////////
|
|
} else if (result.isDenied) {
|
|
//Swal.fire('Changes are not saved', '', 'info')
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
|