Added PreorderStatusflag to Preorder/Index
This commit is contained in:
@@ -630,6 +630,51 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$("input.preorder-statusflag").change((e) => {
|
||||
var elem = e.target;
|
||||
var preorder_id = $(elem).data("preorder_id");
|
||||
var flag_id = $(elem).data("flag_id");
|
||||
var value = $(elem).prop("checked") ? 1 : 0;
|
||||
|
||||
$.ajax({
|
||||
url: "<?=self::getUrl("Preorder", "api")?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
do: "setStatusFlag",
|
||||
preorder_id: preorder_id,
|
||||
flag_id: flag_id,
|
||||
value: value
|
||||
},
|
||||
dataType: "json",
|
||||
context: {
|
||||
elem: elem,
|
||||
preorder_id: preorder_id,
|
||||
flag_id: flag_id,
|
||||
},
|
||||
success: function (success) {
|
||||
var textelem = $("#preorder-" + this.preorder_id + "-statusflag-" + this.flag_id + "-text");
|
||||
if(success.status != "OK") {
|
||||
notify("error","Fehler beim Speichern des Statusflags");
|
||||
$(this.elem).prop("checked", !$(this.elem).prop("checked"));
|
||||
} else {
|
||||
textelem.removeClass("text-danger").addClass("text-success");
|
||||
setTimeout(function() {
|
||||
textelem.removeClass("text-success");
|
||||
textelem.removeClass("text-success")
|
||||
}, 2000, textelem);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function () {
|
||||
notify("error","Fehler beim Speichern des Statusflags");
|
||||
$(this.elem).prop("checked", !$(this.elem).prop("checked"));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// navigation
|
||||
var preorder_id;
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-12">
|
||||
<ul class="nav nav-tabs order-tab">
|
||||
<li class="nav-item"><a class="nav-link active" href="#preorder-detail-<?=$preorder->id?>-detail" data-toggle="tab" aria-expanded="false">Details</a></li>
|
||||
<li class="nav-item"><a class="nav-link active" href="#preorder-detail-<?=$preorder->id?>-detail" data-toggle="tab" aria-expanded="false">Bestellung</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-flags" data-toggle="tab" aria-expanded="false">Status</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-address" data-toggle="tab" aria-expanded="false">Adressdetails</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-rimo" data-toggle="tab" aria-expanded="false">RIMO</a></li>
|
||||
<?php if($me->is("Admin") && $preorder->adb_hausnummer->borderpoint_lat && $preorder->adb_hausnummer->borderpoint_long): ?>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-map" data-toggle="tab" aria-expanded="false" onclick="loadBorderpointMap(<?=$preorder->id?>)">Übergabepunkt</a></li>
|
||||
<?php endif; ?>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-history" data-toggle="tab" aria-expanded="false">History</a></li>
|
||||
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-history" data-toggle="tab" aria-expanded="false">History</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -466,6 +468,51 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="preorder-detail-<?=$preorder->id?>-flags" class="tab-pane">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-header bg-info text-white pl-2 pr-2 pt-1 pb-1">Status</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h3>Bestellstatus</h3>
|
||||
<table class="table table-sm table-striped">
|
||||
<tr>
|
||||
<th>Status Code</th>
|
||||
<td class="text-monospace"><?=$preorder->status->code?></td>
|
||||
</tr><tr>
|
||||
<th>Status Text</th>
|
||||
<td class="text-monospace"><?=$preorder->status->name?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<h3>Statusflags</h3>
|
||||
<table class="table table-sm table-striped">
|
||||
<?php foreach(PreorderStatusflagModel::getAll() as $flag): ?>
|
||||
<tr>
|
||||
<th class="text-right">
|
||||
<input type="checkbox" class="form-control preorder-statusflag"
|
||||
id="preorder-<?=$preorder->id?>-statusflag-<?=$flag->id?>"
|
||||
data-preorder_id="<?=$preorder->id?>"
|
||||
data-flag_id="<?=$flag->id?>"
|
||||
<?=(array_key_exists($flag->id, $preorder->statusflags) && $preorder->statusflags[$flag->id]->value && $preorder->statusflags[$flag->id]->value->value) ? "checked='checked'" : ""?>
|
||||
/>
|
||||
</th>
|
||||
<td class="text-monospace align-middle" id="preorder-<?=$preorder->id?>-statusflag-<?=$flag->id?>-text"><?=$preorder->statusflags[$flag->id]->code?> - <?=$preorder->statusflags[$flag->id]->name?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="preorder-detail-<?=$preorder->id?>-history" class="tab-pane">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12">
|
||||
|
||||
Reference in New Issue
Block a user