summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/mods/mod_rechnungen/settings_edit.phtml63
1 files changed, 55 insertions, 8 deletions
diff --git a/views/mods/mod_rechnungen/settings_edit.phtml b/views/mods/mod_rechnungen/settings_edit.phtml
index 173096b..4ea6a3f 100644
--- a/views/mods/mod_rechnungen/settings_edit.phtml
+++ b/views/mods/mod_rechnungen/settings_edit.phtml
@@ -311,8 +311,30 @@
?>
- <style>.wpsg_mod_rechnungen_archive td { white-space:nowrap; } .wpsg_mod_rechnungen_archive th, .wpsg_mod_rechnungen_archive .wpsg_archive_deleted { white-space:normal; }</style>
- <table class="table wpsg_mod_rechnungen_archive">
+ <style>.wpsg_mod_rechnungen_archive td { white-space:nowrap; } .wpsg_mod_rechnungen_archive th, .wpsg_mod_rechnungen_archive .wpsg_archive_deleted { white-space:normal; } .wpsg_archive_toggle { text-decoration:none; color:inherit; } .wpsg_archive_toggle .dashicons { vertical-align:text-bottom; }</style>
+ <?php
+
+ // Jahre ohne verbliebene Dateien, aber mit Löschvermerk: Ansicht „Gelöscht“
+ $arArchiveView = ['present' => [], 'deleted' => []];
+
+ foreach ($this->view['arArchive'] as $year => $arMonth) {
+
+ $bDeleted = (array_sum(array_column($arMonth, 'files')) === 0 && sizeof(array_filter(array_column($arMonth, 'deleted'))) > 0);
+ $arArchiveView[($bDeleted)?'deleted':'present'][$year] = $arMonth;
+
+ }
+
+ ?>
+
+ <p class="wpsg_archive_views">
+ <a href="#" class="button button-primary" data-view="present"><?php echo wpsg_translate(__('Vorhanden (#1#)', 'wpsg'), sizeof($arArchiveView['present'])); ?></a>
+ <?php if (sizeof($arArchiveView['deleted']) > 0) { ?>
+ <a href="#" class="button" data-view="deleted"><?php echo wpsg_translate(__('Gelöscht (#1#)', 'wpsg'), sizeof($arArchiveView['deleted'])); ?></a>
+ <?php } ?>
+ </p>
+
+ <?php foreach ($arArchiveView as $view => $arYear) { if (sizeof($arYear) === 0) continue; ?>
+ <table class="table wpsg_mod_rechnungen_archive" data-view="<?php echo $view; ?>" <?php echo ($view === 'deleted')?'style="display:none;"':''; ?>>
<thead>
<tr>
<th><?php echo __('Zeitraum', 'wpsg'); ?></th>
@@ -325,20 +347,21 @@
</tr>
</thead>
<tbody>
- <?php foreach ($this->view['arArchive'] as $year => $arMonth) { ?>
+ <?php $bOpen = ($view === 'present'); ?>
+ <?php foreach ($arYear as $year => $arMonth) { ?>
<?php $files = array_sum(array_column($arMonth, 'files')); ?>
- <tr class="wpsg_archive_year">
- <td><strong><?php echo $year; ?></strong></td>
+ <tr class="wpsg_archive_year" data-year="<?php echo $year; ?>">
+ <td><a href="#" class="wpsg_archive_toggle"><span class="dashicons dashicons-arrow-<?php echo ($bOpen)?'down':'right'; ?>"></span><strong><?php echo $year; ?></strong></a></td>
<td class="col_number"><strong><?php echo array_sum(array_column($arMonth, 'rnr')); ?></strong></td>
<td class="col_number"><strong><?php echo array_sum(array_column($arMonth, 'gnr')); ?></strong></td>
<td class="col_number"><strong><?php echo $files; ?></strong></td>
- <td class="col_number"><strong><?php echo size_format(array_sum(array_column($arMonth, 'size')), 1); ?></strong></td>
+ <td class="col_number"><strong><?php echo ($files > 0)?size_format(array_sum(array_column($arMonth, 'size')), 1):''; ?></strong></td>
<td><?php echo wpsg_formatTimestamp(strtotime($this->callMod('wpsg_mod_rechnungen', 'getArchiveKeepUntil', [$year])), true); ?></td>
<td class="col_actions"><?php echo $archive_actions(strval($year), $year, $files); ?></td>
</tr>
<?php foreach ($arMonth as $month => $m) { ?>
- <tr>
- <td>&nbsp;&nbsp;&nbsp;<?php echo $year.'/'.$month; ?></td>
+ <tr class="wpsg_archive_month" data-year="<?php echo $year; ?>" <?php echo ($bOpen)?'':'style="display:none;"'; ?>>
+ <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $year.'/'.$month; ?></td>
<td class="col_number"><?php echo $m['rnr']; ?></td>
<td class="col_number"><?php echo $m['gnr']; ?></td>
<td class="col_number"><?php echo $m['files']; ?></td>
@@ -350,9 +373,11 @@
</td>
</tr>
<?php } ?>
+ <?php $bOpen = false; ?>
<?php } ?>
</tbody>
</table>
+ <?php } ?>
<?php } ?>
@@ -370,6 +395,28 @@
jQuery(document).ready(function() {
if (location.hash === '#tab4') jQuery('[href="#tab4"]').tab('show');
+
+ jQuery('.wpsg_archive_toggle').on('click', function() {
+
+ var year = jQuery(this).closest('tr').data('year');
+ var oTable = jQuery(this).closest('table');
+
+ oTable.find('.wpsg_archive_month[data-year="' + year + '"]').toggle();
+ jQuery(this).find('.dashicons').toggleClass('dashicons-arrow-right dashicons-arrow-down');
+
+ return false;
+
+ } );
+
+ jQuery('.wpsg_archive_views .button').on('click', function() {
+
+ jQuery('.wpsg_archive_views .button').removeClass('button-primary');
+ jQuery(this).addClass('button-primary');
+ jQuery('table.wpsg_mod_rechnungen_archive').hide().filter('[data-view="' + jQuery(this).data('view') + '"]').show();
+
+ return false;
+
+ } );
jQuery('#wpsg_mod_rechnungen_customermail').on('change', function() {