WIP Contract Form
This commit is contained in:
218
Layout/default/Contract/Form.php
Normal file
218
Layout/default/Contract/Form.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?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")?>">Verträge</a></li>
|
||||
<li class="breadcrumb-item active"><?=($contract->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Verträge</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?=($contract->id) ? "Vertrag bearbeiten" : "Neuer Vertrag"?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Contract", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$contact->id?>" />
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="owner_id">Vertragsinhaber *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control basicAutoComplete" autocomplete="off" name="owner_id" id="owner_id" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Tippen zum Suchen... (Bestandskunden)" data-noresults-text="Keine Suchergebnisse">
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="billingaddress_id">Rechnungsempfänger</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control basicAutoComplete" autocomplete="off" name="billingaddress_id" id="billingaddress_id" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Tippen zum suchen... (Bestandskunden)" data-noresults-text="Keine Suchergebnisse">
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="product_id">Produkt *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control basicAutoComplete" autocomplete="off" name="product_id" id="product_id" data-url="<?=self::getUrl('Product','api')?>?do=findProduct&autocomplete=1" placeholder="Tippen zum suchen..." data-noresults-text="Keine Suchergebnisse">
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="product_name">Individueller Produktname</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="product_name" id="product_name" value="<?=$contract->product_name?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="matchcode">Matchcode</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="matchcode" id="matchcode" value="<?=$contract->matchcode?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="note" rows="5"><?=$building->note?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".select2").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
|
||||
// kunde
|
||||
<?php if($contract->owner_id && is_object(($contract->owner))): ?>
|
||||
$('#owner_id').autoComplete('set', { value: <?=$contract->owner_id?>, text: '<?=($contract->owner_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->owner->getCompanyOrName()))." (".$contract->owner->zip." ".$contract->owner->city.", ".$contract->owner->street.")".(($contract->owner->customer_number) ? " [".$contract->owner->customer_number."]" : "") : ""?>'});
|
||||
<?php else: ?>
|
||||
$('#owner_id').autoComplete();
|
||||
<?php endif; ?>
|
||||
|
||||
$('#owner_id').keydown(function() {
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#owner_id').on("autocomplete.select", function(evt, item) {
|
||||
if(item && item.value === 0) {
|
||||
$('#owner_id').autoComplete('set', null);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log($('input[name=owner_id]').val());
|
||||
var id = $('input[name=owner_id]').val();
|
||||
|
||||
if($('#matchcode').val()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.get("<?=self::getUrl('Address', 'Api')?>",
|
||||
{
|
||||
"do": "getAddress",
|
||||
"id": id
|
||||
},
|
||||
function (success) {
|
||||
if(success.status == "OK") {
|
||||
var address = success.result.address;
|
||||
console.log(address);
|
||||
var string = address.street + ", " + address.zip + " " + address.city;
|
||||
$('#matchcode').val(string);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
// rechnungsadresse
|
||||
<?php if($contract->billingaddress_id && is_object($contract->billingaddress)): ?>
|
||||
$('#billingaddress_id').autoComplete('set', { value: <?=$contract->billingaddress_id?>, text: '<?=($contract->billingaddress_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->billingaddress->getCompanyOrName()))." (".$contract->billingaddress->zip." ".$contract->billingaddress->city.", ".$contract->billingaddress->street.")" : ""?>'});
|
||||
<?php else: ?>
|
||||
$('#billingaddress_id').autoComplete();
|
||||
<?php endif; ?>
|
||||
|
||||
$('#billingaddress_id').keydown(function() {
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#billingaddress_id').on("autocomplete.select", function(evt, item) {
|
||||
if(item && item.value === 0) {
|
||||
$('#billingaddress_id').autoComplete('set', null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Produkt
|
||||
|
||||
// kunde
|
||||
<?php if($contract->product_id && is_object(($contract->product))): ?>
|
||||
$('#product_id').autoComplete('set', { value: <?=$contract->product_id?>, text: '<?=($contract->product_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->product->name))." [".$contract->product_id."]" : ""?>'});
|
||||
<?php else: ?>
|
||||
$('#product_id').autoComplete();
|
||||
<?php endif; ?>
|
||||
|
||||
$('#product_id').keydown(function() {
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#product_id').on("autocomplete.select", function(evt, item) {
|
||||
if(item && item.value === 0) {
|
||||
$('#product_id').autoComplete('set', null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// disable mousewheel on input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -24,6 +24,49 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<h4 class="header-title mb-3">Filter</h4>
|
||||
|
||||
<form method="get" action="<?=self::getUrl("Building")?>">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_owner">Inhaber</label>
|
||||
<input type="text" class="form-control" name="filter[owner]" id="filter_street" value="<?=$filter['owner']?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_billingaddress">Rech.Empfänger</label>
|
||||
<input type="text" class="form-control" name="filter[billingaddress]" id="filter_billingaddress" value="<?=$filter['billingaddress']?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_product_group">Produktgruppe</label>
|
||||
<input type="text" class="form-control" name="filter[product_group]" id="filter_product_group" value="<?=$filter['product_group']?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_product_name">Produkt</label>
|
||||
<input type="text" class="form-control" name="filter[product_name]" id="filter_product_name" value="<?=$filter['product_name']?>" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("Building")?>">Filter zurücksetzen</a>
|
||||
</div>
|
||||
<!--<div class="col">
|
||||
<button class="btn btn-info" type="button" onclick="refreshMap()"><i class="far fa-map"></i> Auf Karte anzeigen</button>
|
||||
</div>-->
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="float-left">
|
||||
@@ -38,21 +81,26 @@
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<tr>
|
||||
<th>Contract ID</th>
|
||||
<th>Inhaber</th>
|
||||
<th>Produkt</th>
|
||||
<th>Anschluss</th>
|
||||
<th>Matchcode</th>
|
||||
<th>Preis</th>
|
||||
<th>Preis Setup</th>
|
||||
<th>Rechnungsperiode</th>
|
||||
<th>Fertigstellung</th>
|
||||
<th>Kündigung</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Zuletzt bearbeitet</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($contracts as $contract): ?>
|
||||
<tr>
|
||||
<td><a href="<?=self::getUrl("Address", "Edit", ["id" => $contract->owner_id])?>" target="_blank"><?=$contract->owner->getCompanyOrName()?></a></td>
|
||||
<td><?=$contract->product->product->name?></td>
|
||||
<td>
|
||||
<td><?=$contract->id?></td>
|
||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner_id])?>" target="_blank"><?=$contract->owner->getCompanyOrName()?></a></td>
|
||||
<td><a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><?=$contract->product->name?></a></td>
|
||||
<td><a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
|
||||
<!--<td>
|
||||
<?php if($contract->termination_id): ?>
|
||||
<?=$contract->termination->building->street?><br />
|
||||
<?=$contract->termination->building->zip?> <?=$contract->termination->building->city?><br />
|
||||
@@ -60,7 +108,7 @@
|
||||
<span class="text-monospace text-pink"><?=$contract->termination->code?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</td>-->
|
||||
<td><?=$contract->price?></td>
|
||||
<td><?=$contract->price_setup?></td>
|
||||
<td>
|
||||
@@ -74,12 +122,15 @@
|
||||
<?=(12 / $contract->billing_period)?>x Jährlich
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?=date('d.m.Y H:i', $contract->create)?> (<?=$contract->creator->name?>)</td>
|
||||
<td><?=date('d.m.Y H:i', $contract->edit)?> (<?=$contract->editor->name?>)</td>
|
||||
<td class="text-monospace"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
|
||||
<td class="text-monospace"><?=($contract->cancel_date) ? date('d.m.Y', $contract->cancel_date) : ""?></td>
|
||||
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->create)?><br /><?=$contract->creator->name?></td>
|
||||
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->edit)?><br /><?=$contract->editor->name?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><i class="far fa-eyes" title="Vertrag anzeigen"></i></a>
|
||||
<a href="<?=self::getUrl("Contract", "edit", ["id" => $contract->id])?>"><i class="far fa-edit" title="Vertrag bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("Order", "edit", ["id" => $contract->product->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a>
|
||||
<a href="<?=self::getUrl("Contract", "cancel", ["id" => $contract->id])?>" class="text-danger" title="Vertrag kündigen"><i class="fas fa-trash"></i></a>
|
||||
<a href="<?=self::getUrl("Contract", "cancel", ["id" => $contract->id])?>" class="text-danger" title="Vertrag kündigen"><i class="far fa-file-slash"></i></a>
|
||||
<?php if($contract->orderproduct_id): ?><a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a><?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user