Merge branch 'master' into fronkdev
This commit is contained in:
@@ -34,25 +34,26 @@ endforeach;
|
||||
type="text/css"/>
|
||||
<link href="<?= self::getResourcePath() ?>css/pages/Calendar/View.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/rrule/rrule.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/moment/moment.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<!-- <script type="text/javascript"-->
|
||||
<!-- src="--><?php //= self::getResourcePath() ?><!--assets/js/calendar/index.global.min.js?--><?php //= $git_merge_ts ?><!--"</script>-->
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar-scheduler@6.1.15/index.global.min.js'></script>
|
||||
<script src="https://raw.githack.com/SortableJS/Sortable/master/Sortable.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery-sortablejs@latest/jquery-sortable.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/index.global.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/Sortable.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/jquery-sortable.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/moment/index.global.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/rrule/index.global.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/locales-all.global.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/tooltip.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/calendar/eventsource.min.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
@@ -247,22 +248,24 @@ endforeach;
|
||||
</div>
|
||||
</h5>
|
||||
<div class="calendar-side-borders-sub-inner data-origin-2">
|
||||
<div class="form-check text-left ml-2" data-origin="2">
|
||||
<input data-calendar_id="999" class="form-check-input calendar-check"
|
||||
name="form-check-input"
|
||||
type="checkbox" value="">
|
||||
<input data-calendar_id="999" type="color"
|
||||
class="form-control-color color-input"
|
||||
value="<?= ($Calendar_colors[999]['bgcolor']) ?: $specialCalendarColors[999] ?>"
|
||||
title="Hintergrundfarbe">
|
||||
<input data-calendar_id="999" type="color"
|
||||
class="form-control-color color-text-input"
|
||||
value="<?= ($Calendar_colors[999]['txtcolor']) ? $Calendar_colors[999]['txtcolor'] : '#ffffff' ?>"
|
||||
title="Textfarbe">
|
||||
<label class="calendar-side-label" for="" style="margin-top:2px;">
|
||||
Abwesenheiten
|
||||
</label>
|
||||
</div>
|
||||
<!-- <div style="display:none">-->
|
||||
<!-- <div class="form-check text-left ml-2" data-origin="2">-->
|
||||
<!-- <input data-calendar_id="999" class="form-check-input calendar-check"-->
|
||||
<!-- name="form-check-input"-->
|
||||
<!-- type="checkbox" value="">-->
|
||||
<!-- <input data-calendar_id="999" type="color"-->
|
||||
<!-- class="form-control-color color-input"-->
|
||||
<!-- value="--><?php //= ($Calendar_colors[999]['bgcolor']) ?: $specialCalendarColors[999] ?><!--"-->
|
||||
<!-- title="Hintergrundfarbe">-->
|
||||
<!-- <input data-calendar_id="999" type="color"-->
|
||||
<!-- class="form-control-color color-text-input"-->
|
||||
<!-- value="--><?php //= ($Calendar_colors[999]['txtcolor']) ? $Calendar_colors[999]['txtcolor'] : '#ffffff' ?><!--"-->
|
||||
<!-- title="Textfarbe">-->
|
||||
<!-- <label class="calendar-side-label" for="" style="margin-top:2px;">-->
|
||||
<!-- Abwesenheiten-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-check text-left ml-2" data-origin="2">
|
||||
<input data-calendar_id="998" class="form-check-input calendar-check"
|
||||
name="form-check-input"
|
||||
@@ -479,7 +482,10 @@ endforeach;
|
||||
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-2">
|
||||
<label for="name" class="col-form-label fw-medium ">Teilnehmer <span class="ml-1 calendar-users-all" style="display: none"><i title="Alle von Planungsansicht" class="fa-solid fa-arrow-right-from-bracket"></i></span></label>
|
||||
<label for="name" class="col-form-label fw-medium ">Teilnehmer <span
|
||||
class="ml-1 calendar-users-all" style="display: none"><i
|
||||
title="Alle von Planungsansicht"
|
||||
class="fa-solid fa-arrow-right-from-bracket"></i></span></label>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<select class="form-control form-select select2-multiple-tag" id="calendar-attendees"
|
||||
|
||||
78
Layout/default/Contract/LinkTable.php
Normal file
78
Layout/default/Contract/LinkTable.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @var Contract $contract - asd
|
||||
*/
|
||||
?>
|
||||
|
||||
<h4>Verknüpfte Verträge <small>
|
||||
<a href="<?= self::getUrl("Contract", "add", ["origin_contract_id" => $contract->id]) ?>">
|
||||
<i class="fas fa-plus"></i>NeuenContract anlegen
|
||||
</a>
|
||||
</small>
|
||||
</h4>
|
||||
<?php if ((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
||||
<table class="table table-striped table-sm table-bordered table-hover">
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Kunde</th>
|
||||
<th>Contract ID</th>
|
||||
<th style="min-width: 300px">Produkt</th>
|
||||
<th>Preis</th>
|
||||
<th>Preis Setup</th>
|
||||
<th>Bestelldatum</th>
|
||||
<th>Fertigstellung</th>
|
||||
<th>Kündigung</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$contract_link_data = [];
|
||||
foreach ([$contract->linkFrom, $contract->linkTo] as $links):
|
||||
foreach ($links as $link):
|
||||
if ($link->contract_id == $contract->id) {
|
||||
$direction = $link->type == "credit" ? "zu" : "von";
|
||||
$linkcontract = $link->origin;
|
||||
} else {
|
||||
$linkcontract = $link->contract;
|
||||
if ($link->type == "upgrade" || $link->type == "downgrade") {
|
||||
$direction = "auf";
|
||||
}
|
||||
if ($link->type == "relocation") {
|
||||
$direction = "nach";
|
||||
}
|
||||
if ($link->type == "credit") {
|
||||
$direction = "";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?>"><?= __($link->type, "contract") ?> <?= ($link->type != "link") ? $direction : "" ?></td>
|
||||
<td>
|
||||
<a href="<?= self::getUrl("Address", "View", ["id" => $linkcontract->owner_id]) ?>"><?= $linkcontract->owner->getCompanyOrName() ?></a>
|
||||
</td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?>">
|
||||
<a
|
||||
href="<?= self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id]) ?>"><?= $linkcontract->id ?></a></td>
|
||||
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?>">
|
||||
<a
|
||||
href="<?= self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id]) ?>"><?= $linkcontract->product_name ?>
|
||||
[<?= $linkcontract->matchcode ?>]</a></td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?= ($linkcontract->price < 0) ? "text-danger" : "" ?>">
|
||||
€ <?= number_format($linkcontract->price, 4, ",", ".") ?></td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?= ($linkcontract->price_setup < 0) ? "text-danger" : "" ?>">
|
||||
€ <?= number_format($linkcontract->price_setup, 4, ",", ".") ?></td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><?= ($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : "" ?></td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><?= ($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : "" ?></td>
|
||||
<td class="contract <?= ($linkcontract->isCancelled()) ? "canceled" : "" ?> <?= (!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?= ($linkcontract->cancel_date) ? "text-danger font-weight-bold" : "" ?>"><?= ($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; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
@@ -1,485 +0,0 @@
|
||||
<?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")?>" 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", ['contract_id' => $contract->id, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-top-success">
|
||||
<div class="card-body">
|
||||
<?php if(!$contract->isFinished()): ?>
|
||||
<h2 class="text-center mb-3 text-secondary">In Herstellung</h2>
|
||||
<?php endif; ?>
|
||||
<?php if($contract->isCancelled()): ?>
|
||||
<h2 class="text-center mb-3 text-danger">GEKÜNDIGT</h2>
|
||||
<?php endif; ?>
|
||||
<?php if(str_contains(strtolower($contract->sla->name), "residential")): ?>
|
||||
<h2 class="text-center mb-3 text-dark-red">Privatprodukt</h2>
|
||||
<?php else: ?>
|
||||
<h2 class="text-center mb-3 text-primary">Businessprodukt</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>
|
||||
<!-- 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", ["contract_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->upgradeTo) && count($contract->upgradeTo)): ?>
|
||||
<tr>
|
||||
<th>Upgrade auf:</th>
|
||||
<td>
|
||||
<?php foreach($contract->upgradeTo as $link): ?>
|
||||
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?> <?=(!$link->contract->isFinished()) ? "not-finished" : "" ?>"><?=$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", ["contract_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", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$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", ["contract_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", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$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", ["contract_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", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<th>Vertragsinhaber:</th>
|
||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner_id])?>"><?=$contract->owner->getCompanyOrName()?></a> [<?=$contract->owner->customer_number?>]</td>
|
||||
</tr>
|
||||
<?php if($contract->billingaddress_id): ?>
|
||||
<tr>
|
||||
<th>Rechnungsempfänger:</th>
|
||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->billingaddress_id])?>"><?=$contract->billingaddress->getCompanyOrName()?></a> [<?=$contract->billingaddress->customer_number?>]</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<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>SLA:</th>
|
||||
<td><?=$contract->sla->name?></td>
|
||||
</tr><tr>
|
||||
<th>Externes Produkt:</th>
|
||||
<td><?=($contract->product_external) ? "Ja" : "Nein"?></td>
|
||||
</tr><tr>
|
||||
<th>Menge:</th>
|
||||
<td><?=(float)number_format($contract->amount, 3, ",", ".")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Preis Periodisch Netto:</th>
|
||||
<td class="<?=($contract->price < 0) ? "text-danger" : ""?>">€ <?=number_format(($contract->amount != 1) ? $contract->price * $contract->amount : $contract->price, 4, ",", ".")?></td>
|
||||
</tr><tr>
|
||||
<th>Preis Periodisch Brutto:</th>
|
||||
<td class="<?=($contract->price < 0) ? "text-danger" : ""?>">€
|
||||
<?php if($contract->price && $contract->vatrate): ?>
|
||||
<?php if($contract->amount != 1): ?>
|
||||
<?=number_format($contract->price + ($contract->price / 100) * $contract->vatrate, 4, ",", ".")?>
|
||||
<?php else: ?>
|
||||
<?=number_format(($contract->price + ($contract->price / 100) * $contract->vatrate) * $contract->amount, 4, ",", ".")?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Verrechnungsperiode:</th>
|
||||
<td>
|
||||
<?=__($contract->billing_period, "billing_period")?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Herstellungskosten:</th>
|
||||
<td class="<?=($contract->price_setup < 0) ? "text-danger" : ""?>">
|
||||
<?php if($contract->price_setup > 0): ?>
|
||||
Netto: € <?=number_format($contract->price_setup, 4, ",", ".")?><?=($contract->amount != 1) ? " (Gesamt: € ".number_format($contract->price_setup * $contract->amount, 4, ",", ".").")" : ""?><br />
|
||||
Brutto: € <?=($contract->price_setup && $contract->vatrate) ? number_format($contract->price_setup + ($contract->price_setup / 100) * $contract->vatrate, 4, ",", ".") : ""?><?=($contract->price_setup && $contract->vatrate && $contract->amount != 1) ? " (Gesamt: € ".number_format(($contract->price_setup + ($contract->price_setup / 100) * $contract->vatrate) * $contract->amount, 4, ",", ".").")" : ""?></td>
|
||||
<?php endif; ?>
|
||||
</tr><tr>
|
||||
<th>Verrechnungsstart Verzögerung:</th>
|
||||
<td>
|
||||
<?php if($contract->billing_delay): ?>
|
||||
<?=$contract->billing_delay?> Monate
|
||||
<?php endif; ?>
|
||||
</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) ? "text-danger font-weight-bold" : ""?>">
|
||||
<?=($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"><i class="far fa-list-dropdown fa-fw"></i> Konfiguration bearbeiten</button></a>
|
||||
<a href="<?=self::getUrl("Contractaccessletter", "view", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-success"><i class="far fa-list-numeric fa-fw"></i> Zugangsdaten anzeigen</button></a>
|
||||
<?php if($contract->finish_date && $contract->finish_date < date('U')): ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary"><i class="far fa-people-arrows fa-fw"></i> Inhaberwechsel</button>
|
||||
<a href="<?=self::getUrl("Contract", "productchange", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-purple"><i class="far fa-truck-container fa-fw"></i> Produkt-/Standortwechsel</button></a>
|
||||
<a href="<?=self::getUrl("Contract", "cancel", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-danger"><i class="far fa-axe fa-fw"></i> Kündigen</button></a>
|
||||
<?php elseif(!$contract->finish_date): ?>
|
||||
<a href="<?=self::getUrl("Contract", "finishContract", ['contract_id' => $contract->id])?>" onclick="if(!confirm('Jetzt fertigstellen und in Verrechnung geben?')) return false"><button type="button" class="btn btn-sm btn-success"><i class="far fa-face-confused fa-fw"></i> Jetzt fertigstellen</button></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-top-warning">
|
||||
<div class="card-header">
|
||||
<h5>Journaleinträge</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
|
||||
<table class="table table-striped table-sm journal">
|
||||
<?php if(is_array($contract->journals) && count($contract->journals)): ?>
|
||||
<?php foreach($contract->journals as $j): ?>
|
||||
<tr>
|
||||
<td style="white-space: nowrap" class="text-monospace"><?=date("d.m.Y H:i", $j->create)?> (<?=$j->creator?>)</td>
|
||||
|
||||
<?php if($j->type == "text" || $j->type == "phone"):?>
|
||||
<td>
|
||||
<?php if($j->type == "text"): ?>
|
||||
<i class="fas fa-align-left bg-warning text-white p-1" title="Kommentar"></i>
|
||||
<?php else: ?>
|
||||
<i class="fas fa-phone bg-warning text-white p-1" title="Anruf"></i>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if(strlen($j->text) > 120): ?>
|
||||
<td style="width: 100%" class="pointer" onclick="toggleTruncatedJournalText(<?=$j->id?>)">
|
||||
<span id="truncated-<?=$j->id?>"><i class="fas fa-caret-right"></i> <?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 120)?></span>
|
||||
<span id="fulltext-<?=$j->id?>" class="hidden"><?=nl2br($j->text)?></span>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td style="width: 100%">
|
||||
<?=str_replace(["\n", "\r", "\t"]," ", $j->text)?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<?php elseif($j->type == "file"): ?>
|
||||
<td><i class="fas fa-download bg-primary text-white p-1" title="Dateiupload"></i></td>
|
||||
<td style="width: 100%">
|
||||
<?php if($j->text): ?>
|
||||
<?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?><br />
|
||||
<?php endif; ?>
|
||||
<a class="text-monospace" href="<?=self::getUrl("File", "download", ["id" => $j->contractfile->file_id])?>"><?=$j->contractfile->name?></a>
|
||||
</td>
|
||||
|
||||
<?php elseif($j->type == "created_from"): ?>
|
||||
<td><i class="fas fa-cogs text-secondary pl-1"></i></td>
|
||||
<td style="width: 100%">
|
||||
<?php if($j->value == "manual"): ?>
|
||||
<em>Vertrag manuell erstellt</em>
|
||||
<?php elseif($j->value == "import"): ?>
|
||||
<em>Vertrag importiert: <?=nl2br(htmlentities($j->text))?>
|
||||
<?php elseif($j->value == "order"): ?>
|
||||
<em>Vertrag aus Bestellung <a href="<?=self::getUrl("Order", "", ["id" => $contract->orderproduct->order_id])?>">#<?=$contract->orderproduct->order_id?></a> erstellt
|
||||
<?php elseif($j->value == "productchange"): ?>
|
||||
<em>Vertrag erstellt: <?=nl2br(htmlentities($j->text))?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php elseif($j->type == "contract_finished"): ?>
|
||||
<td><i class="fas fa-flag-checkered text-success pl-1"></i></td>
|
||||
<td style="width: 100%"><em>Vertag fertiggestellt</em>
|
||||
|
||||
</td>
|
||||
<?php elseif($j->type == "credit_created"): ?>
|
||||
<td><i class="far fa-money-bill-simple-wave text-secondary pl-1"></i></td>
|
||||
<td style="width: 100%"><em>Gutschrift-Vertrag <a href="<?=self::getUrl("Contract", "View", ["contract_id" => $j->value])?>"><?=$j->value?></a> erstellt</em>
|
||||
|
||||
</td>
|
||||
<?php elseif($j->type == "link"): ?>
|
||||
<?php $link = new Contract($j->value); ?>
|
||||
<td><i class="fas fa-link text-secondary pl-1"></i></td>
|
||||
<td style="width: 100%"><em>Verknüpfung mit <a href="<?=self::getUrl("Contract", "view", ['contract_id' => $link->id])?>"><?=$link->id?> - <?=$link->product_name?> [<?=$link->matchcode?>]</a> erstellt</em></td>
|
||||
<?php elseif($j->type == "canceled"): ?>
|
||||
<td><i class="fas fa-skull-crossbones bg-danger text-white p-1"></i></td>
|
||||
<td style="width: 100%"><em>Vertag gekündigt</em></td>
|
||||
<?php endif; ?>
|
||||
<td style="white-space: nowrap">
|
||||
<a href="<?=self::getUrl("Contractjournal", "edit", ["journal_id" => $j->id])?>" title="Journaleintrag bearbeiten"><i class="fas fa-edit"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="ml-3"><button type="button" class="btn btn-sm btn-info" onclick="$('#new-journal').toggle()"><i class="fas fa-plus"></i> Journaleintrag hinzufügen</button></div>
|
||||
<div id="new-journal" class="card-body hidden border-top mt-2">
|
||||
<form method="post" action="<?=self::getUrl("Contractjournal", "save")?>" enctype="multipart/form-data">
|
||||
<input type="hidden" name="contract_id" value="<?=$contract->id?>">
|
||||
|
||||
<label for="new_journal_type" class="form-label">Typ</label>
|
||||
<select name="type" id="new_journal_type" class="form-control mb-2">
|
||||
<option value="phone">Telefongespräch</option>
|
||||
<option value="text">Kommentar</option>
|
||||
<option value="file">Dateiupload</option>
|
||||
</select>
|
||||
|
||||
<label for="new_journal_text" class="form-label">Text</label>
|
||||
<textarea name="text" id="new_journal_text" class="form-control mb-2" style="height:120px;"></textarea>
|
||||
|
||||
<div id="new-journal-file-container" class="hidden">
|
||||
<label for="new_journal_file" class="form-label">Dateianhang</label>
|
||||
<input type="file" name="journal_file" id="new_journal_file" class="form-control mb-2" />
|
||||
</div>
|
||||
|
||||
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save mr-1"></i> Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card border-top-success">
|
||||
<div class="card-body">
|
||||
<h4>Verknüpfte Verträge <small><a href="<?=self::getUrl("Contract", "add", ["origin_contract_id" => $contract->id])?>"><i class="fas fa-plus"></i>Neuen Contract anlegen</a></small></h4>
|
||||
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
||||
<table class="table table-striped table-sm table-bordered table-hover">
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Kunde</th>
|
||||
<th>Contract ID</th>
|
||||
<th>Produkt</th>
|
||||
<th>Preis</th>
|
||||
<th>Preis Setup</th>
|
||||
<th>Bestelldatum</th>
|
||||
<th>Fertigstellung</th>
|
||||
<th>Kündigung</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach([$contract->linkFrom, $contract->linkTo] as $links): ?>
|
||||
<?php foreach($links as $link): ?>
|
||||
<?php
|
||||
|
||||
if($link->contract_id == $contract->id) {
|
||||
$direction = "von";
|
||||
$linkcontract = $link->origin;
|
||||
if($link->type == "credit") {
|
||||
$direction = "zu";
|
||||
//continue;
|
||||
}
|
||||
} else {
|
||||
$linkcontract = $link->contract;
|
||||
if($link->type == "upgrade" || $link->type == "downgrade") {
|
||||
$direction = "auf";
|
||||
}
|
||||
if($link->type == "relocation") {
|
||||
$direction = "nach";
|
||||
}
|
||||
if($link->type == "credit") {
|
||||
$direction = "";
|
||||
//continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=__($link->type, "contract")?> <?=($link->type != "link") ? $direction : ""?></td>
|
||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
|
||||
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->product_name?> [<?=$linkcontract->matchcode?>]</a></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : "" ?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?=($linkcontract->price < 0) ? "text-danger" : ""?>">€ <?=number_format($linkcontract->price,4,",",".")?></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : "" ?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?=($linkcontract->price_setup < 0) ? "text-danger" : ""?>">€ <?=number_format($linkcontract->price_setup,4,",",".")?></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
|
||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?> <?=(!$linkcontract->isFinished()) ? "not-finished" : "" ?> <?=($linkcontract->cancel_date) ? "text-danger font-weight-bold" : ""?>"><?=($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; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</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", ['contract_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>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#new_journal_type').change(function() {
|
||||
if($('#new_journal_type').val() == "file") {
|
||||
$('#new-journal-file-container').show();
|
||||
} else {
|
||||
$('#new-journal-file-container').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function toggleTruncatedJournalText(id) {
|
||||
$("#truncated-" + id).toggle();
|
||||
$("#fulltext-" + id).toggle();
|
||||
}
|
||||
|
||||
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
|
||||
event.preventDefault();
|
||||
$(this).ekkoLightbox({
|
||||
alwaysShowClose: true,
|
||||
showArrows: false
|
||||
});
|
||||
});
|
||||
|
||||
function downloadImage(image_id) {
|
||||
event.preventDefault();
|
||||
location.href="<?=self::getUrl("File", "download")?>?id=" + image_id;
|
||||
}
|
||||
|
||||
function toggleGallery() {
|
||||
$("#ticketfile-body").toggle();
|
||||
|
||||
if($("#ticketfile-body").is(":hidden")) {
|
||||
console.log("is hidden");
|
||||
$("#gallery-toggle-button").removeClass("fa-caret-down");
|
||||
$("#gallery-toggle-button").addClass("fa-caret-right");
|
||||
} else {
|
||||
console.log("is not hidden");
|
||||
$("#gallery-toggle-button").removeClass("fa-caret-right");
|
||||
$("#gallery-toggle-button").addClass("fa-caret-down");
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -186,12 +186,13 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.fa-window-maximize, .fa-window-restore{
|
||||
.fa-window-maximize, .fa-window-restore {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
color: #323a36;
|
||||
|
||||
}
|
||||
|
||||
.card-fullscreen {
|
||||
display: block;
|
||||
z-index: 1040;
|
||||
@@ -219,7 +220,7 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
<script>
|
||||
var calendar;
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
let requestUrl = "<?= self::getUrl("TimerecordingReport", "api", ['do' => 'getTimerecordings', 'datatype' => '3', 'datayear' => time()]) ?>";
|
||||
let requestUrl = "<?= self::getUrl("TimerecordingReport", "api", ['do' => 'getTimerecordings', 'datatype' => '3', 'datayear' => time(),'calendar'=>'1']) ?>";
|
||||
var cindex = 1;
|
||||
var holiDays = [];
|
||||
var birthdays = [];
|
||||
@@ -337,7 +338,8 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
};
|
||||
var initialLocaleCode = 'en';
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
||||
locale: 'de',
|
||||
themeSystem: 'bootstrap4',
|
||||
headerToolbar: {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
if (!isset($vueViewName)) {
|
||||
die("vueViewName is not set");
|
||||
}
|
||||
@@ -10,13 +9,29 @@ if (!isset($mfLayoutPackage)) {
|
||||
|
||||
$additionalCSS = $additionalCSS ?? [];
|
||||
$additionalJS = $additionalJS ?? [];
|
||||
|
||||
$vueViewPath = BASEDIR . "/public/js/pages/$vueViewName";
|
||||
$additionalJS = [
|
||||
"bundler.php",
|
||||
"js/pages/" . $vueViewName . "/" . $vueViewName . ".js",
|
||||
...$additionalJS,
|
||||
];
|
||||
|
||||
if (is_dir($vueViewPath)) {
|
||||
$files = scandir($vueViewPath);
|
||||
foreach ($files as $file) {
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fileExtension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($fileExtension === 'css') {
|
||||
$additionalCSS[] = "js/pages/$vueViewName/$file";
|
||||
} else if ($fileExtension === 'js') {
|
||||
$additionalJS[] = "js/pages/$vueViewName/$file";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$additionalCSS = [
|
||||
...$additionalCSS,
|
||||
'plugins/daterangepicker/daterangepicker.css',
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<div id="topSpacer"></div>
|
||||
|
||||
<div style="height: 50px; margin-bottom: 8px">
|
||||
<div style="height: 50px; margin-bottom: 48px">
|
||||
<img alt="Xinon Logo" src="{{ basedir }}/public/assets/images/xinon-full.png" style="text-align:left;height: 85px;">
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,9 +4,14 @@
|
||||
* @var WarehouseShippingNoteModel $shippingNote
|
||||
* @var Array $positions
|
||||
* @var Array $textElements
|
||||
* @var bool $showPrices
|
||||
*/
|
||||
|
||||
$this->setReturnValue(['filename' => $shippingNote->id . ".pdf"]);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -87,11 +92,15 @@ TODO: enable option for showing prices
|
||||
-->
|
||||
<h2 style="text-align: center;color: #005384">Ihr XINON Lieferschein vom <?=date("d.m.Y", $shippingNote->create)?></h2>
|
||||
|
||||
<p>
|
||||
<?= $shippingNote->note ?>
|
||||
</p>
|
||||
|
||||
<table style="border-collapse: collapse; width: 100%;" id="invoiceTable">
|
||||
<tr style="font-weight: bold; border-bottom: 1px solid black;" class="uneven">
|
||||
<th style="text-align: center">Position</th>
|
||||
<th style="text-align: right;padding-right: 4pt">Menge</th>
|
||||
<th style="text-align: right;padding-right: 4pt">EH</th>
|
||||
<th style="text-align: left;padding-right: 4pt">Einheit</th>
|
||||
<th style="text-align: center">Artikel</th>
|
||||
<?php if($showPrices): ?>
|
||||
<th style="text-align: right;padding-right: 4pt">Preis</th>
|
||||
@@ -102,7 +111,7 @@ TODO: enable option for showing prices
|
||||
<tr class="position <?=($i%2 == 0) ? "even" : "uneven" ?>">
|
||||
<td style="text-align: center;"><?= $i + 1 ?></td>
|
||||
<td style="text-align: right;padding-right: 8pt"><?=$p["amount"]?> </td>
|
||||
<td style="text-align: right;padding-right: 8pt"><?=$p["articleUnit"]?> </td>
|
||||
<td style="text-align: left;padding-right: 8pt"><?=$p["articleUnit"]?> </td>
|
||||
<td style="text-align: center;"><b><?=$p["articleTitle"]?></b></td>
|
||||
<?php if($showPrices): ?>
|
||||
<td style="text-align: right;padding-right: 8pt"><?=number_format(
|
||||
@@ -130,5 +139,14 @@ TODO: enable option for showing prices
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if(isset($shippingNote->signature) && $shippingNote->signature !== ''): ?>
|
||||
<div style="margin-top: 20pt;">
|
||||
<img src="<?=$shippingNote->signature?>" style="width: 200pt;" alt="Unterschrift konnte nicht geladen werden"/>
|
||||
<div>Unterschrieben am: <?=date("d.m.Y", strtotime($shippingNote->signatureDate))?></div>
|
||||
<div>Unterschrieben von: <?=$shippingNote->signatureName?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -149,15 +149,15 @@
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<li class="has-sub-submenu font-weight-bold"><a>XINON</a></li>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseArticle")?>"><i class="far fa-fw fa-box text-info"></i> Artikel</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin") || $me->can("WarehouseUser")): ?><li><a href="<?=self::getUrl("WarehouseArticle")?>"><i class="far fa-fw fa-box text-info"></i> Artikel</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseItem")?>"><i class="far fa-fw fa-boxes text-info"></i> Lagerbestand</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseOrderRecommendation")?>"><i class="far fa-fw fa-box-full text-info"></i> Bestellvorschläge</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseOrder")?>"><i class="far fa-fw fa-shopping-bag text-info"></i> Bestellungen</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseShippingNote")?>"><i class="far fa-fw fa-shipping-fast text-info"></i> Lieferscheine</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin") || $me->can("WarehouseUser")): ?><li><a href="<?=self::getUrl("WarehouseShippingNote")?>"><i class="far fa-fw fa-shipping-fast text-info"></i> Lieferscheine</a></li><?php endif; ?>
|
||||
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseDistributor")?>"><i class="far fa-fw fa-cogs text-info"></i> Administration</a></li><?php endif; ?>
|
||||
|
||||
<li class="has-sub-submenu font-weight-bold"><a>E-Stmk Shop</a></li>
|
||||
<?php if($me->can("WarehouseAdmin") || $me->can("WarehouseEShop")): ?><li class="has-sub-submenu font-weight-bold"><a>E-Stmk Shop</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseEShop")): ?><li><a href="<?=self::getUrl("WarehouseEShop")?>"><i class="far fa-fw fa-shopping-cart text-info"></i> E-Shop</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseEShopOrder")?>"><i class="far fa-fw fa-shopping-basket text-info"></i> E-Shop Bestellungen</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseArticlePacket")?>"><i class="far fa-fw fa-box text-info"></i> Artikel-Pakete</a></li><?php endif; ?>
|
||||
|
||||
@@ -177,6 +177,8 @@ class CalendarApicontroller extends mfBaseApicontroller
|
||||
$message[0]['attachments'] = $Calendarevent['data'][0]['attachments']['attachments'];
|
||||
$message[0]['calendar_name'] = $Calendarevent['data'][0]['calendar_name']['calendar_name'];
|
||||
$message[0]['isorganizer'] = $Calendarevent['data'][0]['isorganizer']['isorganizer'];
|
||||
$message[0]['rrule'] = $Calendarevent['data'][0]['rrule']['rrule'];
|
||||
$message[0]['duration'] = $Calendarevent['data'][0]['duration']['duration'];
|
||||
$message[0]['mtime'] = $Calendarevent['data'][0]['mtime']['mtime'];
|
||||
$message[0]['mname'] = $Calendarevent['data'][0]['mname']['mname'];
|
||||
$message[0]['ctime'] = $Calendarevent['data'][0]['ctime']['ctime'];
|
||||
|
||||
@@ -212,6 +212,8 @@ class CalendarController extends mfBaseController
|
||||
$timerecordingemployees = TimerecordingEmployeeModel::getAll();
|
||||
$standardCalendarColors = CalendarModel::$standardCalendarColors;
|
||||
$specialCalendarColors = CalendarModel::$specialCalendarColors;
|
||||
|
||||
|
||||
$this->layout()->set("timerecordingemployees", $timerecordingemployees);
|
||||
$this->layout()->set("standardCalendarColors", $standardCalendarColors);
|
||||
$this->layout()->set("specialCalendarColors", $specialCalendarColors);
|
||||
|
||||
@@ -118,6 +118,7 @@ class CalendarModel
|
||||
|
||||
public static function getCalendarEvents($me, $id = 0, $r = 0)
|
||||
{
|
||||
$rrulefreq = array('daily' => 'DAILY', 'weekly' => 'WEEKLY', 'relativeMonthly' => 'MONTHLY', 'yearly' => 'YEARLY');
|
||||
$calendar = self::search(array("user_id" => $me));
|
||||
$standardCalendarColors = CalendarModel::$standardCalendarColors;
|
||||
$calendarColors = json_decode($calendar[0]->colors, true);
|
||||
@@ -154,13 +155,16 @@ class CalendarModel
|
||||
$visibleCalendars = $r->visibleCalendars;
|
||||
if ($visibleCalendars) {
|
||||
$where .= " AND calendar_id IN (" . implode(",", $visibleCalendars) . ")";
|
||||
$whereTimeRecording = " AND `Calendar`.`go_calendar_id` IN (" . implode(",", $visibleCalendars) . ")";
|
||||
}
|
||||
$sql = "SELECT `cal_events`.id, uuid, calendar_id, `cal_events`.user_id, start_time, end_time, timezone, all_day_event, `cal_events`.name,`cal_calendars`.name calendar_name, description, location, repeat_end_time, reminder, ctime,cname, mtime,mname, muser_id, busy, status, resource_event_id, private, rrule, `cal_events`.background, `cal_events`.files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,busy FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
|
||||
$sql = "SELECT `cal_events`.id, uuid, calendar_id, `cal_events`.user_id, start_time, end_time, timezone, all_day_event, `cal_events`.name,`cal_calendars`.name calendar_name, description, location, repeat_end_time, reminder, ctime,cname, mtime,mname, muser_id, busy, status, resource_event_id, private, rrule, `cal_events`.background, `cal_events`.files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,busy,recurrence FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
|
||||
|
||||
$res = $dbcal->query($sql);
|
||||
if ($dbcal->num_rows($res)) {
|
||||
|
||||
while ($data = $dbcal->fetch_array($res)) {
|
||||
unset($byweekday);
|
||||
$rrule = false;
|
||||
if ($attachments[$data['uuid']]) {
|
||||
$attachment = 1;
|
||||
$attachmentLinks = json_encode($attachments[$data['uuid']]['attachments']);
|
||||
@@ -184,6 +188,40 @@ class CalendarModel
|
||||
$name = $data['name'];
|
||||
}
|
||||
|
||||
if ($data['recurrence']) {
|
||||
$recurrence = json_decode($data['recurrence'], true);
|
||||
if ($rrulefreq[$recurrence['pattern']['type']]) {
|
||||
unset ($byweekday);
|
||||
$freq = $rrulefreq[$recurrence['pattern']['type']];
|
||||
foreach ($recurrence['pattern']['daysOfWeek'] as $value) {
|
||||
$byweekday[] = strtolower(substr($value, 0, 2));
|
||||
}
|
||||
$duration = ($data['end_time'] - $data['start_time']) * 1000;
|
||||
$until = $recurrence['range']['endDate'];
|
||||
if ($until == "0001-01-01") {
|
||||
$until = strtotime("+3 year", time());
|
||||
$until = date("Y-m-d", $until);
|
||||
} else {
|
||||
$until = date("Y-m-d", strtotime($recurrence['range']['endDate']) + 86400);
|
||||
}
|
||||
|
||||
|
||||
$rrule = [
|
||||
'freq' => $freq,
|
||||
'interval' => $recurrence['pattern']['interval'],
|
||||
'byweekday' => $byweekday,
|
||||
'dtstart' => date("Y-m-d\TH:i", $data['start_time']),
|
||||
'until' => $until
|
||||
];
|
||||
if ($freq == "MONTHLY") {
|
||||
$bystpos = array("first" => 1, "second" => 2, "third" => 3, "fourth" => 4, "last" => -1);
|
||||
$rrule['bysetpos'] = $bystpos[$recurrence['pattern']['index']];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rrule = false;
|
||||
}
|
||||
|
||||
if ($calendarColors[$data['calendar_id']]['bgcolor']) {
|
||||
$bgcolor = $calendarColors[$data['calendar_id']]['bgcolor'];
|
||||
$txtcolor = $calendarColors[$data['calendar_id']]['txtcolor'];
|
||||
@@ -194,7 +232,7 @@ class CalendarModel
|
||||
}
|
||||
if ($calenderRights[$data['calendar_id']]) {
|
||||
$rights = $calenderRights[$data['calendar_id']];
|
||||
|
||||
$CalendarUsers[$data['calendar_id']] = $data['calendar_name'];
|
||||
$rows[] = array(
|
||||
'id' => array('id' => $data['id']),
|
||||
'cstart' => array('cstart' => $starttime),
|
||||
@@ -207,6 +245,8 @@ class CalendarModel
|
||||
'rights' => array('rights' => $rights, 'order' => $rights),
|
||||
'location' => array('location' => $data['location']),
|
||||
'busy' => array('busy' => $data['busy']),
|
||||
'rrule' => array('rrule' => $rrule),
|
||||
'duration' => array('duration' => $duration),
|
||||
'event_type' => array('event_type' => $data['event_type']),
|
||||
'description' => array('description' => ($data['description'])),
|
||||
'attachment' => array('attachment' => $attachment),
|
||||
@@ -218,9 +258,59 @@ class CalendarModel
|
||||
'mname' => array('mname' => $data['mname']),
|
||||
'isorganizer' => array('isorganizer' => $data['is_organizer']),
|
||||
'busy' => array('busy' => $data['busy']),
|
||||
'timerecording' => array('timerecording' => 0),
|
||||
);
|
||||
}
|
||||
}
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `Timerecording`.`id`, `Timerecording`.`start` start_time, `Timerecording`.`end` end_time,`Calendar`.`go_calendar_id` calendar_id,`TimerecordingCategory`.`name`,`TimerecordingCategory`.`id` CategoryId,`Timerecording`.`create` ctime,`Timerecording`.`edit` mtime FROM `Timerecording`
|
||||
INNER JOIN `TimerecordingCategory` ON `TimerecordingCategory`.`id`=`Timerecording`.`timerecordingCategory_id`
|
||||
INNER JOIN `Calendar` ON `Calendar`.`user_id`=`Timerecording`.`user_id`
|
||||
WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourday`!='7' AND `TimerecordingCategory`.`hourday`!='5' $whereTimeRecording";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
|
||||
if ($calendarColors[$data['calendar_id']]['bgcolor']) {
|
||||
$bgcolor = $calendarColors[$data['calendar_id']]['bgcolor'];
|
||||
$txtcolor = $calendarColors[$data['calendar_id']]['txtcolor'];
|
||||
} else {
|
||||
$bgcolor = $standardCalendarColors[$colorCounter];
|
||||
$txtcolor = "#000";
|
||||
$colorCounter++;
|
||||
}
|
||||
if ($data['CategoryId'] != 11) {
|
||||
$starttime = date("Y-m-d", $data['start_time']);
|
||||
$endtime = date("Y-m-d", $data['end_time']);
|
||||
if ($starttime != $endtime) {
|
||||
$endtime = $data['end_time'] + 86400;
|
||||
$endtime = date("Y-m-d", $endtime);
|
||||
}
|
||||
|
||||
} else {
|
||||
$starttime = date("Y-m-d H:i", $data['start_time']);
|
||||
$endtime = date("Y-m-d H:i", $data['end_time']);
|
||||
}
|
||||
$rows[] = array(
|
||||
'id' => array('id' => "9999" . $data['id']),
|
||||
'category' => array('category' => $data['name']),
|
||||
'ccategory' => array('ccategory' => $data['name']),
|
||||
'cstart' => array('cstart' => $starttime),
|
||||
'cend' => array('cend' => $endtime),
|
||||
'calendar_id' => array('calendar_id' => $data['calendar_id']),
|
||||
'ctime' => array('ctime' => date("d.m.Y H:i", $data['ctime'])),
|
||||
'cname' => array('cname' => $CalendarUsers[$data['calendar_id']]),
|
||||
'mtime' => array('mtime' => date("d.m.Y H:i", $data['mtime'])),
|
||||
'mname' => array('mname' => $CalendarUsers[$data['calendar_id']]),
|
||||
'description' => array('description' => ""),
|
||||
'bgColor' => array('bgColor' => $bgcolor),
|
||||
'txtColor' => array('txtColor' => $txtcolor),
|
||||
'timerecording' => array('timerecording' => 1),
|
||||
'calendar_name' => array('calendar_name' => $CalendarUsers[$data['calendar_id']]),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
$json['success'] = true;
|
||||
$json['data'] = $rows;
|
||||
} else {
|
||||
@@ -347,8 +437,8 @@ class CalendarModel
|
||||
}
|
||||
}
|
||||
if (!$data['accepted'] && $data['busy'] == 1) {
|
||||
$data['accepted']['ok']=1;
|
||||
$data['accepted']=json_encode($data['accepted']);
|
||||
$data['accepted']['ok'] = 1;
|
||||
$data['accepted'] = json_encode($data['accepted']);
|
||||
}
|
||||
|
||||
$rows = array(
|
||||
@@ -439,6 +529,7 @@ class CalendarModel
|
||||
$type = ($r->type);
|
||||
$busy = ($r->busy);
|
||||
$users = ($r->users);
|
||||
$attendees = ($r->attendees);
|
||||
foreach ($users as $key => $value) {
|
||||
$user_id = $value;
|
||||
}
|
||||
@@ -548,6 +639,8 @@ class CalendarModel
|
||||
|
||||
$updateArray['attachments'] = $attachments;
|
||||
}
|
||||
if ($attendees)
|
||||
$updateArray['attendees'] = $attendees;
|
||||
$json_data = json_encode($updateArray);
|
||||
$data = [];
|
||||
$data['ms_user_id'] = $microsoft_user_id;
|
||||
@@ -718,7 +811,7 @@ class CalendarModel
|
||||
$data['create_timestamp'] = time();
|
||||
$data['edit_timestamp'] = time();
|
||||
$db->insert("tmp_cal_events_attachments", $data);
|
||||
echo "insert_id: " . $db->insert_id;
|
||||
// echo "insert_id: " . $db->insert_id;
|
||||
return $db->insert_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -792,4 +792,189 @@ class Contract extends mfBaseModel {
|
||||
$this->log->debug("Cloned Contract $old_id");
|
||||
}
|
||||
|
||||
// ---- CONTRACT VIEW UTILITY FUNCTIONS START ----
|
||||
public function getContractDetails($getUrl): array {
|
||||
$contract = $this;
|
||||
$contract->getProperty("billingaddress");
|
||||
$contract->getProperty("owner");
|
||||
$contract->getProperty("product");
|
||||
$contract->getProperty("sla");
|
||||
$contract->getProperty("finisher");
|
||||
$contract->getProperty("canceler");
|
||||
$contract->getProperty("creator");
|
||||
$contract->getProperty("editor");
|
||||
$contract->getProperty("vatrate");
|
||||
$contract->getProperty("configvalues");
|
||||
$contract->getProperty("orderproduct");
|
||||
|
||||
|
||||
$contract_details = [];
|
||||
$contract_details['matchcode'] = ['label' => 'Matchcode', 'value' => $contract->matchcode];
|
||||
$contract_details['owner'] = ['label' => 'Kunde',
|
||||
'value' => $contract->owner->getCompanyOrName(),
|
||||
'url' => $getUrl('Address', 'View', ['id' => $contract->billingaddress->id])];
|
||||
if ($contract->billingaddress_id) {
|
||||
$contract_details['billingaddress'] = ['label' => 'Rechnungsadresse',
|
||||
'value' => $contract->billingaddress->getCompanyOrName(),
|
||||
'url' => $getUrl('Address', 'View', ['id' => $contract->billingaddress->id])];
|
||||
}
|
||||
|
||||
$productName = $contract->product->name;
|
||||
$contractProductName = $contract->product_name;
|
||||
$productId = $contract->product_id;
|
||||
|
||||
$contract_details['product'] = ['label' => 'Produkt',
|
||||
'value' => "$contractProductName ($productName) [$productId]",
|
||||
'url' => $getUrl('Product', 'Edit', ['id' => $contract->product_id])];
|
||||
|
||||
if ($contract->prduct_info) {
|
||||
$contract_details['product_info'] = ['label' => 'Produktinfo', 'value' => $contract->product_info];
|
||||
}
|
||||
|
||||
$contract_details['sla'] = ['label' => 'SLA', 'value' => $contract->sla->name];
|
||||
$contract_details['external_product'] = ['label' => 'Externes Produkt', 'value' => $contract->product_external ? "Ja" : "Nein"];
|
||||
$contract_details['amount'] = ['label' => 'Menge', 'value' => Helper::formatNumber($contract->amount, 3)];
|
||||
$contract_details['price_net'] = ['label' => 'Preis Periodisch Netto',
|
||||
'value' => "€ " . Helper::formatNumber($contract->price * $contract->amount, 4),
|
||||
'class' => $contract->price < 0 ? 'text-danger' : null];
|
||||
if ($contract->vatrate) {
|
||||
$contract_details['price_gross'] = ['label' => 'Preis Periodisch Brutto',
|
||||
'value' => "€ " . Helper::formatNumber($contract->price * $contract->amount * floatval("1." . intval($contract->vatrate)), 4),
|
||||
'class' => $contract->price < 0 ? 'text-danger' : null];
|
||||
}
|
||||
|
||||
$contract_details['billing_period'] = ['label' => 'Abrechnungsperiode', 'value' => __($contract->billing_period, "billing_period")];
|
||||
|
||||
if ($contract->price_setup > 0) {
|
||||
$vatRateMultiplier = $contract->vatrate ? ("1." . intval($contract->vatrate)) : 1;
|
||||
$price_net = Helper::formatNumber($contract->price_setup, 4);
|
||||
$sum_net = Helper::formatNumber($contract->price_setup * $contract->amount, 4);
|
||||
$price_gross = Helper::formatNumber($contract->price_setup * $contract->amount * $vatRateMultiplier, 4);
|
||||
$sum_gross = Helper::formatNumber($contract->price_setup * $contract->amount * $vatRateMultiplier, 4);
|
||||
|
||||
$contract_details['price_setup'] = ['label' => 'Einrichtungsgebühr',
|
||||
'value' => "Netto: € {$price_net} (Gesamt: € {$sum_net})\nBrutto: € {$price_gross} (Gesamt: € {$sum_gross})"];
|
||||
}
|
||||
|
||||
if ($contract->billing_delay) $contract_details['billing_delay'] = ['label' => 'Abrechnungsverzögerung',
|
||||
'value' => $contract->billing_delay . " Monate"];
|
||||
$contract_details['order_date'] = ['label' => 'Bestelldatum', 'value' => date('d.m.Y', $contract->order_date)];
|
||||
if ($contract->finish_date) $contract_details['finish_date'] = ['label' => 'Fertigstellung',
|
||||
'value' => date('d.m.Y', $contract->finish_date) . " (" . $contract->finisher->name . ")"];
|
||||
if ($contract->cancel_date) $contract_details['cancel_date'] = ['label' => 'Kündigungsdatum',
|
||||
'value' => date('d.m.Y', $contract->cancel_date) . " (" . $contract->canceler->name . ")"];
|
||||
$contract_details['create'] = ['label' => 'Erstellt', 'value' => date('d.m.Y', $contract->create) . " (" . $contract->creator->name . ")"];
|
||||
$contract_details['edit'] = ['label' => 'Geändert', 'value' => date('d.m.Y', $contract->edit) . " (" . $contract->editor->name . ")"];
|
||||
|
||||
return $contract_details;
|
||||
}
|
||||
|
||||
public function getContractActions($getUrl): array {
|
||||
$contract = $this;
|
||||
|
||||
$contract_actions = [];
|
||||
$contract_actions['contractconfig'] = ['url' => $getUrl("Contractconfig", "edit", ["contract_id" => $contract->id]),
|
||||
'class' => 'btn-outline-info',
|
||||
'icon' => 'far fa-list-dropdown fa-fw',
|
||||
'text' => 'Konfiguration bearbeiten'];
|
||||
$contract_actions['contractaccessletter'] = ['url' => $getUrl("Contractaccessletter", "view", ["contract_id" => $contract->id]),
|
||||
'class' => 'btn-outline-success',
|
||||
'icon' => 'far fa-list-numeric fa-fw',
|
||||
'text' => 'Zugangsdaten anzeigen'];
|
||||
if ($contract->finish_date && $contract->finish_date < date('U')) {
|
||||
$contract_actions['contractownerchange'] = ['class' => 'btn-outline-secondary',
|
||||
'icon' => 'far fa-people-arrows fa-fw',
|
||||
'text' => 'Inhaberwechsel'];
|
||||
$contract_actions['productchange'] = ['url' => $getUrl("Contract", "productchange", ["contract_id" => $contract->id]),
|
||||
'class' => 'btn-outline-purple',
|
||||
'icon' => 'far fa-truck-container fa-fw',
|
||||
'text' => 'Produkt-/Standortwechsel'];
|
||||
$contract_actions['cancel'] = ['url' => $getUrl("Contract", "cancel", ["contract_id" => $contract->id]),
|
||||
'class' => 'btn-outline-danger',
|
||||
'icon' => 'far fa-axe fa-fw',
|
||||
'text' => 'Kündigen'];
|
||||
} else if (!$contract->finish_date) {
|
||||
$contract_actions['contractconfig'] = ['url' => $getUrl("Contract", "finishContract", ['contract_id' => $contract->id]),
|
||||
'class' => 'btn-success',
|
||||
'icon' => 'far fa-face-confused fa-fw',
|
||||
'text' => 'Jetzt fertigstellen',
|
||||
'confirmText' => 'Jetzt fertigstellen und in Verrechnung geben?'];
|
||||
}
|
||||
|
||||
return $contract_actions;
|
||||
}
|
||||
|
||||
public function getContractJournal($getUrl): array {
|
||||
$contract = $this;
|
||||
$contract->getProperty("journals");
|
||||
$contract->getProperty("orderproduct");
|
||||
$contract->getProperty("product");
|
||||
|
||||
$contract_journal = [];
|
||||
if (is_array($contract->journals) && count($contract->journals)) {
|
||||
foreach ($contract->journals as $j) {
|
||||
$entry = [];
|
||||
|
||||
$entry['create'] = date('d.m.Y H:i:s', $j->create);
|
||||
$entry['creator'] = $j->creator->name;
|
||||
|
||||
if ($j->type === "text" || $j->type === "phone") {
|
||||
$entry['icon'] = $j->type === "text" ? "fas fa-comment-dots text-warning " : "fas fa-phone text-warning ";
|
||||
$entry['iconTitle'] = $j->type === "text" ? "Textnachricht" : "Telefonat";
|
||||
$entry['text'] = $j->text;
|
||||
} else if ($j->type === "file") {
|
||||
$entry['icon'] = "fas fa-download text-primary ";
|
||||
$entry['iconTitle'] = "Datei";
|
||||
$entry['text'] = "[URL]";
|
||||
$entry['url'] = $getUrl("File", "download", ["id" => $j->contractfile->file_id]);
|
||||
$entry['urlText'] = $j->contractfile->name;
|
||||
} else if ($j->type === "created_from") {
|
||||
$entry['icon'] = "fas fa-cogs text-secondary ";
|
||||
$entry['iconTitle'] = "Vertrag erstellt";
|
||||
$entry['textClass'] = "font-italic";
|
||||
if ($j->value == "manual") {
|
||||
$entry['text'] = "Contract manuell erstellt";
|
||||
} else if ($j->value == "import") {
|
||||
$entry['text'] = "Contract importiert: " . $j->text;
|
||||
} else if ($j->value == "order") {
|
||||
$entry['text'] = "Vertrag aus Bestellung [URL] erstellt";
|
||||
$entry['url'] = $getUrl("Order", "", ["id" => $contract->orderproduct->order_id]);
|
||||
$entry['urlText'] = "#" . $contract->orderproduct->order_id;
|
||||
} else if ($j->value == "productchange") {
|
||||
$entry['text'] = "Vertrag erstellt:" . $j->text;
|
||||
}
|
||||
} else if ($j->type === "contract_finished") {
|
||||
$entry['icon'] = "fas fa-flag-checkered text-success ";
|
||||
$entry['iconTitle'] = "Vertrag fertiggestellt";
|
||||
$entry['text'] = "Vertrag fertiggestelt";
|
||||
$entry['textClass'] = "font-italic";
|
||||
} else if ($j->type === "credit_created") {
|
||||
$entry['icon'] = "fas fa-credit-card text-gray ";
|
||||
$entry['iconTitle'] = "Gutschrift";
|
||||
$entry['text'] = "Gutschrift Vertrag [URL] erstellt";
|
||||
$entry['textClass'] = "font-italic";
|
||||
$entry['url'] = $getUrl("Contract", "View", ["contract_id" => $j->value]);
|
||||
$entry['urlText'] = $j->value;
|
||||
} else if ($j->type === "link") {
|
||||
$link = new Contract($j->value);
|
||||
$entry['icon'] = "fas fa-link text-secondary ";
|
||||
$entry['iconTitle'] = "Verknüpfung";
|
||||
$entry['text'] = "Verknüpfung mit [URL] erstellt";
|
||||
$entry['textClass'] = "font-italic";
|
||||
$entry['url'] = $getUrl("Contract", "view", ['contract_id' => $link->id]);
|
||||
$entry['urlText'] = $link->id . " - " . $link->product_name . " - [" . $link->matchcode . "]";
|
||||
} else if ($j->type === "canceled") {
|
||||
$entry['icon'] = "fas fa-skull-crossbones bg-danger text-white ";
|
||||
$entry['iconTitle'] = "Kündigung";
|
||||
$entry['textClass'] = "font-italic";
|
||||
$entry['text'] = "Vertrag gekündigt";
|
||||
}
|
||||
$contract_journal[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
return $contract_journal;
|
||||
}
|
||||
// ---- CONTRACT VIEW UTILITY FUNCTIONS END ----
|
||||
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ContractController extends mfBaseController
|
||||
{
|
||||
class ContractController extends mfBaseController {
|
||||
|
||||
protected function init()
|
||||
{
|
||||
protected function init() {
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
@@ -17,9 +15,8 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
protected function indexAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
@@ -59,8 +56,7 @@ class ContractController extends mfBaseController
|
||||
$this->layout()->set("pagination", $pagination);
|
||||
}
|
||||
|
||||
private function getPreparedFilter($filter)
|
||||
{
|
||||
private function getPreparedFilter($filter) {
|
||||
$new_filter = [];
|
||||
|
||||
if (array_key_exists("show_canceled", $filter)) {
|
||||
@@ -71,8 +67,8 @@ class ContractController extends mfBaseController
|
||||
$new_filter['add-where'] = " AND (cancel_date IS NULL OR cancel_date > UNIX_TIMESTAMP())";
|
||||
}
|
||||
|
||||
if(array_key_exists("cancel_date", $filter)) {
|
||||
if($filter["cancel_date"]) {
|
||||
if (array_key_exists("cancel_date", $filter)) {
|
||||
if ($filter["cancel_date"]) {
|
||||
$new_filter["cancel_date"] = true;
|
||||
}
|
||||
}
|
||||
@@ -95,13 +91,49 @@ class ContractController extends mfBaseController
|
||||
return $new_filter;
|
||||
}
|
||||
|
||||
protected function viewAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
protected function viewAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Contract/View");
|
||||
$id = $this->request->contract_id;
|
||||
if (!$id) {
|
||||
$id = $this->request->id;
|
||||
}
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
|
||||
$contract = new Contract($id);
|
||||
if (!$contract->id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
|
||||
$getUrlFunc = function($controller, $action, $params = []) {
|
||||
return $this::getUrl($controller, $action, $params);
|
||||
};
|
||||
|
||||
Helper::renderVue($this, "ContractView", "Contract", ["CONTRACT_DETAILS" => $contract->getContractDetails($getUrlFunc),
|
||||
"CONTRACT_ID" => $contract->id,
|
||||
"CONTRACT_ACTIONS" => $contract->getContractActions($getUrlFunc),
|
||||
"CONTRACT_JOURNAL" => $contract->getContractJournal($getUrlFunc),
|
||||
"CONTRACT_LINK_TABLE_URL" => self::getUrl("Contract", "contractLinkTableHTML", ["contract_id" => $contract->id]),
|
||||
"CONTRACT_NEW_JOURNAL_URL" => self::getUrl("Contractjournal", "save"),
|
||||
"BACK_URL" => isset($_SERVER['HTTP_REFERER']) && str_contains($_SERVER['HTTP_REFERER'], 'Address/View') ? $_SERVER['HTTP_REFERER'] : self::getUrl('Contract', 'Index'),
|
||||
"EDIT_URL" => self::getUrl('Contract', 'Edit', ['contract_id' => $contract->id, 'f' => 'view']),
|
||||
"HEADER" => str_contains(strtolower($contract->sla->name), "residential") ? "Privatprodukt" : "Businessprodukt",
|
||||
"SUB_HEADER" => $contract->product_name . "[" . $contract->id . "]"
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
protected function contractLinkTableHTMLAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$id = $this->request->contract_id;
|
||||
if (!$id) {
|
||||
@@ -119,18 +151,11 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
$this->layout()->set("contract", $contract);
|
||||
|
||||
if ($this->request->filter) {
|
||||
$this->layout()->set("filter", $this->request->filter);
|
||||
}
|
||||
if ($this->request->s) {
|
||||
$this->layout()->set("filter", $this->request->s);
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Contract/LinkTable");
|
||||
}
|
||||
|
||||
protected function cancelAction() {
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$this->layout()->setTemplate("Contract/CancelForm");
|
||||
@@ -138,7 +163,7 @@ class ContractController extends mfBaseController
|
||||
$id = $this->request->contract_id;
|
||||
if (!$id) $id = $this->request->id;
|
||||
|
||||
if(!$id) {
|
||||
if (!$id) {
|
||||
$id = $this->request->id;
|
||||
}
|
||||
if (!is_numeric($id) || !$id) {
|
||||
@@ -152,7 +177,7 @@ class ContractController extends mfBaseController
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
|
||||
if(!$contract->billing_period) {
|
||||
if (!$contract->billing_period) {
|
||||
$this->layout()->setFlash("Kündigung nicht möglich, Produkt ist Einmalprodukt!", "error");
|
||||
$this->redirect("Contract", "view", ["contract_id" => $contract->id]);
|
||||
}
|
||||
@@ -171,7 +196,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
protected function saveCancel() {
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$r = $this->request;
|
||||
@@ -190,23 +215,23 @@ class ContractController extends mfBaseController
|
||||
|
||||
try {
|
||||
$cancel_date = DateTime::createFromFormat("d.m.Y", trim($r->cancel_date), new DateTimeZone("Europe/Vienna"));
|
||||
$cancel_date->setTime(23,59,59);
|
||||
} catch(Exception $e) {
|
||||
$cancel_date->setTime(23, 59, 59);
|
||||
} catch (Exception $e) {
|
||||
$this->layout()->setFlash("Ungültiges Datumsformat");
|
||||
$this->redirect("Contract", "cancel", ["contract_id" => $contract->id]);
|
||||
}
|
||||
|
||||
$contract->cancel_date = $cancel_date->getTimestamp();
|
||||
$contract->edit_by = $this->me->id;
|
||||
if(!$contract->save()) {
|
||||
if (!$contract->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
$this->redirect("Contract", "cancel", ["contract_id" => $contract->id]);
|
||||
}
|
||||
|
||||
$linked_contracts = [];
|
||||
if(is_array($r->links)) {
|
||||
foreach($r->links as $link_id => $action) {
|
||||
if($action == "cancel") {
|
||||
if (is_array($r->links)) {
|
||||
foreach ($r->links as $link_id => $action) {
|
||||
if ($action == "cancel") {
|
||||
$link_contract = new Contract($link_id);
|
||||
|
||||
if (!$link_contract->id) {
|
||||
@@ -216,11 +241,11 @@ class ContractController extends mfBaseController
|
||||
|
||||
$link_contract->cancel_date = $cancel_date->getTimestamp();
|
||||
$link_contract->edit_by = $this->me->id;
|
||||
if(!$link_contract->save()) {
|
||||
if (!$link_contract->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern von verlinktem Vertrag", "warning");
|
||||
}
|
||||
|
||||
if($link_contract->owner_id != $contract->owner_id) continue;
|
||||
if ($link_contract->owner_id != $contract->owner_id) continue;
|
||||
$linked_contracts[] = $link_contract;
|
||||
}
|
||||
}
|
||||
@@ -234,20 +259,20 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
protected function sendCancelNotification() {
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$contract_id = $this->request->contract_id;
|
||||
$contract = new Contract($contract_id);
|
||||
|
||||
$linked_contracts = [];
|
||||
foreach($contract->links as $link) {
|
||||
if($link->origin_contract_id == $contract_id) {
|
||||
foreach ($contract->links as $link) {
|
||||
if ($link->origin_contract_id == $contract_id) {
|
||||
$link_contract = $link->contract;
|
||||
} else {
|
||||
$link_contract = $link->origin;
|
||||
}
|
||||
if($link_contract->owner_id != $contract->owner_id) continue;
|
||||
if ($link_contract->owner_id != $contract->owner_id) continue;
|
||||
$linked_contracts[] = $link_contract;
|
||||
}
|
||||
|
||||
@@ -259,12 +284,11 @@ class ContractController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function productchangeAction()
|
||||
{
|
||||
protected function productchangeAction() {
|
||||
$this->layout()->setTemplate("Contract/ProductchangeForm");
|
||||
|
||||
$f = $this->request->f;
|
||||
if(!$f) {
|
||||
if (!$f) {
|
||||
$f = "c"; // from Contract
|
||||
}
|
||||
$this->layout()->set("f", $f);
|
||||
@@ -275,7 +299,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "addUpgrade");
|
||||
} else {
|
||||
$this->redirect("Contract");
|
||||
@@ -286,28 +310,28 @@ class ContractController extends mfBaseController
|
||||
$contract = new Contract($id);
|
||||
if (!$contract->id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "addUpgrade");
|
||||
} else {
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
}
|
||||
|
||||
if($this->me->isAdmin()) {
|
||||
if ($this->me->isAdmin()) {
|
||||
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||
} else {
|
||||
// check permissions
|
||||
// check if correct network
|
||||
// check permissions
|
||||
// check if correct network
|
||||
|
||||
$my_network_ids = [];
|
||||
foreach($this->me->my_networks as $network) {
|
||||
foreach ($this->me->my_networks as $network) {
|
||||
$my_network_ids[] = $network->id;
|
||||
}
|
||||
|
||||
if($contract->termination_id) {
|
||||
if(!in_array($contract->termination->network_id, $my_network_ids)) {
|
||||
if($f == "o") {
|
||||
// from Order, redirect back to Order
|
||||
if ($contract->termination_id) {
|
||||
if (!in_array($contract->termination->network_id, $my_network_ids)) {
|
||||
if ($f == "o") {
|
||||
// from Order, redirect back to Order
|
||||
$this->layout()->setFlash("Keine Berechtigung", "error");
|
||||
$this->redirect("Order", "addUpgrade", ["owner_id" => $contract->owner_id]);
|
||||
}
|
||||
@@ -331,24 +355,23 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveProductchangeAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin", "salespartner", "netowner"])) {
|
||||
protected function saveProductchangeAction() {
|
||||
if (!$this->me->is(["Admin", "salespartner", "netowner"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$r = $this->request;
|
||||
//var_dump($r->links);exit;
|
||||
//var_dump($r->links);exit;
|
||||
|
||||
$f = $r->f;
|
||||
if(!$f) {
|
||||
if (!$f) {
|
||||
$f = "c"; // from Contract
|
||||
}
|
||||
|
||||
$id = $r->contract_id;
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "addUpgrade");
|
||||
} else {
|
||||
$this->redirect("Contract");
|
||||
@@ -358,7 +381,7 @@ class ContractController extends mfBaseController
|
||||
$contract = new Contract($id);
|
||||
if (!$contract->id) {
|
||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "addUpgrade");
|
||||
} else {
|
||||
$this->redirect("Contract");
|
||||
@@ -382,12 +405,12 @@ class ContractController extends mfBaseController
|
||||
$contract_data['note'] = trim($r->note);
|
||||
|
||||
/*
|
||||
* termination check
|
||||
*/
|
||||
* termination check
|
||||
*/
|
||||
$product = new Product($r->product_id);
|
||||
if (!$product->id) {
|
||||
$this->layout()->setFlash("Produkt nicht gefunden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "productchange", ["contract_id" => $id]);
|
||||
} else {
|
||||
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||
@@ -399,35 +422,35 @@ class ContractController extends mfBaseController
|
||||
$contract_data['product_external_id'] = $product->external_id;
|
||||
$contract_data['sla_id'] = $product->sla_id;
|
||||
|
||||
if($r->finish_date) {
|
||||
if ($r->finish_date) {
|
||||
try {
|
||||
$finish_date = DateTime::createFromFormat("d.m.Y", $r->finish_date, new DateTimeZone("Europe/Vienna"));
|
||||
} catch (Exception $e) {
|
||||
$this->layout()->setFlash("Ungültiges Kündigungsdateum", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "productchange", ["contract_id" => $id]);
|
||||
} else {
|
||||
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||
}
|
||||
}
|
||||
|
||||
$finish_date->setTime(0,0,0);
|
||||
$finish_date->setTime(0, 0, 0);
|
||||
$contract_data["finish_date"] = $finish_date->getTimestamp();
|
||||
|
||||
$contract_cancel_date = clone($finish_date);
|
||||
$contract_cancel_date->modify("-1 day");
|
||||
$contract_cancel_date->setTime(23,59,59);
|
||||
$contract_cancel_date->setTime(23, 59, 59);
|
||||
}
|
||||
|
||||
$require_term = false;
|
||||
if (array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $product->attributes) && $product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME]->value == 1) {
|
||||
//var_dump($prod->attributes);
|
||||
//var_dump($prod->attributes);
|
||||
$require_term = true;
|
||||
$termination = new Termination($contract_data['termination_id']);
|
||||
|
||||
if (!$contract_data['termination_id'] || !$termination->id) {
|
||||
$this->layout()->setFlash("Produkt erfordert Anschluss.", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "productchange", ["contract_id" => $id]);
|
||||
} else {
|
||||
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||
@@ -437,12 +460,12 @@ class ContractController extends mfBaseController
|
||||
$contract_data['termination_id'] = null;
|
||||
}
|
||||
|
||||
//var_dump($r->links);
|
||||
// lookup credit contract and if it's missing in $r->links
|
||||
if(!$this->me->is("Admin")) {
|
||||
//var_dump($r->links);
|
||||
// lookup credit contract and if it's missing in $r->links
|
||||
if (!$this->me->is("Admin")) {
|
||||
$credit_link = ContractLinkModel::includesContractId($contract->id, ["type" => "credit"]);
|
||||
if($credit_link) {
|
||||
if(is_array($r->links) && !array_key_exists($credit_link->id, $r->links)) {
|
||||
if ($credit_link) {
|
||||
if (is_array($r->links) && !array_key_exists($credit_link->id, $r->links)) {
|
||||
$r->links[$credit_link->id] = [];
|
||||
}
|
||||
$r->links[$credit_link->id]["action"] = "keep";
|
||||
@@ -450,7 +473,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($r->links);exit;
|
||||
//var_dump($r->links);exit;
|
||||
|
||||
|
||||
$new_contract->update($contract_data);
|
||||
@@ -458,42 +481,39 @@ class ContractController extends mfBaseController
|
||||
|
||||
if (!$new_contract_id) {
|
||||
$this->layout()->setFlash("Neuer Contract konnte nicht gespeichert werden", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "productchange", ["contract_id" => $id]);
|
||||
} else {
|
||||
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Contractconfig übernehmen
|
||||
// TODO: Contractconfig übernehmen
|
||||
|
||||
|
||||
if($contract_cancel_date) {
|
||||
if ($contract_cancel_date) {
|
||||
$contract->cancel_date = $contract_cancel_date->getTimestamp();
|
||||
$contract->edit_by = $this->me->id;
|
||||
$contract->save();
|
||||
}
|
||||
|
||||
$journal = ContractjournalModel::create([
|
||||
'contract_id' => $new_contract->id,
|
||||
'type' => "created_from",
|
||||
'value' => "productchange",
|
||||
'text' => "Produkt-/Standortwechsel von Contract ID ".$contract->id
|
||||
]);
|
||||
$journal = ContractjournalModel::create(['contract_id' => $new_contract->id,
|
||||
'type' => "created_from",
|
||||
'value' => "productchange",
|
||||
'text' => "Produkt-/Standortwechsel von Contract ID " . $contract->id]);
|
||||
$journal->save();
|
||||
|
||||
|
||||
|
||||
if (is_array($r->links) && count($r->links)) {
|
||||
foreach ($r->links as $link_id => $link_data) {
|
||||
$action = $link_data["action"];
|
||||
$cancel_date = false;
|
||||
if($link_data["cancel_date"]) {
|
||||
if ($link_data["cancel_date"]) {
|
||||
try {
|
||||
$cancel_date = DateTime::createFromFormat("d.m.Y", $link_data["cancel_date"], new DateTimeZone("Europe/Vienna"));
|
||||
} catch (Exception $e) {
|
||||
$this->layout()->setFlash("Ungültiges Kündigungsdatum", "error");
|
||||
if($f == "o") {
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "productchange", ["contract_id" => $id]);
|
||||
} else {
|
||||
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||
@@ -505,7 +525,7 @@ class ContractController extends mfBaseController
|
||||
$old_link = new ContractLink($link_id);
|
||||
if (!$old_link->id) continue;
|
||||
|
||||
// check if link contains this contract
|
||||
// check if link contains this contract
|
||||
if ($old_link->contract_id == $contract->id) {
|
||||
$origin_id = $old_link->origin_contract_id;
|
||||
$link_contract_id = $old_link->contract_id;
|
||||
@@ -522,25 +542,23 @@ class ContractController extends mfBaseController
|
||||
continue;
|
||||
}
|
||||
|
||||
if($action != "cancel" && $old_link->type != "credit") {
|
||||
$new_link = ContractLinkModel::create([
|
||||
'contract_id' => $new_link_contract_id,
|
||||
'origin_contract_id' => $new_link_origin_id,
|
||||
'type' => $old_link->type,
|
||||
]);
|
||||
if ($action != "cancel" && $old_link->type != "credit") {
|
||||
$new_link = ContractLinkModel::create(['contract_id' => $new_link_contract_id,
|
||||
'origin_contract_id' => $new_link_origin_id,
|
||||
'type' => $old_link->type,]);
|
||||
if (!$new_link->save()) {
|
||||
$this->layout()->setFlash("Konnte neuen Link nicht speichern", "warn");
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "cancel") {
|
||||
if($cancel_date && $contract_cancel_date) {
|
||||
// insert cancel_date in old contract
|
||||
if ($cancel_date && $contract_cancel_date) {
|
||||
// insert cancel_date in old contract
|
||||
$lc = new Contract($origin_id);
|
||||
$lc->cancel_date = $cancel_date->getTimestamp();
|
||||
$lc->save();
|
||||
} else {
|
||||
// leave cancellation for later (when finishing upgrade)
|
||||
// leave cancellation for later (when finishing upgrade)
|
||||
$old_link->change_action = "cancel";
|
||||
if (!$old_link->save()) {
|
||||
$this->layout()->setFlash("Konnte alten Link nicht speichern", "warn");
|
||||
@@ -550,42 +568,36 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
if ($old_link->type == "credit" && $action == "keep") {
|
||||
// XXX - if we have finish date then recreate credit contract right now
|
||||
if($contract_cancel_date) {
|
||||
// XXX - if we have finish date then recreate credit contract right now
|
||||
if ($contract_cancel_date) {
|
||||
$new_credit = ContractModel::createCreditForContract($new_contract);
|
||||
$new_credit->save();
|
||||
|
||||
// create journal for credit
|
||||
$journal = ContractjournalModel::create([
|
||||
'contract_id' => $new_credit->id,
|
||||
'type' => "created_from",
|
||||
'value' => "productchange",
|
||||
'text' => "Produkt-/Standortwechsel von Contract ID ".$new_link_origin_id
|
||||
]);
|
||||
// create journal for credit
|
||||
$journal = ContractjournalModel::create(['contract_id' => $new_credit->id,
|
||||
'type' => "created_from",
|
||||
'value' => "productchange",
|
||||
'text' => "Produkt-/Standortwechsel von Contract ID " . $new_link_origin_id]);
|
||||
$journal->save();
|
||||
|
||||
|
||||
$this->log->debug(print_r($new_credit, true));
|
||||
|
||||
// set cancel date for old credit
|
||||
// set cancel date for old credit
|
||||
$old_credit = new Contract($origin_id);
|
||||
$old_credit->cancel_date = $contract_cancel_date->getTimestamp();
|
||||
$old_credit->save();
|
||||
|
||||
// create link to new credit contract
|
||||
$link = ContractLinkModel::create([
|
||||
"contract_id" => $new_credit->id,
|
||||
"origin_contract_id" => $new_contract->id,
|
||||
"type" => "credit"
|
||||
]);
|
||||
// create link to new credit contract
|
||||
$link = ContractLinkModel::create(["contract_id" => $new_credit->id,
|
||||
"origin_contract_id" => $new_contract->id,
|
||||
"type" => "credit"]);
|
||||
$link->save();
|
||||
|
||||
// create upgrade link from old to new credit contract
|
||||
$link = ContractLinkModel::create([
|
||||
"contract_id" => $new_credit->id,
|
||||
"origin_contract_id" => $origin_id,
|
||||
"type" => "upgrade"
|
||||
]);
|
||||
// create upgrade link from old to new credit contract
|
||||
$link = ContractLinkModel::create(["contract_id" => $new_credit->id,
|
||||
"origin_contract_id" => $origin_id,
|
||||
"type" => "upgrade"]);
|
||||
$link->save();
|
||||
|
||||
} else {
|
||||
@@ -595,27 +607,25 @@ class ContractController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
//var_dump($new_link);exit;
|
||||
//var_dump($new_link);exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Upgrade Link erstellen
|
||||
*/
|
||||
* Upgrade Link erstellen
|
||||
*/
|
||||
$change_type = "upgrade";
|
||||
/*if($contract->product_id != $new_contract->product_id) {
|
||||
$change_type = "upgrade";
|
||||
$change_type = "upgrade";
|
||||
} elseif($contract->matchcode != $new_contract->matchcode) {
|
||||
$change_type = "relocation";
|
||||
$change_type = "relocation";
|
||||
} else {
|
||||
$change_type = "productchange";
|
||||
$change_type = "productchange";
|
||||
}*/
|
||||
|
||||
$link = ContractLinkModel::create([
|
||||
'contract_id' => $new_contract_id,
|
||||
'origin_contract_id' => $id,
|
||||
'type' => $change_type
|
||||
]);
|
||||
$link = ContractLinkModel::create(['contract_id' => $new_contract_id,
|
||||
'origin_contract_id' => $id,
|
||||
'type' => $change_type]);
|
||||
|
||||
$link_id = $link->save();
|
||||
if (!$link_id) {
|
||||
@@ -625,19 +635,17 @@ class ContractController extends mfBaseController
|
||||
$new_contract->sendProductchangeNotification($contract);
|
||||
|
||||
$this->layout()->setFlash("Produktwechsel erfolgreich erstellt", "success");
|
||||
if($f == "o") {
|
||||
$this->redirect("Order","Upgrades");
|
||||
if ($f == "o") {
|
||||
$this->redirect("Order", "Upgrades");
|
||||
} else {
|
||||
$this->redirect("Contract", "view", ["contract_id" => $new_contract_id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function finishContractAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
protected function finishContractAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$r = $this->request;
|
||||
@@ -655,27 +663,25 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
$now = new DateTime("now");
|
||||
$now->setTime(0,0,0);
|
||||
$now->setTime(0, 0, 0);
|
||||
|
||||
$contract->finish_date = $now->getTimestamp();
|
||||
$contract->finish_date_by = $this->me->id;
|
||||
try {
|
||||
$saved = $contract->save();
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$saved = false;
|
||||
}
|
||||
|
||||
if(!$saved) {
|
||||
if (!$saved) {
|
||||
$this->layout()->setFlash("Contract konnte nicht gespeichert werden", "error");
|
||||
$this->redirect("Contract", "view", ['contract_id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
// create Journal
|
||||
$journal = ContractjournalModel::create([
|
||||
'contract_id' => $contract->id,
|
||||
'type' => "contract_finished"
|
||||
]);
|
||||
// create Journal
|
||||
$journal = ContractjournalModel::create(['contract_id' => $contract->id,
|
||||
'type' => "contract_finished"]);
|
||||
$journal_id = $journal->save();
|
||||
|
||||
$this->layout()->setFlash("Contract erfolgreich fertiggestellt", "success");
|
||||
@@ -683,32 +689,8 @@ class ContractController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$this->layout()->setTemplate("Contract/Form");
|
||||
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||
|
||||
if ($this->request->origin_contract_id) {
|
||||
$origin = new Contract($this->request->origin_contract_id);
|
||||
if ($origin->id) {
|
||||
$contract = new Contract();
|
||||
$contract->owner_id = $origin->owner_id;
|
||||
$contract->billingaddress_id = $origin->billingaddress_id;
|
||||
$contract->matchcode = $origin->matchcode;
|
||||
//var_dump($contract);exit;
|
||||
$this->layout()->set("contract", $contract);
|
||||
$this->layout()->set("origin_contract_id", $origin->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
protected function editAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$id = $this->request->contract_id;
|
||||
@@ -727,7 +709,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
$this->layout()->set("contract", $contract);
|
||||
//var_dump($contract->owner);exit;
|
||||
//var_dump($contract->owner);exit;
|
||||
|
||||
if ($this->request->f == "view") $this->layout()->set("f", "view");
|
||||
if ($this->request->f != "view") $this->layout()->set("f", "index");
|
||||
@@ -742,17 +724,37 @@ class ContractController extends mfBaseController
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
protected function addAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$this->layout()->setTemplate("Contract/Form");
|
||||
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||
|
||||
if ($this->request->origin_contract_id) {
|
||||
$origin = new Contract($this->request->origin_contract_id);
|
||||
if ($origin->id) {
|
||||
$contract = new Contract();
|
||||
$contract->owner_id = $origin->owner_id;
|
||||
$contract->billingaddress_id = $origin->billingaddress_id;
|
||||
$contract->matchcode = $origin->matchcode;
|
||||
//var_dump($contract);exit;
|
||||
$this->layout()->set("contract", $contract);
|
||||
$this->layout()->set("origin_contract_id", $origin->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$r = $this->request;
|
||||
//var_dump($r);
|
||||
//var_dump($r);
|
||||
|
||||
/*
|
||||
* add or edit
|
||||
*/
|
||||
* add or edit
|
||||
*/
|
||||
$id = $r->id;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
@@ -766,32 +768,32 @@ class ContractController extends mfBaseController
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
//var_dump($r->get());exit;
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
|
||||
$contract_data = [];
|
||||
$contract_data["owner_id"] = (int)$r->owner_id;
|
||||
$contract_data["billingaddress_id"] = ($r->billingaddress_id) ? (int)$r->billingaddress_id : $r->owner_id;
|
||||
$contract_data["product_id"] = (int)$r->product_id;
|
||||
$contract_data["owner_id"] = (int) $r->owner_id;
|
||||
$contract_data["billingaddress_id"] = ($r->billingaddress_id) ? (int) $r->billingaddress_id : $r->owner_id;
|
||||
$contract_data["product_id"] = (int) $r->product_id;
|
||||
$contract_data["matchcode"] = $r->matchcode;
|
||||
$contract_data["product_name"] = $r->product_name;
|
||||
$contract_data["product_info"] = $r->product_info;
|
||||
$contract_data['amount'] = ($r->amount) ? (float)$r->amount : 1;
|
||||
$contract_data['amount'] = ($r->amount) ? (float) $r->amount : 1;
|
||||
$contract_data['vatgroup_id'] = $r->vatgroup_id;
|
||||
$contract_data['sla_id'] = $r->sla_id;
|
||||
$contract_data['price'] = (float)Layout::commaToDot($r->price);
|
||||
$contract_data['price_setup'] = (float)Layout::commaToDot($r->price_setup);
|
||||
$contract_data['price_nne'] = (float)Layout::commaToDot($r->price_nne);
|
||||
$contract_data['price_nbe'] = (float)Layout::commaToDot($r->price_nbe);
|
||||
$contract_data['billing_period'] = (int)$r->billing_period;
|
||||
$contract_data['billing_delay'] = (int)$r->billing_delay;
|
||||
$contract_data['price'] = (float) Layout::commaToDot($r->price);
|
||||
$contract_data['price_setup'] = (float) Layout::commaToDot($r->price_setup);
|
||||
$contract_data['price_nne'] = (float) Layout::commaToDot($r->price_nne);
|
||||
$contract_data['price_nbe'] = (float) Layout::commaToDot($r->price_nbe);
|
||||
$contract_data['billing_period'] = (int) $r->billing_period;
|
||||
$contract_data['billing_delay'] = (int) $r->billing_delay;
|
||||
$contract_data['note'] = $r->note;
|
||||
|
||||
if($r->termination_id) {
|
||||
if ($r->termination_id) {
|
||||
$contract_data["termination_id"] = $r->termination_id;
|
||||
}
|
||||
|
||||
if($r->order_date) {
|
||||
if ($r->order_date) {
|
||||
$order_date = new DateTime("@" . $this->dateToTimestamp($r->order_date));
|
||||
$order_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$order_date->setTime(0, 0, 0);
|
||||
@@ -800,40 +802,40 @@ class ContractController extends mfBaseController
|
||||
$contract_data['order_date'] = null;
|
||||
}
|
||||
|
||||
if($r->finish_date) {
|
||||
if ($r->finish_date) {
|
||||
$finish_date = new DateTime("@" . $this->dateToTimestamp($r->finish_date));
|
||||
$finish_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$finish_date->setTime(0, 0, 0);
|
||||
$contract_data['finish_date'] = $finish_date->getTimestamp();
|
||||
if($mode == "add") {
|
||||
if ($mode == "add") {
|
||||
$contract_data['finish_date_by'] = $this->me->id;
|
||||
} else {
|
||||
if($contract->finish_date) {
|
||||
$contract_finish_date = new DateTime("@".$contract->finish_date);
|
||||
if ($contract->finish_date) {
|
||||
$contract_finish_date = new DateTime("@" . $contract->finish_date);
|
||||
$contract_finish_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
if($contract_finish_date->format("Y-m-d") != $finish_date->format("Y-m-d")) {
|
||||
if ($contract_finish_date->format("Y-m-d") != $finish_date->format("Y-m-d")) {
|
||||
$contract_data['finish_date_by'] = $this->me->id;
|
||||
}
|
||||
} else {
|
||||
$contract_data['finish_date_by'] = $this->me->id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$contract_data['finish_date'] = null;
|
||||
}
|
||||
|
||||
if($r->cancel_date) {
|
||||
if ($r->cancel_date) {
|
||||
$cancel_date = new DateTime("@" . $this->dateToTimestamp($r->cancel_date));
|
||||
$cancel_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$cancel_date->setTime(0, 0, 0);
|
||||
$contract_data['cancel_date'] = $cancel_date->getTimestamp();
|
||||
if($mode == "add") {
|
||||
if ($mode == "add") {
|
||||
$contract_data['cancel_date_by'] = $this->me->id;
|
||||
} else {
|
||||
if($contract->cancel_date) {
|
||||
$contract_cancel_date = new DateTime("@".$contract->cancel_date);
|
||||
if ($contract->cancel_date) {
|
||||
$contract_cancel_date = new DateTime("@" . $contract->cancel_date);
|
||||
$contract_cancel_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
if($contract_cancel_date->format("Y-m-d") != $cancel_date->format("Y-m-d")) {
|
||||
if ($contract_cancel_date->format("Y-m-d") != $cancel_date->format("Y-m-d")) {
|
||||
$contract_data['cancel_date_by'] = $this->me->id;
|
||||
}
|
||||
} else {
|
||||
@@ -845,8 +847,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var_dump($contract_data);exit;
|
||||
//var_dump($contract_data);exit;
|
||||
|
||||
if ($mode == "add") {
|
||||
$contract = ContractModel::create($contract_data);
|
||||
@@ -865,7 +866,7 @@ class ContractController extends mfBaseController
|
||||
$this->layout()->setFlash("Bitte Produkt auswählen.", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
if (!in_array($contract_data['billing_period'], [0,1,12])) {
|
||||
if (!in_array($contract_data['billing_period'], [0, 1, 12])) {
|
||||
$this->layout()->setFlash("Bitte Rechnungsperiode auswählen.", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
@@ -879,7 +880,7 @@ class ContractController extends mfBaseController
|
||||
$contract->product_name = $product->name;
|
||||
}
|
||||
|
||||
//var_dump($contract);exit;
|
||||
//var_dump($contract);exit;
|
||||
|
||||
|
||||
$contract_id = $contract->save();
|
||||
@@ -889,43 +890,35 @@ class ContractController extends mfBaseController
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
// create journal
|
||||
// create journal
|
||||
if ($mode == "add") {
|
||||
$journal = ContractjournalModel::create([
|
||||
'contract_id' => $contract_id,
|
||||
'type' => "created_from",
|
||||
'value' => "manual"
|
||||
]);
|
||||
$journal = ContractjournalModel::create(['contract_id' => $contract_id,
|
||||
'type' => "created_from",
|
||||
'value' => "manual"]);
|
||||
$journal->save();
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Vertrag erfolgreich gespeichert.", "success");
|
||||
|
||||
/*
|
||||
* Create link to origin contract if set
|
||||
*/
|
||||
* Create link to origin contract if set
|
||||
*/
|
||||
if ($mode == "add" && $r->origin_contract_id) {
|
||||
$origin = new Contract($r->origin_contract_id);
|
||||
if ($origin->id) {
|
||||
$link = ContractLinkModel::create([
|
||||
'contract_id' => $contract_id,
|
||||
'origin_contract_id' => $origin->id,
|
||||
'type' => 'link'
|
||||
]);
|
||||
$link = ContractLinkModel::create(['contract_id' => $contract_id,
|
||||
'origin_contract_id' => $origin->id,
|
||||
'type' => 'link']);
|
||||
$link_id = $link->save();
|
||||
if ($link_id) {
|
||||
$journal = ContractjournalModel::create([
|
||||
'contract_id' => $contract_id,
|
||||
'type' => "link",
|
||||
'value' => $origin->id
|
||||
]);
|
||||
$journal = ContractjournalModel::create(['contract_id' => $contract_id,
|
||||
'type' => "link",
|
||||
'value' => $origin->id]);
|
||||
$journal->save();
|
||||
|
||||
$ojournal = ContractjournalModel::create([
|
||||
'contract_id' => $origin->id,
|
||||
'type' => "link",
|
||||
'value' => $contract_id
|
||||
]);
|
||||
$ojournal = ContractjournalModel::create(['contract_id' => $origin->id,
|
||||
'type' => "link",
|
||||
'value' => $contract_id]);
|
||||
$ojournal->save();
|
||||
}
|
||||
}
|
||||
@@ -956,8 +949,7 @@ class ContractController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
{
|
||||
protected function apiAction() {
|
||||
if (!$this->me->is(["Admin", "salespartner", "netowner"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
@@ -990,8 +982,7 @@ class ContractController extends mfBaseController
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
private function getContractApi()
|
||||
{
|
||||
private function getContractApi() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
@@ -1018,32 +1009,32 @@ class ContractController extends mfBaseController
|
||||
|
||||
private function getContractsApi() {
|
||||
$owner_id = $this->request->owner_id;
|
||||
if(!$owner_id) return false;
|
||||
if (!$owner_id) return false;
|
||||
|
||||
$return = [];
|
||||
|
||||
$contracts = ContractModel::search(["owner_id" => $owner_id]);
|
||||
if(!$contracts) {
|
||||
if (!$contracts) {
|
||||
header("Content-type: application/json");
|
||||
echo json_encode([]);
|
||||
exit;
|
||||
}
|
||||
$is_valid_owner = false;
|
||||
|
||||
if(!$this->me->is("Admin")) {
|
||||
foreach($contracts as $contract) {
|
||||
foreach(ContractLinkModel::includesContractId($contract->id) as $link) {
|
||||
if($link->type != "credit") continue;
|
||||
if (!$this->me->is("Admin")) {
|
||||
foreach ($contracts as $contract) {
|
||||
foreach (ContractLinkModel::includesContractId($contract->id) as $link) {
|
||||
if ($link->type != "credit") continue;
|
||||
$link_contract = $link->contract;
|
||||
if($link->contract_id == $contract->id) $link_contract = $link->origin;
|
||||
if($link_contract->owner_id == $this->me->address_id) {
|
||||
if ($link->contract_id == $contract->id) $link_contract = $link->origin;
|
||||
if ($link_contract->owner_id == $this->me->address_id) {
|
||||
$is_valid_owner = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$is_valid_owner) {
|
||||
|
||||
if (!$is_valid_owner) {
|
||||
header("Content-type: application/json");
|
||||
echo json_encode([]);
|
||||
exit;
|
||||
@@ -1051,8 +1042,7 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach($contracts as $contract) {
|
||||
foreach ($contracts as $contract) {
|
||||
$c = get_object_vars($contract->data);
|
||||
$c["id"] = $contract->id;
|
||||
$return[] = $c;
|
||||
@@ -1063,8 +1053,7 @@ class ContractController extends mfBaseController
|
||||
exit;
|
||||
}
|
||||
|
||||
private function findContractApi()
|
||||
{
|
||||
private function findContractApi() {
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
@@ -1104,14 +1093,16 @@ class ContractController extends mfBaseController
|
||||
|
||||
$results = [];
|
||||
|
||||
// return bootstrap-autocomplete format
|
||||
// return bootstrap-autocomplete format
|
||||
foreach ($contracts as $contract) {
|
||||
//$result = ['value' => $contract->id, 'text' => str_replace("'", "\\'", str_replace(["\n", "\r"], " ",$contract->name))];
|
||||
$result = ['value' => $contract->id, 'text' => $contract->id . ": " . $contract->product_name . " [" . $contract->matchcode . "] (" . $contract->owner->getCompanyOrName() . ", " . $contract->owner->street . ", " . $contract->owner->zip . " " . $contract->owner->city . ")"];
|
||||
//$result = ['value' => $contract->id, 'text' => str_replace("'", "\\'", str_replace(["\n", "\r"], " ",$contract->name))];
|
||||
$result = ['value' => $contract->id,
|
||||
'text' => $contract->id . ": " . $contract->product_name . " [" . $contract->matchcode . "] (" . $contract->owner->getCompanyOrName() . ", " . $contract->owner->street . ", " . $contract->owner->zip . " " . $contract->owner->city . ")"];
|
||||
|
||||
$results[] = $result;
|
||||
if (count($results) > 15) {
|
||||
$results[] = ['value' => 0, 'text' => " --> Mehr Suchergebnisse vorhanden. Bitte Suchbegriff genauer definieren <--"];
|
||||
$results[] = ['value' => 0,
|
||||
'text' => " --> Mehr Suchergebnisse vorhanden. Bitte Suchbegriff genauer definieren <--"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,17 @@ class TimerecordingReportController extends mfBaseController
|
||||
$dataweek = $this->request->dataweek;
|
||||
$datamonth = $this->request->datamonth;
|
||||
$datayear = $this->request->datayear;
|
||||
$calendar = $this->request->calendar;
|
||||
if ($calendar) {
|
||||
$calendar = 1;
|
||||
} else {
|
||||
$calendar = 0;
|
||||
}
|
||||
$data = [];
|
||||
|
||||
switch ($do) {
|
||||
case "getTimerecordings":
|
||||
$return = $this->getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear);
|
||||
$return = $this->getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $calendar);
|
||||
break;
|
||||
case "getTimerecordingsTimes":
|
||||
$return = $this->getTimerecordingsTimes($datatype, $dataweek, $datamonth, $datayear);
|
||||
@@ -60,7 +66,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
public function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear)
|
||||
public
|
||||
function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $calendar = 0)
|
||||
{
|
||||
$mustSeconds = 0;
|
||||
$isSeconds = 0;
|
||||
@@ -131,6 +138,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
if ($calendar == "1") {
|
||||
$lastdate = strtotime(" +3 years", $lastdate);
|
||||
}
|
||||
$searchArray = ['start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class WarehouseArticleController extends TTCrud {
|
||||
protected string $headerTitle = 'Artikel';
|
||||
protected string $createText = 'Artikel erstellen';
|
||||
protected $createText = 'Artikel erstellen';
|
||||
|
||||
// @formatter:off
|
||||
protected array $columns = [
|
||||
@@ -32,11 +32,26 @@ class WarehouseArticleController extends TTCrud {
|
||||
];
|
||||
// @formatter:on
|
||||
|
||||
protected array $additionalJSVariables = ['WAREHOUSE_ADMIN' => true];
|
||||
|
||||
protected array $infoMessages = ['create' => 'Artikel wurde erstellt',
|
||||
'update' => 'Artikel wurde aktualisiert',
|
||||
'delete' => 'Artikel wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',];
|
||||
|
||||
protected function prepareCrudConfig() {
|
||||
if (!$this->user->can('WarehouseAdmin')) {
|
||||
// find column with key actions, cheapestPurchasePrice, warningAmount, criticalAmount and set table to false
|
||||
foreach ($this->columns as $key => $column) {
|
||||
if (in_array($column['key'], ['actions', 'cheapestPurchasePrice', 'warningAmount', 'criticalAmount'])) {
|
||||
$this->columns[$key]['table'] = false;
|
||||
}
|
||||
}
|
||||
$this->createText = false;
|
||||
$this->additionalJSVariables['WAREHOUSE_ADMIN'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
return true;
|
||||
|
||||
@@ -430,6 +430,21 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
}
|
||||
|
||||
protected function readGLSEmailAction() {
|
||||
function decode_utf8($str){
|
||||
# paterns
|
||||
$err="(=\?.{10,13}q\?_?|\?\=)";
|
||||
$pat = "/=([0-9A-F]{2})/";
|
||||
$cha="'.chr(hexdec(";
|
||||
# erase null signs in string
|
||||
$str = str_replace("\x00", "", $str);
|
||||
# to decode with eval and replace
|
||||
eval("\$str='".
|
||||
preg_replace($pat,$cha."'$1')).'",$str)
|
||||
."';");
|
||||
# return
|
||||
return $str;
|
||||
}
|
||||
|
||||
$host = '{mail.xinon.at:993/imap/ssl/novalidate-cert}INBOX';
|
||||
$mbox = imap_open($host, 'eshop-versand@xinon.at', 'savemanfb545aw');
|
||||
$emails = imap_search($mbox, 'ALL');
|
||||
@@ -443,7 +458,7 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
$overview = imap_fetch_overview($mbox, $email_number, 0);
|
||||
|
||||
if (strpos($overview[0]->from, 'gls') === false) {
|
||||
//continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
$message = imap_fetchbody($mbox, $email_number, 1); // 1 for plain text part
|
||||
@@ -468,18 +483,43 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
|
||||
$addressLines = explode("\n", $address);
|
||||
$addressLine = trim(array_shift($addressLines));
|
||||
|
||||
$plzCity = trim(array_shift($addressLines));
|
||||
$plzCityParts = explode(' ', $plzCity);
|
||||
$plz = $plzCityParts[0];
|
||||
if (!isset($plzCityParts[1])) {
|
||||
continue;
|
||||
}
|
||||
echo "---------------------------------------\n\n";
|
||||
$city = $plzCityParts[1];
|
||||
|
||||
|
||||
// convert special characters to normal ones because i get J=C3=B6ss instead of Jöss
|
||||
$addressLine = decode_utf8($addressLine);
|
||||
$city = decode_utf8($city);
|
||||
|
||||
echo "Found address: $addressLine, $plz, $city" . PHP_EOL;
|
||||
// END ADDRESS PARSING
|
||||
|
||||
// START TRACKING NUMBER PARSING
|
||||
$trackingNumber = '';
|
||||
preg_match('/\d{6,}/', $message, $matches);
|
||||
// $trackingNumber = '';
|
||||
// preg_match('/\d{6,}/', $message, $matches);
|
||||
// if (!empty($matches)) {
|
||||
// // if addrline includes 27
|
||||
// if (strpos($addressLine, '27') !== false) {
|
||||
// var_dump($matches);
|
||||
// die($message);
|
||||
// }
|
||||
//
|
||||
// $trackingNumber = $matches[0];
|
||||
// }
|
||||
|
||||
// grab tracking number from https://gls-group.eu/track/53158006143 (example) from url
|
||||
preg_match('/track\/(\d+)/', $message, $matches);
|
||||
if (!empty($matches)) {
|
||||
$trackingNumber = $matches[0];
|
||||
$trackingNumber = $matches[1];
|
||||
}
|
||||
echo "Found tracking number: $trackingNumber" . PHP_EOL;
|
||||
// END TRACKING NUMBER PARSING
|
||||
|
||||
|
||||
@@ -487,11 +527,13 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
'deliveryAddressPLZ' => $plz,
|
||||
'deliveryAddressCity' => $city]);
|
||||
if (empty($orders)) {
|
||||
echo "No order found with address: $addressLine, $plz, $city" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// now check if the trackingNumber is already set and if not set it and create a history entry
|
||||
$order = (array) $orders[0];
|
||||
echo "Found order with address: " . $order['id'] . PHP_EOL;
|
||||
//
|
||||
if ($order['trackingNumber']) {
|
||||
continue;
|
||||
@@ -509,15 +551,10 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
'user_id' => 1,
|
||||
'create' => date('U')]);
|
||||
|
||||
die();
|
||||
|
||||
die($address);
|
||||
|
||||
echo "Subject: " . $overview[0]->subject . "\n";
|
||||
echo "From: " . $overview[0]->from . "\n";
|
||||
echo "Date: " . $overview[0]->date . "\n";
|
||||
echo "Message:\n" . $message . "\n\n";
|
||||
echo "---------------------------------------\n\n";
|
||||
// echo "Subject: " . $overview[0]->subject . "\n";
|
||||
// echo "From: " . $overview[0]->from . "\n";
|
||||
// echo "Date: " . $overview[0]->date . "\n";
|
||||
// echo "Message:\n" . $message . "\n\n";
|
||||
}
|
||||
} else {
|
||||
echo "No emails found.";
|
||||
|
||||
@@ -36,21 +36,24 @@ class WarehouseHistoryController {
|
||||
|
||||
if (isset($columns[array_search($item['key'], array_column($columns, 'key'))]['modal']['type'])) {
|
||||
|
||||
if($columns[array_search($item['key'], array_column($columns, 'key'))]['modal']['type'] === 'checkbox') {
|
||||
if ($columns[array_search($item['key'], array_column($columns, 'key'))]['modal']['type'] === 'checkbox') {
|
||||
$item['old_value'] = $item['old_value'] === '1' ? 'Ja' : 'Nein';
|
||||
$item['new_value'] = $item['new_value'] === '1' ? 'Ja' : 'Nein';
|
||||
}
|
||||
|
||||
if($columns[array_search($item['key'], array_column($columns, 'key'))]['modal']['type'] === 'select') {
|
||||
if ($columns[array_search($item['key'], array_column($columns, 'key'))]['modal']['type'] === 'select') {
|
||||
$column = $columns[array_search($item['key'], array_column($columns, 'key'))];
|
||||
$item['old_value'] = $column['modal']['items'][array_search($item['old_value'], array_column($column['modal']['items'], 'value'))]['text'];
|
||||
$item['new_value'] = $column['modal']['items'][array_search($item['new_value'], array_column($column['modal']['items'], 'value'))]['text'];
|
||||
|
||||
if (isset($column['modal']['items'][array_search($item['old_value'], array_column($column['modal']['items'], 'value'))]) &&
|
||||
isset($column['modal']['items'][array_search($item['new_value'], array_column($column['modal']['items'], 'value'))])) {
|
||||
$item['old_value'] = $column['modal']['items'][array_search($item['old_value'], array_column($column['modal']['items'], 'value'))]['text'];
|
||||
$item['new_value'] = $column['modal']['items'][array_search($item['new_value'], array_column($column['modal']['items'], 'value'))]['text'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$item['columnHeader'] = $columns[array_search($item['key'], array_column($columns, 'key'))]['text'];
|
||||
return $item;
|
||||
}, $history);
|
||||
|
||||
@@ -14,7 +14,8 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
['key' => 'deliveryAddressName', 'text' => 'L.-Adr. Name', 'required' => true],
|
||||
['key' => 'deliveryAddressLine', 'text' => 'L.-Adr.', 'required' => true],
|
||||
['key' => 'deliveryAddressPLZ', 'text' => 'L.-Adr. PLZ', 'required' => true],
|
||||
['key' => 'deliveryAddressCity', 'text' => 'L.-Adr. Ort', 'required' => true],
|
||||
['key' => 'deliveryAddressEMail', 'text' => 'L.-Adr. EMail', 'required' => true, 'table' => false],
|
||||
['key' => 'note', 'text' => 'Notiz', 'required' => true, 'table' => false],
|
||||
['key' => 'status',
|
||||
'text' => 'Status',
|
||||
'required' => true,
|
||||
@@ -63,6 +64,7 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
self::returnJson(['success' => false, 'message' => 'Status muss "Neu" sein']);
|
||||
die();
|
||||
}
|
||||
|
||||
$postData['positions'] = json_encode($postData['positions']);
|
||||
return true;
|
||||
}
|
||||
@@ -75,6 +77,7 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
"\r"], " ", $address->getCompanyOrName())) . " (" . $address->zip . " " . $address->city . ", " . $address->street . ")" . (($address->customer_number) ? " [" . $address->customer_number . "]" : "")];
|
||||
return $result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
@@ -169,6 +172,40 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
self::returnJson($textElements);
|
||||
}
|
||||
|
||||
protected function signAction() {
|
||||
$id = $this->request->id;
|
||||
if (strlen($id) < 1) {
|
||||
http_response_code(500);
|
||||
self::returnJson(['success' => false, 'message' => 'Lieferschein wurde nicht gefunden']);
|
||||
}
|
||||
|
||||
$shippingNote = WarehouseShippingNoteModel::get($id);
|
||||
|
||||
if ($shippingNote->signature || $shippingNote->signatureName) {
|
||||
http_response_code(500);
|
||||
self::returnJson(['success' => false, 'message' => 'Lieferschein wurde bereits unterschrieben']);
|
||||
}
|
||||
$post = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$shippingNote = (array) $shippingNote;
|
||||
$shippingNote['signature'] = $post['signature'];
|
||||
$shippingNote['signatureName'] = $post['signatureName'];
|
||||
|
||||
if (strlen($shippingNote['signature']) < 1 || strlen($shippingNote['signatureName']) < 1) {
|
||||
http_response_code(500);
|
||||
self::returnJson(['success' => false, 'message' => 'Unterschrift oder Name fehlt']);
|
||||
}
|
||||
|
||||
try {
|
||||
$shippingNote['signatureDate'] = date("Y-m-d");
|
||||
WarehouseShippingNoteModel::update($shippingNote);
|
||||
self::returnJson(['success' => true, 'message' => 'Unterschrift wurde gespeichert']);
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
self::returnJson(['success' => false, 'message' => 'Unterschrift konnte nicht gespeichert werden']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function createPDFAction() {
|
||||
$id = $this->request->id;
|
||||
if (strlen($id) < 1) {
|
||||
@@ -194,9 +231,38 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
$position['articleDescription'] = $articlePacket->description === $articlePacket->title ? "" : $articlePacket->description;
|
||||
$position['articleUnit'] = 'Stk.';
|
||||
$positions[] = $position;
|
||||
} elseif (isset($position['articleText'])) {
|
||||
$position['articleTitle'] = $position['articleText'];
|
||||
$position['articleDescription'] = "";
|
||||
$position['articleUnit'] = 'Stk.';
|
||||
$positions[] = $position;
|
||||
}
|
||||
}
|
||||
|
||||
// json decode hoursEntries and add to positions
|
||||
$hoursEntries = json_decode($shippingNote->hoursEntries, true);
|
||||
foreach ($hoursEntries as $hoursEntry) {
|
||||
$positions[] = [
|
||||
'articleTitle' => "Arbeitsstunden",
|
||||
'articleDescription' => "Mitarbeiter: " . UserModel::getOne($hoursEntry['userId'])->name,
|
||||
'articleUnit' => 'Std.',
|
||||
'amount' => $hoursEntry['hourCount'],
|
||||
'price' => $hoursEntry['hourlyPrice'] * $hoursEntry['hourCount'] ?? 0,
|
||||
];
|
||||
|
||||
if ($hoursEntry['carId']) {
|
||||
$positions[] = [
|
||||
'articleTitle' => "Fahrkostenpauschale",
|
||||
'articleDescription' => "Fahrzeug: " . TimerecordingCarModel::getOne($hoursEntry['carId'])->number_plate,
|
||||
'articleUnit' => 'Km',
|
||||
'amount' => $hoursEntry['kilometerCount'],
|
||||
'price' => 1 * $hoursEntry['kilometerCount'] ?? 0,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$textElements = [];
|
||||
// parse shippingNote.textElements ({"1":true,"2":true}) to array, fetch each text element and put content into array
|
||||
$shippingNoteTextElements = json_decode($shippingNote->textElements, true);
|
||||
@@ -259,4 +325,148 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
header('Content-Disposition: inline; filename="' . $filename . '"');
|
||||
readfile($filename);
|
||||
}
|
||||
|
||||
// TODO: either move this to UserController or make it better
|
||||
protected function userAutoCompleteAction() {
|
||||
$users = array_map(function($user) {
|
||||
return ['value' => $user->id, 'text' => $user->name];
|
||||
}, UserModel::search(['employee' => true]));
|
||||
|
||||
$out = null;
|
||||
$searchedID = $this->request->searchedID;
|
||||
if (strlen($searchedID) > 0) {
|
||||
// find user with value searchedID
|
||||
$out = array_filter($users, function($user) use ($searchedID) {
|
||||
return $user['value'] == $searchedID;
|
||||
});
|
||||
} else {
|
||||
$out = array_filter($users, function($user) {
|
||||
;
|
||||
return strpos(strtolower($user['text']), strtolower($this->request->q)) !== false;
|
||||
});
|
||||
|
||||
$out = array_slice($out, 0, 10);
|
||||
}
|
||||
|
||||
self::returnJson(array_values($out));
|
||||
}
|
||||
|
||||
//TODO: either move this to TimerecordingCarController or make it better
|
||||
protected function timerecordingCarAutoCompleteAction() {
|
||||
$timerecordingCars = array_map(function($timerecordingCar) {
|
||||
return ['value' => $timerecordingCar->id, 'text' => $timerecordingCar->number_plate . " " . $timerecordingCar->brand . " " . $timerecordingCar->model];
|
||||
}, TimerecordingCarModel::getAll());
|
||||
|
||||
$out = null;
|
||||
$searchedID = $this->request->searchedID;
|
||||
if (strlen($searchedID) > 0) {
|
||||
// find user with value searchedID
|
||||
$out = array_filter($timerecordingCars, function($timerecordingCar) use ($searchedID) {
|
||||
return $timerecordingCar['value'] == $searchedID;
|
||||
});
|
||||
} else {
|
||||
$out = array_filter($timerecordingCars, function($timerecordingCar) {
|
||||
return strpos(strtolower($timerecordingCar['text']), strtolower($this->request->q)) !== false;
|
||||
});
|
||||
|
||||
$out = array_slice($out, 0, 10);
|
||||
}
|
||||
|
||||
self::returnJson(array_values($out));
|
||||
}
|
||||
|
||||
protected function timerecordingCarForUserAction() {
|
||||
$timerecordingCars = TimerecordingCarModel::getAll();
|
||||
$out = null;
|
||||
foreach ($timerecordingCars as $timerecordingCar) {
|
||||
if ($timerecordingCar->user_id == $this->user->id) {
|
||||
header('Content-Type: application/json');
|
||||
die(json_encode(['success' => true, 'id' => $timerecordingCar->id]));
|
||||
}
|
||||
}
|
||||
die(json_encode(['success' => true, 'status' => 'USER_NO_CAR']));
|
||||
}
|
||||
|
||||
|
||||
//TODO: export this to an api class for openstreetmap
|
||||
protected function getDistanceAction() {
|
||||
// $filename = TEMP_DIR . "/DeviceMonitoring/interfacesWithCongestion.json";
|
||||
// use dir TEMP_DIR /OpenStreetMap/from-to.json to cache the results
|
||||
|
||||
$filename = TEMP_DIR . "/OpenStreetMap/" . urlencode($this->request->from) . "-" . urlencode($this->request->to) . ".json";
|
||||
|
||||
if (file_exists($filename)) {
|
||||
$data = file_get_contents($filename);
|
||||
self::returnJson(json_decode($data, true));
|
||||
}
|
||||
|
||||
|
||||
$from = $this->request->from;
|
||||
$to = $this->request->to;
|
||||
$from = urlencode($from);
|
||||
$to = urlencode($to);
|
||||
|
||||
function geocode($address) {
|
||||
if ($address === 'Xinon GmbH') {
|
||||
return [['lat' => 46.99555015, 'lon' => 15.77507876755547]];
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://nominatim.openstreetmap.org/search?q=$address&format=json",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "GET",
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"accept: application/json",
|
||||
"accept-language: de-AT,de;q=0.9,en;q=0.8",
|
||||
"origin: https://routing.openstreetmap.de",
|
||||
"referer: https://routing.openstreetmap.de/",
|
||||
"user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
|
||||
],
|
||||
]);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
if ($err) {
|
||||
die(json_encode(['success' => false, 'message' => 'Error while geocoding']));
|
||||
}
|
||||
|
||||
curl_close($curl);
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
function route($from, $to) {
|
||||
$fromData = geocode($from);
|
||||
$toData = geocode($to);
|
||||
$fromLat = $fromData[0]['lat'];
|
||||
$fromLon = $fromData[0]['lon'];
|
||||
$toLat = $toData[0]['lat'];
|
||||
$toLon = $toData[0]['lon'];
|
||||
$url = "https://router.project-osrm.org/route/v1/driving/$fromLon,$fromLat;$toLon,$toLat?overview=false";
|
||||
$data = json_decode(file_get_contents($url), true);
|
||||
$distance = $data['routes'][0]['distance'];
|
||||
return $distance;
|
||||
}
|
||||
|
||||
$fromData = geocode($from);
|
||||
$toData = geocode($to);
|
||||
|
||||
$distance = route($from, $to);
|
||||
|
||||
$roundedDistanceKm = round($distance / 1000, 0);
|
||||
|
||||
if (!file_exists(dirname($filename))) {
|
||||
mkdir(dirname($filename), 0777, true);
|
||||
}
|
||||
file_put_contents($filename, json_encode(['success' => true, 'distance' => $roundedDistanceKm]));
|
||||
|
||||
self::returnJson(['success' => true, 'distance' => $roundedDistanceKm]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,9 +7,15 @@ class WarehouseShippingNoteModel extends TTCrudBaseModel {
|
||||
public string $deliveryAddressLine;
|
||||
public string $deliveryAddressPLZ;
|
||||
public string $deliveryAddressCity;
|
||||
public string $deliveryAddressEMail;
|
||||
public string $note;
|
||||
public string $status; // 'new'|'accepted'|'invoiced'
|
||||
public string $positions;
|
||||
public string $textElements;
|
||||
public string $hoursEntries;
|
||||
public ?string $signature;
|
||||
public ?string $signatureName;
|
||||
public ?string $signatureDate;
|
||||
public ?int $eShopOrderId;
|
||||
public int $create;
|
||||
public int $createBy;
|
||||
|
||||
@@ -23,7 +23,6 @@ final class AddHistoricBill extends AbstractMigration {
|
||||
$HistoricBills->addColumn("IBAN", "string", ["null" => false, "limit" => 255]);
|
||||
$HistoricBills->addColumn("Mandatinvoice_number", "string", ["null" => false, "limit" => 255]);
|
||||
$HistoricBills->addColumn("payment", "integer", ["null" => false, "default" => "0"]);
|
||||
$HistoricBills->create();
|
||||
|
||||
$HistoricBills->addIndex("invoice_number", ["name" => "invoice_number"]);
|
||||
$HistoricBills->save();
|
||||
|
||||
47
db/migrations/20241112180000_warehouse_modify_2.php
Normal file
47
db/migrations/20241112180000_warehouse_modify_2.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class WarehouseModify2 extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
//WarehouseShippingNote Table
|
||||
$WarehouseShippingNote = $this->table("WarehouseShippingNote", ["signed" => true]);
|
||||
$WarehouseShippingNote->addColumn("deliveryAddressEMail", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("note", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("hoursEntries", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("signature", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->addColumn("signatureName", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->addColumn("signatureDate", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->save();
|
||||
|
||||
//WarehouseArticle Table
|
||||
$WarehouseArticle = $this->table("WarehouseArticle", ["signed" => true]);
|
||||
$WarehouseArticle->changeColumn("cheapestSellPrice", "text", ["null" => true]);
|
||||
$WarehouseArticle->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("WarehouseShippingNote")->removeColumn("deliveryAddressEMail");
|
||||
$this->table("WarehouseShippingNote")->removeColumn("note");
|
||||
$this->table("WarehouseShippingNote")->removeColumn("hoursEntries");
|
||||
$this->table("WarehouseShippingNote")->removeColumn("signature");
|
||||
$this->table("WarehouseShippingNote")->removeColumn("signatureName");
|
||||
$this->table("WarehouseShippingNote")->removeColumn("signatureDate");
|
||||
$this->table("WarehouseShippingNote")->save();
|
||||
|
||||
$this->table("WarehouseArticle")->changeColumn("cheapestSellPrice", "string", ["null" => false, "limit" => 255]);
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,15 @@ FROM debian:bookworm
|
||||
RUN apt update
|
||||
RUN apt install wget libfontenc1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
|
||||
# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb
|
||||
# dpkg ignore
|
||||
|
||||
# dpkg --force-all -i wkhtmltox_0.12.6-1.stretch_amd64.deb
|
||||
# wget https://www.mytaxexpress.com/download/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb
|
||||
# dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb
|
||||
# wget https://archive.debian.org/debian/pool/main/libj/libjpeg8/libjpeg8_8b-1_amd64.deb
|
||||
# dpkg -i libjpeg8_8b-1_amd64.deb
|
||||
|
||||
# Install apache2 and PHP and PHP modules
|
||||
RUN apt update && \
|
||||
apt install -y apache2 curl cron unzip php8.2 php8.2-curl php8.2-cli php8.2-mysqli php8.2-gd php8.2-zip php8.2-dom php8.2-mbstring && \
|
||||
apt install -y apache2 curl cron unzip php8.2 php8.2-imap php8.2-curl php8.2-cli php8.2-mysqli php8.2-gd php8.2-zip php8.2-dom php8.2-mbstring && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
||||
apt clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -44,7 +44,7 @@ class Helper {
|
||||
/**
|
||||
* Validates an array of data based on a set of predefined rules.
|
||||
*
|
||||
* @param array $data The data to validate. Keys represent field names, and values are the corresponding data.
|
||||
* @param array $data The data to validate. Keys represent field names, and values are the corresponding data.
|
||||
* @param array $checkArray An associative array defining validation rules for each field:
|
||||
* - key: The field name to validate.
|
||||
* - value: An associative array of validation rules for that field:
|
||||
@@ -70,11 +70,9 @@ class Helper {
|
||||
|
||||
// Apply default values for missing rules
|
||||
|
||||
$rules = array_merge([
|
||||
'required' => false,
|
||||
'required_length' => 1,
|
||||
'regex' => false,
|
||||
], $rules);
|
||||
$rules = array_merge(['required' => false,
|
||||
'required_length' => 1,
|
||||
'regex' => false,], $rules);
|
||||
|
||||
// Required Check
|
||||
if ($rules['required'] && (is_null($value) || $value === '')) {
|
||||
@@ -95,12 +93,8 @@ class Helper {
|
||||
if ($printErrors) {
|
||||
if (!empty($errors)) {
|
||||
header('Content-Type: application/json');
|
||||
die(json_encode(
|
||||
[
|
||||
'success' => false,
|
||||
'errors' => $errors
|
||||
]
|
||||
));
|
||||
die(json_encode(['success' => false,
|
||||
'errors' => $errors]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +116,8 @@ class Helper {
|
||||
"MF_APP_NAME" => MFAPPNAME_SLUG,
|
||||
"BASE_PATH" => $controller::getUrl(""),
|
||||
"PAGE_TITLE" => $headerTitle,
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => $controller::getUrl("Dashboard")],
|
||||
["text" => $headerTitle, "href" => $controller::getUrl($pageName)]
|
||||
],
|
||||
];
|
||||
"PATH" => [["text" => MFAPPNAME_SLUG, "href" => $controller::getUrl("Dashboard")],
|
||||
["text" => $headerTitle, "href" => $controller::getUrl($pageName)]],];
|
||||
|
||||
$JSGlobals = array_merge($JSGlobals, $additionalGlobals);
|
||||
|
||||
@@ -157,4 +148,17 @@ class Helper {
|
||||
|
||||
return $csv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a number with the given number of decimals, decimal point, and thousands separator.
|
||||
* @param $number
|
||||
* @param int $decimals
|
||||
* @param string $decPoint
|
||||
* @param string $thousandsSep
|
||||
* @return float
|
||||
*/
|
||||
public static function formatNumber($number, int $decimals = 2, string $decPoint = ",", string $thousandsSep = "."): string {
|
||||
return number_format(intval($number), $decimals, $decPoint, $thousandsSep);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
* @property string|null $historyController
|
||||
* @property array $columns
|
||||
* @property array $additionalActions
|
||||
* @property array $additionalJSVariables
|
||||
* @property array $infoMessages
|
||||
* @property bool $onlyView
|
||||
*/
|
||||
@@ -66,11 +67,18 @@ class TTCrud extends mfBaseController {
|
||||
$pageName = "DefaultCrudView";
|
||||
}
|
||||
|
||||
Helper::renderVue($this, $pageName, $this->headerTitle, ["CRUD_CONFIG" => $this->getCrudConfig(),
|
||||
"CREATE_URL" => $this::getUrl($this->mod . "/create"),
|
||||
"TABLE_URL" => $this::getUrl($this->mod . "/get"),
|
||||
"UPDATE_URL" => $this::getUrl($this->mod . "/update"),
|
||||
"DELETE_URL" => $this::getUrl($this->mod . "/delete"),]);
|
||||
$JS_VARIABLES = ["CRUD_CONFIG" => $this->getCrudConfig(),
|
||||
"CREATE_URL" => $this::getUrl($this->mod . "/create"),
|
||||
"TABLE_URL" => $this::getUrl($this->mod . "/get"),
|
||||
"UPDATE_URL" => $this::getUrl($this->mod . "/update"),
|
||||
"DELETE_URL" => $this::getUrl($this->mod . "/delete"),
|
||||
"USER_ID" => $this->user->id];
|
||||
|
||||
if ($this->additionalJSVariables && is_array($this->additionalJSVariables)) {
|
||||
$JS_VARIABLES = array_merge($JS_VARIABLES, $this->additionalJSVariables);
|
||||
}
|
||||
|
||||
Helper::renderVue($this, $pageName, $this->headerTitle, $JS_VARIABLES);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,6 +197,13 @@ class TTCrud extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function updateAction() {
|
||||
if (property_exists($this->model, 'createBy') && !isset($this->postData['createBy'])) {
|
||||
$this->postData['createBy'] = $this->user->id;
|
||||
}
|
||||
if (property_exists($this->model, 'create') && !isset($this->postData['create'])) {
|
||||
$this->postData['create'] = time();
|
||||
}
|
||||
|
||||
Helper::validateArray($this->postData, array_merge($this->checkArray, ['id' => ['required' => true]]));
|
||||
|
||||
if (method_exists($this, 'beforeUpdate') && !$this->beforeUpdate($this->postData)) {
|
||||
|
||||
3363
public/assets/js/calendar/Sortable.js
Normal file
3363
public/assets/js/calendar/Sortable.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
76
public/assets/js/calendar/jquery-sortable.js
vendored
Normal file
76
public/assets/js/calendar/jquery-sortable.js
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
(function (factory) {
|
||||
"use strict";
|
||||
var sortable,
|
||||
jq,
|
||||
_this = this
|
||||
;
|
||||
|
||||
if (typeof define === "function" && define.amd) {
|
||||
try {
|
||||
define(["sortablejs", "jquery"], function(Sortable, $) {
|
||||
sortable = Sortable;
|
||||
jq = $;
|
||||
checkErrors();
|
||||
factory(Sortable, $);
|
||||
});
|
||||
} catch(err) {
|
||||
checkErrors();
|
||||
}
|
||||
return;
|
||||
} else if (typeof exports === 'object') {
|
||||
try {
|
||||
sortable = require('sortablejs');
|
||||
jq = require('jquery');
|
||||
} catch(err) { }
|
||||
}
|
||||
|
||||
if (typeof jQuery === 'function' || typeof $ === 'function') {
|
||||
jq = jQuery || $;
|
||||
}
|
||||
|
||||
if (typeof Sortable !== 'undefined') {
|
||||
sortable = Sortable;
|
||||
}
|
||||
|
||||
function checkErrors() {
|
||||
if (!jq) {
|
||||
throw new Error('jQuery is required for jquery-sortablejs');
|
||||
}
|
||||
|
||||
if (!sortable) {
|
||||
throw new Error('SortableJS is required for jquery-sortablejs (https://github.com/SortableJS/Sortable)');
|
||||
}
|
||||
}
|
||||
checkErrors();
|
||||
factory(sortable, jq);
|
||||
})(function (Sortable, $) {
|
||||
"use strict";
|
||||
|
||||
$.fn.sortable = function (options) {
|
||||
var retVal,
|
||||
args = arguments;
|
||||
|
||||
this.each(function () {
|
||||
var $el = $(this),
|
||||
sortable = $el.data('sortable');
|
||||
|
||||
if (!sortable && (options instanceof Object || !options)) {
|
||||
sortable = new Sortable(this, options);
|
||||
$el.data('sortable', sortable);
|
||||
} else if (sortable) {
|
||||
if (options === 'destroy') {
|
||||
sortable.destroy();
|
||||
$el.removeData('sortable');
|
||||
} else if (options === 'widget') {
|
||||
retVal = sortable;
|
||||
} else if (typeof sortable[options] === 'function') {
|
||||
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
|
||||
} else if (options in sortable.options) {
|
||||
retVal = sortable.option.apply(sortable, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (retVal === void 0) ? this : retVal;
|
||||
};
|
||||
});
|
||||
6
public/assets/js/calendar/rrule/index.global.min.js
vendored
Normal file
6
public/assets/js/calendar/rrule/index.global.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
FullCalendar RRule Plugin v6.1.15
|
||||
Docs & License: https://fullcalendar.io/docs/rrule-plugin
|
||||
(c) 2024 Adam Shaw
|
||||
*/
|
||||
FullCalendar.RRule=function(e,r,t,i){"use strict";function n(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,r}var l=n(t);const u={parse(e,r){if(null!=e.rrule){let t=function(e,r){let t,n=!1,u=!1;if("string"==typeof e.rrule){let r=function(e){let r=l.rrulestr(e,{forceset:!0}),t=function(e){let r=!1,t=!1;function n(e,n,l){let u=i.parseMarker(l);r=r||!u.isTimeUnspecified,t=t||null!==u.timeZoneOffset}return e.replace(/\b(DTSTART:)([^\n]*)/,n),e.replace(/\b(EXDATE:)([^\n]*)/,n),e.replace(/\b(UNTIL=)([^;\n]*)/,n),{isTimeSpecified:r,isTimeZoneSpecified:t}}(e);return Object.assign({rruleSet:r},t)}(e.rrule);t=r.rruleSet,n=r.isTimeSpecified,u=r.isTimeZoneSpecified}if("object"==typeof e.rrule&&e.rrule){let i=a(e.rrule,r);t=new l.RRuleSet,t.rrule(i.rrule),n=i.isTimeSpecified,u=i.isTimeZoneSpecified}let f=[].concat(e.exdate||[]),s=[].concat(e.exrule||[]);for(let e of f){let r=i.parseMarker(e);n=n||!r.isTimeUnspecified,u=u||null!==r.timeZoneOffset,t.exdate(new Date(r.marker.valueOf()-60*(r.timeZoneOffset||0)*1e3))}for(let e of s){let i=a(e,r);n=n||i.isTimeSpecified,u=u||i.isTimeZoneSpecified,t.exrule(i.rrule)}return{rruleSet:t,isTimeSpecified:n,isTimeZoneSpecified:u}}(e,r);if(t)return{typeData:{rruleSet:t.rruleSet,isTimeZoneSpecified:t.isTimeZoneSpecified},allDayGuess:!t.isTimeSpecified,duration:e.duration}}return null},expand(e,r,t){let i;return i=e.isTimeZoneSpecified?e.rruleSet.between(t.toDate(r.start),t.toDate(r.end),!0).map(e=>t.createMarker(e)):e.rruleSet.between(r.start,r.end,!0),i}};function a(e,r){let t=!1,n=!1;function u(e){if("string"==typeof e){let r=i.parseMarker(e);return r?(t=t||!r.isTimeUnspecified,n=n||null!==r.timeZoneOffset,new Date(r.marker.valueOf()-60*(r.timeZoneOffset||0)*1e3)):null}return e}let a=Object.assign(Object.assign({},e),{dtstart:u(e.dtstart),until:u(e.until),freq:s(e.freq),wkst:null==e.wkst?(r.weekDow-1+7)%7:s(e.wkst),byweekday:f(e.byweekday)});return{rrule:new l.RRule(a),isTimeSpecified:t,isTimeZoneSpecified:n}}function f(e){return Array.isArray(e)?e.map(s):s(e)}function s(e){return"string"==typeof e?l.RRule[e.toUpperCase()]:e}const c={rrule:i.identity,exrule:i.identity,exdate:i.identity,duration:i.createDuration};var o=r.createPlugin({name:"@fullcalendar/rrule",recurringTypes:[u],eventRefiners:c});return r.globalPlugins.push(o),e.default=o,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,rrule,FullCalendar.Internal);
|
||||
40
public/assets/js/calendar/rrule/rrule.min.js
vendored
Normal file
40
public/assets/js/calendar/rrule/rrule.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -31,6 +31,7 @@ $jsFiles = [
|
||||
"plugins/moment/moment.min.js",
|
||||
"plugins/daterangepicker/daterangepicker.js",
|
||||
"plugins/vue/" . (isset($_GET['VUE_DEBUG']) || $_SERVER['HTTP_HOST'] === "localhost" ? "vue.js" : "vue.min.js"),
|
||||
"plugins/vue/tt-components/tt-button.js",
|
||||
"plugins/vue/tt-components/tt-card.js",
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
"plugins/vue/tt-components/tt-table-crud.js",
|
||||
@@ -39,11 +40,13 @@ $jsFiles = [
|
||||
"plugins/vue/tt-components/tt-select.js",
|
||||
"plugins/vue/tt-components/tt-datepicker.js",
|
||||
"plugins/vue/tt-components/tt-input.js",
|
||||
"plugins/vue/tt-components/tt-button.js",
|
||||
"plugins/vue/tt-components/tt-modal.js",
|
||||
"plugins/vue/tt-components/tt-autocomplete.js",
|
||||
"plugins/vue/tt-components/tt-icon-select.js",
|
||||
"plugins/vue/tt-components/tt-number-range.js",
|
||||
"plugins/vue/tt-components/tt-checkbox.js",
|
||||
"plugins/vue/tt-components/tt-textarea.js",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,14 @@
|
||||
cursor: move;
|
||||
font-size: 13px;
|
||||
margin: 3px 7px;
|
||||
padding: 3px 5px;
|
||||
padding: 1px 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fc-timegrid-event-short .fc-event-main-frame {
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.fc-toolbar {
|
||||
@media (max-width: 767px) {
|
||||
flex-direction: column;
|
||||
@@ -310,7 +314,16 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
|
||||
.fc-event-type {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 1px;
|
||||
left: -4px;
|
||||
}
|
||||
|
||||
.fc-event-recurrence {
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
left: -4px;
|
||||
}
|
||||
.fc-timegrid-event-short .fc-event-time::after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
.fa-duotone {
|
||||
@@ -449,7 +462,7 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
|
||||
}
|
||||
|
||||
.event-search-result {
|
||||
box-shadow: 0px 0px 3px 3px #48ff00 !important;
|
||||
box-shadow: 0px 0px 3px 3px #f2ff00 !important;
|
||||
}
|
||||
|
||||
.search-div .select2 {
|
||||
|
||||
@@ -82,6 +82,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
var resourceCounter = 0;
|
||||
var rrule = null;
|
||||
var duration = null;
|
||||
var rruleflag = false;
|
||||
$.each($('.calendar-check'), function (index, value) {
|
||||
if ($(this).prop('checked')) {
|
||||
rights = true;
|
||||
@@ -98,72 +101,110 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
|
||||
$.each(json.data, function (index, value) {
|
||||
category = value.ccategory.ccategory;
|
||||
if (!value.timerecording.timerecording) {
|
||||
rrule = null;
|
||||
duration = null;
|
||||
rruleflag = false;
|
||||
category = value.ccategory.ccategory;
|
||||
if (value.rrule.rrule) {
|
||||
rrule = value.rrule.rrule;
|
||||
duration = value.duration.duration;
|
||||
rruleflag = true;
|
||||
|
||||
if (value.calendar_id.calendar_id in calendarRights) {
|
||||
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
|
||||
userevents.push({
|
||||
if (value.calendar_id.calendar_id in calendarRights) {
|
||||
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
let event = {
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: value.description.description,
|
||||
location: value.location.location,
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: rights,
|
||||
rruleflag: rruleflag,
|
||||
rrule: rrule,
|
||||
duration: duration,
|
||||
droppable: movable,
|
||||
startEditable: movable,
|
||||
durationEditable: movable,
|
||||
resizableFromStart: movable,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
};
|
||||
userevents.push(event);
|
||||
if (value.rrule.rrule) {
|
||||
}
|
||||
} else {
|
||||
otherevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: category,
|
||||
color: 'red',
|
||||
editable: false,
|
||||
rruleflag: rruleflag,
|
||||
rrule: rrule,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
|
||||
}
|
||||
} else {
|
||||
let event = {
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
title: value.category.category,
|
||||
description: value.description.description,
|
||||
location: value.location.location,
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: rights,
|
||||
droppable: movable,
|
||||
startEditable: movable,
|
||||
durationEditable: movable,
|
||||
resizableFromStart: movable,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
} else {
|
||||
otherevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: category,
|
||||
color: 'red',
|
||||
editable: false,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
|
||||
};
|
||||
userevents.push(event);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -186,8 +227,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
||||
timeZone: 'UTC',
|
||||
locale: 'de',
|
||||
|
||||
|
||||
resourceAreaWidth: '220px',
|
||||
themeSystem: 'bootstrap4',
|
||||
snapDuration: '00:15:00',
|
||||
selectable: true,
|
||||
@@ -220,7 +260,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
select: function (info) {
|
||||
let resourceId = "";
|
||||
if (info.resource) {
|
||||
console.log(info.resource.id);
|
||||
resourceId = info.resource.id;
|
||||
}
|
||||
let cestDate = new Date(info.startStr);
|
||||
@@ -265,15 +304,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
$('#end-time').val(EndformattedTime);
|
||||
|
||||
}, eventClick: function (info, element) {
|
||||
|
||||
let isOrganizer;
|
||||
|
||||
$.getJSON(requestEventUrl, {
|
||||
id: info.event.id
|
||||
}, function (data) {
|
||||
|
||||
}).done(function (data) {
|
||||
// console.log(data);
|
||||
if (data.data.attachment.attachment) {
|
||||
let docs = "";
|
||||
$.each(data.data.attachments.attachments, function (index, value) {
|
||||
@@ -480,7 +515,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
},
|
||||
eventDidMount: function (info) {
|
||||
// console.log(info);
|
||||
var eventstart = new Date(info.event.startStr);
|
||||
var eventend = new Date(info.event.endStr);
|
||||
|
||||
@@ -495,7 +529,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (eventend == "NaN.NaN.NaN") {
|
||||
eventend = eventstart;
|
||||
}
|
||||
// console.log(eventend);
|
||||
title = '<div class="tooltip-description text-center">Ganztägig von ' + eventstart + ' bis ' + eventend + ' </div>';
|
||||
}
|
||||
|
||||
@@ -528,7 +561,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
title += '<div class="text-left font-13"><span class="font-weight-500">geändert am </span> ' + info.event.extendedProps['mtime'] + '</div>';
|
||||
title += '<div class="text-left font-13"><span class="font-weight-500">geändert von </span> ' + info.event.extendedProps['mname'] + '</div>';
|
||||
}
|
||||
// console.log(info);
|
||||
if ($('.fc-button-active').hasClass('fc-timeGridWeek-button') || $('.fc-button-active').hasClass('fc-timeGridDay-button')) {
|
||||
if (info.event.extendedProps['attachment']) {
|
||||
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-attachment\"><i class=\"fa-light fa-paperclip-vertical\"></i></div>");
|
||||
@@ -537,6 +569,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
|
||||
}
|
||||
if (info.event.extendedProps['rruleflag']) {
|
||||
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-recurrence\"><i class=\"fa-regular fa-arrows-rotate\"></i></div>");
|
||||
}
|
||||
}
|
||||
|
||||
var tooltip = new Tooltip(info.el, {
|
||||
@@ -714,6 +749,14 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
var cevent = calendar.getEventById(event.cal_events_id);
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
var rrule = null;
|
||||
var duration = null;
|
||||
var rruleflag = false;
|
||||
if (event.rrule) {
|
||||
rrule = event.rrule;
|
||||
duration = event.duration;
|
||||
rruleflag = true;
|
||||
}
|
||||
if (event.calendar_id in calendarRights) {
|
||||
if (calendarRights[event.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
@@ -746,6 +789,9 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
attachment: event.attachment,
|
||||
attachments: event.attachments,
|
||||
editable: movable,
|
||||
rruleflag: rruleflag,
|
||||
rrule: rrule,
|
||||
duration: duration,
|
||||
resourceId: event.calendar_id,
|
||||
calendar_name: event.calendar_name,
|
||||
clickable: rights,
|
||||
@@ -1718,6 +1764,9 @@ Xinon GMbH`;
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
var resourceCounter = 0;
|
||||
var rrule = null;
|
||||
var duration = null;
|
||||
var rruleflag = false;
|
||||
$.each($('.calendar-check'), function (index, value) {
|
||||
if ($(this).prop('checked')) {
|
||||
rights = true;
|
||||
@@ -1734,68 +1783,105 @@ Xinon GMbH`;
|
||||
|
||||
|
||||
$.each(json.data, function (index, value) {
|
||||
category = value.ccategory.ccategory;
|
||||
if (!value.timerecording.timerecording) {
|
||||
rrule = null;
|
||||
duration = null;
|
||||
rruleflag = false;
|
||||
category = value.ccategory.ccategory;
|
||||
if (value.rrule.rrule) {
|
||||
rrule = value.rrule.rrule;
|
||||
duration = value.duration.duration;
|
||||
rruleflag = true;
|
||||
|
||||
if (value.calendar_id.calendar_id in calendarRights) {
|
||||
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
if (value.calendar_id.calendar_id in calendarRights) {
|
||||
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
userevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: value.description.description,
|
||||
location: value.location.location,
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: movable,
|
||||
rruleflag: rruleflag,
|
||||
rrule: rrule,
|
||||
duration: duration,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
} else {
|
||||
movable = false;
|
||||
otherevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: category,
|
||||
color: 'red',
|
||||
editable: false,
|
||||
rruleflag: rruleflag,
|
||||
rrule: rrule,
|
||||
duration: duration,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: false,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
|
||||
}
|
||||
userevents.push({
|
||||
} else {
|
||||
let event = {
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
title: value.category.category,
|
||||
description: value.description.description,
|
||||
location: value.location.location,
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: movable,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
} else {
|
||||
otherevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: category,
|
||||
description: category,
|
||||
color: 'red',
|
||||
editable: false,
|
||||
calendar_id: value.calendar_id,
|
||||
event_type: value.event_type.event_type,
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
attachment: value.attachment.attachment,
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: false,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
cname: value.cname.cname,
|
||||
busy: value.busy.busy
|
||||
});
|
||||
|
||||
};
|
||||
userevents.push(event);
|
||||
}
|
||||
|
||||
});
|
||||
calendar.addEventSource(userevents);
|
||||
if (visibleCalendars.includes(998)) {
|
||||
@@ -1809,5 +1895,6 @@ Xinon GMbH`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
;
|
||||
|
||||
73
public/js/pages/ContractView/ContractView.css
Normal file
73
public/js/pages/ContractView/ContractView.css
Normal file
@@ -0,0 +1,73 @@
|
||||
.contract-journal-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto 24px 10fr;
|
||||
max-width: 1200px;
|
||||
margin: auto
|
||||
}
|
||||
|
||||
.contract-journal-grid > * {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.contract-journal-grid > hr {
|
||||
padding: 0px 4px 0 4px ;
|
||||
}
|
||||
|
||||
|
||||
.contract-journal-striped-background {
|
||||
background-color: rgba(0, 0, 0, .05)
|
||||
}
|
||||
|
||||
.view-table tr td:first-child {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.contract-view {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 1fr;
|
||||
grid-gap: 16px;
|
||||
}
|
||||
|
||||
.contract-view-header {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
}
|
||||
|
||||
.contract-view-header *:nth-child(3) {
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.contract-view {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.contract-view-header {
|
||||
grid-template-columns: auto auto;
|
||||
}
|
||||
|
||||
.contract-view-header h2 {
|
||||
grid-row: 2;
|
||||
grid-column: 1 / span 2;
|
||||
}
|
||||
|
||||
.contract-view-header a {
|
||||
grid-row: 1;
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.contract-view-actions {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*if media is larger than 1200px then .contract-view-journal-grid should have column 1 span 2 aswell as .contract-view-links-grid*/
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.contract-view-links-grid, .contract-view-journal-grid {
|
||||
grid-column: 1 / span 2 !important;
|
||||
}
|
||||
}
|
||||
|
||||
181
public/js/pages/ContractView/ContractView.js
Normal file
181
public/js/pages/ContractView/ContractView.js
Normal file
@@ -0,0 +1,181 @@
|
||||
Vue.component('tt-detail-table', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<table class="table table-sm table-striped view-table">
|
||||
<tbody>
|
||||
<tr v-for="(item, key) in detailItems" :key="key">
|
||||
<td v-html="item.label.replaceAll('s', 's<wbr>') + ':'"></td>
|
||||
<td>
|
||||
<template v-if="item.hasOwnProperty('url')">
|
||||
<a :href="item.url" target="_blank">{{item.value}}</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{item.value.includes('1970') ? '' : item.value}}
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>`, props: ['detailItems'],
|
||||
})
|
||||
|
||||
Vue.component('contract-journal', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
<tt-card>
|
||||
<template v-slot:header>
|
||||
<h5 class="text-center">Journaleinträge</h5>
|
||||
</template>
|
||||
|
||||
<div class="contract-journal-grid">
|
||||
<template v-for="(entry, index) in journalEntries">
|
||||
<!-- odd index should have class contract-journal-striped-background-->
|
||||
<div :class="index % 2 === 0 ? 'contract-journal-striped-background' : ''" style="padding-right: 8px" class="text-monospace">{{entry.create}} ({{entry.creator}})</div>
|
||||
<div :class="index % 2 === 0 ? 'contract-journal-striped-background' : ''"><i :class="entry.icon" :title="entry.iconTitle"></i></div>
|
||||
|
||||
<!-- if entry.text is longer than 180 characters add fa-caret in front of the text and use parseTextAddUrls to include html <a>-->
|
||||
<template v-if="entry.text.length > 130">
|
||||
<div
|
||||
:class="index % 2 === 0 ? 'contract-journal-striped-background' : ''"
|
||||
v-if="!expandedTexts.includes(index)"
|
||||
@click="expandedTexts.push(index)" style="cursor: pointer;">
|
||||
<div :class="entry.textClass" v-html="parseTextAddUrls(entry, 'fas fa-caret-down').substring(0, 130) + '...'"></div>
|
||||
</div>
|
||||
<div :class="index % 2 === 0 ? 'contract-journal-striped-background' : ''" v-if="expandedTexts.includes(index)" style="cursor: pointer;" @click="expandedTexts = expandedTexts.filter(i => i !== index)">
|
||||
<div :class="entry.textClass" v-html="parseTextAddUrls(entry, 'fas fa-caret-up', true)"></div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div :class="index % 2 === 0 ? 'contract-journal-striped-background' : ''"><div :class="entry.textClass" v-html="parseTextAddUrls(entry)"></div></div>
|
||||
</template>
|
||||
|
||||
<hr style="grid-column: 1 / span 3; border-top: 1px solid #e9ecef; margin: 0;">
|
||||
</template>
|
||||
|
||||
<div class="ml-3" style="grid-column: 1 / span 3">
|
||||
<button type="button" class="btn btn-sm btn-info" @click="showNewJournal = !showNewJournal"
|
||||
><i class="fas fa-plus"></i> Journaleintrag hinzufügen
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body border-top mt-2" v-if="showNewJournal" id="new-journal" style="grid-column: 1 / span 3">
|
||||
<form method="post" :action="window.TT_CONFIG['CONTRACT_NEW_JOURNAL_URL']" enctype="multipart/form-data">
|
||||
<input type="hidden" name="contract_id" :value="contractId"/>
|
||||
|
||||
<label for="new_journal_type" class="form-label">Typ</label>
|
||||
<select name="type" id="new_journal_type" class="form-control mb-2">
|
||||
<option value="phone">Telefongespräch</option>
|
||||
<option value="text">Kommentar</option>
|
||||
<option value="file">Dateiupload</option>
|
||||
</select>
|
||||
|
||||
<label for="new_journal_text" class="form-label">Text</label>
|
||||
<textarea name="text" id="new_journal_text" class="form-control mb-2" style="height:120px;"></textarea>
|
||||
|
||||
<div id="new-journal-file-container" class="hidden">
|
||||
<label for="new_journal_file" class="form-label">Dateianhang</label>
|
||||
<input type="file" name="journal_file" id="new_journal_file" class="form-control mb-2"/>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save mr-1"></i> Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tt-card>
|
||||
</div>
|
||||
`, props: ['journalEntries', 'contractId'], data() {
|
||||
return {
|
||||
expandedTexts: [], showNewJournal: false, window: window
|
||||
}
|
||||
}, methods: {
|
||||
parseTextAddUrls(entry, addIcon = null, replaceNewLines = false) {
|
||||
let text = JSON.parse(JSON.stringify(entry)).text
|
||||
if (replaceNewLines) {
|
||||
text = text.replace(/(?:\r\n|\r|\n)/g, '<br>')
|
||||
}
|
||||
|
||||
// if addIcon is set, add it to the beginning of the text
|
||||
if (addIcon) {
|
||||
text = `<i class="${addIcon} mr-1"></i> ${text}`
|
||||
}
|
||||
|
||||
if (entry.url && entry["urlText"]) {
|
||||
return text.replace('[URL]', `<a href="${entry.url}" target="_blank">${entry["urlText"]}</a>`)
|
||||
}
|
||||
return text
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Vue.component('contract-view', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
|
||||
<tt-card>
|
||||
<template v-slot:header>
|
||||
<div class="contract-view-header">
|
||||
<tt-button :href="window.TT_CONFIG['BACK_URL']" sm text="Zurück" icon="fas fa-arrow-left" additional-class="btn-primary"/>
|
||||
|
||||
<h2 class="text-center" :class="isPrivateProduct ? 'text-dark-red' : 'text-primary'">
|
||||
{{window.TT_CONFIG.HEADER}}</h2>
|
||||
|
||||
<tt-button :href="window.TT_CONFIG['EDIT_URL']" sm text="Vertrag bearbeiten" icon="fas fa-edit" additional-class="btn-success"/>
|
||||
</div>
|
||||
<h3 class="text-center">{{subHeader}}</h3>
|
||||
</template>
|
||||
|
||||
<div class="contract-view">
|
||||
<tt-card no-body-padding-top class="contract-view-details-grid">
|
||||
<h5 class="text-center">Vertragsdaten</h5>
|
||||
<tt-detail-table :detail-items="contractDetails"/>
|
||||
</tt-card>
|
||||
|
||||
<div class="contract-view-actions-grid">
|
||||
<tt-card no-body-padding-top class="contract-view-actions">
|
||||
<h5 class="text-center">Aktionen</h5>
|
||||
<tt-button v-for="action in window.TT_CONFIG['CONTRACT_ACTIONS']" :href="action.url" sm :text="action.text" :icon="action.icon"
|
||||
:additional-class="action.class" :confirm-text="action.confirmText" :key="action.text" class="mt-2"/>
|
||||
</tt-card>
|
||||
</div>
|
||||
|
||||
<contract-journal class="contract-view-journal-grid"
|
||||
:journal-entries="window.TT_CONFIG['CONTRACT_JOURNAL']"
|
||||
:contract-id="window.TT_CONFIG['CONTRACT_ID']"/>
|
||||
|
||||
<tt-card no-body-padding-top body-overflow-x-auto style="grid-column: 1" class="contract-view-links-grid">
|
||||
<h5 class="text-center">Vertragslinks</h5>
|
||||
<div v-html="contractLinkTableHTML"></div>
|
||||
</tt-card>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</tt-card>
|
||||
|
||||
</div>
|
||||
`, data() {
|
||||
return {
|
||||
window: window,
|
||||
header: window.TT_CONFIG["HEADER"],
|
||||
subHeader: window.TT_CONFIG["SUB_HEADER"],
|
||||
contractDetails: window.TT_CONFIG["CONTRACT_DETAILS"],
|
||||
contractLinkTableHTML: null,
|
||||
}
|
||||
}, computed: {
|
||||
isPrivateProduct() {
|
||||
return window.TT_CONFIG["HEADER"].includes('Privat')
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
const response = await axios.get(window.TT_CONFIG["CONTRACT_LINK_TABLE_URL"])
|
||||
this.contractLinkTableHTML = response.data
|
||||
console.log(response.data)
|
||||
}
|
||||
})
|
||||
@@ -5,9 +5,9 @@ Vue.component('historic-bill', {
|
||||
<tt-table-crud>
|
||||
|
||||
<template v-slot:invoice_number="{ row }">
|
||||
<a :href="'/HistoricBillData/' + row.invoice_number + '.pdf'" target="_blank">{{ row.invoice_number }}</a>
|
||||
<a :href="'/HistoricBillData/' + row.invoice_number + '_' + row.cinvoice_number +'.pdf'" target="_blank">{{ row.invoice_number }}</a>
|
||||
</template>
|
||||
|
||||
|
||||
</tt-table-crud>
|
||||
</tt-card>
|
||||
`, data() {
|
||||
|
||||
@@ -261,7 +261,8 @@ Vue.component('warehouse-article', {
|
||||
|
||||
<template v-slot:cheapestsellprice="{ row }">
|
||||
<template v-for="price in JSON.parse(row.cheapestSellPrice)">
|
||||
<span v-if="price">{{price.title}}: {{(price.price)}} €</span><br>
|
||||
<span v-if="price && window.TT_CONFIG['WAREHOUSE_ADMIN'] === true">{{price.title}}: {{(price.price)}} €<br></span>
|
||||
<span v-if="price && price.title === 'Verkauf'">{{(price.price)}} €</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -271,7 +272,7 @@ Vue.component('warehouse-article', {
|
||||
|
||||
</tt-table-crud>
|
||||
|
||||
<tt-expandable-shopping-cart :cart-items="shoppingCart" @submitOrder="prepareOrder"/>
|
||||
<tt-expandable-shopping-cart v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] === true" :cart-items="shoppingCart" @submitOrder="prepareOrder"/>
|
||||
<tt-modal :show.sync="addShoppingCartModal" title="Artikel zur Bestellung hinzufügen" :delete="false" @submit="addToShoppingCart"
|
||||
@close="addShoppingCartModal = false">
|
||||
<tt-input v-model="addShoppingCartModalCount" placeholder="Menge" type="number" sm></tt-input>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
.warehouse-shipping-note-modal-positions-entry-container {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr 1fr 1fr;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
.warehouse-shipping-note-modal-positions-entry-actions, .warehouse-shipping-note-modal-hours-entry-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding-top: 13px;
|
||||
}
|
||||
|
||||
.warehouse-shipping-note-modal-hours-entry-container {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr 1fr 2fr 1fr 1fr 1fr;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
.warehouse-shipping-note-modal-hours-entry-container.hideHourlyPrice {
|
||||
grid-template-columns: 2fr 1fr 1fr 2fr 1fr 1fr;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.modal-lg, .modal-xl {
|
||||
/*max width either 90% or 1120px*/
|
||||
max-width: min(90vw, 1120px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.warehouse-shipping-note-modal-positions-entry-container,
|
||||
.warehouse-shipping-note-modal-hours-entry-container{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr !important;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
.signModal > div {
|
||||
margin: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
max-height: unset;
|
||||
max-width: unset;
|
||||
}
|
||||
|
||||
.signModal .modal-content {
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.signModal .modal-body {
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.signModal .modal-footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,11 @@
|
||||
const defaultCrudModalData = {
|
||||
billingAddressId: '',
|
||||
deliveryAddressName: '',
|
||||
deliveryAddressLine: '',
|
||||
deliveryAddressPLZ: '',
|
||||
deliveryAddressCity: '',
|
||||
status: 'new',
|
||||
positions: [],
|
||||
textElements: {}
|
||||
}
|
||||
|
||||
window.crudModalStatusOptions =
|
||||
[{value: 'new', text: 'Neu'}, {value: 'accepted', text: 'Akzeptiert'}, {value: 'invoiced', text: 'In Rechnung gestellt'}]
|
||||
|
||||
// create a additional vue component for showing positions in the table with lazy loading for article titles and description
|
||||
Vue.component('warehouse-shipping-note-positions', {
|
||||
//language=Vue
|
||||
props: {
|
||||
positions: Array
|
||||
props: {
|
||||
positions: Array,
|
||||
hoursEntries: Array
|
||||
}, data() {
|
||||
return {
|
||||
articleData: {}, loading: false, articlePacketData: {}
|
||||
articleData: {}, loading: false, articlePacketData: {}, userData: {}
|
||||
}
|
||||
}, template: `
|
||||
<div>
|
||||
@@ -30,8 +16,13 @@ Vue.component('warehouse-shipping-note-positions', {
|
||||
|
||||
<ul v-if="!loading">
|
||||
<li v-for="position in positions">
|
||||
<span>{{ position.amount }}x {{ position.article ? articleData[position.article]?.text : articlePacketData[position.articlePacket]?.text }}</span>
|
||||
<span>{{ position.amount }}x
|
||||
{{ position.article ? articleData[position.article]?.text : position.articlePacket ? articlePacketData[position.articlePacket]?.text : position.articleText }}</span>
|
||||
</li>
|
||||
<template v-for="entry in hoursEntries">
|
||||
<li><span>{{ entry.hourCount }}h Arbeitszeit</span></li>
|
||||
<li v-if="entry.carId">{{entry.kilometerCount}}km Anfahrt</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
`, async mounted() {
|
||||
@@ -45,306 +36,51 @@ Vue.component('warehouse-shipping-note-positions', {
|
||||
this.$set(this.articlePacketData, position.articlePacket, response.data[0]);
|
||||
}
|
||||
}
|
||||
for (const entry of this.hoursEntries) {
|
||||
if (entry.userId) {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/userAutoComplete?searchedID=' + entry.userId);
|
||||
this.$set(this.userData, entry.userId, response.data[0]);
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// noinspection JSUnusedLocalSymbols
|
||||
Vue.component('warehouse-shipping-note', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<tt-card>
|
||||
<tt-modal :show.sync="crudModal" :id="crudModalId"
|
||||
:delete="false"
|
||||
@submit="createOrUpdate()"
|
||||
:title="crudModalId === 'create' ? 'Lieferschein erstellen' : 'Lieferschein bearbeiten'">
|
||||
<tt-autocomplete v-model="crudModalData.billingAddressId"
|
||||
:api-url="window.TT_CONFIG['BASE_PATH'] + '/Address/Api?do=findAddress'"
|
||||
label="Rechnungsadresse" sm row/>
|
||||
|
||||
<tt-select
|
||||
v-if="crudModalId === 'create'"
|
||||
v-model="crudModalSelectDeliveryAddressMode" :options="crudModalSelectDeliveryAddressModeItems" label="Lieferadresse Art" sm
|
||||
row/>
|
||||
|
||||
<template v-if="crudModalSelectDeliveryAddressMode === 'existing'">
|
||||
<tt-select v-model="crudModalDataDeliveryAddressSelected" :options="crudModalDataDeliveryAddressOptions" label="Lieferadresse" sm row/>
|
||||
</template>
|
||||
<template v-else-if="crudModalSelectDeliveryAddressMode === 'new'">
|
||||
<tt-input v-model="crudModalData.deliveryAddressName" label="Lieferadresse Name" sm row/>
|
||||
<tt-input v-model="crudModalData.deliveryAddressLine" label="Lieferadresse" sm row/>
|
||||
<tt-input v-model="crudModalData.deliveryAddressPLZ" label="Lieferadresse PLZ" sm row/>
|
||||
<tt-input v-model="crudModalData.deliveryAddressCity" label="Lieferadresse Ort" sm row/>
|
||||
</template>
|
||||
<tt-select v-if="crudModalVerifyMode === true" v-model="crudModalData.status" :options="window.crudModalStatusOptions" label="Status" sm
|
||||
row/>
|
||||
|
||||
<!-- show a checkbox for each textElement and if selected set it to selected [{"id":1,"title":"Zahlhinweis","content":"Bezahlung in 14 tagen","create":1728456765,"createBy":145}]-->
|
||||
<template>
|
||||
<hr>
|
||||
<h4 class="text-center">Texte</h4>
|
||||
<div v-for="textElement in textElements" style="display: inline-block; margin-right: 10px;">
|
||||
<input type="checkbox" v-model="crudModalData.textElements[textElement.id]" :id="'textElement' + textElement.id">
|
||||
<label :for="'textElement' + textElement.id">{{ textElement.title }}</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<hr>
|
||||
<h4 class="text-center">Positionen</h4>
|
||||
|
||||
|
||||
<template v-if="crudModalData.billingAddressId">
|
||||
<div style="display: flex; justify-content: space-around;padding: 10px;">
|
||||
<tt-autocomplete v-model="crudModalAddPositionArticle" :api-url="window.TT_CONFIG['BASE_PATH'] + '/WarehouseArticle/autoComplete'"
|
||||
placeholder="Artikel" sm row/>
|
||||
<tt-input v-model="crudModalAddPositionAmount" placeholder="Menge" sm row/>
|
||||
<tt-input v-model="crudModalAddPositionPrice" placeholder="Preis" type="number" sm row/>
|
||||
<button style="max-height: 29px" class="btn btn-sm btn-primary" @click="addPosition">Hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Position</th>
|
||||
<th>Artikel</th>
|
||||
<th>Menge</th>
|
||||
<th>Preis</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(position, index) in crudModalData.positions">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ position.article ? articleNames[position.article] : articlePacketNames[position.articlePacket] }}</td>
|
||||
<td>{{ position.amount }}</td>
|
||||
<td>{{ (position.price?.toFixed(2)) }} €</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-danger" @click="crudModalData.positions.splice(index, 1)">Löschen</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</template>
|
||||
<template v-else>
|
||||
<h5 class="text-center">Rechnungsadresse auswählen um Positionen hinzuzufügen</h5>
|
||||
</template>
|
||||
|
||||
|
||||
</tt-modal>
|
||||
|
||||
<warehouse-shipping-note-modal v-if="shippingNoteModalId" :id="shippingNoteModalId" @close="shippingNoteModalId = null;$refs.table.$refs.table.refreshTable()"
|
||||
@open-signing-modal="signingShippingNoteId = $event"/>
|
||||
<warehouse-history-modal :show.sync="historyModal" :id="historyModalId"/>
|
||||
<warehouse-shipping-note-signature-pad v-if="signingShippingNoteId" :shipping-note-id="signingShippingNoteId" @close="signingShippingNoteId = null"/>
|
||||
|
||||
<button @click="openCrudModal('create')" class="btn btn-primary">Lieferschein erstellen</button>
|
||||
<button @click="openVerifyModal" class="btn btn-primary">Lieferscheine Freigeben</button>
|
||||
<button @click="openBilledModal" class="btn btn-primary">Lieferscheine als verrechnet markieren</button>
|
||||
<button @click="shippingNoteModalId = 'create'" class="btn btn-primary">Lieferschein erstellen</button>
|
||||
|
||||
<tt-table-crud emit-edit
|
||||
@openHistory="historyModal = true; historyModalId = $event.id"
|
||||
@print="window.open(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/createPDF?id=' + $event.id)"
|
||||
@printWithPrice="window.open(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/createPDF?id=' + $event.id + '&price=true')"
|
||||
@edit="openCrudModal($event)"
|
||||
@edit="shippingNoteModalId = $event.id"
|
||||
ref="table">
|
||||
|
||||
<template v-slot:expandedRow="{ row }">
|
||||
<warehouse-shipping-note-positions :positions="JSON.parse(row.positions)"/>
|
||||
<warehouse-shipping-note-positions :positions="JSON.parse(row.positions)" :hours-entries="JSON.parse(row.hoursEntries)"/>
|
||||
</template>
|
||||
|
||||
</tt-table-crud>
|
||||
</tt-card>
|
||||
`, data() {
|
||||
return {
|
||||
window: window,
|
||||
historyModal: false,
|
||||
historyModalId: null,
|
||||
crudModal: false,
|
||||
crudModalSelectDeliveryAddressModeItems: [{text: 'Wie Rechnungsadresse', value: 'billing'},
|
||||
{text: 'Bestehende Lieferadresse', value: 'existing'},
|
||||
{text: 'Neue Lieferadresse', value: 'new'}],
|
||||
crudModalSelectDeliveryAddressMode: 'billing',
|
||||
crudModalDataDeliveryAddressOptions: [],
|
||||
crudModalDataDeliveryAddressSelected: '',
|
||||
crudModalVerifyMode: false,
|
||||
crudModalId: null,
|
||||
crudModalData: defaultCrudModalData,
|
||||
crudModalAddPositionArticle: '',
|
||||
crudModalAddPositionAmount: '',
|
||||
crudModalAddPositionPrice: '',
|
||||
articleNames: {},
|
||||
articlePacketNames: {},
|
||||
textElements: [],
|
||||
window: window,
|
||||
historyModal: false,
|
||||
historyModalId: null,
|
||||
shippingNoteModalId: null,
|
||||
signingShippingNoteId: null
|
||||
}
|
||||
}, async mounted() {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getAllTextElements');
|
||||
this.textElements = response.data;
|
||||
},
|
||||
methods: {
|
||||
|
||||
methods: {
|
||||
async openBilledModal() {
|
||||
const unbilledShippingNotes = await axios.post(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/get', {
|
||||
"pagination": {"page": 1, "per_page": 1}, "filters": {
|
||||
"status": "accepted"
|
||||
}, "order": {"key": null, "order": "asc"}
|
||||
});
|
||||
|
||||
if (unbilledShippingNotes.data.rows.length === 0) {
|
||||
this.window.notify('warning', 'Keine Lieferscheine zum Verrechnen gefunden');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.openCrudModal(unbilledShippingNotes.data.rows[0]);
|
||||
this.crudModalVerifyMode = true;
|
||||
},
|
||||
async openVerifyModal() {
|
||||
const unverifiedShippingNotes = await axios.post(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/get', {
|
||||
"pagination": {"page": 1, "per_page": 1}, "filters": {
|
||||
"status": "new"
|
||||
}, "order": {"key": null, "order": "asc"}
|
||||
});
|
||||
|
||||
if (unverifiedShippingNotes.data.rows.length === 0) {
|
||||
this.window.notify('warning', 'Keine Lieferscheine zum Freigeben gefunden');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.openCrudModal(unverifiedShippingNotes.data.rows[0]);
|
||||
this.crudModalVerifyMode = true;
|
||||
|
||||
}, resetCrudModalData() {
|
||||
this.crudModalData.billingAddressId = '';
|
||||
this.crudModalData.deliveryAddressName = '';
|
||||
this.crudModalData.deliveryAddressLine = '';
|
||||
this.crudModalData.deliveryAddressPLZ = '';
|
||||
this.crudModalData.deliveryAddressCity = '';
|
||||
this.crudModalAddPositionArticle = '';
|
||||
this.crudModalAddPositionAmount = '';
|
||||
this.crudModalAddPositionPrice = '';
|
||||
this.crudModalSelectDeliveryAddressMode = 'billing';
|
||||
this.crudModalDataDeliveryAddressSelected = '';
|
||||
this.crudModal = false;
|
||||
}, async openCrudModal(data) {
|
||||
this.resetCrudModalData();
|
||||
this.crudModalVerifyMode = false;
|
||||
if (data === 'create') {
|
||||
this.crudModalId = 'create'
|
||||
this.crudModalData = defaultCrudModalData
|
||||
this.crudModal = true
|
||||
} else {
|
||||
this.crudModalSelectDeliveryAddressMode = 'new';
|
||||
const disconnectedData = JSON.parse(JSON.stringify(data));
|
||||
|
||||
if (disconnectedData.status !== 'new' && disconnectedData.status !== 'accepted') {
|
||||
this.window.notify('warning', 'Lieferschein kann nicht bearbeitet werden, da er bereits in Rechnung gestellt wurde');
|
||||
return;
|
||||
}
|
||||
|
||||
disconnectedData.textElements = JSON.parse(disconnectedData.textElements);
|
||||
disconnectedData.positions = JSON.parse(disconnectedData.positions);
|
||||
for (const position of disconnectedData.positions) {
|
||||
if (position.article) await this.fetchArticleNames(position.article);
|
||||
if (position.articlePacket) await this.fetchArticlePacketNames(position.articlePacket);
|
||||
}
|
||||
this.crudModalId = 'update'
|
||||
this.crudModalData = disconnectedData
|
||||
this.crudModal = true
|
||||
}
|
||||
}, async addPosition() {
|
||||
const missingFields = [];
|
||||
|
||||
// ---------- Check Required Fields ----------
|
||||
|
||||
if (!this.crudModalAddPositionArticle) missingFields.push('Artikel');
|
||||
if (!this.crudModalAddPositionAmount) missingFields.push('Menge');
|
||||
if (!this.crudModalAddPositionPrice) missingFields.push('Preis-Überschreibung');
|
||||
if (missingFields.length > 0) {
|
||||
window.notify('error', 'Bitte füllen Sie die folgenden Felder aus: ' + missingFields.join(', '));
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------- Check if same article is already in positions ----------
|
||||
|
||||
const articleAlreadyInPositions = this.crudModalData.positions.find(position => position.article === this.crudModalAddPositionArticle);
|
||||
if (articleAlreadyInPositions) {
|
||||
window.notify('error', 'Artikel ist bereits in den Positionen enthalten');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.fetchArticleNames(this.crudModalAddPositionArticle);
|
||||
|
||||
this.crudModalData.positions.push({
|
||||
article: this.crudModalAddPositionArticle, amount: this.crudModalAddPositionAmount, price: parseFloat(this.crudModalAddPositionPrice)
|
||||
});
|
||||
|
||||
//TODO: post to server
|
||||
}, async fetchArticleNames(articleId) {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseArticle/autoComplete?searchedID=' + articleId);
|
||||
this.$set(this.articleNames, articleId, response.data[0].text);
|
||||
}, async fetchArticlePacketNames(articlePacketId) {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseArticlePacket/autoComplete?searchedID=' + articlePacketId);
|
||||
this.$set(this.articlePacketNames, articlePacketId, response.data[0].text);
|
||||
}, async createOrUpdate() {
|
||||
const response = await axios.post(this.crudModalId === 'create' ? window['TT_CONFIG']['CREATE_URL'] : window['TT_CONFIG']['UPDATE_URL'],
|
||||
this.crudModalData);
|
||||
if (response.data.success) {
|
||||
this.$refs.table.$refs.table.refreshTable();
|
||||
this.resetCrudModalData();
|
||||
this.window.notify('success', response.data.message || 'Erfolgreich gespeichert');
|
||||
} else {
|
||||
this.window.notify('error',
|
||||
response.data.errors ? Object.values(response.data.errors).join('<br>') : response.data.message || 'Ein Fehler ist aufgetreten');
|
||||
}
|
||||
}, async fetchDeliveryAddresses() {
|
||||
if (!this.crudModalData.billingAddressId || this.crudModalSelectDeliveryAddressMode !== 'existing' && this.crudModalSelectDeliveryAddressMode !== 'billing') return;
|
||||
|
||||
if (this.crudModalSelectDeliveryAddressMode === 'billing') {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/Address/api?do=getAddress&id=' + this.crudModalData.billingAddressId);
|
||||
if (response.data.status !== 'OK' || !response.data.result.address) {
|
||||
window.notify('error', 'Rechnungsadresse konnte nicht gefunden werden');
|
||||
return;
|
||||
}
|
||||
|
||||
this.crudModalData.deliveryAddressName =
|
||||
response.data.result.address.company || response.data.result.address.firstname + ' ' + response.data.result.address.lastname;
|
||||
this.crudModalData.deliveryAddressLine = response.data.result.address.street;
|
||||
this.crudModalData.deliveryAddressPLZ = response.data.result.address.zip;
|
||||
this.crudModalData.deliveryAddressCity = response.data.result.address.city;
|
||||
}
|
||||
if (!this.crudModalData.billingAddressId || this.crudModalSelectDeliveryAddressMode !== 'existing') return;
|
||||
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] +
|
||||
'/WarehouseShippingNote/getDeliveryAddresses?billingAddressId=' +
|
||||
this.crudModalData.billingAddressId);
|
||||
|
||||
this.crudModalDataDeliveryAddressOptions = response.data.map(address => {
|
||||
address.value = address.id;
|
||||
address.text = `${address.deliveryAddressName} - ${address.deliveryAddressLine}, ${address.deliveryAddressPLZ} ${address.deliveryAddressCity}`;
|
||||
return address;
|
||||
});
|
||||
}
|
||||
}, watch: {
|
||||
crudModalAddPositionArticle: async function (newValue) {
|
||||
if (!newValue) return;
|
||||
|
||||
const url = `${window.TT_CONFIG["BASE_PATH"]}/WarehouseShippingNote/getArticleAddressPrice?articleId=${newValue}&addressId=${this.crudModalData.billingAddressId}`;
|
||||
const response = await axios.get(url);
|
||||
this.crudModalAddPositionPrice = response.data.price;
|
||||
},
|
||||
crudModalData: {handler: 'fetchDeliveryAddresses', deep: true},
|
||||
crudModalSelectDeliveryAddressMode: {handler: 'fetchDeliveryAddresses', deep: true},
|
||||
crudModalDataDeliveryAddressSelected: function (newValue) {
|
||||
if (!newValue) return;
|
||||
|
||||
const selectedAddress = this.crudModalDataDeliveryAddressOptions.find(address => address.id === parseInt(newValue));
|
||||
if (!selectedAddress) {
|
||||
window.notify('error', 'Lieferadresse konnte nicht gefunden werden');
|
||||
return;
|
||||
}
|
||||
|
||||
this.crudModalData.deliveryAddressName = selectedAddress.deliveryAddressName;
|
||||
this.crudModalData.deliveryAddressLine = selectedAddress.deliveryAddressLine;
|
||||
this.crudModalData.deliveryAddressPLZ = selectedAddress.deliveryAddressPLZ;
|
||||
this.crudModalData.deliveryAddressCity = selectedAddress.deliveryAddressCity;
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,731 @@
|
||||
Vue.component('warehouse-shipping-note-modal-text-elements', {
|
||||
props: {
|
||||
textElements: Array
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
textElementsData: [],
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div style="display: flex; align-items: center; justify-content: center;">
|
||||
<template v-if="textElementsData.length > 0">
|
||||
<div v-for="textElement in textElementsData" style="display: inline-block; margin-right: 10px;">
|
||||
<input type="checkbox" v-model="textElements[textElement.id]" :id="'textElement' + textElement.id">
|
||||
<label :for="'textElement' + textElement.id" :title="textElement.content">{{ textElement.title }}</label>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="text-center">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
`,
|
||||
async mounted() {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getAllTextElements');
|
||||
this.textElementsData = response.data;
|
||||
}
|
||||
})
|
||||
|
||||
// TODO: maybe also think about creating a component for simple forms like this
|
||||
Vue.component('warehouse-shipping-note-modal-hours-entry', {
|
||||
props: {
|
||||
index: {type: [Number], required: false, default: null},
|
||||
showHourlyPrice: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
userApiUrl: window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/userAutoComplete',
|
||||
carApiUrl: window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/timerecordingCarAutoComplete',
|
||||
userId: '',
|
||||
carId: '',
|
||||
date: '',
|
||||
hourCount: '',
|
||||
kilometerCount: '',
|
||||
hourlyPrice: '',
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div class="warehouse-shipping-note-modal-hours-entry-container" v-bind:class="{ 'hideHourlyPrice': !showHourlyPrice }">
|
||||
<tt-autocomplete v-model="userId" :api-url="userApiUrl" label="Mitarbeiter" sm/>
|
||||
<tt-input v-model="date" label="Datum" type="date" sm/>
|
||||
<tt-input v-model="hourCount" label="Stunden" sm/>
|
||||
<tt-autocomplete v-model="carId" :api-url="carApiUrl" label="Fahrzeug" sm/>
|
||||
<tt-input v-model="hourlyPrice" label="Stundenlohn" type="number" sm v-if="showHourlyPrice"/>
|
||||
<tt-input v-model="kilometerCount" label="Kilometer" sm/>
|
||||
<div class="warehouse-shipping-note-modal-hours-entry-actions">
|
||||
<button @click="createOrUpdate" class="btn btn-sm btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
async createOrUpdate() {
|
||||
if (!this.userId || !this.date || !this.hourCount) {
|
||||
this.window.notify('error', 'Bitte füllen Sie alle Felder aus');
|
||||
return;
|
||||
}
|
||||
|
||||
this.$emit(this.index === null ? 'create' : 'update', {
|
||||
userId: this.userId,
|
||||
date: this.date,
|
||||
hourCount: this.hourCount,
|
||||
hourlyPrice: this.hourlyPrice || null,
|
||||
carId: this.carId ? this.carId : null,
|
||||
kilometerCount: this.carId ? this.kilometerCount : null
|
||||
});
|
||||
// TODO: maybe make this cleaner
|
||||
Object.assign(this.$data, this.$options.data.apply(this))
|
||||
await this.$nextTick();
|
||||
this.userId = this.window.TT_CONFIG['USER_ID']
|
||||
this.updateDate();
|
||||
this.updateKilometerCount().then();
|
||||
this.updateCarId().then();
|
||||
},
|
||||
async updateKilometerCount() {
|
||||
const delAddr = this.$parent.$parent.$parent.delAddrLine +
|
||||
' ' +
|
||||
this.$parent.$parent.$parent.delAddrCity +
|
||||
' ' +
|
||||
this.$parent.$parent.$parent.delAddrPLZ;
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getDistance?from=Xinon%20GmbH&to=' + delAddr);
|
||||
this.kilometerCount = response.data.distance
|
||||
},
|
||||
async updateCarId() {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/timerecordingCarForUser?userId=' + this.userId);
|
||||
if (response.data.status === 'USER_NO_CAR') {
|
||||
this.window.notify('info', 'Kein zugewiesenes Fahrzeug gefunden');
|
||||
return;
|
||||
}
|
||||
this.carId = response.data.id;
|
||||
},
|
||||
updateDate() {
|
||||
if (!this.date) {
|
||||
const today = new Date();
|
||||
const dd = String(today.getDate()).padStart(2, '0');
|
||||
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const yyyy = today.getFullYear();
|
||||
this.date = `${yyyy}-${mm}-${dd}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
if (!this.carId) this.updateCarId().then();
|
||||
if (!this.userId) this.userId = this.window.TT_CONFIG['USER_ID'];
|
||||
if (!this.date) this.updateDate();
|
||||
if (!this.kilometerCount) this.updateKilometerCount().then();
|
||||
|
||||
this.$parent.$parent.$parent.$watch('delAddrLine', this.updateKilometerCount);
|
||||
}
|
||||
})
|
||||
|
||||
// TODO: we should create this to a tt-simple-table component
|
||||
Vue.component('warehouse-shipping-note-modal-hours-view', {
|
||||
props: {
|
||||
hoursEntries: {type: Array, required: true},
|
||||
showHourlyPrice: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
userNames: {}
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div style="display: flex; align-items: center; justify-content: center;">
|
||||
<table class="table table-striped table-sm" style="width: max-content">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mitarbeiter</th>
|
||||
<th>Datum</th>
|
||||
<th>ST</th>
|
||||
<th>KM</th>
|
||||
<th v-if="showHourlyPrice">Stundenlohn</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="hoursEntries.length === 0">
|
||||
<td colspan="6" class="text-center">Keine Einträge</td>
|
||||
</tr>
|
||||
<tr v-for="entry in hoursEntries">
|
||||
<td>{{ userNames[entry.userId] }}</td>
|
||||
<td>{{ window.moment(entry.date).format('DD.MM.YYYY') }}</td>
|
||||
<td>{{ entry.hourCount }}</td>
|
||||
<td>{{ entry.kilometerCount }}</td>
|
||||
<td v-if="showHourlyPrice">{{ entry.hourlyPrice }}</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-danger" @click="$emit('delete', entry)">Löschen</button>
|
||||
<button class="btn btn-sm btn-primary" @click="$emit('edit', entry)">Bearbeiten</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`,
|
||||
// add a method and a watcher to fetch the user names
|
||||
methods: {
|
||||
async fetchUserNames() {
|
||||
for (const entry of this.hoursEntries) {
|
||||
if (!entry.userId) continue;
|
||||
if (entry.userId in this.userNames) continue;
|
||||
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/userAutoComplete?searchedID=' + entry.userId);
|
||||
this.$set(this.userNames, entry.userId, response.data[0].text);
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
hoursEntries: {
|
||||
handler: 'fetchUserNames', immediate: true
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// this component will combine the above 2 components and show the entries and the input fields
|
||||
Vue.component('warehouse-shipping-note-modal-hours', {
|
||||
props: {
|
||||
hoursEntries: {type: Array, required: true},
|
||||
showHourlyPrice: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
selectedUpdateIndex: null,
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
<warehouse-shipping-note-modal-hours-entry @create="create" @update="update" :index.sync="selectedUpdateIndex"
|
||||
:show-hourly-price="showHourlyPrice" ref="entry"/>
|
||||
<warehouse-shipping-note-modal-hours-view @delete="deleteEntry" @edit="editEntry" :hours-entries="hoursEntries"
|
||||
:show-hourly-price="showHourlyPrice"/>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
create(entry) {
|
||||
this.$emit('update:hoursEntries', [...this.hoursEntries, entry]);
|
||||
this.window.notify('success', 'Eintrag erstellt');
|
||||
},
|
||||
update(entry) {
|
||||
this.$emit('update:hoursEntries', this.hoursEntries.map((oldEntry, index) => index === this.selectedUpdateIndex ? entry : oldEntry));
|
||||
this.window.notify('success', 'Eintrag aktualisiert');
|
||||
this.selectedUpdateIndex = null;
|
||||
},
|
||||
deleteEntry(entry) {
|
||||
this.$emit('update:hoursEntries', this.hoursEntries.filter(oldEntry => oldEntry !== entry));
|
||||
this.window.notify('success', 'Eintrag gelöscht');
|
||||
},
|
||||
editEntry(entry) {
|
||||
this.selectedUpdateIndex = this.hoursEntries.indexOf(entry);
|
||||
this.$refs.entry.userId = entry.userId;
|
||||
this.$refs.entry.date = entry.date;
|
||||
this.$refs.entry.hourCount = entry.hourCount;
|
||||
this.$refs.entry.note = entry.note;
|
||||
this.$refs.entry.hourlyPrice = entry.hourlyPrice;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// now we need the same as above for positions
|
||||
// so we need warehouse-shipping-note-modal-positions-entry, warehouse-shipping-note-modal-positions-view and warehouse-shipping-note-modal-positions
|
||||
// positions have a article or article packet, amount and price
|
||||
// when a article or article packet is selected we should fetch the name and description
|
||||
// then fetch the default price for the address
|
||||
Vue.component('warehouse-shipping-note-modal-positions-entry', {
|
||||
props: {
|
||||
index: {type: [Number], required: false, default: null},
|
||||
billAddrId: {type: [String, Number], required: true},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
articleApiUrl: window.TT_CONFIG['BASE_PATH'] + '/WarehouseArticle/autoComplete',
|
||||
articlePacketApiUrl: window.TT_CONFIG['BASE_PATH'] + '/WarehouseArticlePacket/autoComplete',
|
||||
articleId: '',
|
||||
articlePacketId: '',
|
||||
amount: '',
|
||||
price: '',
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div class="warehouse-shipping-note-modal-positions-entry-container">
|
||||
<tt-autocomplete v-model="articleId" :api-url="articleApiUrl" label="Artikel" sm ref="article"/>
|
||||
<!-- <tt-autocomplete v-model="articlePacketId" :api-url="articlePacketApiUrl" label="Artikel Packet" sm/>-->
|
||||
<tt-input v-model="amount" label="Menge" sm/>
|
||||
<tt-input v-model="price" label="Preis" type="number" sm/>
|
||||
<div class="warehouse-shipping-note-modal-positions-entry-actions">
|
||||
<button @click="createOrUpdate" class="btn btn-sm btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
// TODO: if articlePacket is needed we need to implement this
|
||||
async createOrUpdate() {
|
||||
if (!this.amount) return this.window.notify('error', 'Bitte füllen sie die Menge aus');
|
||||
if (!this.price) return this.window.notify('error', 'Bitte füllen sie den Preis aus');
|
||||
const data = {
|
||||
amount: this.amount,
|
||||
price: parseFloat(this.price)
|
||||
}
|
||||
if (!this.articleId && this.$refs.article.displayValue) {
|
||||
data.articleText = this.$refs.article.displayValue;
|
||||
} else if (this.articleId) {
|
||||
data.article = this.articleId;
|
||||
} else {
|
||||
return this.window.notify('error', 'Bitte wählen Sie einen Artikel aus');
|
||||
}
|
||||
|
||||
this.$emit(this.index === null ? 'create' : 'update', data);
|
||||
Object.assign(this.$data, this.$options.data.apply(this))
|
||||
},
|
||||
async fetchPrice() {
|
||||
if (!this.articleId && !this.articlePacketId || !this.billAddrId) return;
|
||||
|
||||
const url = `${window.TT_CONFIG["BASE_PATH"]}/WarehouseShippingNote/getArticleAddressPrice?articleId=${this.articleId ||
|
||||
this.articlePacketId}&addressId=${this.billAddrId}`;
|
||||
const response = await axios.get(url);
|
||||
this.price = response.data.price;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
articleId: {handler: 'fetchPrice', immediate: false},
|
||||
articlePacketId: {handler: 'fetchPrice', immediate: false},
|
||||
billAddrId: {handler: 'fetchPrice', immediate: false},
|
||||
},
|
||||
})
|
||||
|
||||
// here will warehouse-shipping-note-modal-positions-view show the positions in a table
|
||||
Vue.component('warehouse-shipping-note-modal-positions-view', {
|
||||
props: {
|
||||
positions: {type: Array, required: true},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
articleNames: {},
|
||||
articlePacketNames: {},
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div style="display: flex; align-items: center; justify-content: center;">
|
||||
<table class="table table-striped table-sm" style="width: max-content">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Artikel</th>
|
||||
<th>Menge</th>
|
||||
<th>Preis</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="positions.length === 0">
|
||||
<td colspan="4" class="text-center">Keine Einträge</td>
|
||||
</tr>
|
||||
<tr v-for="position in positions">
|
||||
<td>{{ position.article ? articleNames[position.article] : position.articlePacket ? articlePacketNames[position.articlePacket] : position.articleText }}</td>
|
||||
<td>{{ position.amount }}</td>
|
||||
<td>{{ (position.price?.toFixed(2)) }} €</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-danger" @click="$emit('delete', position)">Löschen</button>
|
||||
<button class="btn btn-sm btn-primary" @click="$emit('edit', position)">Bearbeiten</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
async fetchNames() {
|
||||
// TODO: there must be a better way to do this
|
||||
for (const position of this.positions) {
|
||||
if (position.article) this.$set(this.articleNames, position.article, 'Loading...');
|
||||
if (position.articlePacket) this.$set(this.articlePacketNames, position.articlePacket, 'Loading...');
|
||||
}
|
||||
|
||||
const articlePromises = this.positions.filter(position => position.article)
|
||||
.map(position => axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseArticle/autoComplete?searchedID=' + position.article));
|
||||
const articlePacketPromises = this.positions.filter(position => position.articlePacket)
|
||||
.map(position => axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseArticlePacket/autoComplete?searchedID=' + position.articlePacket));
|
||||
|
||||
const articleResponses = await Promise.all(articlePromises);
|
||||
const articlePacketResponses = await Promise.all(articlePacketPromises);
|
||||
|
||||
for (const response of articleResponses) {
|
||||
this.$set(this.articleNames, response.data[0].value, response.data[0].text);
|
||||
}
|
||||
|
||||
for (const response of articlePacketResponses) {
|
||||
this.$set(this.articlePacketNames, response.data[0].value, response.data[0].text);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
// watch positions and fetch article / article packet names - and initially fill them with Loading...
|
||||
watch: {
|
||||
positions: {
|
||||
handler: 'fetchNames', immediate: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// and here we combine the above 2 components
|
||||
Vue.component('warehouse-shipping-note-modal-positions', {
|
||||
props: {
|
||||
positions: {type: Array, required: true},
|
||||
billAddrId: {type: [String, Number], required: true},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
articleNames: {},
|
||||
articlePacketNames: {},
|
||||
selectedUpdateIndex: null,
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
<warehouse-shipping-note-modal-positions-entry @create="create" @update="update" :index.sync="selectedUpdateIndex" :bill-addr-id="billAddrId"
|
||||
ref="entry"/>
|
||||
<warehouse-shipping-note-modal-positions-view @delete="deleteEntry" @edit="editEntry" :positions="positions"/>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
create(entry) {
|
||||
this.$emit('update:positions', [...this.positions, entry]);
|
||||
this.window.notify('success', 'Eintrag erstellt');
|
||||
},
|
||||
update(entry) {
|
||||
this.$emit('update:positions', this.positions.map((oldEntry, index) => index === this.selectedUpdateIndex ? entry : oldEntry));
|
||||
this.window.notify('success', 'Eintrag aktualisiert');
|
||||
this.selectedUpdateIndex = null;
|
||||
},
|
||||
deleteEntry(entry) {
|
||||
this.$emit('update:positions', this.positions.filter(oldEntry => oldEntry !== entry));
|
||||
this.window.notify('success', 'Eintrag gelöscht');
|
||||
},
|
||||
editEntry(entry) {
|
||||
this.selectedUpdateIndex = this.positions.indexOf(entry);
|
||||
if (entry.article)this.$refs.entry.articleId = entry.article;
|
||||
if (entry.articlePacket) this.$refs.entry.articlePacketId = entry.articlePacket;
|
||||
if (entry.articleText) this.$refs.entry.$refs.article.displayValue = entry.articleText;
|
||||
this.$refs.entry.amount = entry.amount;
|
||||
this.$refs.entry.price = entry.price;
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Vue.component('warehouse-shipping-note-modal', {
|
||||
props: {
|
||||
id: {type: [String, Number], required: true},
|
||||
// available modes are ['sign', 'edit', 'accept', 'create']
|
||||
mode: {type: String, default: 'sign'}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
billAddrAutoCompleteUrl: window.TT_CONFIG['BASE_PATH'] + '/Address/Api?do=findAddress',
|
||||
billAddrId: '',
|
||||
delAddrName: '',
|
||||
delAddrLine: '',
|
||||
delAddrPLZ: '',
|
||||
delAddrCity: '',
|
||||
delAddrEMail: '',
|
||||
status: '',
|
||||
note: '',
|
||||
textElements: [],
|
||||
hoursEntries: [],
|
||||
positions: [],
|
||||
}
|
||||
},
|
||||
|
||||
//language=Vue
|
||||
template: `
|
||||
<tt-modal :show="true" @submit="submit" :delete="false" :title="title" @update:show="$emit('close')">
|
||||
<div style="width: 99%">
|
||||
<h4 class="text-center">Liefer- und Rechnungsadresse</h4>
|
||||
<tt-autocomplete v-model="billAddrId" :api-url="billAddrAutoCompleteUrl" label="Rechnungsadresse" sm row/>
|
||||
<warehouse-shipping-note-modal-address :billAddrId="billAddrId" :del-addr-name.sync="delAddrName" :del-addr-line.sync="delAddrLine"
|
||||
:del-addr-p-l-z.sync="delAddrPLZ" :del-addr-city.sync="delAddrCity"
|
||||
:del-addr-e-mail.sync="delAddrEMail"/>
|
||||
|
||||
|
||||
<template v-if="billAddrId && delAddrName && delAddrLine && delAddrPLZ && delAddrCity">
|
||||
<hr>
|
||||
<h4 class="text-center">Textelemente</h4>
|
||||
<warehouse-shipping-note-modal-text-elements :text-elements="textElements"/>
|
||||
|
||||
|
||||
<hr>
|
||||
<tt-textarea label="Einleitender Text" v-model="note" sm row/>
|
||||
|
||||
|
||||
<hr>
|
||||
<h4 class="text-center">Stunden</h4>
|
||||
<warehouse-shipping-note-modal-hours :hours-entries.sync="hoursEntries" :show-hourly-price="false"/>
|
||||
|
||||
|
||||
<hr>
|
||||
<h4 class="text-center">Positionen</h4>
|
||||
<warehouse-shipping-note-modal-positions :positions.sync="positions" :bill-addr-id="billAddrId"/>
|
||||
</template>
|
||||
|
||||
<div v-else class="text-center">Bitte füllen Sie die Rechnungs- und Lieferadresse aus</div>
|
||||
|
||||
</div>
|
||||
<!-- TODO: fix these buttons-->
|
||||
<template v-slot:footer-prepend v-if="id !== 'create'">
|
||||
<button class="btn btn-info" @click="$emit('open-signing-modal', id)">Unterschreiben</button>
|
||||
<!-- <button class="btn btn-success" @click="alert('Accept')">Akzeptieren</button>-->
|
||||
<!-- <button class="btn btn-warning" @click="alert('Invoiced')">Verrechnet</button>-->
|
||||
</template>
|
||||
</tt-modal>
|
||||
`,
|
||||
|
||||
// now we need methods for fetching the shipping note, submiting the shipping note and translate the keys as they are different in the backend
|
||||
async mounted() {
|
||||
// fetch by /getById?id=ID
|
||||
if (this.id !== 'create') {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getById?id=' + this.id);
|
||||
this.billAddrId = response.data.billingAddressId;
|
||||
this.delAddrName = response.data.deliveryAddressName;
|
||||
this.delAddrLine = response.data.deliveryAddressLine;
|
||||
this.delAddrPLZ = response.data.deliveryAddressPLZ;
|
||||
this.delAddrCity = response.data.deliveryAddressCity;
|
||||
this.delAddrEMail = response.data.deliveryAddressEMail;
|
||||
this.note = response.data.note;
|
||||
this.status = response.data.status;
|
||||
|
||||
for (const key of ['textElements', 'hoursEntries', 'positions']) {
|
||||
try {
|
||||
this[key] = JSON.parse(response.data[key]);
|
||||
} catch {
|
||||
this.textElements = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openSigningModal() {
|
||||
|
||||
},
|
||||
async submit() {
|
||||
const data = {
|
||||
billingAddressId: this.billAddrId,
|
||||
deliveryAddressName: this.delAddrName,
|
||||
deliveryAddressLine: this.delAddrLine,
|
||||
deliveryAddressPLZ: this.delAddrPLZ,
|
||||
deliveryAddressCity: this.delAddrCity,
|
||||
deliveryAddressEMail: this.delAddrEMail,
|
||||
textElements: this.textElements,
|
||||
hoursEntries: this.hoursEntries,
|
||||
positions: this.positions,
|
||||
note: this.note,
|
||||
status: this.status ? this.status : 'new'
|
||||
}
|
||||
|
||||
if (this.id !== 'create') data.id = this.id;
|
||||
|
||||
const url = this.id === 'create' ? window.TT_CONFIG['CREATE_URL'] : window.TT_CONFIG['UPDATE_URL'];
|
||||
const response = await axios.post(url, data);
|
||||
|
||||
if (response.data.success) {
|
||||
this.window.notify('success', response.data.message || 'Erfolgreich gespeichert');
|
||||
this.$emit('close');
|
||||
} else {
|
||||
this.window.notify('error',
|
||||
response.data.errors ? Object.values(response.data.errors).join('<br>') : response.data.message || 'Ein Fehler ist aufgetreten');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.id === 'create' ? 'Lieferschein erstellen' : `Lieferschein #${this.id} bearbeiten`;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
Vue.component('warehouse-shipping-note-modal-address', {
|
||||
// also add props for delAddrName, delAddrLine, delAddrPLZ, delAddrCity which we will sync with the parent component
|
||||
props: {
|
||||
billAddrId: {type: [String, Number], required: true},
|
||||
delAddrName: {type: String, required: true},
|
||||
delAddrLine: {type: String, required: true},
|
||||
delAddrPLZ: {type: String, required: true},
|
||||
delAddrCity: {type: String, required: true},
|
||||
delAddrEMail: {type: String, required: true},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
addressModes: [{text: 'Wie Rechnungsadresse', value: 'billing'},
|
||||
{text: 'Bestehende Lieferadresse', value: 'existing'},
|
||||
{text: 'Andere Lieferadresse', value: 'new'}],
|
||||
addressMode: 'existing',
|
||||
addresses: [],
|
||||
fetchedBillAddr: null,
|
||||
selectedAddr: '',
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
<tt-select v-model="addressMode" :options="addressModes" label="Lieferadresse Art" sm row :disabled="billAddrId === ''"/>
|
||||
|
||||
<template v-if="addressMode === 'existing'">
|
||||
<tt-select v-model="selectedAddr" :options="addresses" label="Lieferadresse" sm row/>
|
||||
</template>
|
||||
|
||||
<template v-else-if="addressMode === 'new'">
|
||||
<tt-input v-model="delAddrName" label="Lieferadresse Name" sm row/>
|
||||
<tt-input v-model="delAddrLine" label="Lieferadresse" sm row/>
|
||||
<tt-input v-model="delAddrPLZ" label="Lieferadresse PLZ" sm row/>
|
||||
<tt-input v-model="delAddrCity" label="Lieferadresse Ort" sm row/>
|
||||
<tt-input v-model="delAddrEMail" label="Lieferadresse E-Mail" sm row/>
|
||||
</template>
|
||||
</div>
|
||||
`,
|
||||
watch: {
|
||||
billAddrId: {handler: 'updateBillingMode', immediate: false},
|
||||
addressMode: {handler: 'fetchDeliveryAddresses', immediate: false},
|
||||
selectedAddr: {handler: 'setSelectedAddrValues', immediate: false},
|
||||
},
|
||||
methods: {
|
||||
async updateBillingMode() {
|
||||
await this.fetchDeliveryAddresses();
|
||||
// this.addressMode = 'billing';
|
||||
|
||||
console.log('updateBillingMode');
|
||||
|
||||
// Here we check if the address is already in the list of addresses, if not we will set the addressMode to billing and fetch the billing address
|
||||
if (this.delAddrName && this.delAddrLine && this.delAddrPLZ && this.delAddrCity) {
|
||||
const foundAddress = this.addresses.find(address => address.deliveryAddressName ===
|
||||
this.delAddrName &&
|
||||
address.deliveryAddressLine ===
|
||||
this.delAddrLine &&
|
||||
address.deliveryAddressPLZ ===
|
||||
this.delAddrPLZ &&
|
||||
address.deliveryAddressCity ===
|
||||
this.delAddrCity && address.deliveryAddressEMail === this.delAddrEMail);
|
||||
if (foundAddress) {
|
||||
this.addressMode = 'existing';
|
||||
this.selectedAddr = foundAddress.id;
|
||||
} else {
|
||||
this.addressMode = 'new';
|
||||
}
|
||||
} else {
|
||||
this.addressMode = 'billing';
|
||||
await this.fetchBillingAddress();
|
||||
}
|
||||
},
|
||||
async fetchDeliveryAddresses() {
|
||||
if (this.addressMode === 'billing' && this.billAddrId) {
|
||||
await this.fetchBillingAddress();
|
||||
return;
|
||||
}
|
||||
if (!this.billAddrId || this.addressMode !== 'existing' || this.fetchedBillAddr === this.billAddrId) return;
|
||||
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getDeliveryAddresses?billingAddressId=' + this.billAddrId);
|
||||
|
||||
this.fetchedBillAddr = this.billAddrId;
|
||||
this.addresses = response.data.map(address => {
|
||||
address.value = address.id;
|
||||
address.text = `${address.deliveryAddressName} - ${address.deliveryAddressLine}, ${address.deliveryAddressPLZ} ${address.deliveryAddressCity}`;
|
||||
return address;
|
||||
});
|
||||
},
|
||||
setSelectedAddrValues() {
|
||||
if (!this.selectedAddr) return;
|
||||
|
||||
const selectedAddress = this.addresses.find(address => address.id === parseInt(this.selectedAddr));
|
||||
if (!selectedAddress) {
|
||||
this.window.notify('error', 'Lieferadresse konnte nicht gefunden werden');
|
||||
return;
|
||||
}
|
||||
|
||||
this.$emit('update:delAddrName', selectedAddress.deliveryAddressName);
|
||||
this.$emit('update:delAddrLine', selectedAddress.deliveryAddressLine);
|
||||
this.$emit('update:delAddrPLZ', selectedAddress.deliveryAddressPLZ);
|
||||
this.$emit('update:delAddrCity', selectedAddress.deliveryAddressCity);
|
||||
},
|
||||
async fetchBillingAddress() {
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/Address/api?do=getAddress&id=' + this.billAddrId);
|
||||
if (response.data.status !== 'OK' || !response.data.result.address) {
|
||||
this.window.notify('error', 'Rechnungsadresse konnte nicht gefunden werden');
|
||||
return;
|
||||
}
|
||||
this.window.notify('success', 'Rechnungsadresse gefunden');
|
||||
|
||||
this.$emit('update:delAddrName',
|
||||
response.data.result.address.company || response.data.result.address.firstname + ' ' + response.data.result.address.lastname);
|
||||
this.$emit('update:delAddrLine', response.data.result.address.street);
|
||||
this.$emit('update:delAddrPLZ', response.data.result.address.zip);
|
||||
this.$emit('update:delAddrCity', response.data.result.address.city);
|
||||
this.$emit('update:delAddrEMail', response.data.result.address.email);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// now we need a signature pad component which will fire a close or a signed event and takes shipping note as a prop
|
||||
// when mounted it will load https://cdn.jsdelivr.net/npm/signature_pad@4.1.7/dist/signature_pad.umd.min.js
|
||||
// and display using a tt-modal
|
||||
// and when save/submit is clicked we will send it to /WarehouseShippingNote/sign?id=ID POST with the signature as a base64 encoded image string
|
||||
|
||||
Vue.component('warehouse-shipping-note-signature-pad', {
|
||||
props: {
|
||||
shippingNoteId: {type: Number, required: true}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
signaturePad: null,
|
||||
shippingNote: null,
|
||||
signatureName: '',
|
||||
}
|
||||
},
|
||||
//language=Vue
|
||||
template: `
|
||||
<tt-modal class="signModal" :show="true" :delete="false" :submit="false" @update:show="$emit('close')" :title="'Unterschrift'">
|
||||
<div style="max-width: 520px;display: flex; flex-direction: column; align-items: center;">
|
||||
<div style="width: 480px"><tt-input v-model="signatureName" label="Name" row/></div>
|
||||
<div><canvas id="signature-pad" width="500" height="200" style="border: 1px solid black"></canvas></div>
|
||||
<div>
|
||||
<button class="btn btn-primary" @click="submit()">Speichern</button>
|
||||
<button class="btn btn-primary" @click="signaturePad.clear()">Leeren</button>
|
||||
</div>
|
||||
</div>
|
||||
</tt-modal>
|
||||
`,
|
||||
methods: {
|
||||
async submit() {
|
||||
const data = this.signaturePad.toDataURL();
|
||||
const response = await axios.post(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/sign?id=' + this.shippingNoteId, {signature: data, signatureName: this.signatureName});
|
||||
if (response.data.success) {
|
||||
this.window.notify('success', response.data.message || 'Erfolgreich unterschrieben');
|
||||
this.$emit('close');
|
||||
} else {
|
||||
this.window.notify('error',
|
||||
response.data.errors ? Object.values(response.data.errors).join('<br>') : response.data.message || 'Ein Fehler ist aufgetreten');
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
// fetch shipping note by id
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getById?id=' + this.shippingNoteId);
|
||||
this.shippingNote = response.data;
|
||||
this.signaturePad = new SignaturePad(document.getElementById('signature-pad'));
|
||||
}
|
||||
})
|
||||
6
public/js/pages/WarehouseShippingNote/WarehouseSignaturePad.min.js
vendored
Normal file
6
public/js/pages/WarehouseShippingNote/WarehouseSignaturePad.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -144,13 +144,24 @@ input[type=number]::-webkit-outer-spin-button {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.fa-circle-xmark, .fa-ban, .fa-trash, .fa-edit, .fa-square-check, .fa-arrows-up-down-left-right, .fa-chevron-right {
|
||||
.fa-circle-xmark, .fa-ban, .fa-trash, .fa-arrow-left, .fa-edit, .fa-square-check, .fa-arrows-up-down-left-right, .fa-chevron-right {
|
||||
font-size: 20px !important
|
||||
}
|
||||
|
||||
.tt-table.table-sm > tbody > tr > td * {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 4px;
|
||||
}
|
||||
|
||||
.modal-footer > button {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
td {
|
||||
@@ -262,6 +273,8 @@ td {
|
||||
width: 500px; /* Expanded width */
|
||||
max-width: 85vw;
|
||||
height: 600px; /* Expanded height */
|
||||
max-height: 75vh;
|
||||
overflow: auto;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Vue.component('tt-autocomplete', {
|
||||
template: `
|
||||
<div class="form-group" :class="{'row': row}"
|
||||
:data-api-url="apiUrl"
|
||||
:data-api-url="apiUrl"
|
||||
>
|
||||
<slot name="prepend"></slot>
|
||||
<label :class="{'col-form-label': row, 'col-sm-4': row, 'col-form-label-sm': sm && row}"
|
||||
@@ -24,7 +24,8 @@ Vue.component('tt-autocomplete', {
|
||||
:style="{'padding-right': $slots.append ? '30px' : '0'}"
|
||||
/>
|
||||
<slot name="append"></slot>
|
||||
<button v-show="displayValue.length > 0" @click="displayValue = ''; $emit('input', '');" tabindex="-1" type="button" class="btn btn-link position-absolute"
|
||||
<button v-show="displayValue.length > 0" @click="displayValue = ''; $emit('input', '');" tabindex="-1" type="button"
|
||||
class="btn btn-link position-absolute"
|
||||
style="right: -5px; top: 50%; transform: translateY(-50%);">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
@@ -67,7 +68,7 @@ Vue.component('tt-autocomplete', {
|
||||
</div>
|
||||
`, // TODO: Implement giving the option without the need of an API || need to use computed property to filter the items
|
||||
// TODO: Fix the weirdness with timeout and selecting the suggestion
|
||||
props: {
|
||||
props: {
|
||||
value: {type: [String, Number]},
|
||||
label: {type: String, required: false},
|
||||
apiUrl: String,
|
||||
@@ -76,29 +77,38 @@ Vue.component('tt-autocomplete', {
|
||||
sm: {type: Boolean, default: true},
|
||||
row: {type: Boolean, default: false},
|
||||
}, async mounted() {
|
||||
if (this.value && this.apiUrl) {
|
||||
const response = await axios.get(`${this.apiUrl}&autocomplete=1&searchedID=${this.value}`);
|
||||
this.displayValue = response.data[0].text;
|
||||
} else if (this.value) {
|
||||
const selectedItem = this.items.find(item => item.value === this.value);
|
||||
this.displayValue = selectedItem ? selectedItem.text : '';
|
||||
} else {
|
||||
this.$emit('input', '');
|
||||
this.displayValue = '';
|
||||
}
|
||||
|
||||
this.updateDisplayValue().then();
|
||||
}, data() {
|
||||
return {
|
||||
displayingItems: [], displayValue: '', isLoading: false, showSuggestions: false, cursor: -1, fetchSuggestionsDebounceTimer: null,
|
||||
displayingItems: [], displayValue: '', isLoading: false, showSuggestions: false, cursor: -1, fetchSuggestionsDebounceTimer: null, disableIDFetch: false
|
||||
};
|
||||
}, watch: {
|
||||
value(newValue) {
|
||||
const selectedItem = this.displayingItems.find(item => item.value === newValue);
|
||||
this.displayValue = selectedItem ? selectedItem.text : '';
|
||||
}, apiUrl() {
|
||||
value: {handler: 'updateDisplayValue', immediate: true},
|
||||
apiUrl() {
|
||||
this.fetchSuggestions();
|
||||
},
|
||||
}, methods: {
|
||||
async updateDisplayValue(newValue) {
|
||||
if (this.disableIDFetch) {
|
||||
this.disableIDFetch = false;
|
||||
return;
|
||||
}
|
||||
if (newValue) {
|
||||
this.value = newValue;
|
||||
}
|
||||
|
||||
|
||||
if (this.value && this.apiUrl) {
|
||||
const response = await axios.get(`${this.apiUrl}&autocomplete=1&searchedID=${this.value}`);
|
||||
this.displayValue = response.data[0].text;
|
||||
} else if (this.value) {
|
||||
const selectedItem = this.items.find(item => item.value === this.value);
|
||||
this.displayValue = selectedItem ? selectedItem.text : '';
|
||||
} else {
|
||||
this.$emit('input', '');
|
||||
this.displayValue = '';
|
||||
}
|
||||
},
|
||||
onInput(event) {
|
||||
this.displayValue = event.target.value;
|
||||
this.$emit('input', '');
|
||||
@@ -157,6 +167,7 @@ Vue.component('tt-autocomplete', {
|
||||
}, 100);
|
||||
}, 300); // Adjust the 300ms debounce time as needed
|
||||
}, selectSuggestion(item) {
|
||||
this.disableIDFetch = true;
|
||||
this.$emit('input', item.value);
|
||||
this.displayValue = item.text;
|
||||
this.showSuggestions = false;
|
||||
|
||||
40
public/plugins/vue/tt-components/tt-button.js
Normal file
40
public/plugins/vue/tt-components/tt-button.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// noinspection JSCheckFunctionSignatures
|
||||
Vue.component('tt-button', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<div>
|
||||
<template v-if="href">
|
||||
<a :href="href" class="btn" :class="buttonClasses" onclick="typeof confirmText === 'string' ? confirm(confirmText) : true">
|
||||
<i v-if="icon" :class="icon"></i>
|
||||
{{text}}
|
||||
</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button @click="$emit('click')" class="btn" :class="buttonClasses">
|
||||
<i v-if="icon" :class="icon"></i>
|
||||
{{text}}
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
`, props: {
|
||||
sm: {type: Boolean, default: false},
|
||||
icon: {type: String, required: false},
|
||||
text: {type: String, required: false},
|
||||
href: {type: String, required: false},
|
||||
additionalClass: {type: String, required: false},
|
||||
// TODO: maybe instead of browser confirmation add a custom beautiful confirmation dialog
|
||||
confirmText: {type: String, required: false},
|
||||
}, computed: {
|
||||
buttonClasses() {
|
||||
const classes = {
|
||||
'btn-sm': this.sm,
|
||||
}
|
||||
|
||||
for (const className of this.additionalClass.split(' ')) {
|
||||
classes[className] = true
|
||||
}
|
||||
|
||||
return classes
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,16 +1,18 @@
|
||||
Vue.component('tt-card', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<div class="card">
|
||||
<div class="card-header" v-if="$slots.header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="card-footer" v-if="$slots.footer">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
<div class="card">
|
||||
<div class="card-header" v-if="$slots.header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<div class="card-body" :class="{'pt-0': $slots.header || noBodyPaddingTop}" :style="{'overflow-x': bodyOverflowXAuto ? 'auto' : 'unset'}">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="card-footer" v-if="$slots.footer">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</div>
|
||||
`, props: {
|
||||
noBodyPaddingTop: {type: Boolean, default: false}, bodyOverflowXAuto: {type: Boolean, default: false},
|
||||
}
|
||||
})
|
||||
@@ -2,6 +2,7 @@ Vue.component('tt-input', {
|
||||
props: {
|
||||
label: String,
|
||||
type: String,
|
||||
disabled: Boolean,
|
||||
placeholder: String,
|
||||
required: Boolean,
|
||||
row: Boolean,
|
||||
@@ -34,6 +35,7 @@ Vue.component('tt-input', {
|
||||
:class="{'form-control-sm': sm, 'col-sm-8': row}"
|
||||
:placeholder="placeholder"
|
||||
:required="required"
|
||||
:disabled="disabled"
|
||||
v-bind="additionalProps"
|
||||
v-model="inputValue"
|
||||
@input="$emit('input', $event.target.value)"
|
||||
|
||||
@@ -52,8 +52,8 @@ Vue.component('tt-modal', {
|
||||
@mousedown="$emit('update:show', false)"
|
||||
@keydown.esc="$emit('update:show', false)"
|
||||
v-if="show">
|
||||
<div class="modal-dialog modal-lg" role="document" @mousedown.stop>
|
||||
<div class="modal-content">
|
||||
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document" @mousedown.stop>
|
||||
<div class="modal-content" style="min-height: 45vh;">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{title}}</h5>
|
||||
<button type="button" class="close" @click="$emit('update:show', false)">
|
||||
@@ -65,9 +65,10 @@ Vue.component('tt-modal', {
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<slot name="footer">
|
||||
<slot name="footer-prepend"></slot>
|
||||
<button v-if="save" class="btn btn-primary" @click="$emit('submit')">{{saveText}}</button>
|
||||
<button v-if="$props.delete" class="btn btn-danger" @click="$emit('delete')">{{deleteText}}</button>
|
||||
<button class="btn btn-secondary" @click="$emit('update:show', false)">Close</button>
|
||||
<button class="btn btn-secondary" @click="$emit('update:show', false)">Schließen</button>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ Vue.component('tt-select', {
|
||||
label: {type: String, required: false},
|
||||
required: {type: Boolean, default: false},
|
||||
value: {type: [String, Number], required: false},
|
||||
disabled: {type: Boolean, default: false},
|
||||
suffix: {type: String, required: false},
|
||||
sm: {type: Boolean, default: false},
|
||||
row: {type: Boolean, default: false},
|
||||
@@ -28,7 +29,7 @@ Vue.component('tt-select', {
|
||||
|
||||
:for="label">{{ label }}</label>
|
||||
<select class="form-control" :class="{'form-control-sm': sm, 'col-sm-8': row}"
|
||||
:required="required" v-model="selectedOption"
|
||||
:required="required" v-model="selectedOption" :disabled="disabled"
|
||||
@change="$emit('input', $event.target.value ? $event.target.value : undefined)">
|
||||
<template v-for="option of options">
|
||||
<option v-if="['string','number'].includes(typeof option)" :value="option" :disabled="option.disabled === true">{{ option }}
|
||||
|
||||
@@ -805,12 +805,12 @@ Vue.component('tt-table', {
|
||||
// use header#topnav as top to stick to but if window is resized then check if header#topnav height is changed
|
||||
|
||||
const headerHeight = document.querySelector('header#topnav')?.offsetHeight || 0;
|
||||
style.innerHTML = `table thead th { position: sticky; top: ${headerHeight}px; z-index: 1; background-color: white; }`;
|
||||
style.innerHTML = `table.tt-table thead th { position: sticky; top: ${headerHeight}px; z-index: 1; background-color: white; }`;
|
||||
style.id = 'tt-table-sticky-header';
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
const headerHeight = document.querySelector('header#topnav')?.offsetHeight || 0;
|
||||
style.innerHTML = `table thead th { position: sticky; top: ${headerHeight}px; z-index: 1; background-color: white; }`;
|
||||
style.innerHTML = `table.tt-table thead th { position: sticky; top: ${headerHeight}px; z-index: 1; background-color: white; }`;
|
||||
})
|
||||
|
||||
document.head.appendChild(style);
|
||||
|
||||
Reference in New Issue
Block a user