<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function(){ return redirect()->route('home'); });
Route::get('login', 'AuntController@login')->name('login');
Route::post('DoLogin', 'AuntController@DoLogin')->name('DoLogin');
Route::get('logout', 'AuntController@logout')->name('logout');
// Route::get('createUser', 'AuntController@create')->name('createUser');
Route::group(['middleware' => 'auth'], function() {
	Route::get('/home', 'DashboardController@home')->name('home');
	Route::post('/getKabupaten', 'DashboardController@getKabupaten')->name('getKabupaten');
	Route::post('/getKecamatan', 'DashboardController@getKecamatan')->name('getKecamatan');
	Route::post('/getDesa', 'DashboardController@getDesa')->name('getDesa');
	Route::post('/cekMail', 'AuntController@cekMail')->name('cekMail');
	Route::post('/cekNik', 'AuntController@cekNik')->name('cekNik');
	Route::post('/coaba', 'AuntController@coaba')->name('coaba');

	Route::group(array('prefix'=>'users'), function(){
		Route::group(array('prefix'=>'admin'), function(){
			Route::get('/', 'AdminController@index')->name('admin');
			Route::post('/datagrid', 'AdminController@datagrid')->name('adminDatagrid');
			Route::post('/formAdd', 'AdminController@formAdd')->name('formAddAdmin');
			Route::post('/add', 'AdminController@add')->name('addAdmin');
			Route::post('/detail', 'AdminController@detail')->name('detailAdmin');
			Route::post('/nonActive', 'AdminController@nonActive')->name('nonActiveAdmin');
			Route::post('/active', 'AdminController@active')->name('activeAdmin');
			Route::post('/resetPassword', 'AdminController@resetPassword')->name('resetPasswordAdmin');
			Route::post('/formEdit', 'AdminController@formEdit')->name('formEditAdmin');
			Route::post('/edit', 'AdminController@edit')->name('editAdmin');
			Route::post('/delete', 'AdminController@delete')->name('deleteAdmin');
		});
		Route::group(array('prefix'=>'bidan'), function(){
			Route::get('/', 'BidanController@index')->name('bidan');
			Route::post('/datagrid', 'BidanController@datagrid')->name('bidanDatagrid');
			Route::post('/formAdd', 'BidanController@formAdd')->name('formAddBidan');
			Route::post('/add', 'BidanController@add')->name('addBidan');
			Route::post('/detail', 'BidanController@detail')->name('detailBidan');
			Route::post('/nonActive', 'BidanController@nonActive')->name('nonActiveBidan');
			Route::post('/active', 'BidanController@active')->name('activeBidan');
			Route::post('/resetPassword', 'BidanController@resetPassword')->name('resetPasswordBidan');
			Route::post('/formEdit', 'BidanController@formEdit')->name('formEditBidan');
			Route::post('/edit', 'BidanController@edit')->name('editBidan');
			Route::post('/delete', 'BidanController@delete')->name('deleteBidan');
		});
		Route::group(array('prefix'=>'pusat-kesehatan'), function(){
			Route::get('/', 'PusatKesehatanController@index')->name('pusatKesehatan');
			Route::post('/datagrid', 'PusatKesehatanController@datagrid')->name('pusatKesehatanDatagrid');
			Route::post('/formAdd', 'PusatKesehatanController@formAdd')->name('formAddPusatKesehatan');
			Route::post('/add', 'PusatKesehatanController@add')->name('addPusatKesehatan');
			Route::post('/detail', 'PusatKesehatanController@detail')->name('detailPusatKesehatan');
			Route::post('/nonActive', 'PusatKesehatanController@nonActive')->name('nonActivePusatKesehatan');
			Route::post('/active', 'PusatKesehatanController@active')->name('activePusatKesehatan');
			Route::post('/resetPassword', 'PusatKesehatanController@resetPassword')->name('resetPasswordPusatKesehatan');
			Route::post('/formEdit', 'PusatKesehatanController@formEdit')->name('formEditPusatKesehatan');
			Route::post('/edit', 'PusatKesehatanController@edit')->name('editPusatKesehatan');
			Route::post('/delete', 'PusatKesehatanController@delete')->name('deletePusatKesehatan');
		});
	
		Route::group(array('prefix'=>'kua'), function(){
			Route::get('/', 'UserKUAController@index')->name('usrKua');
			Route::post('/datagrid', 'UserKUAController@datagrid')->name('usrKuaDatagrid');
			Route::post('/formAdd', 'UserKUAController@formAdd')->name('formAddUsrKua');
			Route::post('/add', 'UserKUAController@add')->name('addUsrKua');
			Route::post('/detail', 'UserKUAController@detail')->name('detailUsrKua');
			Route::post('/resetPassword', 'UserKUAController@resetPassword')->name('resetPasswordUsrKua');
			Route::post('/formEdit', 'UserKUAController@formEdit')->name('formEditUsrKua');
			Route::post('/edit', 'UserKUAController@edit')->name('editUsrKua');
			Route::post('/delete', 'UserKUAController@delete')->name('deleteUsrKua');
		});

		Route::group(array('prefix'=>'profile'), function(){
			Route::get('/', 'ProfileController@index')->name('profile');
			Route::post('/formEditPassword', 'ProfileController@formEditPassword')->name('formEditPassword');
			Route::post('/editPassword', 'ProfileController@editPassword')->name('editPassword');
		});
	});
	
	Route::group(array('prefix'=>'keluarga-sehat'), function(){
		/*
		Route::group(array('prefix'=>'identitas'), function(){
			Route::get('/', 'IdentitasPasanganController@index')->name('idenPas');
			Route::post('/datagrid', 'IdentitasPasanganController@datagrid')->name('idenPasDatagrid');
			Route::post('/formAdd', 'IdentitasPasanganController@formAdd')->name('formAddIdenPas');
			Route::post('/cekNoRegistrasi', 'IdentitasPasanganController@cekNoRegistrasi')->name('cekNoRegistrasi');
			Route::post('/cekNIK', 'IdentitasPasanganController@cekNikIstri')->name('cekNikIstri');
			Route::post('/add', 'IdentitasPasanganController@add')->name('addIdenPas');
			Route::post('/detail', 'IdentitasPasanganController@detail')->name('detailIdenPas');
			Route::post('/formEdit', 'IdentitasPasanganController@formEdit')->name('formEditIdenPas');
			Route::post('/edit', 'IdentitasPasanganController@edit')->name('editIdenPas');
		});
		*/
		
		Route::group(array('prefix'=>'kesehatan'), function(){
			Route::get('/', 'KesehatanPasanganController@index')->name('dtKesPas');
			Route::post('/datagrid', 'KesehatanPasanganController@datagrid')->name('dtKesPasDatagrid');
			Route::post('/formAdd', 'KesehatanPasanganController@formAdd')->name('formAddDtKesPas');
			Route::post('/cekPernikahanIstri', 'KesehatanPasanganController@cekPernikahanIstri')->name('cekPernikahanIstri');
			Route::post('/getDetPernikahan', 'KesehatanPasanganController@getDetPernikahan')->name('getDetPernikahan');
			Route::post('/add', 'KesehatanPasanganController@add')->name('addDtKesPas');
			Route::post('/detail', 'KesehatanPasanganController@detail')->name('detailDtKesPas');
			Route::post('/formEdit', 'KesehatanPasanganController@formEdit')->name('formEditDtKesPas');
			Route::post('/edit', 'KesehatanPasanganController@edit')->name('editDtKesPas');
		});
		Route::group(array('prefix'=>'pernikahan'), function(){
			Route::get('/', 'PernikahanPasanganController@index')->name('dtPernikahan');
			Route::post('/datagrid', 'PernikahanPasanganController@datagrid')->name('dtPernikahanDatagrid');
			Route::post('/formAdd', 'PernikahanPasanganController@formAdd')->name('formAddDtPernikahan');
			Route::post('/cekNoRegistrasi', 'PernikahanPasanganController@cekNoRegistrasi')->name('cekNoRegistrasi');
			Route::post('/cekNIK', 'PernikahanPasanganController@cekNikIstri')->name('cekNikIstri');
			Route::post('/add', 'PernikahanPasanganController@add')->name('addDtPernikahan');
			Route::post('/detail', 'PernikahanPasanganController@detail')->name('detailDtPernikahan');
			Route::post('/formEdit', 'PernikahanPasanganController@formEdit')->name('formEditDtPernikahan');
			Route::post('/edit', 'PernikahanPasanganController@edit')->name('editDtPernikahan');
		});
	});
	
	Route::group(array('prefix'=>'istri'), function(){
		Route::get('/', 'IstriController@index')->name('istri');
		Route::post('/datagrid', 'IstriController@datagrid')->name('istriDatagrid');
		Route::post('/formAdd', 'IstriController@formAdd')->name('formAddIstri');
		Route::post('/cekNIK', 'IstriController@cekNIK')->name('cekNik_Istri');
		Route::post('/add', 'IstriController@add')->name('addIstri');
		Route::post('/detail', 'IstriController@detail')->name('detailIstri');
		Route::post('/formEdit', 'IstriController@formEdit')->name('formEditIstri');
		Route::post('/edit', 'IstriController@edit')->name('editIstri');
		Route::post('/delete', 'IstriController@delete')->name('deleteIstri');
	});

	Route::group(array('prefix'=>'data-ibu'), function(){
		Route::get('/', 'KehamilanController@index')->name('dataIbu');
		Route::post('/searchIbuHamil', 'KehamilanController@searchIbuHamil')->name('searchIbuHamil');
		Route::post('/formAddKehamilan', 'KehamilanController@formAddKehamilan')->name('formAddKehamilan');
		Route::post('/addKehamilan', 'KehamilanController@addKehamilan')->name('addKehamilan');
		Route::post('/detailKehamilan', 'KehamilanController@detailKehamilan')->name('detailKehamilan');
		Route::post('/formEditKehamilan', 'KehamilanController@formEditKehamilan')->name('formEditKehamilan');
		Route::post('/editKehamilan', 'KehamilanController@editKehamilan')->name('editKehamilan');
		
		Route::post('/mainKunjungan', 'KehamilanController@mainKunjungan')->name('mainKunjungan');
		Route::post('/searchKunjungan', 'KehamilanController@searchKunjungan')->name('searchKunjungan');
		Route::post('/detailKunjungan', 'KehamilanController@detailKunjungan')->name('detailKunjungan');
		Route::post('/formAddKunjungan', 'KehamilanController@formAddKunjungan')->name('formAddKunjungan');
		Route::post('/formEditKunjungan', 'KehamilanController@formEditKunjungan')->name('formEditKunjungan');
		Route::post('/updateKunjungan', 'KehamilanController@updateKunjungan')->name('updateKunjungan');
	});
	
	Route::group(array('prefix'=>'1000-hpk'), function(){
		Route::get('/', 'SeribuHpkController@index')->name('1000hpk');
		Route::post('/searchBumil', 'SeribuHpkController@searchBumil')->name('searchBumil');
		Route::post('/formAddKelahiran', 'SeribuHpkController@formAddKelahiran')->name('formAddKelahiran');
		Route::post('/addKelahiran', 'SeribuHpkController@addKelahiran')->name('addKelahiran');
		Route::post('/detail', 'SeribuHpkController@detailBumil')->name('detailBumil');
		Route::post('/main1000hpk', 'SeribuHpkController@main1000hpk')->name('main1000hpk');
		Route::post('/cek1000hpk', 'SeribuHpkController@cek1000hpk')->name('cek1000hpk');
		Route::post('/formJumlahAnak', 'SeribuHpkController@formJumlahAnak')->name('formJumlahAnak');
		Route::post('/addAnak', 'SeribuHpkController@addAnak')->name('addAnak');
		Route::post('/searchAnak', 'SeribuHpkController@searchAnak')->name('searchAnak');
		Route::post('/detailPerkembanganAnak', 'SeribuHpkController@detailPerkembanganAnak')->name('detailPerkembanganAnak');
		Route::post('/getGrafikBBU', 'SeribuHpkController@getGrafikBBU')->name('getGrafikBBU');
		Route::post('/getGrafikPBU', 'SeribuHpkController@getGrafikPBU')->name('getGrafikPBU');
		Route::post('/getGrafikPBBB', 'SeribuHpkController@getGrafikPBBB')->name('getGrafikPBBB');
		Route::post('/updateInfoAnak', 'SeribuHpkController@updateInfoAnak')->name('updateInfoAnak');
		Route::post('/searchImunAnak', 'SeribuHpkController@searchImunAnak')->name('searchImunAnak');
		Route::post('/formUpdateImun', 'SeribuHpkController@formUpdateImun')->name('formUpdateImun');
		Route::post('/UpdateImun', 'SeribuHpkController@UpdateImun')->name('UpdateImun');
		Route::post('/searchPerkemBulan', 'SeribuHpkController@searchPerkemBulan')->name('searchPerkemBulan');
		Route::post('/formPerkemBulan', 'SeribuHpkController@formPerkemBulan')->name('formPerkemBulan');
		Route::post('/UpdatePerkemBulan', 'SeribuHpkController@UpdatePerkemBulan')->name('UpdatePerkemBulan');
		Route::post('/detailPerkemBulan', 'SeribuHpkController@detailPerkemBulan')->name('detailPerkemBulan');
	});
});

Route::group(['prefix'=>'api'], function(){
	route::any('login','Api\APIUserController@DoLogin');

	Route::group(['middleware'=>'apiAuth'], function(){
		route::any('getDataUser','Api\APIUserController@getdatauser');
		// route::any('editDataUser','Api\APIUserController@editDataUser');

		Route::group(['prefix'=>'daerah'], function(){
			route::any('getprovinsi', 'Api\APIUserController@getProvinsi');
			route::any('getkabupaten', 'Api\APIUserController@getKabupaten');
			route::any('getkecamatan', 'Api\APIUserController@getKecamatan');
			route::any('getdesa', 'Api\APIUserController@getDesa');
		});
		
		Route::group(['prefix'=>'ibu'],function(){
			route::any('cariibu','Api\APIIstriController@cariibu');
			route::any('inputdataibu','Api\APIIstriController@inputdataibu');
			route::any('editdataibu','Api\APIIstriController@editdataibu');
		});

		Route::group(['prefix'=>'kehamilan'], function(){
			route::any('carikehamilan', 'Api\APIKehamilanController@carikehamilan');
			route::any('addkehamilan', 'Api\APIKehamilanController@addkehamilan');
			route::any('editkehamilan', 'Api\APIKehamilanController@editkehamilan');
			route::any('cekUsia', 'Api\APIKehamilanController@cekUsia');
			route::any('addKunjungan', 'Api\APIKehamilanController@addKunjungan');
			// route::any('detailKunjungan', 'Api\APIKehamilanController@detailKunjungan');
			route::any('listKunjungan', 'Api\APIKehamilanController@listKunjungan');

		});
			
		Route::group(['prefix'=>'1000hpk'], function(){
			route::any('carikelahiran', 'Api\API1000hpkController@carikelahiran');
			route::any('addkelahiran', 'Api\API1000hpkController@addkelahiran');
			route::any('listanak', 'Api\API1000hpkController@listAnak');
			route::any('addanak', 'Api\API1000hpkController@addAnak');
			route::any('infoDataAnak', 'Api\API1000hpkController@infoDataAnak');
			route::any('updateDataAnak', 'Api\API1000hpkController@updateDataAnak');

			route::any('infoImunisasi', 'Api\API1000hpkController@infoimunisasi');
			route::any('updateImunisasi', 'Api\API1000hpkController@updateImunisasi');
			
			route::any('dataPerkembangan', 'Api\API1000hpkController@dataPerkembangan');
			route::any('updatePerkembangan', 'Api\API1000hpkController@updatePerkembangan');
		});

		Route::group(['prefix'=>'keluarga'], function(){
			route::any('cariIstri', 'Api\APIKeluargaController@cariIstri');
		});
	});

	Route::group(['prefix'=>'web'],function(){
		Route::group(['prefix'=>'periode'], function(){
			route::any('addPeriode', 'Api\Web\APIWEBPeriodeController@addPeriode');
			route::any('addPeriodeFromAndro', 'Api\Web\APIWEBPeriodeController@addPeriodeFromAndro');
			route::any('editPeriodKunjung', 'Api\Web\APIWEBPeriodeController@editPeriodKunjung');
		});
		Route::group(['prefix'=>'bumil'], function(){
			route::any('addBumil', 'Api\Web\APIWEBIbuHamilController@addBumil');
			route::any('editBumil', 'Api\Web\APIWEBIbuHamilController@editBumil');
		});
		
		Route::group(['prefix'=>'bidan'], function(){
			route::any('addBidan', 'Api\Web\APIWEBBidanController@addBidan');
			route::any('nonActiveBidan', 'Api\Web\APIWEBBidanController@nonActiveBidan');
			route::any('activeBidan', 'Api\Web\APIWEBBidanController@activeBidan');
			route::any('resetBidan', 'Api\Web\APIWEBBidanController@resetBidan');
			route::any('gantiPassword', 'Api\Web\APIWEBBidanController@gantiPassword');
			route::any('editBidan', 'Api\Web\APIWEBBidanController@editBidan');
		});
	});
});
