openstamanager/modules/contratti/plugins/addpianficazione.php

134 lines
4.2 KiB
PHP
Raw Normal View History

<?php
include_once __DIR__.'/../../../core.php';
2018-02-18 19:53:23 +01:00
//<form action="plugin_editor.php?id_plugin=$id_plugin$&id_module=$id_module$&id_parent=$id_parent$" method="post" role="form">
$idcontratto_riga = $get['idcontratto_riga'];
$qp = 'SELECT *, (SELECT data_conclusione FROM co_contratti WHERE id = '.$id_record.' ) AS data_conclusione, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=co_righe_contratti.idtipointervento) AS tipointervento FROM co_righe_contratti WHERE id = '.$idcontratto_riga;
$rsp = $dbo->fetchArray($qp);
$data_richiesta = readDate($rsp[0]['data_richiesta']);
$orario_inizio = '09:00';
$orario_fine = '17:00';
echo '
2018-02-18 19:53:23 +01:00
<form id="add_form" action="'.$rootdir.'/editor.php?id_module='.Modules::get('Contratti')['id'].'&id_record='.$id_record.'&idcontratto_riga='.$idcontratto_riga.'" method="post">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="pianificazione">
<div class="row">
2018-02-20 16:46:23 +01:00
<div class="col-md-7">
2018-03-22 00:22:30 +01:00
{[ "type": "select", "label": "'.tr('Tipo intervento').'", "name": "idtipointervento", "id": "idtipointervento_", "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione ASC", "value": "'.$rsp[0]['idtipointervento'].'", "extra": "disabled" ]}
</div>
2018-02-20 16:46:23 +01:00
<div class="col-md-5">
{[ "type": "number", "label": "'.tr('Intervallo').'", "name": "intervallo", "class": "", "decimals": 0, "required": 1, "icon-after": "GG", "min-value": "1" ]}
</div>
2018-02-20 16:46:23 +01:00
</div>
2018-02-20 16:46:23 +01:00
<div class="row">
2018-02-20 16:46:23 +01:00
<div class="col-md-12">
2018-03-22 00:22:30 +01:00
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "placeholder": "'.tr('Descrizione').'", "name": "richiesta", "id": "richiesta_", "extra": "readonly", "value": "'.$rsp[0]['richiesta'].'" ]}
</div>
2018-02-20 16:46:23 +01:00
</div>
2018-02-20 16:46:23 +01:00
<div class="row">
2018-02-20 16:46:23 +01:00
<!--div class="col-md-8">
2018-02-18 19:53:23 +01:00
{[ "type": "checkbox", "label": "'.tr('Pianifica anche date passate').'", "name": "date_passate", "value": "0", "help": "", "placeholder": "'.tr('Pianificare promemoria anche con date precedenti ad oggi: ').date('d/m/Y').'" ]}
</div-->
2018-02-20 16:46:23 +01:00
';
?>
2018-02-20 16:46:23 +01:00
<div class="col-md-7">
2018-02-18 19:53:23 +01:00
{[ "type": "select", "label": "<?php echo tr('Inizio pianificazione'); ?>", "name": "parti_da_oggi", "values": "list= \"0\":\"<?php echo tr('Pianificare a partire da questo promemoria ').$data_richiesta; ?>\", \"1\":\"<?php echo tr('Pianificare a partire da oggi ').date('d/m/Y'); ?>\"", "value": "" ]}
</div>
2018-02-20 16:46:23 +01:00
<?php
2018-02-18 19:53:23 +01:00
echo '
2018-02-20 16:46:23 +01:00
<div class="col-md-5">
2018-03-22 00:22:30 +01:00
{[ "type": "date", "label": "'.tr('Fine pianificazione <small>(Data conclusione contratto)</small>').'", "name": "data_conclusione", "id": "data_conclusione_", "extra": "readonly", "value": "'.$rsp[0]['data_conclusione'].'" ]}
</div>
2018-02-20 16:46:23 +01:00
</div>
2018-02-20 16:46:23 +01:00
<div class="row">
2018-02-20 16:46:23 +01:00
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Pianifica anche l\'intervento').'", "name": "pianifica_intervento", "value": "0", "help": "", "placeholder": "'.tr('Pianificare già l\'intervento ').'" ]}
</div>
2018-02-20 16:46:23 +01:00
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Tecnici').'", "multiple": "1", "name": "idtecnico[]", "required": 0, "ajax-source": "tecnici", "value": "", "extra": "disabled" ]}
</div>
2018-02-20 16:46:23 +01:00
<div class="col-xs-6 col-md-2">
{[ "type": "time", "label": "'.tr('Orario inizio').'", "name": "orario_inizio", "required": 0, "value": "'.$orario_inizio.'", "extra": "disabled" ]}
</div>
<div class="col-xs-6 col-md-2">
{[ "type": "time", "label": "'.tr('Orario fine').'", "name": "orario_fine", "required": 0, "value": "'.$orario_fine.'", "extra": "disabled" ]}
</div>
2018-02-20 16:46:23 +01:00
</div>
2018-02-20 16:46:23 +01:00
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> '.tr('Pianifica').'</button>
</div>
</div>
2018-02-20 16:46:23 +01:00
</form>';
echo '
<script src="'.$rootdir.'/lib/init.js"></script>';
echo '
<script>
2018-02-20 16:46:23 +01:00
$( document ).ready(function() {
$( "#pianifica_intervento" ).click(function() {
2018-02-20 16:46:23 +01:00
if ($(this).is(":checked")){
$("#idtecnico").removeAttr("disabled");
$("#orario_inizio").removeAttr("disabled");
$("#orario_fine").removeAttr("disabled");
}else{
$("#idtecnico").prop("disabled", true);
$("#orario_inizio").prop("disabled", true);
$("#orario_fine").prop("disabled", true);
}
2018-02-20 16:46:23 +01:00
});
});
2018-02-18 19:53:23 +01:00
</script>';