Merge branch 'fronkdev' into 'master'

Updated preorder api / Delete Workorder

See merge request fronk/thetool!116
This commit is contained in:
Frank Schubert
2023-11-09 13:56:40 +00:00
18 changed files with 505 additions and 26 deletions
@@ -313,21 +313,25 @@
<div class="col-6">
<h3>Workorder</h3>
<table class="table table-sm table-striped">
<tr>
<th>Name</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_name?></td>
</tr><tr>
<th>External ID</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_id?></td>
</tr><tr>
<th>Status</th>
<td><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_status?></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=($preorder->adb_wohneinheit->rimo_workorder->id) ? date("d.m.Y H:i:s", $preorder->adb_wohneinheit->rimo_workorder->create) : ""?></td>
</tr>
</table>
<?php if(is_object($preorder->adb_wohneinheit->rimo_workorder) && $preorder->adb_wohneinheit->rimo_workorder->id): ?>
<small id="preorder-detail-<?=$preorder->id?>-workorder-del"><a href="#" onclick="if(confirm('Achtung: Löscht die Workorder in thetool, aber NICHT in RIMO!')) return deleteWorkorder(<?=$preorder->id?>)" class="text-danger"><i class="far fa-times-circle"></i> Workorder löschen</a></small>
<table class="table table-sm table-striped" id="preorder-detail-<?=$preorder->id?>-workorder">
<tr>
<th>Name</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_name?></td>
</tr><tr>
<th>External ID</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_id?></td>
</tr><tr>
<th>Status</th>
<td><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_status?></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=(is_object($preorder->adb_wohneinheit->rimo_workorder)) ? date("d.m.Y H:i:s", $preorder->adb_wohneinheit->rimo_workorder->create) : ""?></td>
</tr>
</table>
<?php endif; ?>
</div>
@@ -388,9 +392,11 @@
}
if("building" in update) {
// update building status text
$("#preorder-detail-building-status-" + pid).text(update.building.status.code + " - " + update.building.status.text);
}
if("unit" in update) {
// update unit status text
$("#preorder-detail-unit-status-" + pid).text(update.unit.status.code + " - " + update.unit.status.text);
}
@@ -400,4 +406,29 @@
},
'json');
}
function deleteWorkorder(pid) {
console.log("in delete workorder");
if(!Number.isInteger(pid) || pid < 1) {
return false;
}
$.post("<?=self::getUrl("Preorder","Api")?>",
{
'do': "deleteWorkorder",
id: pid,
},
function(success) {
if(success.status == "OK") {
$("#preorder-detail-" + success.result.id + "-workorder td").each(function() {
$(this).html("<em class='text-monospace'>--gelöscht--</em>");
});
$("#preorder-detail-" + success.result.id + "-workorder-del").remove();
}
},
'json');
return false;
}
</script>
+154
View File
@@ -0,0 +1,154 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Bestellungen";
?>
<?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("Preordercampaign")?>">Vorbestellkampagnen</a></li>
<li class="breadcrumb-item active">Vorbestellungen</li>
</ol>
</div>
<h4 class="page-title">Vorbestellungen<?=(isset($campaign) && $campaign) ? " - ".$campaign->name : ""?></h4>
</div>
</div>
</div>
<!-- end page title -->
<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("Preorderlogistics")?>">
<div class="row mt-2">
<div class="col-1">
<label class="form-label" for="filter_ucode">Bestellcode</label>
<input type="text" class="form-control" name="filter[ucode]" id="filter_ucode" value="<?=$filter['ucode'] ?? ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_oaid">OAID</label>
<input type="text" class="form-control" name="filter[oaid]" id="filter_oaid" value="<?=$filter['oaid'] ?? ""?>" />
</div>
<div class="col-2">
<label class="form-label" for="filter_address">Anschlussadresse</label>
<input type="text" class="form-control" name="filter[address]" id="filter_address" value="<?=$filter['address'] ?? ""?>" />
</div>
<div class="col-2">
<label class="form-label" for="filter_kunde">Kunde</label>
<input type="text" class="form-control" name="filter[kunde]" id="filter_kunde" value="<?=$filter['kunde'] ?? ""?>" />
</div>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button>
<?php if(isset($campaign) && $campaign->id): ?>
<a class="btn btn-secondary" href="<?=self::getUrl("Preorderlogistics", "Index", ['filter' => ['preordercampaign_id' => $campaign->id], "resetFilter" => 1])?>">Filter zurücksetzen</a>
<?php else: ?>
<a class="btn btn-secondary" href="<?=self::getUrl("Preorderlogistics")?>">Filter zurücksetzen</a>
<?php endif; ?>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Bestellungen</h4>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th></th>
<th></th>
<th>Bestelltyp<br />Bestellcode</th>
<th>OAID</th>
<th>Anschlussadresse</th>
<th>Kunde</th>
<th>Kontakt</th>
<th></th>
</tr>
<?php foreach($preorders as $preorder): ?>
<tr class="preorder-list-tr" id="preorder-<?=$preorder->id?>">
<td><button type="button" class="btn btn-sm btn-success" onclick="printShippingSlip(<?=$preorder->id?>)">Versandetikett und<br />Beipackzettel drucken</button> </td>
<td>
<label>Versandt <i class="fas fa-check text-success hidden"></i><input type="checkbox" class="form-control pointer" name="sent" value="1" id="sent-<?=$preorder->id?>" /></label>
</td>
<td>
<?=__($preorder->type, "preorder")?><br />
<?=$preorder->ucode?><br />
</td>
<td class="text-pink"><span><?=$preorder->oaid?></span></td>
<?php if($preorder->building_id): ?>
<td><?=$preorder->building->street?><br /><?=$preorder->building->zip?> <?=$preorder->building->city?></td>
<?php elseif($preorder->adb_hausnummer_id): ?>
<td <?=($preorder->address_created) ? "class='alert-warning' title='Adresse manuell angelegt'" : ""?>">
<?=$preorder->adb_hausnummer->strasse->name?>
<?=$preorder->adb_hausnummer->hausnummer?><br />
<?=($preorder->adb_wohneinheit_id) ? ((string)$preorder->adb_wohneinheit ? $preorder->adb_wohneinheit."<br />" : "") : "<i class='text-pink'>&lt;keine Wohneinheit&gt;</i><br />"?>
<?=$preorder->adb_hausnummer->plz->plz?>
<?=$preorder->adb_hausnummer->ortschaft->name?><br />
<?=$preorder->adb_hausnummer->strasse->gemeinde->name?>
</td>
<?php else: ?>
<td></td>
<?php endif; ?>
<td>
<?=($preorder->company) ? $preorder->company : $preorder->firstname." ".$preorder->lastname?><br />
<?=$preorder->street?><?=($preorder->housenumber) ? " ".$preorder->housenumber : ""?><br />
<?=$preorder->zip?> <?=$preorder->city?>
</td>
<td>
<?=($preorder->phone) ? $preorder->phone."<br />" : ""?>
<?=($preorder->email) ? $preorder->email : ""?>
</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
+8
View File
@@ -85,6 +85,14 @@
<small>z.B. Meridiam</small>
</div>
<div class="form-group" id="preorderlogistics-container">
<label for="preorderlogistics">Preorder Logistikpartner:</label>
<select name="preorderlogistics" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("preorderlogistics")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("preorderlogistics")) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" class="form-control" value="" />
+2 -2
View File
@@ -105,13 +105,13 @@
</li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","salespartner"]) && $me->can(["Order", "Preorder"])): ?>
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can(["Order", "Preorder"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fal fa-fw fa-money-bill-wave"></i>Verkauf <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin","netowner","salespartner"]) && $me->can("Preorder")): ?>
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can("Preorder")): ?>
<li><a href="<?=self::getUrl("Preordercampaign")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellung</a></li>
<?php endif; ?>
<?php if($me->is(["Admin","salespartner"]) && $me->can("Order")): ?>