<?php

use App\Http\Controllers\Payments\PaymentController;
use App\Http\Controllers\Payments\RequisitionController;
use Illuminate\Support\Facades\Route;

Route::get('/payments', [PaymentController::class, 'showPayments']);
Route::post('/payments', [PaymentController::class, 'showPayments']);

Route::get('/payment/{id}/{module?}', [PaymentController::class, 'index']);

Route::get('/requisition', [RequisitionController::class, 'showRequisitions']);
Route::post('/requisition', [RequisitionController::class, 'showRequisitions']);
Route::get('/requisition-delete', [RequisitionController::class, 'deleteRequisitions']);
Route::get('/requisition-details/{id}', [RequisitionController::class, 'showRequisitionDetails']);

Route::get('/create-new-requisition', [RequisitionController::class, 'showCreateNewRequisition']);
Route::post('/create-new-requisition', [RequisitionController::class, 'storeCreateNewRequisition']);

Route::get('/requisition-debit-accounts/{type}', [RequisitionController::class, 'showDebitRequisitionLedgers']);

Route::get('/requisition-first-approval/{id}', [RequisitionController::class, 'requisitionFirstApproval']);
Route::get('/requisition-second-approval/{id}', [RequisitionController::class, 'requisitionSecondApproval']);

Route::get('/pay-requisition/{id}', [RequisitionController::class, 'showPayRequisition']);
Route::post('/pay-requisition/{id}', [RequisitionController::class, 'storePayRequisition']);

Route::get('/edit-requisition-details/{id}', [RequisitionController::class, 'showEditRequisitionDetails']);
Route::post('/edit-requisition-details/{id}', [RequisitionController::class, 'storeEditRequisitionDetails']);

/**Delete a Requisition Section**/
Route::get('/delete-requisition-from-batch/{id}', [RequisitionController::class, 'deleteRequisitionItem']);



/**Create Functions to Control my own Requisitions**/
Route::get('/my-requisitions', [RequisitionController::class, 'showMyRequisitions']);
Route::post('/my-requisitions', [RequisitionController::class, 'showMyRequisitions']);

Route::get('/create-my-own-requisition', [RequisitionController::class, 'showCreateMyOwnRequisition']);
Route::post('/create-my-own-requisition', [RequisitionController::class, 'storeCreateMyOwnRequisition']);

Route::get('/get-issued-certificates-on-vehicle/{insurer}/{regNo}', [RequisitionController::class, 'searchIssuedCertificatesOnVehicle']);
Route::get('/get-policy-premium-balance-for-refund/{dnNo}', [RequisitionController::class, 'searchPolicyPremiumRefundAmount']);
Route::get('/get-available-polies-on-vehicle/{regNo}', [RequisitionController::class, 'searchMotorVehiclePolicies']);
Route::get('/get-agent-incentives-payable/{agent}/{month}/{year}', [RequisitionController::class, 'searchAgentIncentives']);

Route::get('/view-requisition-payment-details/{id}', [RequisitionController::class, 'viewRequisitionPaymentDetails']);

/**Download Declaration Reports**/
Route::get('/download-declarations-report', [RequisitionController::class, 'showDownloadDeclarationsReport']);
Route::get('/get-declaration-report-on-vehicle/{insurer}/{regNo}/{from?}/{to?}', [RequisitionController::class, 'searchDeclarationReportOnVehicle']);


/**Updating a Payment Routes**/
Route::get('/edit-payment-ref-number/{id}', [PaymentController::class, 'showEditRefNumber']);
Route::post('/edit-payment-ref-number/{id}', [PaymentController::class, 'storeEditRefNumber']);
