Added adb unit count to OpenAccessId Index
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
<label class="form-label" for="filter_origin">Herkunft</label>
|
||||
<select name="filter[origin]" id="filter_origin" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="ofaa" <?=($filter['origin'] == "ofaa") ? "selected='selected'" : ""?>>OFAA</option>
|
||||
<option value="thetool" <?=($filter['origin'] == "thetool") ? "selected='selected'" : ""?>>thetool</option>
|
||||
<option value="ofaa" <?=(array_key_exists("origin", $filter) && $filter['origin'] == "ofaa") ? "selected='selected'" : ""?>>OFAA</option>
|
||||
<option value="thetool" <?=(array_key_exists("origin", $filter) && $filter['origin'] == "thetool") ? "selected='selected'" : ""?>>thetool</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<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("OpenAccessId")?>">Filter zurücksetzen</a>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("OpenAccessId", "", ["resetFilter" => 1])?>">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>
|
||||
@@ -121,8 +121,7 @@
|
||||
<th>OAID Set</th>
|
||||
<th>Herkunft</th>
|
||||
<th>Besitzer</th>
|
||||
<th>Zugewiesen</th>
|
||||
<th></th>
|
||||
<th colspan="2" title="Anzahl ADB Wohneinheiten">Zugewiesen</th>
|
||||
<th>Exportiert</th>
|
||||
<th></th>
|
||||
|
||||
@@ -136,6 +135,7 @@
|
||||
<td><?=$oaid->origin_id?></td>
|
||||
<td><?=$oaid->origin?></td>
|
||||
<td><?=$oaid->owner->getCompanyOrName()?></td>
|
||||
<td class="text-right <?=($oaid->adb_wohneinheit_count > 1 || $oaid->adb_wohneinheit_id && $oaid->adb_wohneinheit_count < 1) ? "text-danger" : ""?>"><?=($oaid->adb_wohneinheit_id) ? $oaid->adb_wohneinheit_count."x" : ""?></td>
|
||||
<td>
|
||||
<?php if($oaid->termination_id): ?>
|
||||
<?=(is_object($oaid->termination) && $oaid->termination->building_id) ? $oaid->termination->building->getAddress() : ""?>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class OpenAccessId extends mfBaseModel {
|
||||
private $owner;
|
||||
private $adb_wohneinheit;
|
||||
private $adb_wohneinheit_count;
|
||||
private $termination;
|
||||
|
||||
public function loadRandomUnassigned($attributes = []) {
|
||||
@@ -332,6 +333,11 @@ class OpenAccessId extends mfBaseModel {
|
||||
return $this->adb_wohneinheit;
|
||||
}
|
||||
|
||||
if($name == "adb_wohneinheit_count") {
|
||||
$this->adb_wohneinheit_count = ADBWohneinheitModel::count(["oaid" => $this->oaid]);
|
||||
return $this->adb_wohneinheit_count;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
@@ -17,11 +17,23 @@ class OpenAccessIdController extends mfBaseController {
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("OpenAccessId/Index");
|
||||
|
||||
$this->layout->set("filter", $this->request->filter);
|
||||
if($this->request->filter) {
|
||||
$filter = $this->getPreparedFilter($this->request->filter);
|
||||
if($this->request->resetFilter) {
|
||||
unset($_SESSION[MFAPPNAME.'-OpenAccessId-filter']);
|
||||
}
|
||||
|
||||
$filter = [];
|
||||
if(is_array($this->request->filter)) {
|
||||
$filter = $this->request->filter;
|
||||
$_SESSION[MFAPPNAME.'-OpenAccessId-filter'] = $filter;
|
||||
} else {
|
||||
if(array_key_exists(MFAPPNAME.'-OpenAccessId-filter', $_SESSION) && count($_SESSION[MFAPPNAME.'-OpenAccessId-filter'])) {
|
||||
$filter = $_SESSION[MFAPPNAME.'-OpenAccessId-filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $filter);
|
||||
$filter = $this->getPreparedFilter($filter);
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
|
||||
Reference in New Issue
Block a user