Nuovo modulo "Provenienze"

This commit is contained in:
Luca 2022-06-10 17:33:35 +02:00
parent a9e882f485
commit 5cd3089ca3
17 changed files with 1349 additions and 4 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

View File

@ -20,6 +20,16 @@
outline: none;
}
@font-face {
font-family: 'Source Sans Pro';
src: local('Source Sans Pro'),
url('../fonts/sourcesanspro-regular-webfont.eot') format('embedded-opentype'),
url('../fonts/sourcesanspro-regular-webfont.woff') format('woff'),
url('../fonts/sourcesanspro-regular-webfont.woff2') format('woff2'),
url('../fonts/sourcesanspro-regular-webfont.ttf') format('truetype'),
url('../fonts/sourcesanspro-regular-webfont.svg') format('svg');
}
html,
body {
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

View File

@ -24,6 +24,7 @@
.skin-default.login-page .wrapper {
background: #d2d6de;
display: block;
}
.skin-default .content-wrapper,

View File

@ -255,6 +255,11 @@ const fonts = gulp.parallel(() => {
'bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
'bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
'bootstrap/dist/fonts/glyphicons-halflings-regular.woff2',
'../assets/src/css/fonts/sourcesanspro-regular-webfont.eot',
'../assets/src/css/fonts/sourcesanspro-regular-webfont.svg',
'../assets/src/css/fonts/sourcesanspro-regular-webfont.ttf',
'../assets/src/css/fonts/sourcesanspro-regular-webfont.woff',
'../assets/src/css/fonts/sourcesanspro-regular-webfont.woff2',
];
for (const i in vendor) {

View File

@ -333,8 +333,6 @@ if (Auth::check()) {
$settings_collapse = session_get('settings.sidebar-collapse') ? 1 : 0;
$hide_sidebar = Auth::check() && (setting('Nascondere la barra sinistra di default') || $settings_collapse);
echo '
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="skin-'.$theme.(!empty($hide_sidebar) ? ' sidebar-collapse' : '').(!Auth::check() ? ' hold-transition login-page' : '').'">

View File

@ -85,6 +85,7 @@ switch (post('op')) {
$anagrafica->dipendenti = post('dipendenti');
$anagrafica->macchine = post('macchine');
$anagrafica->idagente = post('idagente');
$anagrafica->id_provenienza = post('id_provenienza');
$anagrafica->idrelazione = post('idrelazione');
$anagrafica->sitoweb = post('sitoweb');
$anagrafica->iscrizione_tribunale = post('iscrizione_tribunale');

View File

@ -372,6 +372,19 @@ switch ($resource) {
}
break;
case 'provenienze':
$query = 'SELECT id, descrizione, colore AS bgcolor FROM an_provenienze |where| ORDER BY descrizione';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
}
break;
/*
* Opzioni utilizzate:

View File

@ -490,9 +490,8 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
<div class="tab-pane '.(!$is_cliente ? 'hide' : 'active').'" id="cliente">
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Tipo attività predefinita').'", "name": "idtipointervento_default", "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione ASC", "value": "$idtipointervento_default$" ]}
{[ "type": "select", "label": "'.tr('Provenienza cliente').'", "name": "id_provenienza", "ajax-source": "provenienze", "value": "$id_provenienza$", "icon-after": "add|'.Modules::get('Provenienze')['id'].'" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Relazione con il cliente').'", "name": "idrelazione", "ajax-source": "relazioni", "value": "$idrelazione$", "icon-after": "add|'.Modules::get('Relazioni')['id'].'" ]}
</div>
@ -556,6 +555,11 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
echo '
</div>
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Tipo attività predefinita').'", "name": "idtipointervento_default", "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione ASC", "value": "$idtipointervento_default$" ]}
</div>
</div>';
echo '

View File

@ -0,0 +1,83 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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';
switch (filter('op')) {
case 'update':
$descrizione = filter('descrizione');
$colore = filter('colore');
if (isset($descrizione)) {
if ($dbo->fetchNum('SELECT * FROM `an_provenienze` WHERE `descrizione`='.prepare($descrizione).' AND `id`!='.prepare($id_record)) == 0) {
$dbo->query('UPDATE `an_provenienze` SET `descrizione`='.prepare($descrizione).', `colore`='.prepare($colore).' WHERE `id`='.prepare($id_record));
flash()->info(tr('Salvataggio completato.'));
} else {
flash()->error(tr("E' già presente una provenienza _NAME_.", [
'_TYPE_' => $descrizione,
]));
}
} else {
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio'));
}
break;
case 'add':
$descrizione = filter('descrizione');
$colore = filter('colore');
if (isset($descrizione)) {
if ($dbo->fetchNum('SELECT * FROM `an_provenienze` WHERE `descrizione`='.prepare($descrizione)) == 0) {
$dbo->query('INSERT INTO `an_provenienze` (`descrizione`, `colore`) VALUES ('.prepare($descrizione).', '.prepare($colore).')');
$id_record = $dbo->lastInsertedID();
if (isAjaxRequest()) {
echo json_encode(['id' => $id_record, 'text' => $descrizione]);
}
flash()->info(tr('Aggiunta nuova provenienza _NAME_', [
'_NAME_' => $descrizione,
]));
} else {
flash()->error(tr("E' già presente una provenienza di _NAME_.", [
'_NAME_' => $descrizione,
]));
}
} else {
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio'));
}
break;
case 'delete':
$righe = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE id_provenienza='.prepare($id_record));
if (isset($id_record) && empty($righe)) {
$dbo->query('DELETE FROM `an_provenienze` WHERE `id`='.prepare($id_record));
flash()->info(tr('Provenienza _NAME_ eliminata con successo!', [
'_NAME_' => $descrizione,
]));
} else {
flash()->error(tr('Sono presenti '.count($righe).' anagrafiche collegate a questa provenienza.'));
}
break;
}

View File

@ -0,0 +1,51 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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';
?><form action="" method="post" id="add-form">
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-9">
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1 ]}
</div>
<div class="col-md-3">
{[ "type": "text", "label": "<?php echo tr('Colore'); ?>", "name": "colore", "required": 1, "class": "colorpicker text-center", "value": "", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]}
</div>
</div>
<!-- PULSANTI -->
<div class="row">
<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>
</div>
</div>
</form>
<script>
$(document).ready( function() {
$('.colorpicker').colorpicker().on('changeColor', function() {
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
</script>

View File

@ -0,0 +1,77 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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';
?><form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<!-- DATI -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><?php echo tr('Dati'); ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-9">
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
</div>
<div class="col-md-3">
{[ "type": "text", "label": "<?php echo tr('Colore'); ?>", "name": "colore", "required": 1, "class": "colorpicker text-center", "value": "$colore$", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]}
</div>
</div>
</div>
</div>
</form>
<?php
$righe = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idrelazione='.prepare($id_record));
if (!empty($righe)) {
echo '
<div class="alert alert-danger">
'.tr('Ci sono _NUM_ anagrafiche collegate', [
'_NUM_' => $righe,
]).'.
</div>';
} else {
?>
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>
<?php
}
?>
<script>
$(document).ready( function() {
$('.colorpicker').colorpicker().on('changeColor', function() {
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
</script>

View File

@ -0,0 +1,24 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `an_provenienze` WHERE id='.prepare($id_record));
}

View File

@ -60,3 +60,27 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
-- Filtro per mostrare preventivi ai clienti
INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES
((SELECT `id` FROM `zz_groups` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_modules` WHERE `name`='Preventivi'), 'Mostra preventivi ai clienti coinvolti', 'co_preventivi.idanagrafica=|id_anagrafica|', 'WHR', 1, 0);
-- Nuova tabella per gestire le provenienze
CREATE TABLE IF NOT EXISTS `an_provenienze` (
`id` int NOT NULL AUTO_INCREMENT,
`descrizione` varchar(100) NOT NULL,
`colore` varchar(7) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
INSERT INTO `an_provenienze` (`id`, `descrizione`, `colore`) VALUES
(NULL, 'Sito web', '#caffb7'),
(NULL, 'Passaparola', '#8fbafd');
-- Aggiunto id_provenienza per scheda anagrafica Cliente
ALTER TABLE `an_anagrafiche` ADD `id_provenienza` AFTER `idrelazione`, INT DEFAULT NULL;
-- Nuovo modulo "Provenienze"
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`, `use_notes`, `use_checklists`) VALUES (NULL, 'Provenienze', 'Provenienze', 'provenienze', 'SELECT |select| FROM `an_provenienze` WHERE 1=1 HAVING 2=2', '', 'fa fa-angle-right', '2.4.34', '2.4.34', '1', (SELECT id FROM zz_modules t WHERE t.name = 'Anagrafiche'), '1', '1', '0', '0');
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `visible`, `format`, `default`) VALUES
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Provenienze'), 'id', 'an_provenienze.id', 1, 1, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Provenienze'), 'descrizione', 'an_provenienze.descrizione', 2, 1, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Provenienze'), 'colore', 'an_provenienze.colore', 3, 1, 0, 1);