mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Miglioramento informazioni rinnovo per Contratti
This commit is contained in:
parent
9a9b9e8df2
commit
7957c6f3c7
@ -40,7 +40,7 @@ echo '
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Valore').'</th>
|
<th>'.tr('Valore').'</th>
|
||||||
<th width="10%">#</th>
|
<th width="10%" class="text-center">#</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -32,11 +32,18 @@ use Plugins\PianificazioneInterventi\Promemoria;
|
|||||||
switch (post('op')) {
|
switch (post('op')) {
|
||||||
case 'add':
|
case 'add':
|
||||||
$idanagrafica = post('idanagrafica');
|
$idanagrafica = post('idanagrafica');
|
||||||
$nome = post('nome');
|
|
||||||
|
|
||||||
$anagrafica = Anagrafica::find($idanagrafica);
|
$anagrafica = Anagrafica::find($idanagrafica);
|
||||||
|
|
||||||
$contratto = Contratto::build($anagrafica, $nome);
|
// Generazione Contratto
|
||||||
|
$contratto = Contratto::build($anagrafica, post('nome'));
|
||||||
|
|
||||||
|
// Salvataggio informazioni sul rinnovo
|
||||||
|
$contratto->rinnovabile = post('rinnovabile');
|
||||||
|
$contratto->rinnovo_automatico = post('rinnovo_automatico');
|
||||||
|
$contratto->giorni_preavviso_rinnovo = post('giorni_preavviso_rinnovo');
|
||||||
|
$contratto->ore_preavviso_rinnovo = post('ore_preavviso_rinnovo');
|
||||||
|
$contratto->save();
|
||||||
|
|
||||||
$id_record = $contratto->id;
|
$id_record = $contratto->id;
|
||||||
|
|
||||||
flash()->info(tr('Aggiunto contratto numero _NUM_!', [
|
flash()->info(tr('Aggiunto contratto numero _NUM_!', [
|
||||||
|
@ -21,7 +21,8 @@ include_once __DIR__.'/../../core.php';
|
|||||||
|
|
||||||
$id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica'];
|
$id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica'];
|
||||||
|
|
||||||
?><form action="" method="post" id="add-form">
|
echo '
|
||||||
|
<form action="" method="post" id="add-form">
|
||||||
<input type="hidden" name="op" value="add">
|
<input type="hidden" name="op" value="add">
|
||||||
<input type="hidden" name="backto" value="record-edit">
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
|
|
||||||
@ -30,18 +31,57 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1 ]}
|
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 1 ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "value": "<?php echo $id_anagrafica; ?>", "ajax-source": "clienti", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Cliente&readonly_tipo=1" ]}
|
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Informazioni rinnovo -->
|
||||||
|
<div class="box box-primary">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title">'.tr('Informazioni per rinnovo').'</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "checkbox", "label": "'.tr('Rinnovabile').'", "name": "rinnovabile", "id": "rinnovabile_add", "help": "'.tr('Il contratto è rinnovabile?').'" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "checkbox", "label": "'.tr('Rinnovo automatico').'", "name": "rinnovo_automatico", "id": "rinnovo_automatico_add", "help": "'.tr('Il contratto è da rinnovare automaticamente alla scadenza').'", "disabled": 1 ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "number", "label": "'.tr('Preavviso per rinnovo').'", "name": "giorni_preavviso_rinnovo", "id": "giorni_preavviso_rinnovo_add", "decimals": "2", "icon-after": "giorni", "disabled": 1 ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "number", "label": "'.tr('Ore rimanenti rinnovo').'", "name": "ore_preavviso_rinnovo", "id": "ore_preavviso_rinnovo_add", "decimals": "2", "icon-after": "ore", "disabled": 1, "help": "'.tr('Ore residue nel contratto prima di visualizzare una avviso per un eventuale rinnovo anticipato.').'" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- PULSANTI -->
|
<!-- PULSANTI -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
input("rinnovabile").on("change", function() {
|
||||||
|
const disabled = parseInt($(this).val()) === 0;
|
||||||
|
|
||||||
|
input("giorni_preavviso_rinnovo").setDisabled(disabled);
|
||||||
|
input("ore_preavviso_rinnovo").setDisabled(disabled);
|
||||||
|
input("rinnovo_automatico").setDisabled(disabled);
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
@ -493,17 +493,6 @@ if (!empty($elementi)) {
|
|||||||
echo '
|
echo '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#rinnovabile").click(function() {
|
|
||||||
if ($(this).is(":checked")){
|
|
||||||
input("giorni_preavviso_rinnovo").enable();
|
|
||||||
input("rinnovo_automatico").enable();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
input("giorni_preavviso_rinnovo").disable();
|
|
||||||
input("rinnovo_automatico").disable();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#data_conclusione").on("dp.change", function (e) {
|
$("#data_conclusione").on("dp.change", function (e) {
|
||||||
let data_accettazione = $("#data_accettazione");
|
let data_accettazione = $("#data_accettazione");
|
||||||
data_accettazione.data("DateTimePicker").maxDate(e.date);
|
data_accettazione.data("DateTimePicker").maxDate(e.date);
|
||||||
@ -514,4 +503,3 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
?>
|
|
||||||
|
@ -34,7 +34,6 @@ echo '
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "checkbox", "label": "'.tr('Rinnovabile').'", "name": "rinnovabile", "help": "'.tr('Il contratto è rinnovabile?').'", "value": "$rinnovabile$" ]}
|
{[ "type": "checkbox", "label": "'.tr('Rinnovabile').'", "name": "rinnovabile", "help": "'.tr('Il contratto è rinnovabile?').'", "value": "$rinnovabile$" ]}
|
||||||
@ -62,13 +61,17 @@ echo '
|
|||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<table class="table table-hover table-condensed table-bordered table-striped">
|
<table class="table table-hover table-condensed table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Descrizione').'</th>
|
<th>'.tr('Descrizione').'</th>
|
||||||
<th width="100">'.tr('Totale').'</th>
|
<th width="100">'.tr('Totale').'</th>
|
||||||
<th width="150">'.tr('Data inizio').'</th>
|
<th width="150">'.tr('Data inizio').'</th>
|
||||||
<th width="150">'.tr('Data conclusione').'</th>
|
<th width="150">'.tr('Data conclusione').'</th>
|
||||||
</tr>';
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>';
|
||||||
|
|
||||||
while (!empty($id_contratto_precedente)) {
|
while (!empty($id_contratto_precedente)) {
|
||||||
$rs = $dbo->fetchArray('SELECT nome, numero, data_accettazione, data_conclusione, budget, idcontratto_prev FROM co_contratti WHERE id='.prepare($id_contratto_precedente));
|
$rs = $dbo->fetchArray('SELECT nome, numero, data_accettazione, data_conclusione, budget, idcontratto_prev FROM co_contratti WHERE id='.prepare($id_contratto_precedente));
|
||||||
@ -89,4 +92,15 @@ while (!empty($id_contratto_precedente)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</table>';
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
input("rinnovabile").on("change", function() {
|
||||||
|
const disabled = parseInt($(this).val()) === 0;
|
||||||
|
|
||||||
|
input("giorni_preavviso_rinnovo").setDisabled(disabled);
|
||||||
|
input("ore_preavviso_rinnovo").setDisabled(disabled);
|
||||||
|
input("rinnovo_automatico").setDisabled(disabled);
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user