Browse Source

FN company name

pull/1/head
khaidralirahman 11 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
}
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": [
@ -84,7 +88,8 @@ const ProjectPhase = ({ params, ...props }) => {
"paging": {
"length": rowsPerPage,
"start": start
}
},
'joins': []
}
if (role_name !== "Super Admin") {
payload.columns.push(
@ -94,6 +99,12 @@ const ProjectPhase = ({ 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(PROJECT_PHASE_SEARCH, payload, HEADER)
@ -129,14 +140,18 @@ const ProjectPhase = ({ params, ...props }) => {
}
const payload = {
"columns": [
{
"name": "name",
"logic_operator": "like",
"value": search,
"operator": "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": search,
}
]
},
"columns": [],
"orders": {
"ascending": true,
"columns": [
@ -146,7 +161,23 @@ const ProjectPhase = ({ 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
@ -157,10 +188,12 @@ const ProjectPhase = ({ params, ...props }) => {
let resData = result.data.data;
const excelData = [];
resData.map((val, index) => {
let dataRow = {
"Nama": val.name,
"Color": val.color,
let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama=val.name;
dataRow.Color=val.color;
excelData.push(dataRow)
})
await setDataExport(excelData)
@ -308,6 +341,16 @@ const ProjectPhase = ({ params, ...props }) => {
</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('color'),

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

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

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

@ -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 ? (

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

@ -70,14 +70,18 @@ const ProjectType = ({ params, ...props }) => {
}
const payload = {
"columns": [
{
"name": "name",
"logic_operator": "like",
"value": search,
"operator": "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": search,
}
]
},
"columns": [],
"orders": {
"ascending": false,
"columns": [
@ -87,7 +91,8 @@ const ProjectType = ({ params, ...props }) => {
"paging": {
"length": rowsPerPage,
"start": start
}
},
'joins': []
}
if (role_name !== "Super Admin") {
payload.columns.push(
@ -97,6 +102,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(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER)
@ -130,14 +141,18 @@ const ProjectType = ({ params, ...props }) => {
}
const payload = {
"columns": [
{
"name": "name",
"logic_operator": "like",
"value": search,
"operator": "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": search,
}
]
},
"columns": [],
"orders": {
"ascending": true,
"columns": [
@ -147,9 +162,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(PROJECT_TYPE_SEARCH, payload, HEADER)
@ -160,10 +190,12 @@ const ProjectType = ({ params, ...props }) => {
let resData = result.data.data;
const excelData = [];
resData.map((val, index) => {
let dataRow = {
"Nama": val.name,
"Deskripsi": val.description,
let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama=val.name;
dataRow.Deskripsi=val.description;
excelData.push(dataRow)
})
await setDataExport(excelData);
@ -314,6 +346,16 @@ const ProjectType = ({ params, ...props }) => {
</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('description'), dataIndex: 'description', key: 'description' },
];
@ -364,7 +406,7 @@ const ProjectType = ({ params, ...props }) => {
<h4 className="capitalize">{pageName}</h4>
<Row>
<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>
<Tooltip title={t('projectType')}>

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

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

Loading…
Cancel
Save