|
|
@ -11,7 +11,8 @@ import { useTranslation } from 'react-i18next'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const column = [ |
|
|
|
const column = [ |
|
|
|
{ name: "Nama" }, |
|
|
|
{ name: "Company Name" }, |
|
|
|
|
|
|
|
{ name: "Nama Divisi" }, |
|
|
|
{ name: "Deskripsi" }, |
|
|
|
{ name: "Deskripsi" }, |
|
|
|
{ name: "Color" }, |
|
|
|
{ name: "Color" }, |
|
|
|
] |
|
|
|
] |
|
|
@ -67,6 +68,17 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
|
|
|
|
|
|
|
|
const getListDivision = async () => { |
|
|
|
const getListDivision = async () => { |
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
|
|
|
|
group_column: { |
|
|
|
|
|
|
|
"operator": "AND", |
|
|
|
|
|
|
|
"group_operator": "OR", |
|
|
|
|
|
|
|
"where": [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"name": "name", |
|
|
|
|
|
|
|
"logic_operator": "~*", |
|
|
|
|
|
|
|
"value": search, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
columns: [], |
|
|
|
columns: [], |
|
|
|
"orders": { |
|
|
|
"orders": { |
|
|
|
"ascending": true, |
|
|
|
"ascending": true, |
|
|
@ -77,7 +89,8 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
"paging": { |
|
|
|
"paging": { |
|
|
|
"length": 0, |
|
|
|
"length": 0, |
|
|
|
"start": -1 |
|
|
|
"start": -1 |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
'joins': [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (role_name !== "Super Admin") { |
|
|
|
if (role_name !== "Super Admin") { |
|
|
@ -88,6 +101,12 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
payload.columns.push( |
|
|
|
payload.columns.push( |
|
|
|
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, |
|
|
|
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
payload.joins.push( |
|
|
|
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
const listDivions = await axios |
|
|
|
const listDivions = await axios |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
@ -112,14 +131,18 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
start = currentPage * rowsPerPage - rowsPerPage; |
|
|
|
start = currentPage * rowsPerPage - rowsPerPage; |
|
|
|
} |
|
|
|
} |
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
columns: [ |
|
|
|
group_column: { |
|
|
|
|
|
|
|
"operator": "AND", |
|
|
|
|
|
|
|
"group_operator": "OR", |
|
|
|
|
|
|
|
"where": [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
name: "name", |
|
|
|
"name": "name", |
|
|
|
logic_operator: "ilike", |
|
|
|
"logic_operator": "~*", |
|
|
|
value: search, |
|
|
|
"value": search, |
|
|
|
operator: "AND" |
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
columns: [], |
|
|
|
"orders": { |
|
|
|
"orders": { |
|
|
|
"ascending": true, |
|
|
|
"ascending": true, |
|
|
|
"columns": [ |
|
|
|
"columns": [ |
|
|
@ -129,7 +152,8 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
"paging": { |
|
|
|
"paging": { |
|
|
|
"length": rowsPerPage, |
|
|
|
"length": rowsPerPage, |
|
|
|
"start": start |
|
|
|
"start": start |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
'joins': [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (role_name !== "Super Admin") { |
|
|
|
if (role_name !== "Super Admin") { |
|
|
@ -140,6 +164,12 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
payload.columns.push( |
|
|
|
payload.columns.push( |
|
|
|
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, |
|
|
|
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
payload.joins.push( |
|
|
|
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
@ -162,14 +192,18 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
"columns": [ |
|
|
|
group_column: { |
|
|
|
|
|
|
|
"operator": "AND", |
|
|
|
|
|
|
|
"group_operator": "OR", |
|
|
|
|
|
|
|
"where": [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
"name": "name", |
|
|
|
"name": "name", |
|
|
|
"logic_operator": "like", |
|
|
|
"logic_operator": "~*", |
|
|
|
"value": search, |
|
|
|
"value": search, |
|
|
|
"operator": "AND" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"columns": [], |
|
|
|
"orders": { |
|
|
|
"orders": { |
|
|
|
"ascending": true, |
|
|
|
"ascending": true, |
|
|
|
"columns": [ |
|
|
|
"columns": [ |
|
|
@ -179,9 +213,24 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
"paging": { |
|
|
|
"paging": { |
|
|
|
"length": rowsPerPage, |
|
|
|
"length": rowsPerPage, |
|
|
|
"start": start |
|
|
|
"start": start |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'joins': [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (role_name !== "Super Admin") { |
|
|
|
|
|
|
|
payload.columns.push( |
|
|
|
|
|
|
|
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
payload.columns.push( |
|
|
|
|
|
|
|
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
payload.joins.push( |
|
|
|
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
@ -190,10 +239,12 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
let resData = result.data.data; |
|
|
|
let resData = result.data.data; |
|
|
|
const excelData = []; |
|
|
|
const excelData = []; |
|
|
|
resData.map((val, index) => { |
|
|
|
resData.map((val, index) => { |
|
|
|
let dataRow = { |
|
|
|
let dataRow = {}; |
|
|
|
"Nama Divisi": val.name, |
|
|
|
if (role_name === 'Super Admin') { |
|
|
|
"Deskripsi": val.description, |
|
|
|
dataRow.Company = val.join_first_company_name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dataRow["Nama Divisi"]=val.name; |
|
|
|
|
|
|
|
dataRow.Deskripsi=val.description; |
|
|
|
excelData.push(dataRow) |
|
|
|
excelData.push(dataRow) |
|
|
|
}) |
|
|
|
}) |
|
|
|
await setDataExport(excelData) |
|
|
|
await setDataExport(excelData) |
|
|
@ -385,6 +436,11 @@ const ProjectType = ({ params, ...props }) => { |
|
|
|
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i> |
|
|
|
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i> |
|
|
|
</Tooltip> |
|
|
|
</Tooltip> |
|
|
|
</td> |
|
|
|
</td> |
|
|
|
|
|
|
|
{role_name === 'Super Admin'&& |
|
|
|
|
|
|
|
( |
|
|
|
|
|
|
|
<td>{n.join_first_company_name}</td> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
<td>{n.name}</td> |
|
|
|
<td>{n.name}</td> |
|
|
|
<td>{n.description ?? '-'}</td> |
|
|
|
<td>{n.description ?? '-'}</td> |
|
|
|
{n.color != null ? ( |
|
|
|
{n.color != null ? ( |
|
|
|