Browse Source

update export & search project information

pull/1/head
wahyun 10 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 () => {
setLoading(true);
let start = 0;
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
if (currentPage !== 1 && currentPage > 1) {
start = currentPage * rowsPerPage - rowsPerPage;
}
@ -371,13 +369,13 @@ const CreatedProyek = ({ params, ...props }) => {
};
if (all_project !== null && all_project === true) {
payload["columns"] = [
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
];
);
} else {
payload["columns"] = [
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
];
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
}
const result = await axios
@ -1329,19 +1327,27 @@ const CreatedProyek = ({ params, ...props }) => {
const handleExportExcel = async () => {
const payload = {
columns: [
{
name: "nama",
logic_operator: "ilike",
value: search,
operator: "AND",
},
],
paging: { start: 0, length: -1 },
joins: [],
orders: { columns: ["id"], ascending: false },
};
if (all_project !== null && all_project === true) {
payload["columns"] = [
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
];
);
} else {
payload["columns"] = [
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
];
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
}
const result = await axios
@ -1411,11 +1417,20 @@ const CreatedProyek = ({ params, ...props }) => {
column_join: "type_proyek_id",
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 },
};
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
.post(PROYEK_SEARCH, payload, HEADER)
.then((res) => res)

Loading…
Cancel
Save