add my changes with tooltipped publisher emails into christines php code

This commit is contained in:
Dario Rekowski on RockPI 2020-06-25 14:37:05 +00:00
commit 80611d56ee
3 changed files with 90 additions and 171 deletions

View File

@ -23,12 +23,6 @@ class StateBalancesController extends AppController
//$this->Auth->allow(['add', 'edit']);
$this->Auth->allow(['overview', 'overviewGdt']);
$this->loadComponent('JsonRequestClient');
$this->set(
'naviHierarchy',
(new NaviHierarchy())->
add(new NaviHierarchyEntry(__('Startseite'), 'Dashboard', 'index', false))->
add(new NaviHierarchyEntry(__('Kontoübersicht'), 'StateBalances', 'overview', true))
);
}
/**
* Index method
@ -47,6 +41,12 @@ class StateBalancesController extends AppController
public function overview()
{
$this->set(
'naviHierarchy',
(new NaviHierarchy())->
add(new NaviHierarchyEntry(__('Startseite'), 'Dashboard', 'index', false))->
add(new NaviHierarchyEntry(__('Kontoübersicht'), 'StateBalances', 'overview', true))
);
$startTime = microtime(true);
$this->viewBuilder()->setLayout('frontend');
$session = $this->getRequest()->getSession();
@ -93,7 +93,7 @@ class StateBalancesController extends AppController
//var_dump($sendCoins);
if ($sendCoins->state_user_id != $user['id']) {
array_push($involvedUserIds, intval($sendCoins->state_user_id));
} else if ($sendCoins->receiver_user_id != $user['id']) {
} elseif ($sendCoins->receiver_user_id != $user['id']) {
array_push($involvedUserIds, intval($sendCoins->receiver_user_id));
}
}
@ -144,6 +144,7 @@ class StateBalancesController extends AppController
$otherUser = null;
if ($sendCoins->state_user_id == $user['id']) {
$type = 'send';
if(isset($involvedUserIndices[$sendCoins->receiver_user_id])) {
$otherUser = $involvedUserIndices[$sendCoins->receiver_user_id];
}
@ -176,6 +177,12 @@ class StateBalancesController extends AppController
public function overviewGdt()
{
$this->set(
'naviHierarchy',
(new NaviHierarchy())->
add(new NaviHierarchyEntry(__('Startseite'), 'Dashboard', 'index', false))->
add(new NaviHierarchyEntry(__('GDT Kontoübersicht'), 'StateBalances', 'overviewGdt', true))
);
$startTime = microtime(true);
$this->viewBuilder()->setLayout('frontend');
$session = $this->getRequest()->getSession();
@ -188,10 +195,9 @@ class StateBalancesController extends AppController
//var_dump($requestResult);
if('success' === $requestResult['state'] && 'success' === $requestResult['data']['state']) {
//var_dump(array_keys($requestResult['data']));
$ownEntries = $requestResult['data']['ownEntries'];
//$gdtEntries = $requestResult['data']['entries'];
$gdtSum = 0;

View File

@ -9,192 +9,105 @@ use Cake\I18n\FrozenTime;
function publisherLink($publisher, $the) {
/*if(is_a($publisher, 'App\Model\Entity\Publisher')) {
return $the->Html->link(h($publisher->email), ['controller' => 'GdtEntries', 'action' => 'viewPerEmail', $publisher->email], ['title' => $publisher->getNames()]);
} else {
return $the->Html->link(h($publisher), ['controller' => 'GdtEntries', 'action' => 'viewPerEmail', $publisher]);
}*/
if(is_array($publisher)) {
return h($publisher['email']);
}
else {
return h($publisher);
}
//return json_encode($publisher);
}
$this->assign('title', __('GDT Kontoübersicht'));
$header = '<h3>' . __('Zur Verfügung: ') . '</h3>';
$gdtSumFromEmails = 0;
foreach($gdtSumPerEmail as $email => $gdt) {
$gdtSumFromEmails += $gdt;
}
$ownEuroSum = 0;
$ownGdtSum = 0;
$publisherEuroSum = 0;
$publisherGdtSum = 0;
if($gdtSum > 0){
$header .= '<h2>'.$this->element('printGDT', ['number' => $gdtSumFromEmails]).'</h2>';
}
if($moreEntrysAsShown) {
$header .= '<span>'. __('Nur die letzten 100 Einträge werden angezeigt!') . '</span>';
}
$this->assign('header', $header);
?>
<style type="text/css">
.font-smaller {
font-size:smaller;
}
.font-color-grey
{
color:grey;
}
</style>
<div class="row">
<div class="col-md-8 equel-grid">
<div class="grid">
<div class="grid-body py-3">
overview
<h3><?= __('Zur Verfügung: ') ?></h3>
<?php if($gdtSum > 0) : ?>
<h2><?= $this->element('printGDT', ['number' => $gdtSumFromEmails]) ?></h2>
<?php endif; ?>
<?php if($moreEntrysAsShown) : ?>
<span><?= __('Nur die letzten 100 Einträge werden angezeigt!'); ?></span>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php if(isset($ownEntries) && count($ownEntries) > 0) :?>
<div class="row">
<div class="col-md-12 equel-grid">
<div class="grid">
<div class="grid-body py-3">
<p class="card-title ml-n1"><?= __('Eigene Einzahlungen') ?></p>
</div>
<div class="table-responsive">
<table class="table table-hover table-sm">
<thead>
<tr class="solid-header">
<th class="pl-4"><?= __('Datum') ?></th>
<th><?= __('Euro') ?></th>
<th><?= __('Factor')?></th>
<th><?= __('GDT') ?></th>
<th><?= __('Kommentar') ?></th>
<th><?= __('E-Mail') ?></th>
</tr>
</thead>
<tbody>
<?php foreach($ownEntries as $entry) :
$ownEuroSum += $entry['amount'];
$ownGdtSum += $entry['gdt'];
?>
<tr>
<td><?= new FrozenTime($entry['date']) ?></td>
<td>
<?= $this->element('printEuro', ['number' => $entry['amount']]); ?>
<?php
if($entry['amount2']) {
echo ' + ' . $this->element('printEuro', ['number' => $entry['amount2']]);
$ownEuroSum += $entry['amount2'];
}
?>
</td>
<td>
<?= $this->Number->format($entry['factor']) ?>
<?php if($entry['factor2'] != '1') : ?> x
<?= $this->Number->format($entry['factor2']) ?>
<?php endif; ?>
</td>
<td><?= $this->element('printGDT', ['number' => $entry['gdt']]) ?></td>
<td><?= h($entry['comment']) ?></td>
<td><?= $entry['email'] ?></td>
</tr>
<tr class="font-smaller">
<td><i class="font-color-grey"><?= __('Zwischensumme') ?>:</i></td>
<td><i class="font-color-grey"><?= $this->element('printEuro', ['number' => $ownEuroSum]) ?></i></td>
<td></td>
<td><i class="font-color-grey"><?= $this->element('printGDT', ['number' => $ownGdtSum]) ?></i></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="content-list">
<p class="content-list-title"><?= __('Eigene Einzahlungen') ?></p>
<div class="content-list-table">
<div class="row">
<div class="cell header-cell c3"><?= __('E-Mail') ?></div>
<div class="cell header-cell c3"><?= __('Datum') ?></div>
<div class="cell header-cell c0"><?= __('Kommentar') ?></div>
<div class="cell header-cell c3"><?= __('Euro') ?></div>
<div class="cell header-cell c2"><?= __('Factor')?></div>
<div class="cell header-cell c3"><?= __('GDT') ?></div>
</div>
<?php foreach($ownEntries as $entry) : ?>
<div class="row">
<div class="cell c3"><?= $entry['email'] ?></div>
<div class="cell c3"><?= new FrozenTime($entry['date']) ?></div>
<div class="cell c0"><?= h($entry['comment']) ?></div>
<div class="cell c3">
<?= $this->element('printEuro', ['number' => $entry['amount']]); ?>
<?php if($entry['amount2']) echo ' + ' . $this->element('printEuro', ['number' => $entry['amount2']]) ?>
</div>
<div class="cell c2">
<?= $this->Number->format($entry['factor']) ?>
<?php if($entry['factor2'] != '1') : ?> x
<?= $this->Number->format($entry['factor2']) ?>
<?php endif; ?>
</div>
<div class="cell c3"><?= $this->element('printGDT', ['number' => $entry['gdt']]) ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if(isset($connectEntries) && count($connectEntries) > 0) : ?>
<div class="row">
<div class="col-md-12 equel-grid">
<div class="grid">
<div class="grid-body py-3">
<p class="card-title ml-n1"><?= __('Einzahlungen anderer (Publisherprogramm)') ?></p>
</div>
<div class="table-responsive">
<table class="table table-hover table-sm">
<thead>
<tr class="solid-header">
<!--<th class="pl-4"><?= __('Einzahlender') ?></th>-->
<th class="pl-4"><th><?= __('Datum') ?></th>
<th><?= __('Euro') ?></th>
<th><?= __('Factor') ?></th>
<th><?= __('GDT')?></th>
<th><?= __('E-Mail') ?></th>
</tr>
</thead>
<tbody>
<?php foreach($connectEntries as $entry) :
$elopageTransaction = $entry['connect']['elopage_transaction'];
$gdtEntry = $entry['connect']['gdt_entry'];
$publisherEuroSum += $gdtEntry['amount'];
$publisherGdtSum += $gdtEntry['gdt'];
?>
<!-- <tr><td colspan="5">
<?= $elopageTransaction['email'] ?>
<?php foreach($entry['publishersPath'] as $c => $publisher) : ?>
->
<?= publisherLink($publisher, $this) ?>
<?php endforeach; ?>
</td>
</tr>-->
<tr>
<!--<td><?= h($elopageTransaction['email']) ?></td>-->
<td><?= new FrozenTime($gdtEntry['date']) ?></td>
<td>
<?= $this->element('printEuro', ['number' => $gdtEntry['amount']]) ?>
<?php
if($gdtEntry['amount2']) {
echo ' + ' . $this->element('printEuro', ['number' => $gdtEntry['amount2']]);
$publisherEuroSum += $gdtEntry['amount2'];
}
?>
</td>
<td>
<?= $this->Number->format($gdtEntry['factor']) ?>
<?php if($gdtEntry['factor2'] != '1') : ?> x
<?= $this->Number->format($gdtEntry['factor2']) ?>
<?php endif; ?>
</td>
<td><?= $this->element('printGDT', ['number' => $gdtEntry['gdt']]) ?></td>
<td data-tippy-content="<?= $elopageTransaction['email'] ?>
<?php foreach($entry['publishersPath'] as $c => $publisher) : ?>
-><br>
<?= publisherLink($publisher, $this) ?>
<?php if($publisher['email'] == $user['email']) break ?>
<?php endforeach; ?>"><?= $elopageTransaction['email'] ?></td>
</tr>
<tr class="font-smaller">
<td><i class="font-color-grey"><?= __('Zwischensumme') ?>:</i></td>
<td><i class="font-color-grey"><?= $this->element('printEuro', ['number' => $publisherEuroSum]) ?></i></td>
<td></td>
<td><i class="font-color-grey"><?= $this->element('printGDT', ['number' => $publisherGdtSum]) ?></i></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="content-list">
<p class="content-list-title"><?= __('Einzahlungen anderer (Publisherprogramm)') ?></p>
<div class="content-list-table">
<div class="row">
<div class="cell header-cell c0"><?= __('Einzahlender') ?></div>
<div class="cell header-cell c3"><?= __('Datum') ?></div>
<div class="cell header-cell c3"><?= __('Euro') ?></div>
<div class="cell header-cell c2"><?= __('Factor')?></div>
<div class="cell header-cell c3"><?= __('GDT') ?></div>
</div>
<?php foreach($connectEntries as $entry) :
$elopageTransaction = $entry['connect']['elopage_transaction'];
$gdtEntry = $entry['connect']['gdt_entry'];
?>
<div class="row">
<div class="cell c0" data-tippy-content="<?= $elopageTransaction['email'] ?>
<?php foreach($entry['publishersPath'] as $c => $publisher) : ?>
-><br>
<?= publisherLink($publisher, $this) ?>
<?php if($publisher['email'] == $user['email']) break ?>
<?php endforeach; ?>"><?= $elopageTransaction['email'] ?>
</div>
<!--<div class="cell c0"><?= h($elopageTransaction['email']) ?></div>-->
<div class="cell c3"><?= new FrozenTime($gdtEntry['date']) ?></div>
<div class="cell c3">
<?= $this->element('printEuro', ['number' => $gdtEntry['amount']]) ?>
<?php if($gdtEntry['amount2']) echo ' + ' . $this->element('printEuro', ['number' => $gdtEntry['amount2']]) ?>
</div>
<div class="cell c2">
<?= $this->Number->format($gdtEntry['factor']) ?>
<?php if($gdtEntry['factor2'] != '1') : ?> x
<?= $this->Number->format($gdtEntry['factor2']) ?>
<?php endif; ?>
</div>
<div class="cell c3"><?= $this->element('printGDT', ['number' => $gdtEntry['gdt']]) ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?= $this->Html->css(['gdt.css']) ?>
<?= $this->Html->script(['basic', 'popper.min', 'tippy-bundle.umd.min']) ?>
<script type="text/javascript">
domIsReady(function() {

View File

@ -8,7 +8,7 @@
"watch:css": "gulp watchStyles",
"prebuild": "browserify ./src/js/app.js -t [ babelify --presets [ @babel/preset-env ] ] -o ./public/app.rl.js -v",
"build": "gulp compressStyles && browserify ./public/app.rl.js -g uglifyify -p bundle-collapser/plugin | uglifyjs --compress --mangle toplevel,eval > ../webroot/js/app.min.js",
"build:css" : "gulp compressStyles"
"build:css": "gulp compressStyles"
},
"author": "Dario Rekowski",
"license": "ISC",