Files
thetool/Layout/default/Contract/View.php
2022-12-15 20:48:48 +01:00

292 lines
15 KiB
PHP

<?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"><a href="<?=self::getUrl("Contract")?>">Aktive Produkte</a></li>
<li class="breadcrumb-item active"><?=$contract->product_name?> [<?=$contract->matchcode?>]</li>
</ol>
</div>
<h4 class="page-title">Aktives Produkt</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
<a href="<?=self::getUrl("Contract","edit", ['id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
</div>
</div>
<div class="card">
<div class="card-body">
<?php if($contract->isCancelled()): ?>
<h2 class="text-center mb-3 text-danger">GEKÜNDIGT</h2>
<?php endif; ?>
<h3 class="text-center mb-3 <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=$contract->product_name?> (<?=$contract->id?>)</h3>
<table class="table table-sm table-striped view-table">
<tr>
<th style="max-width: 50vw;">Matchcode:</th>
<td style="width: 50vw;"><?=$contract->matchcode?></td>
</tr>
<tr>
<th>Vertragsinhaber:</th>
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner->id])?>"><?=$contract->owner->getCompanyOrName()?> (<?=$contract->owner->customer_number?>)</a></td>
</tr>
<?php if($contract->billingaddress_id): ?>
<tr>
<th>Rechnungsempfänger:</th>
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner->id])?>"><?=$contract->billingaddress->getCompanyOrName()?> (<?=$contract->billingaddress->customer_number?>)</a></td>
</tr>
<?php endif; ?>
<tr>
<th>Produkt:</th>
<td><?=$contract->product_name?></td>
</tr><tr>
<th>Produkt Info:</th>
<td><?=$contract->product_info?></td>
</tr>
<!-- upgrades -->
<?php if(is_array($contract->upgradeFrom) && count($contract->upgradeFrom)): ?>
<tr>
<th>Upgrade von:</th>
<td>
<?php foreach($contract->upgradeFrom as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<?php if(is_array($contract->upgradeTo) && count($contract->upgradeTo)): ?>
<tr>
<th>Upgrade auf:</th>
<td>
<?php foreach($contract->upgradeTo as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<!-- downgrades -->
<?php if(is_array($contract->downgradeFrom) && count($contract->downgradeFrom)): ?>
<tr>
<th>Downgrade von:</th>
<td>
<?php foreach($contract->downgradeFrom as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<?php if(is_array($contract->downgradeTo) && count($contract->downgradeTo)): ?>
<tr>
<th>Downgrade auf:</th>
<td>
<?php foreach($contract->downgradeTo as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<!-- productchange -->
<?php if(is_array($contract->productchangeFrom) && count($contract->productchangeFrom)): ?>
<tr>
<th>Produktwechsel von:</th>
<td>
<?php foreach($contract->productchangeFrom as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<?php if(is_array($contract->productchangeTo) && count($contract->productchangeTo)): ?>
<tr>
<th>Produktwechsel auf:</th>
<td>
<?php foreach($contract->productchangeTo as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<!-- relocation -->
<?php if(is_array($contract->relocationFrom) && count($contract->relocationFrom)): ?>
<tr>
<th>Umzug von:</th>
<td>
<?php foreach($contract->relocationFrom as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date && $link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<?php if(is_array($contract->relocationTo) && count($contract->relocationTo)): ?>
<tr>
<th>Umzug auf:</th>
<td>
<?php foreach($contract->relocationTo as $link): ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
<?php endforeach; ?>
</td>
</tr>
<?php endif; ?>
<tr>
<th>SLA:</th>
<td><?=$contract->sla->name?></td>
</tr><tr>
<th>Externes Produkt:</th>
<td><?=($contract->product_external) ? "Ja" : "Nein"?></td>
</tr><tr>
<th>Setup Preis:</th>
<td>€ <?=$contract->price_setup?></td>
</tr><tr>
<th>Preis Periodisch:</th>
<td>€ <?=$contract->price?></td>
</tr><tr>
<th>Verrechnungsperiode:</th>
<td>
<?=($contract->billing_period == 1) ? "Monatlich" : ""?>
<?=($contract->billing_period == 12) ? "Jährlich" : ""?>
<?=($contract->billing_period == 24) ? "Zweijährlich" : ""?>
<?=($contract->billing_period == 36) ? "Dreijährlich" : ""?>
</td>
</tr><tr>
<th>Verrechnungsstart Verzögerung:</th>
<td><?=$contract->billing_delay?> Monate</td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Bestelldatum:</th>
<td class="text-monospace"><?=($contract->order_date) ? date('d.m.Y',$contract->order_date) : ""?></td>
</tr><tr>
<th>Fertigstellungsdatum:</th>
<td class="text-monospace">
<?=($contract->finish_date) ? date('d.m.Y',$contract->finish_date) : ""?>
<?=($contract->finish_date_by) ? "(".$contract->finisher->name.")" : ""?>
</td>
</tr><tr>
<th>Kündigungsdatum:</th>
<td class="text-monospace">
<?=($contract->cancel_date) ? date('d.m.Y',$contract->cancel_date) : ""?>
<?=($contract->cancel_date_by) ? "(".$contract->canceler->name.")" : ""?>
</td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Erstellt:</th>
<td class="text-monospace"><?=date('d.m.Y H:i:s',$contract->create)?> (<?=$contract->creator->name?>)</td>
</tr><tr>
<th>Zuletzt bearbeitet:</th>
<td class="text-monospace"><?=date('d.m.Y H:i:s',$contract->edit)?> (<?=$contract->editor->name?>)</td>
</tr><tr class="bg-white">
<td colspan="2" class="text-center">
<a href="<?=self::getUrl("Contractconfig", "edit", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-info">Konfiguration bearbeiten</button></a>
<button type="button" class="btn btn-sm btn-outline-secondary">Inhaberwechsel</button>
<button type="button" class="btn btn-sm btn-outline-success">Produkt-/Standortwechsel</button>
<button type="button" class="btn btn-sm btn-outline-danger">Kündigen</button>
</td>
</tr>
</table>
</div>
</div>
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
<div class="card">
<div class="card-body">
<h4>Verknüpfte Verträge</h4>
<table class="table table-striped table-sm table-bordered table-hover">
<tr>
<th>Kunde</th>
<th>Contract ID</th>
<th>Produkt</th>
<th>Matchcode</th>
<th>Bestelldatum</th>
<th>Fertigstellung</th>
<th>Kündigung</th>
<th></th>
</tr>
<?php foreach($contract->links as $link): ?>
<?php
if($link->contract_id == $contract->id) {
$linkcontract = $link->origin;
} else {
$linkcontract = $link->contract;
}
?>
<tr>
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->product->name?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->matchcode?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
<td>
<a href="<?=self::getUrl("Contract", "deleteLink", ["link_id" => $link->id])?>" onclick="if(!confirm('Verknüpfung wirklich entfernen?')) return false;" class="text-danger" title="Verknüpfung entfernen"><i class="fas fa-xmark-large"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<!--
<div class="card">
<div class="card-body">
<h4>Konfiguration</h4>
<table class="table table-sm table-striped view-table">
<?php foreach($contract->configgroups as $group): ?>
<tr>
<th style="max-width: 50vw;"><h4><?=$group->name?></h4></th>
<td style="width: 50vw;"></td>
</tr>
<?php foreach($group->items as $item): ?>
<tr>
<th style="max-width: 50vw;"><?=$item->displayname?>:</th>
<td style="width: 50vw;">
<?=$item->value->string?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
<div class="text-center">
<a href="#" class="btn btn-sm btn-outline-primary">Konfiguration bearbeiten</a>
</div>
</div>
</div>-->
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
<a href="<?=self::getUrl("Contract","edit", ['id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>