|
|
@ -13,14 +13,7 @@ import { PRESENSI_SEARCH, PROYEK_SEARCH, USERPROYEK_SEARCH, K3_SEARCH, SIMPRO_BA |
|
|
|
import { withTranslation } from 'react-i18next'; |
|
|
|
import { withTranslation } from 'react-i18next'; |
|
|
|
const { RangePicker } = DatePicker; |
|
|
|
const { RangePicker } = DatePicker; |
|
|
|
const { Option } = Select |
|
|
|
const { Option } = Select |
|
|
|
const token = localStorage.getItem('token'); |
|
|
|
|
|
|
|
const config = { |
|
|
|
|
|
|
|
headers: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
|
|
|
"Content-type": `application/json` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BASE_URL = "" |
|
|
|
const BASE_URL = "" |
|
|
|
|
|
|
|
|
|
|
@ -31,8 +24,33 @@ const momentFormat = 'DD-MM-YY'; |
|
|
|
const LENGTH_DATA = 10 |
|
|
|
const LENGTH_DATA = 10 |
|
|
|
|
|
|
|
|
|
|
|
class index extends Component { |
|
|
|
class index extends Component { |
|
|
|
|
|
|
|
|
|
|
|
constructor(props) { |
|
|
|
constructor(props) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, role_name = '', hierarchy = []; |
|
|
|
|
|
|
|
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { |
|
|
|
|
|
|
|
role_id = props.location.state.role_id; |
|
|
|
|
|
|
|
user_id = props.location.state.user_id; |
|
|
|
|
|
|
|
token = props.location.state.token; |
|
|
|
|
|
|
|
isLogin = props.location.state.isLogin; |
|
|
|
|
|
|
|
company_id = props.location.state.company_id; |
|
|
|
|
|
|
|
role_name = props.location.state.role_name; |
|
|
|
|
|
|
|
hierarchy = props.location.state.hierarchy; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
token = window.localStorage.getItem('token'); |
|
|
|
|
|
|
|
role_name = window.localStorage.getItem('role_name'); |
|
|
|
|
|
|
|
company_id = window.localStorage.getItem('company_id'); |
|
|
|
|
|
|
|
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy"))); |
|
|
|
|
|
|
|
} |
|
|
|
super(props) |
|
|
|
super(props) |
|
|
|
|
|
|
|
this.config = { |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
|
|
|
"Content-type": "application/json" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
this.state = { |
|
|
|
this.state = { |
|
|
|
dataTable: [], |
|
|
|
dataTable: [], |
|
|
|
dataExport: [], |
|
|
|
dataExport: [], |
|
|
@ -61,7 +79,11 @@ class index extends Component { |
|
|
|
allUserToProyek: [], |
|
|
|
allUserToProyek: [], |
|
|
|
proyekIds: [], |
|
|
|
proyekIds: [], |
|
|
|
allDataProyek: [], |
|
|
|
allDataProyek: [], |
|
|
|
finishSetupOption: false |
|
|
|
finishSetupOption: false, |
|
|
|
|
|
|
|
company_id: company_id, |
|
|
|
|
|
|
|
role_name: role_name, |
|
|
|
|
|
|
|
role_id: role_id, |
|
|
|
|
|
|
|
hierarchy: hierarchy |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -111,9 +133,14 @@ class index extends Component { |
|
|
|
"joins": [], |
|
|
|
"joins": [], |
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.state.role_id !== "Super Admin") { |
|
|
|
|
|
|
|
payload.columns.push( |
|
|
|
|
|
|
|
{ name: "created_by_id", logic_operator: "IN", value: this.state.hierarchy, operator: "AND" } |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.post(PROYEK_SEARCH, payload, config) |
|
|
|
.post(PROYEK_SEARCH, payload, this.config) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
@ -194,7 +221,7 @@ class index extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.post(K3_SEARCH, payload, config) |
|
|
|
.post(K3_SEARCH, payload, this.config) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
@ -394,7 +421,7 @@ class index extends Component { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.post(K3_SEARCH, payload, config) |
|
|
|
.post(K3_SEARCH, payload, this.config) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
|