diff --git a/modules/contratti/add.php b/modules/contratti/add.php index b42fde314..933d28dbf 100755 --- a/modules/contratti/add.php +++ b/modules/contratti/add.php @@ -37,7 +37,7 @@ echo '
- {[ "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" ]} + {[ "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", "readonly": "'.((empty($id_anagrafica)) ? 0 : 1).'" ]}
diff --git a/modules/interventi/edit.php b/modules/interventi/edit.php index e57fe4f0a..baea68048 100755 --- a/modules/interventi/edit.php +++ b/modules/interventi/edit.php @@ -88,7 +88,7 @@ if (!empty($record['idpreventivo'])) { '.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'].'" ]} + {[ "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'].'", "icon-after": "add|'.Modules::get('Preventivi')['id'].'|pianificabile=1&idanagrafica='.$record['idanagrafica'].'" ]}
'; diff --git a/modules/preventivi/actions.php b/modules/preventivi/actions.php index a4f66757a..1f2061469 100755 --- a/modules/preventivi/actions.php +++ b/modules/preventivi/actions.php @@ -42,8 +42,16 @@ switch (post('op')) { $tipo = TipoSessione::find($idtipointervento); $preventivo = Preventivo::build($anagrafica, $tipo, $nome, $data_bozza, $id_sede); + + $preventivo->idstato = post('idstato'); + $preventivo->save(); + $id_record = $preventivo->id; + if (isAjaxRequest()) { + echo json_encode(['id' => $id_record, 'text' => 'Contratto '.$preventivo->numero.' del '.dateFormat($preventivo->data_bozza).' - '.$preventivo->nome]); + } + flash()->info(tr('Aggiunto preventivo numero _NUM_!', [ '_NUM_' => $preventivo['numero'], ])); diff --git a/modules/preventivi/add.php b/modules/preventivi/add.php index 4d4d26dc9..62e4b0536 100755 --- a/modules/preventivi/add.php +++ b/modules/preventivi/add.php @@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php'; $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica']; +$stati = get('pianificabile') ? 'SELECT id, descrizione FROM co_statipreventivi WHERE is_pianificabile=1' : 'SELECT id, descrizione FROM co_statipreventivi'; + ?>
@@ -29,26 +31,35 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
+
- {[ "type": "date", "label": "", "name": "data_bozza", "value": "", "required": 1 ]} -
+ {[ "type": "text", "label": "", "name": "nome", "required": 1 ]} +
+
- {[ "type": "text", "label": "", "name": "nome", "required": 1 ]} + {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "" ]}
-
- {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente&readonly_tipo=1" ]} -
{[ "type": "select", "label": "", "name": "idsede", "ajax-source": "sedi", "placeholder": "Sede legale" ]}
+ +
+ {[ "type": "date", "label": "", "name": "data_bozza", "value": "", "required": 1 ]} +
+ +
{[ "type": "select", "label": "", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento" ]}
+ +
+ {[ "type": "select", "label": "", "name": "idstato", "required": 1, "values": "query=" ]} +