Files
thetool/Layout/default/Callcenterstats/Index.php
Frank Schubert 8f73a21ca3 swapped in/out
2025-07-17 20:47:10 +02:00

170 lines
7.9 KiB
PHP

<?php
/**
* @var string $mfLayoutPackage
*
* @var CallcenterIdentity[] $identities
* @var string[] $selected_identities
* @var DateTime $from
* @var DateTime $to
*/
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item active">Callcenter Auswertung</li>
</ol>
</div>
<h4 class="page-title">Callcenter Auswertung</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-6 col-xl-5">
<div class="card">
<div class="card-body">
<h4 class="card-header mb-2">Callcenter Auswertung</h4>
<form class="form-horizontal" method="post" action="<?=self::getUrl("Callcenterstats") ?>">
<div class="form-group row">
<label class="col-lg-2 col-form-label">Identität(en)</label>
<div class="col-lg-10">
<select name="identities[]" id="identities" multiple="multiple" class="form-control select2">
<?php foreach($identities as $ident): ?>
<option value="<?=$ident->number?>" data-color="<?=$ident->color?>" <?=($selected_identities && in_array($ident->number, $selected_identities) ? "selected='selected'" : "")?>><?=$ident->name?> - <?=$ident->display?></option>
<?php endforeach; ?>
</select>
<small><a href="#" onclick="selectColors(['green','pink']); return false;"><i class="fas fa-plus"></i> ESTMK</a></small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label">Zeitraum von:</label>
<div class="col-lg-10">
<input type="text" class="form-control datepicker" name="from" value="<?=$from->format("d.m.Y")?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label">Zeitraum bis:</label>
<div class="col-lg-10">
<input type="text" class="form-control datepicker" name="to" value="<?=$to->format("d.m.Y")?>"/>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<input type="submit" class="btn btn-primary" name="run" value="Auswerten" />
</div>
</div>
</form>
</div>
</div>
<?php if(isset($in) || isset($out)): ?>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-6">
<h4 class="text-right">Eingehend</h4>
<?php if(isset($out)): ?>
<table class="table table-sm table-striped">
<tr>
<th class="text-right">Anzahl eingehende Calls:</th>
<td class="text-monospace text-right"><?=number_format($in["count"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right">Sekunden gesamt:</th>
<td class="text-monospace text-right"><?=number_format($in["seconds"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right">Verrechenbare Minuten:</th>
<td class="text-monospace text-right"><?=number_format($in["billable"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right">Kosten:</th>
<td class="text-monospace text-right">€ <?=number_format($in["cost"], 0, ",", ".")?></td>
</tr>
</table>
<?php endif; ?>
</div>
<div class="col-6">
<h4 class="text-right">Ausgehend</h4>
<?php if(isset($in)): ?>
<table class="table table-sm table-striped">
<tr>
<th class="text-right">Anzahl ausgehende Calls:</th>
<td class="text-monospace text-right"><?=number_format($out["count"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right"h>Sekunden gesamt:</th>
<td class="text-monospace text-right"><?=number_format($out["seconds"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right">Verrechenbare Minuten:</th>
<td class="text-monospace text-right"><?=number_format($out["billable"], 0, ",", ".")?></td>
</tr>
<tr>
<th class="text-right">Kosten:</th>
<td class="text-monospace text-right">€ <?=number_format($out["cost"], 0, ",", ".")?></td>
</tr>
</table>
<?php endif; ?>
</div>
</div>
<div class="row">
<div class="col text-right">
<h4>Summe: € <?=number_format($in["cost"] + $out["cost"], 0, ",", ".")?></h4>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<script>
$(".select2").select2({closeOnSelect: false});
$(".datepicker").datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true,
orientation: "bottom"
});
function selectColors(colors = []) {
var pattern = "(" + colors.join("|") + ")";
$("#identities option").each(function(i, elem) {
var c = $(elem).data("color");
if(c.match(pattern)) {
$(elem).attr("selected", "selected");
$(elem).change();
}
});
return false;
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>