195 lines
12 KiB
PHP
195 lines
12 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"><a href="<?=self::getUrl("Contract", "view", ['id' => $contract->id])?>"><?=$contract->product_name?> [<?=$contract->matchcode?>]</a></li>
|
|
<li class="breadcrumb-item active">Kündigung</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","View", ['id' => $contract->id, 'filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h3 class="text-center mb-3"><?=$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>
|
|
<tr>
|
|
<th>Produkt:</th>
|
|
<td><?=$contract->product_name?> [<?=$contract->product_id?>]<?=($contract->product_name != $contract->product->name) ? " <i>(".$contract->product->name.")</i>" : ""?></td>
|
|
</tr><tr>
|
|
<th>Produkt Info:</th>
|
|
<td><?=$contract->product_info?></td>
|
|
</tr><tr>
|
|
<th>Fertigstellungsdatum:</th>
|
|
<td><?=date("d.m.Y",$contract->finish_date)?></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="text-center mb-3">Kündigung</h4>
|
|
|
|
<form method="post" action="<?=self::getUrl("Contract", "saveCancel")?>">
|
|
<input type="hidden" name="contract_id" value="<?=$contract->id?>" />
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-xl-8">
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="cancel_date">Kündigungsdatum:</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="cancel_date" id="cancel_date" value="<?=($term_end_date) ? $term_end_date->format("d.m.Y") : ""?>">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for=""></label>
|
|
<div class="col-lg-10">
|
|
<button type="button" class="btn btn-outline-primary" onclick="setCancelDate('<?=date("d.m.Y")?>')">Heute</button>
|
|
<button type="button" class="btn btn-outline-primary" onclick="setCancelDate('<?=($tomorrow) ? $tomorrow->format("d.m.Y") : ""?>')">Morgen</button>
|
|
<button type="button" class="btn btn-outline-primary" onclick="setCancelDate('<?=($term_end_date) ? $term_end_date->format("d.m.Y") : ""?>')">Ende der Vertragslaufzeit</button>
|
|
<button type="button" class="btn btn-outline-primary" onclick="setCancelDate('<?=($period_end_date) ? $period_end_date->format("d.m.Y") : ""?>')">Ende der aktuellen Rechnungsperiode</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
|
|
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
|
<h4>Verknüpfte Verträge</h4>
|
|
|
|
<table class="table table-striped table-sm table-bordered table-hover" id="link-table">
|
|
<tr>
|
|
<th title="Verlinkter Contract bleibt bestehen">nicht kündigen</th>
|
|
<th title="Verlinkter Contract wird auch gekündigt">ebenfalls Kündigen</th>
|
|
<th>Kunde</th>
|
|
<th>Contract ID</th>
|
|
<th>Produkt</th>
|
|
<th>Matchcode</th>
|
|
<th>Preis Netto</th>
|
|
<th>Bestelldatum</th>
|
|
<th>Fertigstellung</th>
|
|
<th>Kündigung</th>
|
|
</tr>
|
|
<?php foreach($contract->links as $link): ?>
|
|
<?php
|
|
|
|
if($link->contract_id == $contract->id) {
|
|
$linkcontract = $link->origin;
|
|
} else {
|
|
$linkcontract = $link->contract;
|
|
}
|
|
|
|
if(!$linkcontract->billing_period) continue;
|
|
|
|
?>
|
|
<tr data-link-type="<?=$link->type?>">
|
|
<td class="text-center">
|
|
<input type="radio" class="form-check link-keep" id="link-<?=$linkcontract->id?>-action-keep" name="links[<?=$linkcontract->id?>]" value="keep" <?=($linkcontract->cancel_date && $linkcontract->cancel_date < date('U')) ? "" : "checked='checked'"?> />
|
|
</td>
|
|
<td><input type="radio" class="form-check link-cancel" id="link-<?=$linkcontract->id?>-action-cancel" name="links[<?=$linkcontract->id?>]" value="cancel" /></td>
|
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>" target="_blank"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
|
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->id?></a></td>
|
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->product_name?></a></td>
|
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->matchcode?></a></td>
|
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=($linkcontract->price < 0) ? "text-danger" : ""?>">€ <?=number_format($linkcontract->price, 4, ",", ".")?></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>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- TODO: Fileupload -->
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
<div class="col text-center">
|
|
<input type="submit" class="btn btn-primary" value="Kündigung speichern" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<a href="<?=self::getUrl("Contract","View", ['id' => $contract->id, 'filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
$('#cancel_date').datepicker({
|
|
language: 'de',
|
|
format: "dd.mm.yyyy",
|
|
showWeekDays: true,
|
|
todayBtn: 'linked',
|
|
autoclose: true
|
|
});
|
|
|
|
function setCancelDate(date) {
|
|
$("#cancel_date").val(date);
|
|
}
|
|
</script>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|