Commit c8b2082b authored by syadziy's avatar syadziy

update issue Outlook PA can submit and list company per user

parent 27a08cfb
...@@ -139,19 +139,39 @@ export default class OutlookPA extends Component { ...@@ -139,19 +139,39 @@ export default class OutlookPA extends Component {
} }
}) })
if (companyData.length > 0) { let arrayBaru = []
companyData = companyData.sort((a, b) => a.company_name.localeCompare(b.company_name)) this.state.userCompany.map((item, index) => {
} let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
if (arrayBaru.length > 0) {
arrayBaru = arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name))
}
let defaultProps = { let defaultProps = {
options: companyData, options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; }
let indexID = null let indexID = null
if (this.state.rawData !== undefined) { if (this.state.rawData !== undefined) {
indexID = companyData.findIndex((val) => val.company_id == this.state.rawData.company_id) indexID = arrayBaru.findIndex((val) => val.company_id == this.state.rawData.company_id)
} }
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// if (companyData.length > 0) {
// companyData = companyData.sort((a, b) => a.company_name.localeCompare(b.company_name))
// }
// let defaultProps = {
// options: companyData,
// getOptionLabel: (option) => titleCase(option.company_name),
// };
// let indexID = null
// if (this.state.rawData !== undefined) {
// indexID = companyData.findIndex((val) => val.company_id == this.state.rawData.company_id)
// }
this.setState({ listCompany: defaultProps, company: indexID == null ? arrayBaru[0] : arrayBaru[indexID] }, () => {
console.log(response.data.data); console.log(response.data.data);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
...@@ -840,6 +860,10 @@ export default class OutlookPA extends Component { ...@@ -840,6 +860,10 @@ export default class OutlookPA extends Component {
let array = [] let array = []
let canSubmit = true let canSubmit = true
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[3] !== "submitted" && item[3] !== 'approved') {
canSubmit = false
array.push(item[3])
}
// if (item[1] !== 'Cash Flow') { // if (item[1] !== 'Cash Flow') {
// if (item[3] !== "submitted" && item[3] !== 'approved') { // if (item[3] !== "submitted" && item[3] !== 'approved') {
// canSubmit = false // canSubmit = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment