Browse Source

update export & search project information

pull/1/head
wahyun 12 months ago
parent
commit
bf8c59a264
  1. 41
      src/views/SimproV2/CreatedProyek/index.js

41
src/views/SimproV2/CreatedProyek/index.js

@ -330,8 +330,6 @@ const CreatedProyek = ({ params, ...props }) => {
const getDataProyek = async () => { const getDataProyek = async () => {
setLoading(true); setLoading(true);
let start = 0; let start = 0;
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
start = currentPage * rowsPerPage - rowsPerPage; start = currentPage * rowsPerPage - rowsPerPage;
} }
@ -371,13 +369,13 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
if (all_project !== null && all_project === true) { if (all_project !== null && all_project === true) {
payload["columns"] = [ payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" } { name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
]; );
} else { } else {
payload["columns"] = [ payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
]; );
} }
const result = await axios const result = await axios
@ -1329,19 +1327,27 @@ const CreatedProyek = ({ params, ...props }) => {
const handleExportExcel = async () => { const handleExportExcel = async () => {
const payload = { const payload = {
columns: [
{
name: "nama",
logic_operator: "ilike",
value: search,
operator: "AND",
},
],
paging: { start: 0, length: -1 }, paging: { start: 0, length: -1 },
joins: [], joins: [],
orders: { columns: ["id"], ascending: false }, orders: { columns: ["id"], ascending: false },
}; };
if (all_project !== null && all_project === true) { if (all_project !== null && all_project === true) {
payload["columns"] = [ payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" } { name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
]; );
} else { } else {
payload["columns"] = [ payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
]; );
} }
const result = await axios const result = await axios
@ -1411,11 +1417,20 @@ const CreatedProyek = ({ params, ...props }) => {
column_join: "type_proyek_id", column_join: "type_proyek_id",
column_results: ["name", "description"], column_results: ["name", "description"],
}, },
// { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
], ],
orders: { columns: ["nama"], ascending: true }, orders: { columns: ["nama"], ascending: true },
}; };
if (all_project !== null && all_project === true) {
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
);
} else {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
}
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)

Loading…
Cancel
Save