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