const URL = "/one-api/mockup/purchase/faktur/Fakturv4/";

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

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

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

        let data = response.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = response.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = response.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = response.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = response.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

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

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

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

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

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