<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Jenis_pelayanan extends CI_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->model('M_jenis_pelayanan');
	}

	public function data_jenis_pelayanan()
	{
		$result = $this->M_jenis_pelayanan->data_jenis_pelayanan()->result_array();
		echo json_encode($result);
	}

	public function simpan_jenis_pelayanan()
	{
		$data["nama"] = $this->input->post('nama', TRUE);
		$respon = $this->M_jenis_pelayanan->simpan_jenis_pelayanan($data);
		echo json_encode($respon);
	}

	public function ambil_jenis_pelayanan()
	{
		$data["id_jenis_pelayanan"] = $this->input->post('id_jenis_pelayanan', TRUE);
		$respon = $this->M_jenis_pelayanan->ambil_jenis_pelayanan($data)->row_array();
		echo json_encode($respon);
	}

	public function update_jenis_pelayanan()
	{
		$data["id_jenis_pelayanan"] = $this->input->post('id_jenis_pelayanan', TRUE);
		$data["nama"] = $this->input->post('nama', TRUE);
		$respon = $this->M_jenis_pelayanan->update_jenis_pelayanan($data);
		echo json_encode($respon);
	}

	public function hapus_jenis_pelayanan()
	{
		$data["id_jenis_pelayanan"] = $this->input->post('id_jenis_pelayanan', TRUE);
		$respon = $this->M_jenis_pelayanan->hapus_jenis_pelayanan($data);
		echo json_encode($respon);
	}
}
