<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\DokterController;
use App\Http\Controllers\FrontpageController;
use App\Http\Controllers\PasienController;
use App\Http\Controllers\PoliController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\ReportController;
use App\Http\Controllers\ListController;
use App\Http\Controllers\TemplateController;
use App\Http\Controllers\LogbookController;
use App\Http\Controllers\JsonTransferController;

Route::get('/', [FrontpageController::class, 'index']);

Route::get('login', function () {
    return view('login');
});
Route::post('authenticate', [AuthController::class, 'authenticate'])->name('login');
Route::get('logout', [AuthController::class, 'logout'])->name('logout');
Route::get('hasil/{id}', [DokterController::class, 'ctkFormhasil']);
Route::get('label/{id}', [DokterController::class, 'ctkLabel']);
Route::get('cekandroid/{firebaseid}', [AuthController::class, 'cekandroid']);
Route::post('registerpasien', [FrontpageController::class, 'registerApi']);
Route::post('registerjson', [FrontpageController::class, 'registerApiFormatJSON']);
Route::post('prosesbatal', [DokterController::class, 'cancelOrder']);
Route::post('ekstrakhasil', [DokterController::class, 'gethasiltoSIMRS'])->name('gethasiltoSIMRS');
Route::post('cekaksess', [FrontpageController::class, 'exCekAksess'])->name('exCekAksess');
Route::post('ekstrakexpertise', [DokterController::class, 'ekstrakExpertise'])->name('ekstrakExpertise');
Route::post('getnolabnorm', [DokterController::class, 'getNOLabnorm'])->name('getnolabnorm');

Route::group(['middleware' => 'project.ipg'], function() {
	Route::get('getkalenderlist', [FrontpageController::class, 'getKalenderlist'])->name('getkalenderlist');
	Route::get('mikro', [FrontpageController::class, 'viewMikro']);
	Route::get('/autocomplete-klinik', [FrontpageController::class, 'autocompleteKlinik'])->name('autocomplete.klinik');
	Route::get('/autocomplete-dokter', [FrontpageController::class, 'autocompleteDokter'])->name('autocomplete.dokter');

	Route::get('checkout', [FrontpageController::class, 'viewCheckout']);
	Route::get('pendaftaran', [FrontpageController::class, 'pendaftaran']);
	Route::get('pengambilan', [FrontpageController::class, 'pengambilan']);
	Route::post('register', [FrontpageController::class, 'register']);
	Route::post('exantrian', [FrontpageController::class, 'exantrian']);
	Route::post('getname', [PasienController::class, 'getPasien'])->name('getName');
	Route::post('getnamebyrm', [PasienController::class, 'getPasienbynorm'])->name('getnamebyrm');
	Route::post('search', [FrontpageController::class, 'autoComplete'])->name('searchajax');
	Route::get('auto', [FrontpageController::class, 'auto'])->name('auto');
	Route::get('getfnk', [FrontpageController::class, 'getFnk'])->name('getFnk');
	Route::get('getfk', [FrontpageController::class, 'getFk'])->name('getFk');
	Route::get('getdsa', [FrontpageController::class, 'getDsa'])->name('getDsa');
	Route::get('getmri', [FrontpageController::class, 'getMri'])->name('getMri');
	Route::get('getcts', [FrontpageController::class, 'getCts'])->name('getCts');
	Route::get('getusg', [FrontpageController::class, 'getUsg'])->name('getUsg');
	Route::get('getbone', [FrontpageController::class, 'getBone'])->name('getBone');
	Route::post('exdatamoving', [FrontpageController::class, 'exMoveApiRegister'])->name('exMoveApiRegister');

	Route::post('exdatapenugasan', [FrontpageController::class, 'exDatapenugasan'])->name('exDatapenugasan');

	Route::post('getlistdoneonly', [FrontpageController::class, 'getListdoneonly'])->name('getListdoneonly');
	Route::post('kirimwa', [FrontpageController::class, 'kirimWA'])->name('kirimWA');

	Route::get('poli', [PoliController::class, 'index']);
	Route::get('poli/getlistruangan', [PoliController::class, 'getListRuangan'])->name('getListRuangan');
	Route::get('poli/getlistpoli', [PoliController::class, 'getListPoli'])->name('getListPoli');
	Route::post('poli/addpoli', [PoliController::class, 'storePoli'])->name('storePoli');
	Route::post('poli/updatepoli', [PoliController::class, 'updatePoli'])->name('updatePoli');
	Route::post('poli/deletePoli', [PoliController::class, 'deletePoli'])->name('deletePoli');
	Route::post('poli/addruangan', [PoliController::class, 'storeRuangan'])->name('storeRuangan');
	Route::post('poli/updateruangan', [PoliController::class, 'updateRuangan'])->name('updateRuangan');
	Route::post('poli/deleteruangan', [PoliController::class, 'deleteRuangan'])->name('deleteRuangan');

	Route::get('gudang', [PoliController::class, 'viewGudangIndex']);
	Route::post('simbhp/exaddbarang', [PoliController::class, 'exAddbarang'])->name('exAddBarang');
	Route::post('simbhp/reportbhp', [PoliController::class, 'jsonReportbhp'])->name('reportBHP');
	Route::post('simbhp/kwitansi', [PoliController::class, 'exKwitansi'])->name('kwitansiBHP');
	Route::get('simbhp/rekapbhp', [PoliController::class, 'jsonRekapbhp'])->name('rekapBHP');

	Route::get('dokter', [DokterController::class, 'index']);
	Route::get('reportppds', [DokterController::class, 'reportppds']);
	Route::get('dokter/getlisttem', [DokterController::class, 'getListtem'])->name('getListTemplate');
	Route::get('dokter/getlistppds', [DokterController::class, 'getListppds'])->name('getlistppds');
	Route::post('dokter/getadendum', [DokterController::class, 'getAdendum'])->name('getadendum');	
	Route::post('dokter/store', [DokterController::class, 'store']);	
	Route::post('dokter/getdokter', [DokterController::class, 'getDokter'])->name('getDokter');
	Route::post('dokter/update', [DokterController::class, 'update']);
	Route::post('dokter/delete', [DokterController::class, 'delete'])->name('deleteDokter');
	Route::post('dokter/sendorder', [DokterController::class, 'sendOrder'])->name('sendorder');
	Route::post('dokter/getresult', [DokterController::class, 'getResult'])->name('getResult');
	Route::post('dokter/cancelorder', [DokterController::class, 'cancelOrder'])->name('cancelPACSorder');
	Route::post('dokter/exexpertise', [DokterController::class, 'exExpertise'])->name('exexpertise');
	Route::post('dokter/exexpertisepacs', [DokterController::class, 'exexpertisePacs'])->name('exexpertisepacs');
	Route::post('dokter/savepdf', [DokterController::class, 'savePdf'])->name('savePdf');
	Route::post('dokter/getriwayat', [DokterController::class, 'getRiwayat'])->name('getriwayat');
	Route::post('dokter/periksa', [DokterController::class, 'periksa'])->name('markPeriksa');
	Route::post('dokter/getpasienbydate', [DokterController::class, 'getPasienbydate'])->name('getpasienbydate');
	Route::post('dokter/exuploader', [DokterController::class, 'exUploader'])->name('exuploader');
	Route::post('dokter/getfoto', [DokterController::class, 'getFoto'])->name('getfoto');
	Route::post('dokter/getpasienvalue', [DokterController::class, 'getpasienValue'])->name('getpasienvalue');
	Route::post('dokter/exaddadendum', [DokterController::class, 'exaddAdendum'])->name('exaddadendum');
	Route::post('dokter/exprintlabel', [DokterController::class, 'exprintLabel'])->name('exprintlabel');
	Route::post('dokter/exprintform', [DokterController::class, 'exprintForm'])->name('exprintform');
	Route::post('dokter/exprintlabelsimrs', [DokterController::class, 'exprintLabelSIMRS'])->name('exprintlabelSIMRS');
	Route::post('dokter/exprintformsimrs', [DokterController::class, 'exprintFormSIMRS'])->name('exprintformSIMRS');
	Route::post('dokter/exsendtomany', [DokterController::class, 'exsendTomany'])->name('exsendtomany');
	Route::post('dokter/exsendtoinsitu', [DokterController::class, 'exsendToinsitu'])->name('exsendtoinsitu');
	Route::post('dokter/getListadendum', [DokterController::class, 'getListadendum'])->name('getListadendum');
	Route::post('dokter/exprinttandaterima', [DokterController::class, 'exTandaTerima'])->name('exTandaTerima');

	Route::get('pasien', [PasienController::class, 'index']);
	Route::post('pasien/store', [PasienController::class, 'store']);
	Route::post('pasien/getpasien', [PasienController::class, 'getPasien'])->name('getPasien');
	Route::post('pasien/update', [PasienController::class, 'update']);
	Route::post('pasien/delete', [PasienController::class, 'delete'])->name('deletePasien');
	Route::get('pasien/getpatienalllist', [PasienController::class, 'getPatienalllist'])->name('getPatienalllist');
	
	Route::get('user', [UserController::class, 'index']);
	Route::post('user/store', [UserController::class, 'store']);
	Route::post('user/getUser', [UserController::class, 'getUser'])->name('getUser');
	Route::post('user/update', [UserController::class, 'update']);
	Route::post('user/delete', [UserController::class, 'delete'])->name('deleteUser');
	Route::post('user/exsetting', [UserController::class, 'exSetting'])->name('exsetting');
	Route::post('user/exttd', [UserController::class, 'exTtd'])->name('exTtd');
	Route::get('user/getworklist', [UserController::class, 'getWorklist'])->name('getworklist');
	Route::post('user/exsettingworklist', [UserController::class, 'exSettingworklist'])->name('exsettingworklist');
	Route::post('user/updatefoto', [UserController::class, 'updateFoto'])->name('updatefoto');

	Route::get('report', [ReportController::class, 'index']);
	Route::post('report', [ReportController::class, 'report'])->name('reportPeriksa');
	Route::post('rekapperiksa', [ReportController::class, 'rekapPeriksa'])->name('rekapPeriksa');
	Route::get('rekapantibiotik', [ReportController::class, 'genRekapAntibiotik']);
	Route::get('glassreport', [ReportController::class, 'genGlassReport']);
	Route::get('znreport', [ReportController::class, 'genZNreport']);

	Route::get('list', [ListController::class, 'index']);
	Route::get('list/getlist', [ListController::class, 'getList'])->name('getList');
	Route::get('list/getlistterjadwal', [ListController::class, 'getListterjadwal'])->name('getListterjadwal');
	Route::post('list/listdetail', [ListController::class, 'listDetail'])->name('listDetail');
	Route::post('list/listdelete', [ListController::class, 'delete'])->name('deleteList');
	
	Route::get('template', [TemplateController::class, 'index']);
	Route::get('sirab', [TemplateController::class, 'viewSIRAb']);
	Route::get('template/getlistjawaban', [TemplateController::class, 'getListJawaban'])->name('getListJawaban');
	Route::post('template/storejawaban', [TemplateController::class, 'storeJawaban'])->name('storeJawaban');
	Route::post('template/updatejawaban', [TemplateController::class, 'updateJawaban'])->name('updateJawaban');
	Route::post('template/deletejawaban', [TemplateController::class, 'deleteJawaban'])->name('deleteJawaban');
	Route::post('template/storesubjawaban', [TemplateController::class, 'storeSubjawaban'])->name('storeSubjawaban');
	Route::post('template/getlistsubjawaban', [TemplateController::class, 'getListSubjawaban'])->name('getListSubjawaban');
	Route::post('template/updatesubjawaban', [TemplateController::class, 'updateSubjawaban'])->name('updateSubjawaban');
	Route::post('template/deletesubjawaban', [TemplateController::class, 'deleteSubjawaban'])->name('deleteSubjawaban');
	Route::get('/templateimage/{imageName}', [TemplateController::class, 'showImage']);
	Route::post('template/uploadkop', [TemplateController::class, 'exUploadKOP'])->name('exUploadKOP');
	Route::get('/barcode/{data}', [TemplateController::class, 'showBarcode'])->name('generate.barcode');
	Route::post('template/exsirab', [TemplateController::class, 'exSIRAb'])->name('exSIRAb');

	Route::get('logbook', [LogbookController::class, 'index']);
	Route::get('logbookmenu', [LogbookController::class, 'logbookControl']);
	Route::get('logbookstatistik', [LogbookController::class, 'logbookStatistik']);
	Route::post('logbook/datalistlogbook', [LogbookController::class, 'jsonListlogbook'])->name('jsonListlogbook');
	Route::post('logbook/jsonviewlistlogbookppds', [LogbookController::class, 'jsonViewlistlogbookppds'])->name('jsonViewlistlogbookppds');
	Route::post('logbook/jsonviewlogbook', [LogbookController::class, 'jsonViewlogbook'])->name('jsonViewlogbook');
	Route::post('logbook/jsonviewlistlogbook', [LogbookController::class, 'jsonViewlistlogbook'])->name('jsonViewlistlogbook');
	Route::post('logbook/jpencarian', [LogbookController::class, 'jsonPencarian'])->name('jsonPencarian');
	Route::post('logbook/jpencarianspv', [LogbookController::class, 'jsonPencarianSPV'])->name('jsonPencarianSPV');
	Route::post('logbook/exaddlogbook', [LogbookController::class, 'exAddlogbook'])->name('exAddlogbook');
	Route::post('logbook/exmenuslogbook', [LogbookController::class, 'exMenuslogbook'])->name('exMenuslogbook');
	Route::get('viewlogbookppds/{id}', [LogbookController::class, 'viewLogbookppds']);
	

	Route::get('/backup', [JsonTransferController::class, 'index'])->name('json.index');
	Route::post('/json-transfer/generate', [JsonTransferController::class, 'generate'])->name('json.generate');
	Route::get('/json-transfer/download-all', [JsonTransferController::class, 'downloadAll'])->name('json.downloadAll');
	Route::get('/json-transfer/download/{table}', [JsonTransferController::class, 'downloadTable'])->name('json.downloadTable');
	Route::post('/json-transfer/import/{table}', [JsonTransferController::class, 'importTable'])->name('json.importTable');
});

