Browse Source

FN company name

pull/1/head
khaidralirahman 10 months ago
parent
commit
5b95b58651
  1. 85
      src/views/Master/ProjectPhase/index.js
  2. 73
      src/views/SimproV2/ChecklistK3/index.js
  3. 100
      src/views/SimproV2/Divisi/index.js
  4. 88
      src/views/SimproV2/ProjectType/index.js
  5. 72
      src/views/SimproV2/Satuan/index.js

85
src/views/Master/ProjectPhase/index.js

@ -67,14 +67,18 @@ const ProjectPhase = ({ params, ...props }) => {
start = (currentPage * rowsPerPage) - rowsPerPage start = (currentPage * rowsPerPage) - rowsPerPage
} }
const payload = { const payload = {
"columns": [ group_column: {
{ "operator": "AND",
"name": "name", "group_operator": "OR",
"logic_operator": "ilike", "where": [
"value": search, {
"operator": "AND" "name": "name",
} "logic_operator": "~*",
], "value": search,
}
]
},
"columns": [],
"orders": { "orders": {
"ascending": true, "ascending": true,
"columns": [ "columns": [
@ -84,7 +88,8 @@ const ProjectPhase = ({ params, ...props }) => {
"paging": { "paging": {
"length": rowsPerPage, "length": rowsPerPage,
"start": start "start": start
} },
'joins': []
} }
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
payload.columns.push( payload.columns.push(
@ -94,6 +99,12 @@ const ProjectPhase = ({ 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(PROJECT_PHASE_SEARCH, payload, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
@ -129,14 +140,18 @@ const ProjectPhase = ({ params, ...props }) => {
} }
const payload = { const payload = {
"columns": [ group_column: {
{ "operator": "AND",
"name": "name", "group_operator": "OR",
"logic_operator": "like", "where": [
"value": search, {
"operator": "AND" "name": "name",
} "logic_operator": "~*",
], "value": search,
}
]
},
"columns": [],
"orders": { "orders": {
"ascending": true, "ascending": true,
"columns": [ "columns": [
@ -146,7 +161,23 @@ const ProjectPhase = ({ 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
@ -157,10 +188,12 @@ const ProjectPhase = ({ 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": val.name, if (role_name === 'Super Admin') {
"Color": val.color, dataRow.Company = val.join_first_company_name;
} }
dataRow.Nama=val.name;
dataRow.Color=val.color;
excelData.push(dataRow) excelData.push(dataRow)
}) })
await setDataExport(excelData) await setDataExport(excelData)
@ -308,6 +341,16 @@ const ProjectPhase = ({ params, ...props }) => {
</Tooltip>{" "} </Tooltip>{" "}
</>, </>,
}, },
{
title: role_name === 'Super Admin' ? "Company Name" : null,
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
<span>{record.join_first_company_name}</span>
) : null;
}
},
{ title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" }, { title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ {
title: t('color'), title: t('color'),

73
src/views/SimproV2/ChecklistK3/index.js

@ -47,6 +47,7 @@ const ChecklistK3 = ({ params }) => {
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const { t } = useTranslation() const { t } = useTranslation()
const column = [ const column = [
{ name: "Company Name" },
{ name: t('name') }, { name: t('name') },
{ name: t('description') }, { name: t('description') },
] ]
@ -70,14 +71,18 @@ const ChecklistK3 = ({ params }) => {
} }
const payload = { const payload = {
"columns": [ group_column: {
{ "operator": "AND",
"name": "name", "group_operator": "OR",
"logic_operator": "ilike", "where": [
"value": search, {
"operator": "AND" "name": "name",
} "logic_operator": "~*",
], "value": search,
}
]
},
"columns": [],
"orders": { "orders": {
"ascending": true, "ascending": true,
"columns": [ "columns": [
@ -87,7 +92,8 @@ const ChecklistK3 = ({ params }) => {
"paging": { "paging": {
"length": rowsPerPage, "length": rowsPerPage,
"start": start "start": start
} },
'joins': []
} }
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
@ -98,6 +104,12 @@ const ChecklistK3 = ({ params }) => {
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
@ -126,13 +138,37 @@ const ChecklistK3 = ({ params }) => {
const handleExportExcel = async () => { const handleExportExcel = async () => {
const payload = { const payload = {
group_column: {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": search,
}
]
},
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"columns": [ "columns": [],
{ "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" }
],
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
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(CHECKLIST_K3_SEARCH, payload, config) .post(CHECKLIST_K3_SEARCH, payload, config)
@ -143,10 +179,12 @@ const ChecklistK3 = ({ params }) => {
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": val.name, if (role_name === 'Super Admin') {
"Deskripsi": val.description, dataRow.Company = val.join_first_company_name;
} }
dataRow.Nama=val.name;
dataRow.Deskripsi=val.description;
excelData.push(dataRow) excelData.push(dataRow)
}) })
await setDataExport(excelData); await setDataExport(excelData);
@ -329,6 +367,11 @@ const ChecklistK3 = ({ params }) => {
<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>
</tr> </tr>

100
src/views/SimproV2/Divisi/index.js

@ -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",
name: "name", "group_operator": "OR",
logic_operator: "ilike", "where": [
value: search, {
operator: "AND" "name": "name",
}, "logic_operator": "~*",
], "value": search,
}
]
},
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 ? (

88
src/views/SimproV2/ProjectType/index.js

@ -70,14 +70,18 @@ const ProjectType = ({ params, ...props }) => {
} }
const payload = { const payload = {
"columns": [ group_column: {
{ "operator": "AND",
"name": "name", "group_operator": "OR",
"logic_operator": "like", "where": [
"value": search, {
"operator": "AND" "name": "name",
} "logic_operator": "~*",
], "value": search,
}
]
},
"columns": [],
"orders": { "orders": {
"ascending": false, "ascending": false,
"columns": [ "columns": [
@ -87,7 +91,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") {
payload.columns.push( payload.columns.push(
@ -97,6 +102,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(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER)
@ -130,14 +141,18 @@ const ProjectType = ({ params, ...props }) => {
} }
const payload = { const payload = {
"columns": [ group_column: {
{ "operator": "AND",
"name": "name", "group_operator": "OR",
"logic_operator": "like", "where": [
"value": search, {
"operator": "AND" "name": "name",
} "logic_operator": "~*",
], "value": search,
}
]
},
"columns": [],
"orders": { "orders": {
"ascending": true, "ascending": true,
"columns": [ "columns": [
@ -147,9 +162,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(PROJECT_TYPE_SEARCH, payload, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER)
@ -160,10 +190,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": val.name, if (role_name === 'Super Admin') {
"Deskripsi": val.description, dataRow.Company = val.join_first_company_name;
} }
dataRow.Nama=val.name;
dataRow.Deskripsi=val.description;
excelData.push(dataRow) excelData.push(dataRow)
}) })
await setDataExport(excelData); await setDataExport(excelData);
@ -314,6 +346,16 @@ const ProjectType = ({ params, ...props }) => {
</Tooltip> </Tooltip>
</>, </>,
}, },
{
title: role_name === 'Super Admin' ? "Company Name" : null,
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
<span>{record.join_first_company_name}</span>
) : null;
}
},
{ title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" }, { title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: t('description'), dataIndex: 'description', key: 'description' }, { title: t('description'), dataIndex: 'description', key: 'description' },
]; ];
@ -364,7 +406,7 @@ const ProjectType = ({ params, ...props }) => {
<h4 className="capitalize">{pageName}</h4> <h4 className="capitalize">{pageName}</h4>
<Row> <Row>
<Col> <Col>
<Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder={t('searchType')} /> <Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder={t('search')} />
</Col> </Col>
<Col> <Col>
<Tooltip title={t('projectType')}> <Tooltip title={t('projectType')}>

72
src/views/SimproV2/Satuan/index.js

@ -59,6 +59,7 @@ const Satuan = ({ params, ...props }) => {
}, [dataExport]) }, [dataExport])
const column = [ const column = [
{ name: "Company Name" },
{ name: t('name') }, { name: t('name') },
{ name: t('description') }, { name: t('description') },
] ]
@ -71,14 +72,18 @@ const Satuan = ({ params, ...props }) => {
} }
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": [
@ -88,7 +93,8 @@ const Satuan = ({ params, ...props }) => {
"paging": { "paging": {
"length": rowsPerPage, "length": rowsPerPage,
"start": start "start": start
} },
'joins': []
} }
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
@ -99,6 +105,12 @@ const Satuan = ({ 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" }
)
} }
@ -127,11 +139,36 @@ const Satuan = ({ params, ...props }) => {
const handleExportExcel = async () => { const handleExportExcel = async () => {
const payload = { const payload = {
group_column: {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": search,
}
]
},
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"columns": [ "columns": [],
{ "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" } "orders": { "columns": ["id"], "ascending": false },
], 'joins': []
"orders": { "columns": ["id"], "ascending": false } }
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(SATUAN_SEARCH, payload, HEADER) .post(SATUAN_SEARCH, payload, HEADER)
@ -141,10 +178,12 @@ const Satuan = ({ 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": val.name, if (role_name === 'Super Admin') {
"Deskripsi": val.description, dataRow.Company = val.join_first_company_name;
} }
dataRow.Nama=val.name;
dataRow.Deskripsi=val.description;
excelData.push(dataRow) excelData.push(dataRow)
}) })
await setDataExport(excelData); await setDataExport(excelData);
@ -328,6 +367,11 @@ const Satuan = ({ 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>
</tr> </tr>

Loading…
Cancel
Save