keeping filter and pagination when saving OrderJournal
This commit is contained in:
@@ -223,6 +223,10 @@
|
||||
<div id="new-journal-<?=$order->id?>" class="card-body hidden">
|
||||
<form method="post" action="<?=self::getUrl("OrderJournal", "save")?>">
|
||||
<input type="hidden" name="order_id" value="<?=$order->id?>" />
|
||||
<input type="hidden" name="s" value="<?=$pagination['start']?>" />
|
||||
<?php foreach($filter as $n => $v): ?>
|
||||
<input type="hidden" name="filter[<?=$n?>]" value="<?=$v?>" />
|
||||
<?php endforeach; ?>
|
||||
<textarea name="text" class="form-control mb-2" style="height:120px;"></textarea>
|
||||
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save"></i> Speichern</button>
|
||||
</form>
|
||||
@@ -550,6 +554,10 @@
|
||||
<div id="new-journal-<?=$order->id?>" class="card-body hidden">
|
||||
<form method="post" action="<?=self::getUrl("OrderJournal", "save")?>">
|
||||
<input type="hidden" name="order_id" value="<?=$order->id?>" />
|
||||
<input type="hidden" name="s" value="<?=$pagination['start']?>" />
|
||||
<?php foreach($filter as $n => $v): ?>
|
||||
<input type="hidden" name="filter[<?=$n?>]" value="<?=$v?>" />
|
||||
<?php endforeach; ?>
|
||||
<textarea name="text" class="form-control mb-2" style="height:120px;"></textarea>
|
||||
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save"></i> Speichern</button>
|
||||
</form>
|
||||
@@ -755,7 +763,6 @@
|
||||
});
|
||||
|
||||
|
||||
|
||||
function toggleOrder(id) {
|
||||
$('#order-detail-' + id).toggle();
|
||||
if($('#order-detail-' + id).is(":hidden")) {
|
||||
@@ -768,7 +775,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function scrollToDiv(element){
|
||||
element = element.replace("link", "");
|
||||
$('html,body').unbind().animate({scrollTop: $(element).offset().top-180},'slow');
|
||||
@@ -778,7 +784,7 @@
|
||||
toggleOrder(<?=$highlight?>);
|
||||
scrollToDiv("#order-<?=$highlight?>");
|
||||
<?php if($addJournal): ?>
|
||||
$('#new-journal-<?=$highlight?>').toggle()
|
||||
$('#new-journal-<?=$highlight?>').toggle();
|
||||
$('#new-journal-<?=$highlight?> textarea[name=text]').focus();
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -40,7 +40,7 @@ class OrderController extends mfBaseController {
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
$pagination['count'] = 20;
|
||||
$pagination['count'] = 3;
|
||||
$pagination['maxItems'] = 0;
|
||||
|
||||
if(is_numeric($this->request->s)) {
|
||||
|
||||
@@ -22,6 +22,8 @@ class OrderJournalController extends mfBaseController {
|
||||
|
||||
$r = $this->request;
|
||||
$order_id = $r->order_id;
|
||||
$s = $r->s;
|
||||
|
||||
if(!is_numeric($order_id) || $order_id < 1) {
|
||||
$this->layout()->setFlash("Bestellung nicht gefunden!", "error");
|
||||
$this->redirect("Order");
|
||||
@@ -36,10 +38,19 @@ class OrderJournalController extends mfBaseController {
|
||||
$text = trim(htmlentities($r->text));
|
||||
if(!$text) {
|
||||
$this->layout()->setFlash("Bitte Text eingeben", "error");
|
||||
$this->redirect("Order", "Index", [], "order=".$order_id);
|
||||
$this->redirect("Order", "Index", ['s' => $s], "order=".$order_id);
|
||||
}
|
||||
|
||||
|
||||
$query = [];
|
||||
if(is_numeric($this->request->s) && $this->request->s > 0) {
|
||||
$query["s"] = $this->request->s;
|
||||
}
|
||||
if (is_array($this->request->filter)) {
|
||||
$query["filter"] = $this->request->filter;
|
||||
}
|
||||
$qs = http_build_query($query);
|
||||
|
||||
|
||||
$journal = new OrderJournal();
|
||||
$journal->order_id = $order_id;
|
||||
@@ -49,11 +60,13 @@ class OrderJournalController extends mfBaseController {
|
||||
|
||||
if(!$journal->save()) {
|
||||
$this->layout()->setFlash("Fehler beim speichern!", "error");
|
||||
$this->redirect("Order", "Index", [], "order=".$order_id);
|
||||
$this->redirect("Order", "Index", $qs, "order=".$order_id);
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Journaleintrag gespeichert", "success");
|
||||
$this->redirect("Order", "Index", [], "order=".$order_id);
|
||||
$this->redirect("Order", "Index", $qs, "order=".$order_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,10 +85,8 @@ class PatchingController extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($pagination);exit;
|
||||
//$this->layout()->set("terminations", $terms);
|
||||
$this->layout()->set("pagination", $pagination);
|
||||
//var_dump($pagination);exit;
|
||||
$terminations = [];
|
||||
foreach($terms as $term) {
|
||||
$term->order = OrderModel::getFirst(["termination_id" => $term->id]);
|
||||
@@ -179,7 +177,6 @@ class PatchingController extends mfBaseController {
|
||||
$mode = "add";
|
||||
$patch_data["termination_id"] = $term_id;
|
||||
}
|
||||
//var_dump($mode, $patch_data);exit;
|
||||
|
||||
if($mode == "add") {
|
||||
$patch_data['create_by'] = 1;
|
||||
|
||||
Reference in New Issue
Block a user