From 9569522c839f206a917233500ab5bac27079d177 Mon Sep 17 00:00:00 2001 From: Theo Weijmer Date: Sun, 5 Aug 2018 11:03:58 +0200 Subject: [PATCH] Uppercase II --- .../controllers/beheer/VatController.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 application/controllers/beheer/VatController.php diff --git a/application/controllers/beheer/VatController.php b/application/controllers/beheer/VatController.php new file mode 100644 index 0000000..32b2d04 --- /dev/null +++ b/application/controllers/beheer/VatController.php @@ -0,0 +1,60 @@ +load->model( $models ); + $this->load->library( $libraries ); + } + + public function index() + { + + } + + public function getVats( $archive ) + { + $vats = Vat::getVats( $archive ); + + $this->json( $vats ); + } + + public function addVat() + { + Vat::create( [] ); + } + + public function saveVat( $vatID ) + { + $vatrate = $this->input->post( 'vatrate' ); + Vat::whereId( $vatID )->update( ['vatrate' => $vatrate] ); + } + + public function removeVat( $vatID ) + { + $removeVat = new RemoveVat($vatID); + + $allowRemove = $removeVat->getRemoveAllowed(); + + if( $allowRemove === FALSE ) return $this->json( ['result'=>FALSE]); + + Vat::whereId($vatID)->delete(); + + $this->json( ['result'=>TRUE]); + } +} \ No newline at end of file