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