팝업에 로딩바 적용
This commit is contained in:
parent
3ed4325775
commit
7af6eeb020
@ -1,10 +1,9 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useState, useContext } from 'react'
|
import { useEffect, useState, useContext } from 'react'
|
||||||
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
|
||||||
import SingleDatePicker from '../common/datepicker/SingleDatePicker'
|
import SingleDatePicker from '../common/datepicker/SingleDatePicker'
|
||||||
import EstimateFileUploader from './EstimateFileUploader'
|
import EstimateFileUploader from './EstimateFileUploader'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
@ -14,11 +13,10 @@ import dayjs from 'dayjs'
|
|||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
import { SessionContext } from '@/app/SessionProvider'
|
import { SessionContext } from '@/app/SessionProvider'
|
||||||
import Select, { components } from 'react-select'
|
import Select from 'react-select'
|
||||||
import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils'
|
import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils'
|
||||||
import ProductFeaturesPop from './popup/ProductFeaturesPop'
|
import ProductFeaturesPop from './popup/ProductFeaturesPop'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { correntObjectNoState } from '@/store/settingAtom'
|
|
||||||
import { useSearchParams } from 'next/navigation'
|
import { useSearchParams } from 'next/navigation'
|
||||||
import { usePlan } from '@/hooks/usePlan'
|
import { usePlan } from '@/hooks/usePlan'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { useState } from 'react'
|
import { useState, useContext } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { floorPlanObjectState, estimateState } from '@/store/floorPlanObjectAtom'
|
import { floorPlanObjectState, estimateState } from '@/store/floorPlanObjectAtom'
|
||||||
import { usePathname, useSearchParams } from 'next/navigation'
|
import { usePathname, useSearchParams } from 'next/navigation'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDownPopLockFlg }) {
|
export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDownPopLockFlg }) {
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
|
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { promisePost } = useAxios()
|
const { promisePost } = useAxios()
|
||||||
|
|
||||||
@ -68,8 +71,10 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown
|
|||||||
|
|
||||||
const options = { responseType: 'blob' }
|
const options = { responseType: 'blob' }
|
||||||
|
|
||||||
|
setIsGlobalLoading(true)
|
||||||
await promisePost({ url: url, data: params, option: options })
|
await promisePost({ url: url, data: params, option: options })
|
||||||
.then((resultData) => {
|
.then((resultData) => {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (resultData) {
|
if (resultData) {
|
||||||
let fileName = 'unknow'
|
let fileName = 'unknow'
|
||||||
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||||
@ -97,6 +102,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
console.log('::FileDownLoad Error::', error)
|
console.log('::FileDownLoad Error::', error)
|
||||||
alert('File does not exist.')
|
alert('File does not exist.')
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React from 'react'
|
import { useContext } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
@ -7,10 +7,13 @@ import { useAxios } from '@/hooks/useAxios'
|
|||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { logout, setSession, login } from '@/lib/authActions'
|
import { logout, setSession, login } from '@/lib/authActions'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
export default function ChangePasswordPop(props) {
|
export default function ChangePasswordPop(props) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
|
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { patch } = useAxios(globalLocaleState)
|
const { patch } = useAxios(globalLocaleState)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -98,9 +101,11 @@ export default function ChangePasswordPop(props) {
|
|||||||
chgPwd: _password1,
|
chgPwd: _password1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsGlobalLoading(true)
|
||||||
await patch({ url: '/api/login/v1.0/user/change-password', data: param })
|
await patch({ url: '/api/login/v1.0/user/change-password', data: param })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res?.result?.code === 200) {
|
if (res?.result?.code === 200) {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (res?.result?.resultCode === 'S') {
|
if (res?.result?.resultCode === 'S') {
|
||||||
swalFire({
|
swalFire({
|
||||||
text: getMessage('main.popup.login.success'),
|
text: getMessage('main.popup.login.success'),
|
||||||
@ -117,11 +122,13 @@ export default function ChangePasswordPop(props) {
|
|||||||
alert(res?.result?.resultMsg)
|
alert(res?.result?.resultMsg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
logout()
|
logout()
|
||||||
console.log('code not 200 error')
|
console.log('code not 200 error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
logout()
|
logout()
|
||||||
console.log('catch::::::::', error)
|
console.log('catch::::::::', error)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react'
|
import { useState, useContext } from 'react'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { queryStringFormatter } from '@/util/common-utils'
|
import { queryStringFormatter } from '@/util/common-utils'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
@ -8,9 +8,12 @@ import FindAddressPopQGrid from './FindAddressPopQGrid'
|
|||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { isNotEmptyArray } from '@/util/common-utils'
|
import { isNotEmptyArray } from '@/util/common-utils'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
export default function FindAddressPop(props) {
|
export default function FindAddressPop(props) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
|
|
||||||
const { get } = useAxios(globalLocaleState)
|
const { get } = useAxios(globalLocaleState)
|
||||||
|
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -61,8 +64,10 @@ export default function FindAddressPop(props) {
|
|||||||
zipcode: watch('zipNo'),
|
zipcode: watch('zipNo'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsGlobalLoading(true)
|
||||||
get({ url: `https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter(params)}` }).then((res) => {
|
get({ url: `https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter(params)}` }).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (isNotEmptyArray(res.results)) {
|
if (isNotEmptyArray(res.results)) {
|
||||||
setGridProps({ ...gridProps, gridData: res.results })
|
setGridProps({ ...gridProps, gridData: res.results })
|
||||||
} else {
|
} else {
|
||||||
@ -70,10 +75,12 @@ export default function FindAddressPop(props) {
|
|||||||
setGridProps({ ...gridProps, gridData: [] })
|
setGridProps({ ...gridProps, gridData: [] })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
swalFire({ text: getMessage('stuff.addressPopup.error.message1'), type: 'alert', icon: 'warning' })
|
swalFire({ text: getMessage('stuff.addressPopup.error.message1'), type: 'alert', icon: 'warning' })
|
||||||
setGridProps({ ...gridProps, gridData: [] })
|
setGridProps({ ...gridProps, gridData: [] })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
// 주소적용 클릭
|
// 주소적용 클릭
|
||||||
const applyAddress = () => {
|
const applyAddress = () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState, useRef } from 'react'
|
import { useEffect, useState, useRef, useContext } from 'react'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
@ -10,6 +10,7 @@ import PlanRequestPopQGrid from './PlanRequestPopQGrid'
|
|||||||
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
||||||
import QPagination from '@/components/common/pagination/QPagination'
|
import QPagination from '@/components/common/pagination/QPagination'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
export default function PlanRequestPop(props) {
|
export default function PlanRequestPop(props) {
|
||||||
const [pageNo, setPageNo] = useState(1) //현재 페이지 번호
|
const [pageNo, setPageNo] = useState(1) //현재 페이지 번호
|
||||||
const [pageSize, setPageSize] = useState(20) //페이지 당 게시물 개수
|
const [pageSize, setPageSize] = useState(20) //페이지 당 게시물 개수
|
||||||
@ -17,6 +18,7 @@ export default function PlanRequestPop(props) {
|
|||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
const [planReqObject, setPlanReqObject] = useState({})
|
const [planReqObject, setPlanReqObject] = useState({})
|
||||||
|
|
||||||
const { promiseGet } = useAxios(globalLocaleState)
|
const { promiseGet } = useAxios(globalLocaleState)
|
||||||
@ -89,8 +91,10 @@ export default function PlanRequestPop(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const apiUrl = `/api/object/planReq/list?${queryStringFormatter(params)}`
|
const apiUrl = `/api/object/planReq/list?${queryStringFormatter(params)}`
|
||||||
|
setIsGlobalLoading(true)
|
||||||
promiseGet({ url: apiUrl }).then((res) => {
|
promiseGet({ url: apiUrl }).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (isNotEmptyArray(res.data.data)) {
|
if (isNotEmptyArray(res.data.data)) {
|
||||||
setGridProps({ ...gridProps, gridData: res.data.data, gridCount: res.data.data[0].totCnt })
|
setGridProps({ ...gridProps, gridData: res.data.data, gridCount: res.data.data[0].totCnt })
|
||||||
setTotalCount(res.data.data[0].totCnt)
|
setTotalCount(res.data.data[0].totCnt)
|
||||||
@ -99,10 +103,12 @@ export default function PlanRequestPop(props) {
|
|||||||
setTotalCount(0)
|
setTotalCount(0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
setGridProps({ ...gridProps, gridData: [], gridCount: 0 })
|
setGridProps({ ...gridProps, gridData: [], gridCount: 0 })
|
||||||
setTotalCount(0)
|
setTotalCount(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
// 페이징 현재페이지 변경
|
// 페이징 현재페이지 변경
|
||||||
const handleChangePage = (page) => {
|
const handleChangePage = (page) => {
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import { useState, useEffect, useContext } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { isEmptyArray } from '@/util/common-utils'
|
import { isEmptyArray } from '@/util/common-utils'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
export default function WindSelectPop(props) {
|
export default function WindSelectPop(props) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
@ -13,6 +14,7 @@ export default function WindSelectPop(props) {
|
|||||||
const [windSpeed, setWindSpeed] = useState(null)
|
const [windSpeed, setWindSpeed] = useState(null)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
//선택한 라디오 값 세팅
|
//선택한 라디오 값 세팅
|
||||||
const handleChangeRadio = (e) => {
|
const handleChangeRadio = (e) => {
|
||||||
setWindSpeed(e.target.value)
|
setWindSpeed(e.target.value)
|
||||||
@ -31,15 +33,20 @@ export default function WindSelectPop(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setIsGlobalLoading(true)
|
||||||
if (props.prefName !== '') {
|
if (props.prefName !== '') {
|
||||||
promiseGet({ url: `/api/object/windSpeed/${props.prefName}/list` }).then((res) => {
|
promiseGet({ url: `/api/object/windSpeed/${props.prefName}/list` }).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (!isEmptyArray(res.data)) {
|
if (!isEmptyArray(res.data)) {
|
||||||
setWindSpeedList(res.data)
|
setWindSpeedList(res.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
|
setIsGlobalLoading(false)
|
||||||
}, [props])
|
}, [props])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -445,7 +445,9 @@ export const useEstimateController = (planNo, flag) => {
|
|||||||
userId: session.userId,
|
userId: session.userId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsGlobalLoading(true)
|
||||||
await promisePost({ url: '/api/estimate/save-estimate-copy', data: params }).then((res) => {
|
await promisePost({ url: '/api/estimate/save-estimate-copy', data: params }).then((res) => {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
if (isObjectNotEmpty(res.data)) {
|
if (isObjectNotEmpty(res.data)) {
|
||||||
let newObjectNo = res.data.objectNo
|
let newObjectNo = res.data.objectNo
|
||||||
@ -457,6 +459,8 @@ export const useEstimateController = (planNo, flag) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user