diff --git a/module/productplan/config/dtable.php b/module/productplan/config/dtable.php index 1111f847ff..5dda5f611c 100644 --- a/module/productplan/config/dtable.php +++ b/module/productplan/config/dtable.php @@ -113,6 +113,7 @@ $config->productplan->dtable->fieldList['actions']['actionsMap']['close']['data- $config->productplan->dtable->fieldList['actions']['actionsMap']['activate']['icon'] = 'active'; $config->productplan->dtable->fieldList['actions']['actionsMap']['activate']['hint'] = $this->lang->productplan->activateAB; +$config->productplan->dtable->fieldList['actions']['actionsMap']['activate']['url'] = 'javascript:activateProductPlan("{planID}")'; $config->productplan->dtable->fieldList['actions']['actionsMap']['plus']['icon'] = 'plus'; diff --git a/module/productplan/control.php b/module/productplan/control.php index 52684b2baa..d8e573db32 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -498,18 +498,8 @@ class productplan extends control public function start(int $planID) { $this->productplan->updateStatus($planID, 'doing', 'started'); - if(dao::isError()) - { - $response['result'] = 'fail'; - $response['message'] = dao::getError(); - } - else - { - $response['result'] = 'success'; - $response['message'] = ''; - $response['load'] = array('back' => true); - } - return $this->send($response); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + return $this->send(array('result' => 'success', 'load' => true, 'closeModal' => true)); } /** @@ -568,19 +558,12 @@ class productplan extends control * @access public * @return void */ - public function activate($planID, $confirm = 'no') + public function activate(int $planID) { - if($confirm == 'no') - { - return print(js::confirm($this->lang->productplan->confirmActivate, $this->createLink('productplan', 'activate', "planID=$planID&confirm=yes"), 'parent')); - } - else - { - $this->productplan->updateStatus($planID, 'doing', 'activated'); + $this->productplan->updateStatus($planID, 'doing', 'activated'); - if(dao::isError()) return print(js::error(dao::getError())); - return print(js::reload('parent')); - } + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + return $this->send(array('result' => 'success', 'load' => true, 'closeModal' => true)); } /** diff --git a/module/productplan/js/browse.ui.js b/module/productplan/js/browse.ui.js index f9f9aaf4fa..dc073dfd86 100644 --- a/module/productplan/js/browse.ui.js +++ b/module/productplan/js/browse.ui.js @@ -71,6 +71,14 @@ window.finishProductPlan = function(planID) }); } +window.activateProductPlan = function(planID) +{ + zui.Modal.confirm({message: confirmActivate, icon:'icon-info-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) => + { + if(res) $.ajaxSubmit({url: $.createLink('productplan', 'activate', 'planID=' + planID)}); + }); +} + window.deleteProductPlan = function(planID) { zui.Modal.confirm({message: confirmDelete, icon:'icon-info-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) => diff --git a/module/productplan/ui/browsebylist.html.php b/module/productplan/ui/browsebylist.html.php index f5cadb191c..3f707ad978 100644 --- a/module/productplan/ui/browsebylist.html.php +++ b/module/productplan/ui/browsebylist.html.php @@ -298,6 +298,7 @@ jsVar('totalChild', $totalChild); jsVar('totalIndependent', $totalIndependent); jsVar('confirmStart', $this->lang->productplan->confirmStart); jsVar('confirmFinish', $this->lang->productplan->confirmFinish); +jsVar('confirmActivate', $this->lang->productplan->confirmActivate); jsVar('confirmDelete', $this->lang->productplan->confirmDelete); render();