mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-22 22:37:37 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
5972752763
@ -41,6 +41,8 @@ if (null == $orario_inizio || '00:00:00' == $orario_inizio) {
|
|||||||
$id_tecnico = filter('id_tecnico');
|
$id_tecnico = filter('id_tecnico');
|
||||||
if ($user['gruppo'] == 'Tecnici' && !empty($user['idanagrafica'])) {
|
if ($user['gruppo'] == 'Tecnici' && !empty($user['idanagrafica'])) {
|
||||||
$id_tecnico = $user['idanagrafica'];
|
$id_tecnico = $user['idanagrafica'];
|
||||||
|
}elseif ($user['gruppo'] == 'Clienti' && !empty($user['idanagrafica'])) {
|
||||||
|
$id_cliente = $user['idanagrafica'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stato di default associato all'attivitò
|
// Stato di default associato all'attivitò
|
||||||
@ -160,7 +162,7 @@ if (!empty($id_intervento)) {
|
|||||||
echo '
|
echo '
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.$module_anagrafiche['id'].'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.(empty($id_anagrafica) ? 0 : 1).'" ]}
|
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.(!$id_cliente ? $id_anagrafica : $id_cliente).'", "ajax-source": "clienti", "icon-after": "add|'.$module_anagrafiche['id'].'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.( (empty($id_anagrafica) && empty($id_cliente)) ? 0 : 1).'" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -1,21 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
||||||
* Copyright (C) DevCode s.n.c.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
@ -59,7 +42,7 @@ if (!empty($sessioni)) {
|
|||||||
<th width="10%">'.tr('Sconto km').'</th>';
|
<th width="10%">'.tr('Sconto km').'</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$is_completato) {
|
if (!$is_completato && $user['gruppo'] != 'Clienti' ) {
|
||||||
echo '
|
echo '
|
||||||
<th width="100" class="text-center">#</th>';
|
<th width="100" class="text-center">#</th>';
|
||||||
}
|
}
|
||||||
@ -192,7 +175,7 @@ if (!empty($sessioni)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pulsante per la sessione
|
// Pulsante per la sessione
|
||||||
if (!$is_completato) {
|
if (!$is_completato && $user['gruppo'] != 'Clienti' ) {
|
||||||
echo '
|
echo '
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<button type="button" class="btn btn-sm btn-warning tip" title="'.tr('Modifica sessione').'" onclick="modificaSessione(this)">
|
<button type="button" class="btn btn-sm btn-warning tip" title="'.tr('Modifica sessione').'" onclick="modificaSessione(this)">
|
||||||
@ -215,25 +198,20 @@ if (!empty($sessioni)) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-info">
|
<div class=\'alert alert-info\' ><i class=\'fa fa-info-circle\'></i> '.tr('Nessun tecnico assegnato').'.</div>';
|
||||||
<i class="fa fa-info-circle"></i> '.tr('Nessun tecnico assegnato').'.
|
|
||||||
</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
if (!$is_completato && $user['gruppo'] != 'Clienti' ) {
|
||||||
<div id="info-conflitti"></div>';
|
|
||||||
|
|
||||||
if (!$is_completato) {
|
|
||||||
echo '
|
echo '
|
||||||
<!-- AGGIUNTA TECNICO -->
|
<!-- AGGIUNTA TECNICO -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-offset-6 col-md-4">
|
<div class="col-md-offset-6 col-md-4">
|
||||||
{[ "type": "select", "label": "'.tr('Tecnico').'", "name": "nuovo_tecnico", "placeholder": "'.tr('Seleziona un tecnico').'", "ajax-source": "tecnici", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Tecnico" ]}
|
{[ "type": "select", "label": "'.tr('Tecnico').'", "name": "nuovotecnico", "placeholder": "'.tr('Seleziona un tecnico').'", "ajax-source": "tecnici", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Tecnico" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<label> </label>
|
<label> </label>
|
||||||
<button type="button" class="btn btn-primary btn-block" onclick="if($(\'#nuovo_tecnico\').val()){ add_tecnici($(\'#nuovo_tecnico\').val()); }else{ swal(\''.tr('Attenzione').'\', \''.tr('Seleziona il tecnico da aggiungere').'.\', \'warning\'); $(\'#nuovo_tecnico\').focus(); }">
|
<button type="button" class="btn btn-primary btn-block" onclick="if($(\'#nuovotecnico\').val()){ add_tecnici($(\'#nuovotecnico\').val()); }else{ swal(\''.tr('Attenzione').'\', \''.tr('Seleziona il tecnico da aggiungere').'.\', \'warning\'); $(\'#nuovotecnico\').focus(); }">
|
||||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -241,7 +219,7 @@ if (!$is_completato) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<script src="'.base_path().'/assets/src/js/functions/functions.js"></script>
|
<script src="'.$rootdir.'/assets/src/js/functions/functions.js"></script>
|
||||||
<script>$(document).ready(init)</script>
|
<script>$(document).ready(init)</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -258,91 +236,69 @@ async function modificaSessione(button) {
|
|||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
|
|
||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('modals/manage_sessione.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_sessione=" + id);
|
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('manage_sessione.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_sessione=" + id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcolaConflittiTecnici() {
|
$(document).ready(function() {';
|
||||||
let tecnici = [input("nuovo_tecnico").get()];
|
|
||||||
let inizio = moment().startOf("hour");
|
|
||||||
|
|
||||||
return $("#info-conflitti").load("'.$module->fileurl('occupazione_tecnici.php').'", {
|
|
||||||
"id_module": globals.id_module,
|
|
||||||
"id_record": globals.id_record,
|
|
||||||
"tecnici[]": tecnici,
|
|
||||||
"inizio": inizio.format("YYYY-MM-DD HH:mm:ss"),
|
|
||||||
"fine": inizio.add(1, "hours").format("YYYY-MM-DD HH:mm:ss"),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
input("nuovo_tecnico").change(function() {
|
|
||||||
calcolaConflittiTecnici();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
calcolaConflittiTecnici();
|
|
||||||
';
|
|
||||||
if (empty($sessioni)) {
|
if (empty($sessioni)) {
|
||||||
echo '
|
echo '
|
||||||
$(".btn-details").attr("disabled", true);
|
$(".btn-details").attr("disabled", true);
|
||||||
$(".btn-details").addClass("disabled");
|
$(".btn-details").addClass("disabled");
|
||||||
$("#showall_dettagli").removeClass("hide");
|
$("#showall_dettagli").removeClass("hide");
|
||||||
$("#dontshowall_dettagli").addClass("hide");';
|
$("#dontshowall_dettagli").addClass("hide");';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
$(".btn-details").attr("disabled", false);
|
$(".btn-details").attr("disabled", false);
|
||||||
$(".btn-details").removeClass("disabled");';
|
$(".btn-details").removeClass("disabled");';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Aggiunge una nuova riga per la sessione di lavoro in base al tecnico selezionato.
|
|
||||||
*/
|
|
||||||
function add_tecnici(id_tecnico) {
|
|
||||||
$.ajax({
|
|
||||||
url: globals.rootdir + "/actions.php",
|
|
||||||
beforeSubmit: function(arr, $form, options) {
|
|
||||||
return $form.parsley().validate();
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id_module: globals.id_module,
|
|
||||||
id_record: globals.id_record,
|
|
||||||
op: "add_sessione",
|
|
||||||
id_tecnico: id_tecnico,
|
|
||||||
},
|
|
||||||
type: "post",
|
|
||||||
success: function() {
|
|
||||||
caricaTecnici();
|
|
||||||
caricaCosti();
|
|
||||||
|
|
||||||
calcolaConflittiTecnici();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rimuove la sessione di lavoro dall\'intervento.
|
* Aggiunge una nuova riga per la sessione di lavoro in base al tecnico selezionato.
|
||||||
*/
|
*/
|
||||||
function elimina_sessione(id_sessione) {
|
function add_tecnici(id_tecnico) {
|
||||||
if (confirm("Eliminare sessione di lavoro?")) {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
|
beforeSubmit: function(arr, $form, options) {
|
||||||
|
return $form.parsley().validate();
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
id_module: globals.id_module,
|
id_module: globals.id_module,
|
||||||
id_record: globals.id_record,
|
id_record: globals.id_record,
|
||||||
op: "delete_sessione",
|
op: "add_sessione",
|
||||||
id_sessione: id_sessione,
|
id_tecnico: id_tecnico,
|
||||||
},
|
},
|
||||||
type: "post",
|
type: "post",
|
||||||
success: function() {
|
success: function() {
|
||||||
caricaTecnici();
|
$("#tecnici").load("'.$module->fileurl('ajax_tecnici.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||||
caricaCosti();
|
$("#costi").load("'.$module->fileurl('ajax_costi.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||||
|
|
||||||
calcolaConflittiTecnici();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/*
|
||||||
|
* Rimuove la sessione di lavoro dall\'intervento.
|
||||||
|
*/
|
||||||
|
function elimina_sessione(id_sessione) {
|
||||||
|
if (confirm("Eliminare sessione di lavoro?")) {
|
||||||
|
$.ajax({
|
||||||
|
url: globals.rootdir + "/actions.php",
|
||||||
|
data: {
|
||||||
|
id_module: globals.id_module,
|
||||||
|
id_record: globals.id_record,
|
||||||
|
op: "delete_sessione",
|
||||||
|
id_sessione: id_sessione,
|
||||||
|
},
|
||||||
|
type: "post",
|
||||||
|
success: function() {
|
||||||
|
$("#tecnici").load("'.$module->fileurl('ajax_tecnici.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||||
|
$("#costi").load("'.$module->fileurl('ajax_costi.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
@ -1,305 +1,165 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
||||||
* Copyright (C) DevCode s.n.c.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Modules\Anagrafiche\Anagrafica;
|
|
||||||
use Modules\Anagrafiche\Sede;
|
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
$block_edit = $record['flag_completato'];
|
$block_edit = $record['flag_completato'];
|
||||||
$module_anagrafiche = Modules::get('Anagrafiche');
|
$module_anagrafiche = Modules::get('Anagrafiche');
|
||||||
|
|
||||||
echo '
|
unset($_SESSION['superselect']['idanagrafica']);
|
||||||
<form action="" method="post" id="edit-form">
|
unset($_SESSION['superselect']['idsede_partenza']);
|
||||||
|
unset($_SESSION['superselect']['idsede_destinazione']);
|
||||||
|
unset($_SESSION['superselect']['idintervento']);
|
||||||
|
$_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
|
||||||
|
$_SESSION['superselect']['idsede_partenza'] = $record['idsede_partenza'];
|
||||||
|
$_SESSION['superselect']['idsede_partenza'];
|
||||||
|
$_SESSION['superselect']['idintervento'] = $id_record;
|
||||||
|
$_SESSION['superselect']['idsede_destinazione'] = $record['idsede_destinazione'];
|
||||||
|
$_SESSION['superselect']['permetti_movimento_a_zero'] = false;
|
||||||
|
|
||||||
|
?><form action="" method="post" id="edit-form">
|
||||||
<input type="hidden" name="op" value="update">
|
<input type="hidden" name="op" value="update">
|
||||||
<input type="hidden" name="backto" value="record-edit">
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
<input type="hidden" name="id_record" value="'.$id_record.'">
|
<input type="hidden" name="id_record" value="<?php echo $id_record; ?>">
|
||||||
|
|
||||||
<div class="row">
|
<!-- DATI CLIENTE -->
|
||||||
<div class="col-md-8">
|
<div class="panel panel-primary">
|
||||||
<!-- DATI CLIENTE -->
|
<div class="panel-heading">
|
||||||
<div class="panel panel-primary">
|
<h3 class="panel-title"><?php echo tr('Dati cliente'); ?></h3>
|
||||||
<div class="panel-heading">
|
</div>
|
||||||
<h3 class="panel-title">'.tr('Dati cliente').'</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<!-- RIGA 1 -->
|
<!-- RIGA 1 -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-3">
|
||||||
'.Modules::link('Anagrafiche', $record['idanagrafica'], null, null, 'class="pull-right"').'
|
<?php
|
||||||
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "$idanagrafica$", "ajax-source": "clienti", "readonly": "'.$record['flag_completato'].'" ]}
|
echo Modules::link('Anagrafiche', $record['idanagrafica'], null, null, 'class="pull-right"');
|
||||||
</div>
|
?>
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Cliente' AND deleted_at IS NULL ORDER BY ragione_sociale", "value": "$idanagrafica$", "ajax-source": "clienti", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
<div class="col-md-6">
|
echo '
|
||||||
{[ "type": "select", "label": "'.tr('Sede destinazione').'", "name": "idsede_destinazione","value": "$idsede_destinazione$", "ajax-source": "sedi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "placeholder": "'.tr('Sede legale').'", "readonly": "'.$record['flag_completato'].'" ]}
|
<div class="col-md-3">
|
||||||
</div>
|
{[ "type": "select", "label": "'.tr('Sede destinazione').'", "name": "idsede_destinazione","value": "$idsede_destinazione$", "ajax-source": "sedi", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "placeholder": "'.tr('Sede legale').'", "readonly": "'.$record['flag_completato'].'" ]}
|
||||||
|
</div>';
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-3">
|
||||||
'.Modules::link('Anagrafiche', $record['idclientefinale'], null, null, 'class="pull-right"').'
|
<?php
|
||||||
{[ "type": "select", "label": "'.tr('Per conto di').'", "name": "idclientefinale", "value": "$idclientefinale$", "ajax-source": "clienti", "readonly": "'.$record['flag_completato'].'" ]}
|
echo Modules::link('Anagrafiche', $record['idclientefinale'], null, null, 'class="pull-right"');
|
||||||
</div>
|
?>
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Per conto di'); ?>", "name": "idclientefinale", "value": "$idclientefinale$", "ajax-source": "clienti", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<?php
|
||||||
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.intval($record['flag_completato']).'" ]}
|
echo '
|
||||||
</div>
|
<div class="col-md-3">
|
||||||
</div>
|
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "readonly": "'.($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']).'" ]}
|
||||||
|
</div>';
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- RIGA 2 -->
|
<!-- RIGA 2 -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">';
|
<div class="col-md-6">
|
||||||
if (!empty($record['idpreventivo'])) {
|
<?php
|
||||||
echo '
|
if (!empty($record['idpreventivo'])) {
|
||||||
'.Modules::link('Preventivi', $record['idpreventivo'], null, null, 'class="pull-right"');
|
echo '
|
||||||
}
|
'.Modules::link('Preventivi', $record['idpreventivo'], null, null, 'class="pull-right"');
|
||||||
echo '
|
}
|
||||||
{[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'" ]}
|
?>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">';
|
{[ "type": "select", "label": "<?php echo tr('Preventivo'); ?>", "name": "idpreventivo", "value": "$idpreventivo$", "ajax-source": "preventivi", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
$idcontratto_riga = $dbo->fetchOne('SELECT id FROM co_promemoria WHERE idintervento='.prepare($id_record))['id'];
|
<div class="col-md-6">
|
||||||
|
<?php
|
||||||
|
$idcontratto_riga = $dbo->fetchOne('SELECT id FROM co_promemoria WHERE idintervento='.prepare($id_record))['id'];
|
||||||
|
|
||||||
if (!empty($record['idcontratto'])) {
|
if (!empty($record['idcontratto'])) {
|
||||||
echo '
|
echo '
|
||||||
'.Modules::link('Contratti', $record['idcontratto'], null, null, 'class="pull-right"');
|
'.Modules::link('Contratti', $record['idcontratto'], null, null, 'class="pull-right"');
|
||||||
}
|
|
||||||
echo '
|
|
||||||
|
|
||||||
{[ "type": "select", "label": "'.tr('Contratto').'", "name": "idcontratto", "value": "'.$record['id_contratto'].'", "ajax-source": "contratti", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'" ]}
|
|
||||||
|
|
||||||
<input type="hidden" name="idcontratto_riga" value="'.$idcontratto_riga.'">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
$anagrafica_cliente = $intervento->anagrafica;
|
|
||||||
$sede_cliente = $anagrafica_cliente->sedeLegale;
|
|
||||||
if (!empty($intervento->idsede_destinazione)) {
|
|
||||||
$sede_cliente = Sede::find($intervento->idsede_destinazione);
|
|
||||||
}
|
|
||||||
|
|
||||||
$anagrafica_azienda = Anagrafica::find(setting('Azienda predefinita'));
|
|
||||||
$sede_azienda = $anagrafica_azienda->sedeLegale;
|
|
||||||
|
|
||||||
$google = setting('Google Maps API key');
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="panel panel-primary">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title"><i class="fa fa-map"></i> '.tr('Geolocalizzazione').'</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">';
|
|
||||||
|
|
||||||
$map_load_message = '<p>'.tr('Clicca per visualizzare').'</p>';
|
|
||||||
if (empty($google)) {
|
|
||||||
echo '
|
|
||||||
<div class="alert alert-info">
|
|
||||||
'.Modules::link('Impostazioni', $dbo->fetchOne("SELECT `id` FROM `zz_settings` WHERE nome='Google Maps API key'")['id'], tr('Per abilitare la visualizzazione delle anagrafiche nella mappa, inserire la Google Maps API Key nella scheda Impostazioni')).'.
|
|
||||||
</div>';
|
|
||||||
} elseif (!empty($sede_cliente->gaddress) || (!empty($sede_cliente->lat) && !empty($sede_cliente->lng))) {
|
|
||||||
echo '
|
|
||||||
<div id="map-edit" style="height: 200px;width: 100%;display: flex;align-items: center;justify-content: center;" onclick="caricaMappa()">
|
|
||||||
'.$map_load_message.'
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
<br>';
|
|
||||||
|
|
||||||
// Navigazione diretta verso l'indirizzo
|
|
||||||
echo '
|
|
||||||
<a class="btn btn-info btn-block" onclick="calcolaPercorso()">
|
|
||||||
<i class="fa fa-map-signs"></i> '.tr('Calcola percorso').'
|
|
||||||
</a>';
|
|
||||||
} else {
|
|
||||||
// Navigazione diretta verso l'indirizzo
|
|
||||||
echo '
|
|
||||||
<a class="btn btn-info btn-block" onclick="calcolaPercorso()">
|
|
||||||
<i class="fa fa-map-signs"></i> '.tr('Calcola percorso').'
|
|
||||||
</a>';
|
|
||||||
|
|
||||||
// Ricerca diretta su Google Maps
|
|
||||||
echo '
|
|
||||||
<a class="btn btn-info btn-block" onclick="cercaGoogleMaps()">
|
|
||||||
<i class="fa fa-map-marker"></i> '.tr('Cerca su Google Maps').'
|
|
||||||
</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function modificaPosizione() {
|
|
||||||
openModal("'.tr('Modifica posizione').'", "'.$module->fileurl('modals/posizione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function cercaGoogleMaps() {
|
|
||||||
const indirizzo = getIndirizzoAnagrafica();
|
|
||||||
window.open("https://maps.google.com/maps/search/" + indirizzo);
|
|
||||||
}
|
|
||||||
|
|
||||||
function calcolaPercorso() {
|
|
||||||
const indirizzo_partenza = getIndirizzoAzienda();
|
|
||||||
const indirizzo_destinazione = getIndirizzoAnagrafica();
|
|
||||||
window.open("https://maps.google.com/maps/dir/" + indirizzo_partenza + "/" + indirizzo_destinazione);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIndirizzoAzienda() {
|
|
||||||
const indirizzo = "'.$sede_azienda->indirizzo.'";
|
|
||||||
const citta = "'.$sede_azienda->citta.'";
|
|
||||||
|
|
||||||
const lat = parseFloat("'.$sede_azienda->lat.'");
|
|
||||||
const lng = parseFloat("'.$sede_azienda->lng.'");
|
|
||||||
|
|
||||||
const indirizzo_default = encodeURI(indirizzo) + "," + encodeURI(citta);
|
|
||||||
if (!lat || !lng) return indirizzo_default;
|
|
||||||
|
|
||||||
return lat + "," + lng;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIndirizzoAnagrafica() {
|
|
||||||
const indirizzo = "'.$sede_cliente->indirizzo.'";
|
|
||||||
const citta = "'.$sede_cliente->citta.'";
|
|
||||||
|
|
||||||
const lat = parseFloat("'.$sede_cliente->lat.'");
|
|
||||||
const lng = parseFloat("'.$sede_cliente->lng.'");
|
|
||||||
|
|
||||||
const indirizzo_default = encodeURI(indirizzo) + "," + encodeURI(citta);
|
|
||||||
if (!lat || !lng) return indirizzo_default;
|
|
||||||
|
|
||||||
return lat + "," + lng;
|
|
||||||
}
|
|
||||||
|
|
||||||
function caricaMappa() {
|
|
||||||
const map_div = $("#map-edit");
|
|
||||||
if (map_div.html().trim() !== "'.$map_load_message.'"){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.getScript("//maps.googleapis.com/maps/api/js?libraries=places&key='.$google.'", function() {
|
|
||||||
const map_element = map_div[0];
|
|
||||||
const lat = parseFloat("'.$sede_cliente->lat.'");
|
|
||||||
const lng = parseFloat("'.$sede_cliente->lng.'");
|
|
||||||
|
|
||||||
if (!lat || !lng) return;
|
|
||||||
const position = new google.maps.LatLng(lat, lng);
|
|
||||||
|
|
||||||
// Create a Google Maps native view under the map_canvas div.
|
|
||||||
const map = new google.maps.Map(map_element, {
|
|
||||||
zoom: 14,
|
|
||||||
scrollwheel: false,
|
|
||||||
mapTypeControl: true,
|
|
||||||
mapTypeId: "roadmap",
|
|
||||||
mapTypeControlOptions: {
|
|
||||||
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
|
|
||||||
mapTypeIds: ["roadmap", "terrain"],
|
|
||||||
}
|
}
|
||||||
});
|
?>
|
||||||
|
|
||||||
map.setCenter(position);
|
{[ "type": "select", "label": "<?php echo tr('Contratto'); ?>", "name": "idcontratto", "value": "<?php echo $record['id_contratto']; ?>", "ajax-source": "contratti", "readonly": "<?php echo ($user['gruppo'] != 'Clienti' ? $record['flag_completato'] : '1'); ?>" ]}
|
||||||
const marker = new google.maps.Marker({
|
|
||||||
position: position,
|
|
||||||
map: map,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>';
|
|
||||||
|
|
||||||
?>
|
<input type='hidden' name='idcontratto_riga' value='<?php echo $idcontratto_riga; ?>'>
|
||||||
<!-- DATI INTERVENTO -->
|
</div>
|
||||||
<div class="panel panel-primary">
|
</div>
|
||||||
<div class="panel-heading">
|
</div>
|
||||||
<h3 class="panel-title"><?php echo tr('Dati intervento'); ?></h3>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
<!-- DATI INTERVENTO -->
|
||||||
<!-- RIGA 3 -->
|
<div class="panel panel-primary">
|
||||||
<div class="row">
|
<div class="panel-heading">
|
||||||
<div class="col-md-3">
|
<h3 class="panel-title"><?php echo tr('Dati intervento'); ?></h3>
|
||||||
{[ "type": "span", "label": "<?php echo tr('Numero'); ?>", "name": "codice", "value": "$codice$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="panel-body">
|
||||||
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora richiesta'); ?>", "name": "data_richiesta", "required": 1, "value": "$data_richiesta$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
<!-- RIGA 3 -->
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
{[ "type": "span", "label": "<?php echo tr('Numero'); ?>", "name": "codice", "value": "$codice$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora scadenza'); ?>", "name": "data_scadenza", "required": 0, "value": "$data_scadenza$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora richiesta'); ?>", "name": "data_richiesta", "required": 1, "value": "$data_richiesta$", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY nome", "value": "$idzona$" , "placeholder": "<?php echo tr('Nessuna zona'); ?>", "extra": "readonly", "help":"<?php echo 'La zona viene definita automaticamente in base al cliente selezionato'; ?>." ]}
|
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora scadenza'); ?>", "name": "data_scadenza", "required": 0, "value": "$data_scadenza$", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div class="col-md-3">
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY nome", "value": "$idzona$" , "placeholder": "<?php echo tr('Nessuna zona'); ?>", "extra": "readonly", "help":"<?php echo 'La zona viene definita automaticamente in base al cliente selezionato'; ?>." ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- RIGA 4 -->
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
{[ "type": "select", "label": "<?php echo tr('Tipo attività'); ?>", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento", "value": "$idtipointervento$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-4">
|
<!-- RIGA 4 -->
|
||||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL", "value": "$idstatointervento$", "class": "unblockable" ]}
|
<div class="row">
|
||||||
</div>
|
<div class="col-md-4">
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Tipo attività'); ?>", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento", "value": "$idtipointervento$", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL", "value": "$idstatointervento$", <?php echo ($user['gruppo'] == 'Clienti' ? '"readonly":1' : '"class": "unblockable"');?> ]}
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$tecnici_assegnati = $database->fetchArray('SELECT id_tecnico FROM in_interventi_tecnici_assegnati WHERE id_intervento = '.prepare($id_record));
|
$tecnici_assegnati = $database->fetchArray('SELECT id_tecnico FROM in_interventi_tecnici_assegnati WHERE id_intervento = '.prepare($id_record));
|
||||||
$tecnici_assegnati = array_column($tecnici_assegnati, 'id_tecnico');
|
$tecnici_assegnati = array_column($tecnici_assegnati, 'id_tecnico');
|
||||||
echo '
|
echo '
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{[ "type": "select", "label": "'.tr('Tecnici assegnati').'", "multiple": "1", "name": "tecnici_assegnati[]", "ajax-source": "tecnici", "value": "'.implode(',', $tecnici_assegnati).'", "icon-after": "add|'.$module_anagrafiche['id'].'|tipoanagrafica=Tecnico" ]}
|
{[ "type": "select", "label": "'.tr('Tecnici assegnati').'", "multiple": "1", "name": "tecnici_assegnati[]", "ajax-source": "tecnici", "value": "'.implode(',', $tecnici_assegnati).'", "icon-after": "add|'.$module_anagrafiche['id'].'|tipoanagrafica=Tecnico" '.($user['gruppo'] != 'Clienti' ? '' : ', "readonly":"1"').' ]}
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- RIGA 5 -->
|
<!-- RIGA 5 -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "textarea", "label": "<?php echo tr('Richiesta'); ?>", "name": "richiesta", "required": 1, "class": "autosize", "value": "$richiesta$", "extra": "rows='5'", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
{[ "type": "textarea", "label": "<?php echo tr('Richiesta'); ?>", "name": "richiesta", "required": 1, "class": "autosize", "value": "$richiesta$", "extra": "rows='5'", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "ckeditor", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
{[ "type": "ckeditor", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "<?php echo ($user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato']); ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
// Nascondo le note interne ai clienti
|
if( $user['gruppo'] != 'Clienti' ){
|
||||||
if ($user->gruppo != 'Clienti') {
|
|
||||||
echo '
|
echo '
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "textarea", "label": "'.tr('Note interne').'", "name": "informazioniaggiuntive", "class": "autosize", "value": "$informazioniaggiuntive$", "extra": "rows=\'5\'" ]}
|
{[ "type": "textarea", "label": "'.tr('Note interne').'", "name": "informazioniaggiuntive", "class": "autosize", "value": "$informazioniaggiuntive$", "extra": "rows=\'5\'" ]}
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Visualizzo solo se l'anagrafica cliente è un ente pubblico
|
// Visualizzo solo se l'anagrafica cliente è un ente pubblico
|
||||||
if (!empty($record['idcontratto'])) {
|
if (!empty($record['idcontratto'])) {
|
||||||
$contratto = $dbo->fetchOne('SELECT num_item,codice_cig,codice_cup,id_documento_fe FROM co_contratti WHERE id = '.prepare($record['idcontratto']));
|
$contratto = $dbo->fetchOne('SELECT num_item,codice_cig,codice_cup,id_documento_fe FROM co_contratti WHERE id = '.prepare($record['idcontratto']));
|
||||||
@ -360,7 +220,19 @@ echo '
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12" id="tecnici"></div>
|
<div class="col-md-12" id="tecnici">
|
||||||
|
<?php
|
||||||
|
if (file_exists($docroot.'/modules/interventi/custom/ajax_tecnici.php')) {
|
||||||
|
?>
|
||||||
|
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -377,23 +249,7 @@ echo '
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!$block_edit) {
|
if (!$block_edit && $user['gruppo'] != 'Clienti' ){
|
||||||
// Lettura ddt (entrata o uscita)
|
|
||||||
$ddt_query = 'SELECT COUNT(*) AS tot FROM dt_ddt
|
|
||||||
LEFT JOIN `dt_causalet` ON `dt_causalet`.`id` = `dt_ddt`.`idcausalet`
|
|
||||||
LEFT JOIN `dt_statiddt` ON `dt_statiddt`.`id` = `dt_ddt`.`idstatoddt`
|
|
||||||
LEFT JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt`
|
|
||||||
WHERE idanagrafica='.prepare($record['idanagrafica']).'
|
|
||||||
AND `dt_statiddt`.`descrizione` IN (\'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')
|
|
||||||
AND `dt_tipiddt`.`dir` = '.prepare($intervento->direzione).'
|
|
||||||
AND `dt_causalet`.`is_importabile` = 1
|
|
||||||
AND dt_ddt.id IN (SELECT idddt FROM dt_righe_ddt WHERE dt_righe_ddt.idddt = dt_ddt.id AND (qta - qta_evasa) > 0)';
|
|
||||||
$ddt = $dbo->fetchArray($ddt_query)[0]['tot'];
|
|
||||||
echo '
|
|
||||||
<button type="button" class="btn btn-sm btn-primary'.(!empty($ddt) ? '' : ' disabled').'" data-href="'.base_path().'/modules/interventi/add_ddt.php?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="tooltip" data-title="'.tr('Aggiungi ddt').'">
|
|
||||||
<i class="fa fa-plus"></i> '.tr('Ddt').'
|
|
||||||
</button>';
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-sm btn-primary tip" title="'.tr('Aggiungi articolo').'" onclick="gestioneArticolo(this)">
|
<button type="button" class="btn btn-sm btn-primary tip" title="'.tr('Aggiungi articolo').'" onclick="gestioneArticolo(this)">
|
||||||
<i class="fa fa-plus"></i> '.tr('Articolo').'
|
<i class="fa fa-plus"></i> '.tr('Articolo').'
|
||||||
@ -432,8 +288,10 @@ $articoli = $intervento->articoli;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div id="righe">
|
||||||
<div class="col-md-12" id="righe"></div>
|
<?php
|
||||||
|
include $structure->filepath('row-list.php');
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -446,7 +304,19 @@ $articoli = $intervento->articoli;
|
|||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12" id="costi"></div>
|
<div class="col-md-12" id="costi">
|
||||||
|
<?php
|
||||||
|
if (file_exists($docroot.'/modules/interventi/custom/ajax_costi.php')) {
|
||||||
|
?>
|
||||||
|
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -463,7 +333,7 @@ $articoli = $intervento->articoli;
|
|||||||
<div class="alert alert-warning"><i class="fa fa-warning"></i> '.tr('Questo intervento non è ancora stato firmato dal cliente').'.</div>';
|
<div class="alert alert-warning"><i class="fa fa-warning"></i> '.tr('Questo intervento non è ancora stato firmato dal cliente').'.</div>';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
<img src="'.base_path().'/files/interventi/'.$record['firma_file'].'" class="img-thumbnail"><div> </div>
|
<img src="'.$rootdir.'/files/interventi/'.$record['firma_file'].'" class="img-thumbnail"><div> </div>
|
||||||
<div class="col-md-6 col-md-offset-3 alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
<div class="col-md-6 col-md-offset-3 alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
||||||
'_DATE_' => Translator::dateToLocale($record['firma_data']),
|
'_DATE_' => Translator::dateToLocale($record['firma_data']),
|
||||||
'_TIME_' => Translator::timeToLocale($record['firma_data']),
|
'_TIME_' => Translator::timeToLocale($record['firma_data']),
|
||||||
@ -510,51 +380,6 @@ async function gestioneRiga(button, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
|
||||||
*/
|
|
||||||
function caricaRighe() {
|
|
||||||
let container = $("#righe");
|
|
||||||
|
|
||||||
localLoading(container, true);
|
|
||||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
|
||||||
container.html(data);
|
|
||||||
localLoading(container, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\'Attività.
|
|
||||||
*/
|
|
||||||
function caricaTecnici() {
|
|
||||||
let container = $("#tecnici");
|
|
||||||
|
|
||||||
localLoading(container, true);
|
|
||||||
return $.get("'.$structure->fileurl('ajax_tecnici.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
|
||||||
container.html(data);
|
|
||||||
localLoading(container, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\'Attività.
|
|
||||||
*/
|
|
||||||
function caricaCosti() {
|
|
||||||
let container = $("#costi");
|
|
||||||
|
|
||||||
localLoading(container, true);
|
|
||||||
return $.get("'.$structure->fileurl('ajax_costi.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
|
||||||
container.html(data);
|
|
||||||
localLoading(container, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
caricaRighe();
|
|
||||||
caricaTecnici();
|
|
||||||
caricaCosti();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#idanagrafica").change(function () {
|
$("#idanagrafica").change(function () {
|
||||||
updateSelectOption("idanagrafica", $(this).val());
|
updateSelectOption("idanagrafica", $(this).val());
|
||||||
session_set("superselect,idanagrafica", $(this).val(), 0);
|
session_set("superselect,idanagrafica", $(this).val(), 0);
|
||||||
@ -587,7 +412,7 @@ $("#idcontratto").change(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#matricola").change(function () {
|
$("#matricola").change(function () {
|
||||||
session_set("superselect,matricola", $(this).val(), 0);
|
session_set("superselect,marticola", $(this).val(), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#idsede").change(function () {
|
$("#idsede").change(function () {
|
||||||
|
@ -1,27 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
||||||
* Copyright (C) DevCode s.n.c.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once __DIR__.'/init.php';
|
use Modules\Interventi\Intervento;
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
|
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
|
||||||
|
|
||||||
|
$intervento = $intervento ?: Intervento::find($id_record);
|
||||||
$righe = $intervento->getRighe();
|
$righe = $intervento->getRighe();
|
||||||
|
|
||||||
if (!$righe->isEmpty()) {
|
if (!$righe->isEmpty()) {
|
||||||
echo '
|
echo '
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@ -39,7 +26,7 @@ if (!$righe->isEmpty()) {
|
|||||||
<th class="text-center" width="15%">'.tr('Importo').'</th>';
|
<th class="text-center" width="15%">'.tr('Importo').'</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$record['flag_completato']) {
|
if (!$record['flag_completato'] && $user['gruppo'] != 'Clienti') {
|
||||||
echo '
|
echo '
|
||||||
<th class="text-center" width="120" class="text-center">'.tr('#').'</th>';
|
<th class="text-center" width="120" class="text-center">'.tr('#').'</th>';
|
||||||
}
|
}
|
||||||
@ -59,22 +46,7 @@ if (!$righe->isEmpty()) {
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'" '.$extra.'>
|
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'" '.$extra.'>
|
||||||
<td>';
|
<td>
|
||||||
|
|
||||||
// Informazioni aggiuntive sulla destra
|
|
||||||
echo '
|
|
||||||
<small class="pull-right text-right text-muted">';
|
|
||||||
|
|
||||||
// Aggiunta dei riferimenti ai documenti
|
|
||||||
if ($riga->hasOriginalComponent()) {
|
|
||||||
echo '
|
|
||||||
'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine'));
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</small>';
|
|
||||||
|
|
||||||
echo '
|
|
||||||
'.Modules::link($riga->isArticolo() ? Modules::get('Articoli')['id'] : null, $riga->isArticolo() ? $riga['idarticolo'] : null, $descrizione);
|
'.Modules::link($riga->isArticolo() ? Modules::get('Articoli')['id'] : null, $riga->isArticolo() ? $riga['idarticolo'] : null, $descrizione);
|
||||||
|
|
||||||
if ($riga->isArticolo()) {
|
if ($riga->isArticolo()) {
|
||||||
@ -102,7 +74,7 @@ if (!$righe->isEmpty()) {
|
|||||||
</td>';
|
</td>';
|
||||||
|
|
||||||
if ($show_prezzi) {
|
if ($show_prezzi) {
|
||||||
// Costo unitario
|
//Costo unitario
|
||||||
echo '
|
echo '
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
'.moneyFormat($riga->costo_unitario).'
|
'.moneyFormat($riga->costo_unitario).'
|
||||||
@ -138,7 +110,7 @@ if (!$righe->isEmpty()) {
|
|||||||
|
|
||||||
// Pulsante per riportare nel magazzino centrale.
|
// Pulsante per riportare nel magazzino centrale.
|
||||||
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
|
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
|
||||||
if (!$record['flag_completato']) {
|
if (!$record['flag_completato'] && $user['gruppo'] != 'Clienti' ) {
|
||||||
echo '
|
echo '
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="input-group-btn">';
|
<div class="input-group-btn">';
|
||||||
@ -179,9 +151,9 @@ if (!$righe->isEmpty()) {
|
|||||||
echo '
|
echo '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
let riga = $(button).closest("tr");
|
var riga = $(button).closest("tr");
|
||||||
let id = riga.data("id");
|
var id = riga.data("id");
|
||||||
let type = riga.data("type");
|
var type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -204,9 +176,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
let riga = $(button).closest("tr");
|
var riga = $(button).closest("tr");
|
||||||
let id = riga.data("id");
|
var id = riga.data("id");
|
||||||
let type = riga.data("type");
|
var type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
@ -230,9 +202,9 @@ function rimuoviRiga(button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modificaSeriali(button) {
|
function modificaSeriali(button) {
|
||||||
let riga = $(button).closest("tr");
|
var riga = $(button).closest("tr");
|
||||||
let id = riga.data("id");
|
var id = riga.data("id");
|
||||||
let type = riga.data("type");
|
var type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user