Contractjournal finished & Started Contractconfig Hooks for Provisioning Workflow

This commit is contained in:
Frank Schubert
2023-02-24 15:50:28 +01:00
parent aa373b5f4e
commit 3210981994
21 changed files with 562 additions and 279 deletions

View File

@@ -224,32 +224,84 @@
<div class="row justify-content-center">
<div class="col-8">
<table class="table table-striped table-sm">
<table class="table table-striped table-sm journal">
<?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>
<td style="width: 100%">
<?php if($j->type == "text"):?>
<?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?>
<?php elseif($j->type == "phone"): ?>
<i class="fas fa-phone text-white bg-warning p-1"></i> <?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?>
<?php elseif($j->type == "file"): ?>
<?php if($j->type == "text" || $j->type == "phone"):?>
<td><i class="fas <?=($j->type == "text") ? "fa-align-left bg-success" : "fa-phone bg-success"?> text-white p-1"></i></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(htmlentities($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"></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])?>"> <i class="fas fa-download"></i> <?=$j->contractfile->name?></a>
<?php elseif($j->type == "created_from"): ?>
<?php if($j->value == "manual"): ?>
<em>Vertrag manuell angelegt.</em>
<?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 angelegt</em>
<?php endif; ?>
</td>
</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 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; ?>
<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>
@@ -257,11 +309,11 @@
</div>
<?php endif; ?>
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
<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>Kunde</th>
@@ -307,9 +359,10 @@
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
@@ -321,4 +374,21 @@
</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();
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>