<?php
function success_insert() {
    echo "<h1>Records added successfully Please Wait.</h1>";
    echo'<script>location.replace("")</script>';	    
}

if(isset($_POST['add_services'])){
    $name= $_POST['name'];
    $detail= $_POST['detail'];
    $status= $_POST['status'];
    $obj->insert('services', [
        'name' => $name,
        'detail' => $detail,
        'status' => $status
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
if(isset($_POST['add_tax_slabs'])){
    $state= $_POST['state'];
    $duration= $_POST['duration'];
    $amount= $_POST['amount'];
    $obj->insert('tax_slabs', [
        'state' => $state,
        'duration' => $duration,
        'amount' => $amount
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
if(isset($_POST['add_category'])){
    $name= $_POST['name'];
    $obj->insert('category', [
        'name' => $name,
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
if(isset($_POST['add_sub_category'])){
    $category= $_POST['category'];
    $name= $_POST['name'];
    $obj->insert('sub_category', [
        'category' => $category,
        'name' => $name,
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
if(isset($_POST['add_employee'])){
    $name= $_POST['name'];
    $number= $_POST['number'];
    $password= $_POST['password'];
    $status= $_POST['status'];
    $role= $_POST['role'];
     
    $obj->insert('employee', [
        'name' => $name,
        'number' => $number,
        'password' => $password,
        'status' => $status,
        'role' => $role,
        
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
if(isset($_POST['add_bank_details'])){
    $bank_name= $_POST['bank_name'];
    $account_number= $_POST['account_number'];
    $ifsc_code= $_POST['ifsc_code'];
    $qr_code= $_POST['qr_code'];
    $upi_id= $_POST['upi_id'];
     
    $obj->insert('bank_details', [
        'bank_name' => $bank_name,
        'account_number' => $account_number,
        'ifsc_code' => $ifsc_code,
        'qr_code' => $qr_code,
        'upi_id' => $upi_id,
        
    ]);

    if($obj->getResult()){
        success_insert();
    }
}
?>