openstamanager/modules/fasce_orarie/edit.php

183 lines
6.2 KiB
PHP
Raw Permalink Normal View History

<?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';
2024-02-08 13:10:46 +01:00
use Modules\Pagamenti\Pagamento;
2024-01-15 15:30:45 +01:00
// $block_edit = $record['is_predefined'];
?>
<form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<!-- DATI -->
2024-05-16 18:02:50 +02:00
<div class="card card-primary">
2024-05-17 12:11:00 +02:00
<div class="card-header">
2024-05-16 18:02:50 +02:00
<h3 class="card-title"><?php echo tr('Dati'); ?></h3>
</div>
2024-05-16 18:02:50 +02:00
<div class="card-body">
<div class="row">
<div class="col-md-6">
2024-04-19 16:44:08 +02:00
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$title$" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "multiple":"1", "label": "<?php echo tr('Giorni'); ?>", "name": "giorni[]", "required": 0, "value": "$giorni$", "values": "list=\"1\":\"<?php echo tr('Lunedì'); ?>\", \"2\":\"<?php echo tr('Martedì'); ?>\", \"3\":\"<?php echo tr('Mercoledì'); ?>\", \"4\":\"<?php echo tr('Giovedì'); ?>\", \"5\":\"<?php echo tr('Venerdì'); ?>\", \"6\":\"<?php echo tr('Sabato'); ?>\", \"7\":\"<?php echo tr('Domenica'); ?>\"" ]}
</div>
</div>
<div class="row">
<div class="col-md-3">
{[ "type": "time", "label": "<?php echo tr('Ora inizio'); ?>", "name": "ora_inizio", "required": 1, "value": "$ora_inizio$" ]}
</div>
<div class="col-md-3">
{[ "type": "time", "label": "<?php echo tr('Ora fine'); ?>", "name": "ora_fine", "required": 1, "value": "$ora_fine$" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr('Includi festività'); ?>", "name": "include_bank_holidays", "required": 0, "value": "$include_bank_holidays$" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr('Predefinita'); ?>", "name": "is_predefined", "required": 0, "value": "$is_predefined$" ]}
</div>
</div>
</div>
</div>
<!-- Date aggiuntive -->
2024-05-16 18:02:50 +02:00
<div class="card card-primary hide">
2024-05-17 12:11:00 +02:00
<div class="card-header">
2024-05-16 18:02:50 +02:00
<h3 class="card-title"><?php echo tr('Date aggiuntive'); ?></h3>
</div>
2024-05-16 18:02:50 +02:00
<div class="card-body">
<div id="elenco-date">
<?php
2024-06-11 16:58:27 +02:00
$results = Pagamento::where('name', prepare($record['descrizione']))->first()->id;
2024-01-15 15:30:45 +01:00
$numero_data = 1;
foreach ($results as $result) {
}
2024-01-15 15:30:45 +01:00
?>
2024-04-08 15:44:33 +02:00
</div>
2024-05-16 18:02:50 +02:00
<div class="float-right d-none d-sm-inline">
<button type="button" class="btn btn-info" onclick="aggiungiData()">
<i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?>
</button>
<button type="submit" class="btn btn-success">
<i class="fa fa-check"></i> <?php echo tr('Salva'); ?>
</button>
</div>
</div>
</div>
</form>
<?php
echo '
<form class="hide" id="template">
2024-05-16 18:02:50 +02:00
<div class="card">
<div class="card-header with-border">
<h3 class="card-title">'.tr('Nuova data').'</h3>
</div>
2024-05-16 18:02:50 +02:00
<div class="card-body">
<input type="hidden" value="" name="id[-id-]">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome[-id-]"]}
</div>
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data').'", "name": "data[-id-]" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "'.tr('Data ricorrente').'", "name": "data_ricorrente[-id-]", "value": "" ]}
</div>
</div>
</div>
</div>
</form>';
?>
<script>
var indice_data = "<?php echo $numero_data; ?>";
function aggiungiData() {
aggiungiContenuto("#elenco-date", "#template", {"-id-": indice_data});
indice_data++;
}
</script>
<?php
2024-04-18 17:44:05 +02:00
$elementi = $dbo->fetchArray('SELECT `in_tipiintervento`.`codice`, `in_tipiintervento_lang`.`title`, `in_tipiintervento`.`id` FROM `in_tipiintervento` LEFT JOIN `in_tipiintervento_lang` ON (`in_tipiintervento`.`id` = `in_tipiintervento_lang`.`id_record` AND `in_tipiintervento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') LEFT JOIN `in_fasceorarie_tipiintervento` ON `in_tipiintervento`.`id`=`in_fasceorarie_tipiintervento`.`idtipointervento` WHERE `in_fasceorarie_tipiintervento`.`idfasciaoraria`='.prepare($id_record));
if (!empty($elementi)) {
echo '
2024-05-16 18:02:50 +02:00
<div class="card card-warning collapsable collapsed-card">
<div class="card-header with-border">
<h3 class="card-title"><i class="fa fa-warning"></i> '.tr('Tipi interventi collegati: _NUM_', [
2024-03-22 15:52:24 +01:00
'_NUM_' => count($elementi),
]).'</h3>
2024-05-16 18:02:50 +02:00
<div class="card-tools pull-right">
2024-05-23 17:51:21 +02:00
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
2024-05-16 18:02:50 +02:00
<div class="card-body">
<ul>';
foreach ($elementi as $elemento) {
$descrizione = tr('_REF_ (_TIPO_INTERVENTO_)', [
2024-03-22 15:52:24 +01:00
'_REF_' => $elemento['descrizione'],
'_TIPO_INTERVENTO_' => $elemento['codice'],
]);
2023-08-04 14:54:28 +02:00
$modulo = 'Tipi di intervento';
$id = $elemento['idtipointervento'];
echo '
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
}
echo '
</ul>
</div>
</div>';
}
?>
2023-08-04 14:54:28 +02:00
<a class="btn btn-danger ask <?php echo intval($record['can_delete']) == 0 ? 'disabled' : ''; ?>" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>