diff --git a/airtime_mvc/application/controllers/PlayouthistoryController.php b/airtime_mvc/application/controllers/PlayouthistoryController.php index 83bedc3dd..39dbebd98 100644 --- a/airtime_mvc/application/controllers/PlayouthistoryController.php +++ b/airtime_mvc/application/controllers/PlayouthistoryController.php @@ -163,6 +163,13 @@ class PlayouthistoryController extends Zend_Controller_Action $historyService = new Application_Service_HistoryService(); $json = $historyService->createPlayedItem($params); + + if (isset($json["form"])) { + $this->view->form = $json["form"]; + $json["form"] = $this->view->render('playouthistory/dialog.phtml'); + + unset($this->view->form); + } $this->_helper->json->sendJson($json); } @@ -213,6 +220,13 @@ class PlayouthistoryController extends Zend_Controller_Action $historyService = new Application_Service_HistoryService(); $json = $historyService->editPlayedItem($params); + + if (isset($json["form"])) { + $this->view->form = $json["form"]; + $json["form"] = $this->view->render('playouthistory/dialog.phtml'); + + unset($this->view->form); + } $this->_helper->json->sendJson($json); } diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php index db36b2856..6a8d3bda5 100644 --- a/airtime_mvc/application/services/HistoryService.php +++ b/airtime_mvc/application/services/HistoryService.php @@ -719,6 +719,7 @@ class Application_Service_HistoryService $msgs = $form->getMessages(); Logging::info($msgs); + $json["form"] = $form; $json["error"] = $msgs; } @@ -756,6 +757,7 @@ class Application_Service_HistoryService $msgs = $form->getMessages(); Logging::info($msgs); + $json["form"] = $form; $json["error"] = $msgs; } diff --git a/airtime_mvc/public/js/airtime/playouthistory/historytable.js b/airtime_mvc/public/js/airtime/playouthistory/historytable.js index 26be956f6..1d2ed7384 100644 --- a/airtime_mvc/public/js/airtime/playouthistory/historytable.js +++ b/airtime_mvc/public/js/airtime/playouthistory/historytable.js @@ -460,8 +460,9 @@ var AIRTIME = (function(AIRTIME) { $.post(url, data, function(json) { //TODO put errors on form. - if (json.error !== undefined) { - + if (json.form !== undefined) { + var $newForm = $(json.form); + $hisDialogEl.html($newForm.html()); } else { removeHistoryDialog();