referente del cliente finale

This commit is contained in:
Beppe 2021-06-22 17:31:10 +02:00
parent d140a0b1a1
commit 3bdc8020e8
3 changed files with 26 additions and 3 deletions

View File

@ -295,7 +295,11 @@ switch ($resource) {
$filter[] = 'id='.prepare($element);
}
$where[] = 'idanagrafica='.prepare($superselect['idanagrafica']);
if( isset($superselect['idclientefinale']) ){
$where[] = '(idanagrafica='.prepare($superselect['idanagrafica']).' OR idanagrafica='.prepare($superselect['idclientefinale']).')';
}else{
$where[] = 'idanagrafica='.prepare($superselect['idanagrafica']);
}
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');

View File

@ -74,7 +74,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.intval($record['flag_completato']).'" ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica'], 'idclientefinale' => $record['idclientefinale']]).', "readonly": "'.intval($record['flag_completato']).'" ]}
</div>
</div>
@ -597,6 +597,8 @@ $(document).ready(function() {
var contratto = input("idcontratto");
var preventivo = input("idpreventivo");
var ordine = input("idordine");
var cliente_finale = input("idclientefinale");
var referente = input("idreferente");
// Gestione della modifica dell\'anagrafica
anagrafica.change(function() {
@ -606,6 +608,9 @@ $(document).ready(function() {
let value = !$(this).val();
let placeholder = value ? "'.tr('Seleziona prima un cliente').'" : "'.tr("Seleziona un'opzione").'";
referente.getElement()
.selectReset(placeholder);
sede.setDisabled(value)
.getElement().selectReset(placeholder);
@ -629,7 +634,16 @@ $(document).ready(function() {
input("idtipointervento").getElement()
.selectSetNew(data.idtipointervento, data.idtipointervento_descrizione);
}
});
});
//gestione del cliente finale
cliente_finale.change(function() {
updateSelectOption("idclientefinale", $(this).val());
session_set("superselect,idclientefinale", $(this).val(), 0);
referente.getElement()
.selectReset("'.tr("Seleziona un'opzione").'");
});
// Gestione della modifica della sede selezionato
sede.change(function() {

View File

@ -40,3 +40,8 @@ UPDATE `zz_plugins` SET `enabled`=0 WHERE `name`='Componenti ini';
INSERT INTO `zz_plugins` ( `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`, `created_at`, `updated_at`) VALUES ('Componenti', 'Componenti', (SELECT `id` FROM `zz_modules` WHERE name='Impianti'), (SELECT `id` FROM `zz_modules` WHERE name='Impianti'), 'tab', '', '1', '0', '0', '', '', NULL, 'custom', 'componenti', '', NOW(), NOW());
CREATE TABLE `my_componenti_articoli` ( `id` INT NOT NULL AUTO_INCREMENT, `id_impianto` INT NOT NULL , `id_articolo` INT NOT NULL , `pre_id_articolo` INT NOT NULL, `note` TEXT NOT NULL , `data_registrazione` DATE NULL , `data_installazione` DATE NULL , `data_disinstallazione` DATE NULL , `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `updated_at` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`));
-- Aggiunta vista referente in modulo attività
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Interventi' ), 'Referente', '(SELECT an_referenti.nome FROM an_referenti WHERE an_referenti.id=in_interventi.idreferente)', '7', '1', '0', '0', '', '', '1', '0', '0');
INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) (SELECT `zz_groups`.`id`, (SELECT `zz_views`.`id` FROM `zz_views` WHERE `zz_views`.`name`='Referente' AND `zz_views`.`id_module`=(SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Interventi' )) FROM `zz_groups` );