<?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;
use App\Http\Controllers\BiorepositoryController;
use App\Http\Controllers\GudangController;
use App\Http\Controllers\MobileApiController;

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::get('mobile/expertise/{periksa}', [MobileApiController::class, 'openExpertise']);
Route::post('registerpasien', [FrontpageController::class, 'registerApi']);
Route::post('registerulang', [FrontpageController::class, 'registerApiUlang']);

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/{periksa}/expertise', [FrontpageController::class, 'viewMikroExpertise'])->name('mikro.expertise');
	Route::get('mikro/{id}', [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('tabsmode/{id}', [FrontpageController::class, 'viewTabletsMode']);
	Route::get('penerimaansample', [FrontpageController::class, 'viewPenerimaanSample']);
	Route::get('modemobile', [FrontpageController::class, 'viewMobileMode']);
	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::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('biorepository', [BiorepositoryController::class, 'index'])->name('biorepository.index');
	Route::get('gudang', [GudangController::class, 'viewGudangIndex']);
	Route::post('biorepository/store-cabinet', [BiorepositoryController::class, 'storeCabinet'])->name('biorepository.storeCabinet');
	Route::post('biorepository/store-rack', [BiorepositoryController::class, 'storeRack'])->name('biorepository.storeRack');
	Route::post('biorepository/store-specimen', [BiorepositoryController::class, 'storeSpecimen'])->name('biorepository.storeSpecimen');
	Route::post('biorepository/delete-specimen/{id}', [BiorepositoryController::class, 'deleteSpecimen'])->name('biorepository.deleteSpecimen');
	Route::post('biorepository/delete-rack/{id}', [BiorepositoryController::class, 'deleteRack'])->name('biorepository.deleteRack');
	Route::post('biorepository/delete-cabinet/{id}', [BiorepositoryController::class, 'deleteCabinet'])->name('biorepository.deleteCabinet');
	Route::post('simbhp/exaddbarang', [GudangController::class, 'exAddbarang'])->name('exAddBarang');
	Route::get('simbhp/snapshot', [GudangController::class, 'jsonSnapshot'])->name('simbhp.snapshot');
	Route::get('simbhp/expired-batches', [GudangController::class, 'jsonExpiredBatches'])->name('simbhp.expiredBatches');
	Route::post('simbhp/racikan', [GudangController::class, 'storeRacikan'])->name('simbhp.racikan');
	Route::post('simbhp/update-expired', [GudangController::class, 'updateExpiredBatch'])->name('simbhp.updateExpired');
	Route::post('simbhp/reportbhp', [GudangController::class, 'jsonReportbhp'])->name('reportBHP');
	Route::get('simbhp/reportbhp/export', [GudangController::class, 'exportReportbhp'])->name('reportBHPExport');
	Route::post('simbhp/kwitansi', [GudangController::class, 'exKwitansi'])->name('kwitansiBHP');
	Route::get('simbhp/rekapbhp', [GudangController::class, 'jsonRekapbhp'])->name('rekapBHP');

	Route::get('dokter', [DokterController::class, 'index']);
	Route::get('reportppds', [DokterController::class, 'reportppds']);
	Route::post('dashboard/early-warning/{id}/cancel', [FrontpageController::class, 'cancelEarlyWarning'])->name('dashboard.earlyWarning.cancel');
	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/batalperiksa', [DokterController::class, 'batalPeriksa'])->name('batalPeriksa');
	Route::post('dokter/batalperiksaterima', [DokterController::class, 'batalPeriksaTerima'])->name('batalPeriksaTerima');
	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('notifikasi/nilai-kritis', [DokterController::class, 'criticalValueNotifications'])->name('criticalValueNotifications');
	Route::get('notifikasi/nilai-kritis/export', [DokterController::class, 'criticalValueNotificationExport'])->name('criticalValueNotificationExport');
	Route::get('notifikasi/nilai-kritis/summary', [DokterController::class, 'criticalValueNotificationSummary'])->name('criticalValueNotificationSummary');
	Route::get('notifikasi/nilai-kritis/{id}', [DokterController::class, 'criticalValueNotificationOpen'])->name('criticalValueNotificationOpen');
	Route::post('notifikasi/nilai-kritis/{id}/mark-read', [DokterController::class, 'criticalValueNotificationMarkRead'])->name('criticalValueNotificationMarkRead');

	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('mikroskopisbtasp', [ReportController::class, 'genMikroskopisBtaSpReport']);
	Route::get('tatreport', [ReportController::class, 'genTATreport']);
	Route::get('reportpenerimaansample', [ReportController::class, 'genRekapPenerimaanSample']);
	Route::post('reportpenerimaansample/mark-printed', [ReportController::class, 'markRekapPenerimaanSamplePrinted'])->name('markRekapPenerimaanSamplePrinted');
	Route::get('/glass-report/export', [ReportController::class, 'exportGlassReport'])->name('exportGlassReport');
	Route::get('rekap-antibiotik/export', [ReportController::class, 'exportRekapAntibiotik'])->name('exportRekapAntibiotik');
	Route::get('list', [ListController::class, 'index']);
	Route::get('list/getlist', [ListController::class, 'getList'])->name('getList');
	Route::post('list/getlistdatatables', [ListController::class, 'getListDataTables'])->name('getListDataTables');
	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');
	Route::post('/git/pull', [JsonTransferController::class, 'pull'])->name('git.pull');
});
