const URL = "/one-api/mockup/masterdata/accounting/";

export async function get_listing_type(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/listpresentasecabang', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function get_list_detail_type(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/detailpresentasecabang', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function insert_type_presentase(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/inserttypepresentase', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function edit_type_presentase(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/edittypepresentase', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function delete_type_presentase(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/deletetypepresentase', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function get_list_regional(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/getlistregional', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function get_regional_branch(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/getregionalbranch', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function insert_detail_precab(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/insertdetailprecab', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function get_current_value_detail(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/getvaluedetailprecab', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function edit_detail_precab(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/editdetailprecab', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function delete_detail_precab(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/deletedetailprecab', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function search_coa(params) {
    try {
        var resp = await axios.post(URL + 'presentasecabang/searchcoa', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}