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

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

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

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

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

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

export async function saveKoreksiJurnal(params) {
    try {
        var resp = await axios.post(URL + 'saveKoreksiJurnal', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        var data = resp.data
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function getDaftarJournalBalik(params) {
    try {
        var resp = await axios.post(URL + 'getDaftarJournalBalik', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        var data = resp.data
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function getDetailJournalBalik(params) {
    try {
        var resp = await axios.post(URL + 'getDetailJournalBalik', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        var data = resp.data
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function updateStatusKoreksiJurnal(params) {
    try {
        var resp = await axios.post(URL + 'updateStatusKoreksiJurnal', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        var data = resp.data
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function getUserApproveLevel(params) {
    try {
        var resp = await axios.post(URL + 'getUserApproveLevel', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        var data = resp.data
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}