Commit 80e2cf57 authored by muhammad ridwan's avatar muhammad ridwan

bug fixing v1

parent 58dc11d4
...@@ -26,7 +26,7 @@ export default class CarfmDocument extends Component { ...@@ -26,7 +26,7 @@ export default class CarfmDocument extends Component {
load: false, load: false,
name: '', name: '',
userCompActive: [], userCompActive: [],
isHasAccessDocument: false, isHasAccessDocument: true,
submenu_id : 0, submenu_id : 0,
submenu_name: "", submenu_name: "",
menu_title: "" menu_title: ""
...@@ -38,8 +38,8 @@ export default class CarfmDocument extends Component { ...@@ -38,8 +38,8 @@ export default class CarfmDocument extends Component {
// this.getPermission() // this.getPermission()
await this.getMenuName(); await this.getMenuName();
this.getDataCarfm(); await this.getDataCarfm();
this.getDetailUser(); await this.getDetailUser();
} }
...@@ -68,11 +68,11 @@ export default class CarfmDocument extends Component { ...@@ -68,11 +68,11 @@ export default class CarfmDocument extends Component {
) )
} }
getDataCarfm(create){ async getDataCarfm(create){
let payload = { let payload = {
submenu_id : this.state.submenu_id submenu_id : this.state.submenu_id
} }
api.create().getCarfmDocumentBySubmenu(payload).then( await api.create().getCarfmDocumentBySubmenu(payload).then(
response => { response => {
if(response){ if(response){
if(response.data.status === 'success'){ if(response.data.status === 'success'){
...@@ -112,11 +112,11 @@ export default class CarfmDocument extends Component { ...@@ -112,11 +112,11 @@ export default class CarfmDocument extends Component {
) )
} }
getPermission(subMenu) { async getPermission(subMenu) {
let payload = { let payload = {
menu: subMenu menu: subMenu
} }
api.create().getPermission(payload).then(response => { await api.create().getPermission(payload).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -137,9 +137,9 @@ export default class CarfmDocument extends Component { ...@@ -137,9 +137,9 @@ export default class CarfmDocument extends Component {
}) })
} }
getDetailUser() { async getDetailUser() {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { await api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -153,8 +153,8 @@ export default class CarfmDocument extends Component { ...@@ -153,8 +153,8 @@ export default class CarfmDocument extends Component {
}) })
} }
getCompanyActive() { async getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { await api.create().getPerusahaanActive().then((response) => {
console.log("getcompanyactive start"); console.log("getcompanyactive start");
console.log(response); console.log(response);
console.log("getcompanyactive stop"); console.log("getcompanyactive stop");
...@@ -198,13 +198,13 @@ export default class CarfmDocument extends Component { ...@@ -198,13 +198,13 @@ export default class CarfmDocument extends Component {
}) })
} }
createUploadDocument() { async createUploadDocument() {
this.setState({ visibleCreate: false, konfirmasi: false }) this.setState({ visibleCreate: false, konfirmasi: false })
const formData = this.state.formData const formData = this.state.formData
formData.append("documentId", this.state.docId) formData.append("documentId", this.state.docId)
formData.append("updated", 1) formData.append("updated", 1)
this.setState({ loading: true }) this.setState({ loading: true })
api.create().updateDocument(formData).then(response => { await api.create().updateDocument(formData).then(response => {
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
...@@ -230,9 +230,9 @@ export default class CarfmDocument extends Component { ...@@ -230,9 +230,9 @@ export default class CarfmDocument extends Component {
}) })
} }
createDocument(payload) { //upload apinya disini async createDocument(payload) { //upload apinya disini
this.setState({ loading: true }) this.setState({ loading: true })
api.create().uploadCarfmDocument(payload).then(response => { await api.create().uploadCarfmDocument(payload).then(response => {
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
......
...@@ -53,21 +53,21 @@ export default class CreateCarfmDoc extends Component { ...@@ -53,21 +53,21 @@ export default class CreateCarfmDoc extends Component {
} }
} }
componentDidMount() { async componentDidMount() {
this.getDataCompany() await this.getMenuName()
this.getPeriode() await this.getDataCompany()
this.getMonth() await this.getPeriode()
this.getFileSize() await this.getMonth()
this.getMenuName() await this.getFileSize()
} }
getFileSize() { async getFileSize() {
let body = { let body = {
group: 'MAX_FILE_SIZE', group: 'MAX_FILE_SIZE',
company_id: 0, company_id: 0,
type: 'MAX_FILE_SIZE' type: 'MAX_FILE_SIZE'
} }
api.create().getAllSettingByType(body).then(response => { await api.create().getAllSettingByType(body).then(response => {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -95,8 +95,8 @@ export default class CreateCarfmDoc extends Component { ...@@ -95,8 +95,8 @@ export default class CreateCarfmDoc extends Component {
}) })
} }
getDataCompany() { async getDataCompany() {
api.create().getPerusahaanUserActive().then((response) => { await api.create().getPerusahaanUserActive().then((response) => {
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
...@@ -131,9 +131,9 @@ export default class CreateCarfmDoc extends Component { ...@@ -131,9 +131,9 @@ export default class CreateCarfmDoc extends Component {
}) })
} }
getMenuName(){ async getMenuName(){
api.create().getMenuByUser().then( await api.create().getMenuByUser().then(
response => { response => {
if(response.data){ if(response.data){
if(response.data.status === 'success'){ if(response.data.status === 'success'){
...@@ -153,8 +153,8 @@ export default class CreateCarfmDoc extends Component { ...@@ -153,8 +153,8 @@ export default class CreateCarfmDoc extends Component {
) )
} }
getPeriode() { async getPeriode() {
api.create().getPeriodeTransaction().then(response => { await api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date let dateNow = new Date
let year = format(dateNow, 'yyyy') let year = format(dateNow, 'yyyy')
if (response.data) { if (response.data) {
...@@ -185,8 +185,8 @@ export default class CreateCarfmDoc extends Component { ...@@ -185,8 +185,8 @@ export default class CreateCarfmDoc extends Component {
}) })
} }
getMonth() { async getMonth() {
api.create().getMonthTransaction().then(response => { await api.create().getMonthTransaction().then(response => {
let dateNow = new Date let dateNow = new Date
// let bulan = format(dateNow, 'MMMM') // let bulan = format(dateNow, 'MMMM')
if (response.data) { if (response.data) {
......
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