|
|
|
@ -321,61 +321,14 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getDataProyekByCustomer = async () => { |
|
|
|
|
let start = 0; |
|
|
|
|
|
|
|
|
|
if (currentPage !== 1 && currentPage > 1) { |
|
|
|
|
start = currentPage * rowsPerPage - rowsPerPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
|
columns: [ |
|
|
|
|
{ |
|
|
|
|
name: "nama", |
|
|
|
|
logic_operator: "ilike", |
|
|
|
|
value: search, |
|
|
|
|
operator: "AND", |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
select: [ |
|
|
|
|
"id", |
|
|
|
|
"nama", |
|
|
|
|
"rencana_biaya", |
|
|
|
|
"type_proyek_id", |
|
|
|
|
"currency_symbol", |
|
|
|
|
"mulai_proyek", |
|
|
|
|
"akhir_proyek", |
|
|
|
|
], |
|
|
|
|
joins: [ |
|
|
|
|
{ |
|
|
|
|
name: "m_users", |
|
|
|
|
column_join: "user_id", |
|
|
|
|
column_results: ["name", "username"], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "m_proyek", |
|
|
|
|
column_join: "proyek_id", |
|
|
|
|
column_results: ["type_proyek_id"], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
|
paging: { start: start, length: rowsPerPage }, |
|
|
|
|
user_id: { user_id: user_id } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (parseInt(role_id) !== 1) { |
|
|
|
|
payload["columns"] = [ |
|
|
|
|
{ name: "id", logic_operator: "=", value: proyek_id, operator: "AND" }, |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const url = `${BASE_OSPRO}/api/project-by-customer/${user_id}`; |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH_BY_USER, payload, HEADER) |
|
|
|
|
.get(url, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data || []; |
|
|
|
|
|
|
|
|
|
setDatatable(dataRes); |
|
|
|
|
setTotalPage(result.data.totalRecord); |
|
|
|
|
setLoading(false); |
|
|
|
|