From 4082aeaed38e8f1f05eb77074294ce76f2900b92 Mon Sep 17 00:00:00 2001 From: elvanowen <vanzz_95@hotmail.com> Date: Mon, 16 May 2016 18:26:01 +0700 Subject: [PATCH] Everything --- salaryman/app/config/services.php | 2 +- salaryman/app/controllers/IndexController.php | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/salaryman/app/config/services.php b/salaryman/app/config/services.php index 03545a4..ba0aa44 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 d961f86..42d721a 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")); } -- GitLab