diff --git a/app/config/Migrations/schema-dump-default.lock b/app/config/Migrations/schema-dump-default.lock index c94439fb..3b00c1ee 100644 Binary files a/app/config/Migrations/schema-dump-default.lock and b/app/config/Migrations/schema-dump-default.lock differ diff --git a/app/plugins/Awards/Assets/js/controllers/rec-quick-edit-controller.js b/app/plugins/Awards/Assets/js/controllers/rec-quick-edit-controller.js index 683891e3..43a59cbc 100644 --- a/app/plugins/Awards/Assets/js/controllers/rec-quick-edit-controller.js +++ b/app/plugins/Awards/Assets/js/controllers/rec-quick-edit-controller.js @@ -41,6 +41,7 @@ class AwardsRecommendationQuickEditForm extends Controller { submit(event) { + document.getElementById("recommendation_edit_close").click(); } setAward(event) { let awardId = event.target.dataset.awardId; diff --git a/app/plugins/Awards/src/Controller/RecommendationsController.php b/app/plugins/Awards/src/Controller/RecommendationsController.php index e8c9ec88..511b7aac 100644 --- a/app/plugins/Awards/src/Controller/RecommendationsController.php +++ b/app/plugins/Awards/src/Controller/RecommendationsController.php @@ -427,7 +427,9 @@ public function edit($id = null) $this->Recommendations->getConnection()->begin(); if (!$this->Recommendations->save($recommendation)) { $this->Recommendations->getConnection()->rollback(); - $this->Flash->error(__('The recommendation could not be saved. Please, try again.')); + if (!$this->request->getHeader('Turbo-Frame')) { + $this->Flash->error(__('The recommendation could not be saved. Please, try again.')); + } if ($this->request->getData("current_page")) { return $this->redirect($this->request->getData("current_page")); } @@ -442,7 +444,9 @@ public function edit($id = null) $newNote->author_id = $this->request->getAttribute("identity")->id; if (!$this->Recommendations->Notes->save($newNote)) { $this->Recommendations->getConnection()->rollback(); - $this->Flash->error(__('The note could not be saved. Please, try again.')); + if (!$this->request->getHeader('Turbo-Frame')) { + $this->Flash->error(__('The note could not be saved. Please, try again.')); + } if ($this->request->getData("current_page")) { return $this->redirect($this->request->getData("current_page")); } @@ -450,7 +454,9 @@ public function edit($id = null) } } $this->Recommendations->getConnection()->commit(); - $this->Flash->success(__('The recommendation has been saved.')); + if (!$this->request->getHeader('Turbo-Frame')) { + $this->Flash->success(__('The recommendation has been saved.')); + } } if ($this->request->getData("current_page")) { return $this->redirect($this->request->getData("current_page")); @@ -554,8 +560,9 @@ public function turboEditForm($id = null) ->contain(['Branches' => function ($q) { return $q->select(['id', 'name']); }]) - ->where(["start_date >" => DateTime::now(), 'OR' => ['closed' => false, 'closed IS' => null]]) + ->where(['OR' => ['closed' => false, 'closed IS' => null]]) ->select(['id', 'name', 'start_date', 'end_date', 'Branches.name']) + ->orderBy(['start_date' => 'ASC']) ->all(); $statusList = Recommendation::getStatuses(); foreach ($statusList as $key => $value) { @@ -594,8 +601,9 @@ public function turboQuickEditForm($id = null) ->contain(['Branches' => function ($q) { return $q->select(['id', 'name']); }]) - ->where(["start_date >" => DateTime::now(), 'OR' => ['closed' => false, 'closed IS' => null]]) + ->where(['OR' => ['closed' => false, 'closed IS' => null]]) ->select(['id', 'name', 'start_date', 'end_date', 'Branches.name']) + ->orderBy(['start_date' => 'ASC']) ->all(); $statusList = Recommendation::getStatuses(); foreach ($statusList as $key => $value) { diff --git a/app/plugins/Awards/templates/Recommendations/board.php b/app/plugins/Awards/templates/Recommendations/board.php index c48e17c5..2f2ec09a 100644 --- a/app/plugins/Awards/templates/Recommendations/board.php +++ b/app/plugins/Awards/templates/Recommendations/board.php @@ -5,24 +5,24 @@ if ($hiddenStates != ""): if (!$showHidden): ?> - Html->link( + Html->link( "Show $hiddenStates In last $range days", [$view, '?' => ['showHidden' => 'true']], ['class' => 'btn btn-primary btn-sm end m-3'] ) ?> - - Html->link( + + Html->link( "Hide $hiddenStates In last $range days", [$view], ['class' => 'btn btn-primary btn-sm end m-3'] ) ?> - +
$recommendations) : ?> - + @@ -38,45 +38,46 @@ $recommendations) : ?> - +
+ - -
-
-
stack_rank ?>" + data-rec-id="id ?>" id="card_id ?>" + data-kanban-target="card"> +
+
award->abbreviation; if ($recommendation->specialty != null && $recommendation->specialty != "" && $recommendation->specialty != "No Specialty Selected") : $awardTitle = $awardTitle . " (" . $recommendation->specialty . ")"; endif; ?> - Html->link($awardTitle, ['action' => 'view', $recommendation->id]) ?> - -
-
- member_sca_name ?> -
-

Text->autoParagraph( + Html->link($awardTitle, ['action' => 'view', $recommendation->id]) ?> + +

+
+ member_sca_name ?> +
+

Text->autoParagraph( h($this->Text->truncate($recommendation->reason, 100)), ) ?>

- Last Modified: modified->format('m/d/Y') ?> by - ModifiedByMembers['sca_name'] ?> -
-
- Last Modified: modified->format('m/d/Y') ?> by + ModifiedByMembers['sca_name'] ?> +
+ + -
+ element('recommendationQuickEditModal', ['modalId' => 'boardEditModal']) ?> \ No newline at end of file diff --git a/app/plugins/Awards/templates/Recommendations/index.php b/app/plugins/Awards/templates/Recommendations/index.php index 0b0759dc..80520882 100644 --- a/app/plugins/Awards/templates/Recommendations/index.php +++ b/app/plugins/Awards/templates/Recommendations/index.php @@ -48,7 +48,5 @@ 'updateUrl' => false, ]); echo $this->KMP->startBlock("modals"); ?> - -element('recommendationQuickEditModal') ?> KMP->endBlock(); ?> \ No newline at end of file diff --git a/app/plugins/Awards/templates/Recommendations/table.php b/app/plugins/Awards/templates/Recommendations/table.php index 7175b07b..55d6fc57 100644 --- a/app/plugins/Awards/templates/Recommendations/table.php +++ b/app/plugins/Awards/templates/Recommendations/table.php @@ -359,7 +359,8 @@ checkCan("edit", $recommendation)) : ?> checkCan("view", $recommendation)) : ?> @@ -448,4 +449,5 @@ ), ) ?>

+ element('recommendationQuickEditModal', ['modalId' => 'tableEditModal']) ?> \ No newline at end of file diff --git a/app/plugins/Awards/templates/element/recommendationQuickEditModal.php b/app/plugins/Awards/templates/element/recommendationQuickEditModal.php index f64a98af..6f43b780 100644 --- a/app/plugins/Awards/templates/element/recommendationQuickEditModal.php +++ b/app/plugins/Awards/templates/element/recommendationQuickEditModal.php @@ -33,7 +33,7 @@ ); echo $this->Modal->create("Edit Recommendation", [ - "id" => "editModal", + "id" => $modalId, "close" => true, ]); ?> @@ -48,6 +48,7 @@ $this->Form->button("Close", [ "data-bs-dismiss" => "modal", "type" => "button", + "id" => "recommendation_edit_close" ]), ]); diff --git a/app/webroot/js/controllers.js b/app/webroot/js/controllers.js index 02da7f6f..b6b7ee17 100644 --- a/app/webroot/js/controllers.js +++ b/app/webroot/js/controllers.js @@ -2636,7 +2636,9 @@ class AwardsRecommendationQuickEditForm extends _hotwired_stimulus__WEBPACK_IMPO gridBtnOutletDisconnected(outlet) { outlet.removeListener(this.setId.bind(this)); } - submit(event) {} + submit(event) { + document.getElementById("recommendation_edit_close").click(); + } setAward(event) { let awardId = event.target.dataset.awardId; this.awardTarget.value = awardId; diff --git a/app/webroot/mix-manifest.json b/app/webroot/mix-manifest.json index 687eb86e..18bbc415 100644 --- a/app/webroot/mix-manifest.json +++ b/app/webroot/mix-manifest.json @@ -1,5 +1,5 @@ { - "/js/controllers.js": "/js/controllers.js?id=7cf5fb1065794e53e17f2adb34c24ebf", + "/js/controllers.js": "/js/controllers.js?id=6e03142dec8d72597ab1d34e5037c8a8", "/js/index.js": "/js/index.js?id=05830d35bc6fe6a349e66365323c6a6a", "/js/manifest.js": "/js/manifest.js?id=8cb20bf9ab0e0431d222718610e09416", "/js/core.js": "/js/core.js?id=b1125d54a85324a90cdae0b0b8f4dac8",