diff --git a/salaryman/app/config/services.php b/salaryman/app/config/services.php index 03545a4a7ebff8ec1eec50fe98f5de1825f23ce1..ba0aa44d79806d2913eb046d4bb6574689bc6576 100644 --- a/salaryman/app/config/services.php +++ b/salaryman/app/config/services.php @@ -109,7 +109,7 @@ $di->set('router', function(){ ); $router->addGet( - "/show", + "/show/n/{nip}/y/{year}/m/{month}", array( "controller" => "index", "action" => "show" diff --git a/salaryman/app/controllers/IndexController.php b/salaryman/app/controllers/IndexController.php index d961f86a24bd04d0cb00301d50a8128ddf3197fe..42d721acfa13539a775abe1f20a800967869b0c6 100644 --- a/salaryman/app/controllers/IndexController.php +++ b/salaryman/app/controllers/IndexController.php @@ -14,7 +14,7 @@ class IndexController extends ControllerBase if ($this->session->role == "admin"){ $this->response->redirect("list/y/" . date("Y") . "/m/" . date("m") . "/p/1"); } else { - $this->response->redirect("show"); + $this->response->redirect("show/n/" + $this->session->nip + "/y/" . date("Y") . "/m/" . date("m")); } } else { $this->view->pick("users/login"); @@ -24,10 +24,18 @@ class IndexController extends ControllerBase public function showAction(){ if ($this->session->role == "pegawai"){ + $this->assets + ->addJs('js/bootstrap-datepicker/js/bootstrap-datepicker.min.js') + ->addJs('js/salaryman/look.js'); + + $this->assets + ->addCss('css/salaryman/statistics.css') + ->addCss('css/bootstrap-datepicker/bootstrap-datepicker.min.css'); + $httpRequest = new HttpRequest(); $result = $httpRequest - ->setUrl($this->config->services->salaryServices . "/getSalary/" . $this->session->nip) + ->setUrl($this->config->services->salaryServices . "/getSalary/" . "n/" . $this->dispatcher->getParam("nip") . "/y/" . $this->dispatcher->getParam("year") . "/m/" . $this->dispatcher->getParam("month")) ->setMethod("GET") ->sendRequest(); @@ -35,26 +43,38 @@ class IndexController extends ControllerBase return $this->dispatcher->forward(array("controller" => "index", "action" => "notFound")); } - $debugger = new Debugger($this); - $debugger - ->stopProgram() - ->addMessage($this->config->services->salaryServices . "/getSalary/" . "n/" . $this->dispatcher->getParam("nip") . "/y/" . $this->dispatcher->getParam("year") . "/m/" . $this->dispatcher->getParam("month")) - ->addMessage($result) - ->showMessage(); - + $result->data->gaji_total = number_format($result->data->gaji_total); + $result->data->gaji_pokok = number_format($result->data->gaji_pokok); $this->view->salary = $result->data; + // $debugger = new Debugger($this); + // $debugger + // ->stopProgram() + // ->addMessage($result) + // ->showMessage(); + $result = $httpRequest ->setUrl($this->config->services->rapelServices . "/getRapel/n/" . $this->session->nip) ->setMethod("GET") ->sendRequest(); + // $debugger = new Debugger($this); + // $debugger + // ->stopProgram() + // ->addMessage($result) + // ->showMessage(); + if ($result->status == "NOT-FOUND"){ return $this->dispatcher->forward(array("controller" => "index", "action" => "notFound")); } $this->view->rapel = $result->data->rapel; $this->view->user = $this->session; + $this->view->nip = $this->dispatcher->getParam("nip"); + $this->view->year = $this->dispatcher->getParam("year"); + $this->view->month = $this->dispatcher->getParam("month"); + + $this->tag->setDefault("rapel", 0); } else { return $this->dispatcher->forward(array("controller" => "index", "action" => "index")); }