Commit bfd45510 authored by Arfin Syadziy's avatar Arfin Syadziy

Merge branch 'dev/arfin' into 'ENV-DEV-CR-CAFRM'

Dev/arfin

See merge request !1599
parents 8bde7f1c ed408605
......@@ -19,6 +19,7 @@ export default class CreateCarfmDoc extends Component {
super(props)
this.state = {
perusahaan: null,
perusahaanData: null,
getPerusahaan: null,
errorPerusahaan: false,
msgErrorPerusahaan: '',
......@@ -45,29 +46,24 @@ export default class CreateCarfmDoc extends Component {
fileType: '',
docId: '',
sizeUpload: "1",
menuName: null,
saveDisable: false,
submitVal: 0
isClickSave: 0
}
}
async componentDidMount() {
this.props.handleLoading(1)
await this.getMenuName()
await this.getDataCompany()
await this.getPeriode()
await this.getMonth()
await this.getFileSize()
this.props.handleLoading(0)
componentDidMount() {
this.getDataCompany()
this.getPeriode()
this.getMonth()
this.getFileSize()
}
async getFileSize() {
getFileSize() {
let body = {
group: 'MAX_FILE_SIZE',
company_id: 0,
type: 'MAX_FILE_SIZE'
}
await api.create().getAllSettingByType(body).then(response => {
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -95,8 +91,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async getDataCompany() {
await api.create().getPerusahaanUserActive().then((response) => {
getDataCompany() {
api.create().getPerusahaanUserActive().then((response) => {
if (response.data) {
if (response.data.status == 'success') {
let data = response.data.data
......@@ -111,10 +107,10 @@ export default class CreateCarfmDoc extends Component {
// company_name: 'Default'
// })
let typeProps = {
options: typeData.sort((a, b) => a.company_name.localeCompare(b.company_name)),
options: typeData.sort((a, b) => a.company_name - b.company_name),
getOptionLabel: (option) => option.company_name,
};
this.setState({ perusahaan: typeProps}, () => console.log(this.state.perusahaan))
this.setState({ perusahaan: typeProps })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -131,30 +127,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async getMenuName(){
await api.create().getMenuByUser().then(
response => {
if(response.data){
if(response.data.status === 'success'){
response.data.data.map(
(item) => {
if(item.menu_id == this.props.submenu_id){
this.setState({
menuName : item.menu_name
}
);
}
}
)
}
}
}
)
}
async getPeriode() {
await api.create().getPeriodeTransaction().then(response => {
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
let year = format(dateNow, 'yyyy')
if (response.data) {
......@@ -185,8 +159,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async getMonth() {
await api.create().getMonthTransaction().then(response => {
getMonth() {
api.create().getMonthTransaction().then(response => {
let dateNow = new Date
// let bulan = format(dateNow, 'MMMM')
if (response.data) {
......@@ -261,7 +235,8 @@ export default class CreateCarfmDoc extends Component {
}
else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning', saveDisable: false })
} else if(this.state.submitVal === 1) {
} else {
console.log(this.state.isClickSave + " ===> di luar");
const formData = new FormData();
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id);
......@@ -271,7 +246,7 @@ export default class CreateCarfmDoc extends Component {
formData.append("documentPeriode", this.state.periode.periode);
formData.append("documentMonth", this.state.monthId.month_id);
this.setState({ formData }, () => {
this.props.createDocument(this.state.formData, )
this.props.createDocument(this.state.formData)
})
}
}
......@@ -338,13 +313,12 @@ export default class CreateCarfmDoc extends Component {
</div>
<div className="column-2">
<div style={{ padding: 10, borderRadius: 5, marginTop: "1.2em" }}>
<TextField
value={this.state.menuName}
value={this.props.menuName}
InputProps={{ style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
placeholder="Category"
disabled
size="medium"
fullWidth={true}
/>
......@@ -459,21 +433,10 @@ export default class CreateCarfmDoc extends Component {
disabled={this.state.saveDisable}
type="button"
onClick={() =>
{
this.props.handleLoading(1);
this.setState({
saveDisable: true,
submitVal : this.state.submitVal + 1
}, console.log());
setTimeout(() => {
this.state.isClickSave == 1 ? null :
this.setState({ isClickSave: 1 }, () => {
this.validasi()
console.log("vlidasi " + this.validasi());
}, 100)
this.props.handleLoading(0);
}
})
}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......
......@@ -57,7 +57,6 @@ export default class TableDocument extends Component {
let dataTable = []
response.data.data.map((item, index) => {
let indexId = this.props.userCompActive.findIndex((val) => val == item.company_id)
if (indexId !== -1) {
dataTable.push( [
index,
......@@ -73,22 +72,22 @@ export default class TableDocument extends Component {
item.values
])
}
})
// console.log(dataTable)
this.setState({ dataTable, loading: false })
let docPath = response.data.data.map((item) => {
return [
item.document_filepath
]
})
this.setState({ docPath, loading: false })
let docId = response.data.data.map((item) => {
return [
item.document_id
]
})
this.setState({ docId, loading: false })
// console.log(dataTable)
this.setState({ dataTable, docPath, docId, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......
......@@ -22,6 +22,7 @@ export default class DocumentManagement extends Component {
constructor(props) {
super(props)
this.state = {
alert: false,
tab: 0,
listData: [],
id: 0,
......
......@@ -20,7 +20,7 @@ import SubHolding from '../container/Reports/SubHolding';
import SummaryTriputra from '../container/SummaryTriputra/SummaryOfTriputra';
import MasterDataCAT from '../container/MasterData/MasterDataCAT/MasterDataCAT';
import ProgressReport from '../container/ProgressReport/ProgressReport';
import CarfmDocument from "../container/CRFM/CarfmDocument";
import CarfmDocument from "../container/CAFRM/CafrmDocument";
const routes = [
{
......
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