Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

How to on/off useDetailPopUp? #51

Closed
abbb1399 opened this issue Mar 9, 2021 · 2 comments
Closed

How to on/off useDetailPopUp? #51

abbb1399 opened this issue Mar 9, 2021 · 2 comments

Comments

@abbb1399
Copy link

abbb1399 commented Mar 9, 2021

Version

toast-ui/vue-calendar: 1.1.1

Test Environment

Window, Vue

Current Behavior

I wanna have useDetailPopup on and off, when specific user clicks his/her own event.
In order to do this, I used 'setOptions' as below, it didnt work well though.

// Write example code
onClickSchedule (res) {
      //1. 처음 이벤트 클릭시 eventDetailPopup을 끄기 
      this.$refs.tuiCal.invoke('setOptions', { useDetailPopup: false })

      // 2. isPrivate이 true인지 확인
      if (res.schedule.isPrivate) {
        this.FETCH_EMPLOYEE_ID_BY_SCHEDULE_ID({
          // 3. if(true)면 해당 이벤트의 id로 회원의 id가져오기
          employeeScheduleId: res.schedule.id
        }).then(() => {
          // 4. 저장된 회원 id와 로그인한 회원의 id를 비교하여 로그인한 회원인지 구분하기.
          if (this.getEmployeeId === Number(this.myEmployeeId)) {
            // 5. 해당 isReadOnly을 일시적으로 false로 만들기
            res.schedule.isReadOnly = false

           //6. 위 작업이 끝나면 eventDetailPopup을 다시 켜기 
            this.$refs.tuiCal.invoke('setOptions', { useDetailPopup: true })
          }
        }).catch(err => {
          console.log(err)
          if (err.response.status === 403) {
            this.message = '권한이 없습니다. 로그아웃 합니다.'
            this.showNotify(this.message)
            this.$router.push('/')
          }
        })
      }



Expected Behavior

자신이 쓴 event만 수정 가능하도록 하려고, useDetialPopUp을 setOptions로 false 하였다가, 작업이 끝나면 true로 바꿔주고 싶습니다. 하지만 아래와 같은 에러가 발생합니다.

Uncaught (in promise) TypeError: Cannot read property 'status' of undefined
at eval (VM14949 Scheduler.vue:450)

@jungeun-cho
Copy link
Contributor

jungeun-cho commented Mar 10, 2021

The API to turn on/off schedule details popup is not yet supported.

If you need that feature right now, you should set the useDetailPopup option to false and use a custom popup.

useDetailPopup: false,
...

onClickSchedule (res) {
 // your task
 // open your detail popup 
}

And if you want to make the schedule read-only and make it impossible to modify, you need to invoke updateSchedule.

schedule.isReadOnly = true;
this.$refs.tuiCalendar.invoke(
  "updateSchedule",
  schedule.id,
  schedule.calendarId,
  schedule
);

@abbb1399
Copy link
Author

abbb1399 commented Mar 18, 2021

Thanks for your reply. Hope 'the API to turn on/off schedule details popup' made later :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants