swalFire confirm 창 버튼 입력받을 수 있도록
This commit is contained in:
parent
63387325c3
commit
67a0dae2e2
@ -203,9 +203,7 @@ export default function CanvasMenu(props) {
|
|||||||
setCurrentMenu(menu.title)
|
setCurrentMenu(menu.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathname !== '/floor-plan' && pathname !== '/floor-plan/estimate/5' && pathname !== '/floor-plan/simulator/6') {
|
if (pathname !== '/floor-plan') router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
||||||
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeSelectedRoofMaterial = (e) => {
|
const changeSelectedRoofMaterial = (e) => {
|
||||||
@ -368,7 +366,9 @@ export default function CanvasMenu(props) {
|
|||||||
*/
|
*/
|
||||||
const handleEstimateLockController = (estimateRecoilState) => {
|
const handleEstimateLockController = (estimateRecoilState) => {
|
||||||
swalFire({
|
swalFire({
|
||||||
text: estimateRecoilState.lockFlg === '0' ? getMessage('estimate.detail.lock.alertMsg') : getMessage('estimate.detail.unlock.alertMsg'),
|
// text: estimateRecoilState.lockFlg === '0' ? getMessage('estimate.detail.lock.alertMsg') : getMessage('estimate.detail.unlock.alertMsg'),
|
||||||
|
html: estimateRecoilState.lockFlg === '0' ? getMessage('estimate.detail.lock.alertMsg') : getMessage('estimate.detail.unlock.alertMsg'),
|
||||||
|
confirmButtonText: estimateRecoilState.lockFlg === '1' ? getMessage('estimate.detail.unlock.confirmBtnName') : '',
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
confirmFn: async () => {
|
confirmFn: async () => {
|
||||||
setIsGlobalLoading(true)
|
setIsGlobalLoading(true)
|
||||||
|
|||||||
@ -206,6 +206,8 @@ export function usePlan(params = {}) {
|
|||||||
const handleCurrentPlan = async (newCurrentId) => {
|
const handleCurrentPlan = async (newCurrentId) => {
|
||||||
const orderingNo = plans?.find((obj) => obj.id === newCurrentId).ordering
|
const orderingNo = plans?.find((obj) => obj.id === newCurrentId).ordering
|
||||||
const objectNo = floorPlanState.objectNo
|
const objectNo = floorPlanState.objectNo
|
||||||
|
//견적서 or 발전시뮬
|
||||||
|
if (pathname !== '/floor-plan') {
|
||||||
await promiseGet({ url: `/api/estimate/${objectNo}/${orderingNo}/detail` })
|
await promiseGet({ url: `/api/estimate/${objectNo}/${orderingNo}/detail` })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
@ -242,6 +244,14 @@ export function usePlan(params = {}) {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
// if (pathname === '/floor-plan') {
|
||||||
|
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
|
||||||
|
saveCanvas()
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
updateCurrentPlan(newCurrentId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCurrentPlan = (newCurrentId) => {
|
const updateCurrentPlan = (newCurrentId) => {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import Swal from 'sweetalert2'
|
import Swal from 'sweetalert2'
|
||||||
import withReactContent from 'sweetalert2-react-content'
|
import withReactContent from 'sweetalert2-react-content'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* title: 제목
|
* title: 제목
|
||||||
@ -13,14 +14,25 @@ import withReactContent from 'sweetalert2-react-content'
|
|||||||
*/
|
*/
|
||||||
export const useSwal = () => {
|
export const useSwal = () => {
|
||||||
const MySwal = withReactContent(Swal)
|
const MySwal = withReactContent(Swal)
|
||||||
|
const { getMessage } = useMessage()
|
||||||
|
|
||||||
const swalFire = ({ title = '', text = '', html = '', type = 'alert', icon = '', confirmFn = () => {}, denyFn = () => {} }) => {
|
const swalFire = ({
|
||||||
|
title = '',
|
||||||
|
text = '',
|
||||||
|
html = '',
|
||||||
|
type = 'alert',
|
||||||
|
icon = '',
|
||||||
|
confirmButtonText = '',
|
||||||
|
cancelButtonText = '',
|
||||||
|
confirmFn = () => {},
|
||||||
|
denyFn = () => {},
|
||||||
|
}) => {
|
||||||
if (type === 'alert') {
|
if (type === 'alert') {
|
||||||
MySwal.fire({
|
MySwal.fire({
|
||||||
title,
|
title,
|
||||||
text,
|
text,
|
||||||
icon: icon === '' ? 'success' : icon,
|
icon: icon === '' ? 'success' : icon,
|
||||||
confirmButtonText: '확인',
|
confirmButtonText: getMessage('common.ok'),
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
confirmFn()
|
confirmFn()
|
||||||
})
|
})
|
||||||
@ -32,8 +44,8 @@ export const useSwal = () => {
|
|||||||
icon: icon === '' ? 'question' : icon,
|
icon: icon === '' ? 'question' : icon,
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: '확인',
|
confirmButtonText: confirmButtonText === '' ? getMessage('common.ok') : confirmButtonText,
|
||||||
cancelButtonText: '취소',
|
cancelButtonText: cancelButtonText === '' ? getMessage('common.cancel') : cancelButtonText,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
confirmFn()
|
confirmFn()
|
||||||
|
|||||||
@ -498,6 +498,7 @@
|
|||||||
"common.require": "必須",
|
"common.require": "必須",
|
||||||
"common.finish": "完了",
|
"common.finish": "完了",
|
||||||
"common.ok": "確認",
|
"common.ok": "確認",
|
||||||
|
"common.cancel": "キャンセル",
|
||||||
"commons.west": "立つ",
|
"commons.west": "立つ",
|
||||||
"commons.east": "ドン",
|
"commons.east": "ドン",
|
||||||
"commons.south": "南",
|
"commons.south": "南",
|
||||||
@ -935,7 +936,8 @@
|
|||||||
"estimate.detail.reset.alertMsg": "初期化されました.",
|
"estimate.detail.reset.alertMsg": "初期化されました.",
|
||||||
"estimate.detail.reset.confirmMsg": "保存した見積書情報が初期化され、図面情報が反映されます。本当に初期化しますか?",
|
"estimate.detail.reset.confirmMsg": "保存した見積書情報が初期化され、図面情報が反映されます。本当に初期化しますか?",
|
||||||
"estimate.detail.lock.alertMsg": "見積書を[ロック]すると、変更できません。見積もりを編集するには、ロックを解除してください.",
|
"estimate.detail.lock.alertMsg": "見積書を[ロック]すると、変更できません。見積もりを編集するには、ロックを解除してください.",
|
||||||
"estimate.detail.unlock.alertMsg": "見積書を修正して保存",
|
"estimate.detail.unlock.alertMsg": "[ロック解除]すると、見積書を編集できます.\n 解除しますか?",
|
||||||
|
"estimate.detail.unlock.confirmBtnName": "解放",
|
||||||
"estimate.detail.alert.delFile": "添付ファイルを完全に削除するには[保存]ボタンをクリックしてください",
|
"estimate.detail.alert.delFile": "添付ファイルを完全に削除するには[保存]ボタンをクリックしてください",
|
||||||
"estimate.detail.alert.selectDelItem": "削除する商品を選択してください.",
|
"estimate.detail.alert.selectDelItem": "削除する商品を選択してください.",
|
||||||
"estimate.menu.move.valid1": "回路を分割していないため、見積もりを呼び出すことはできません.",
|
"estimate.menu.move.valid1": "回路を分割していないため、見積もりを呼び出すことはできません.",
|
||||||
|
|||||||
@ -507,6 +507,7 @@
|
|||||||
"common.require": "필수",
|
"common.require": "필수",
|
||||||
"common.finish": "완료",
|
"common.finish": "완료",
|
||||||
"common.ok": "확인",
|
"common.ok": "확인",
|
||||||
|
"common.cancel": "취소",
|
||||||
"commons.west": "서",
|
"commons.west": "서",
|
||||||
"commons.east": "동",
|
"commons.east": "동",
|
||||||
"commons.south": "남",
|
"commons.south": "남",
|
||||||
@ -943,8 +944,9 @@
|
|||||||
"estimate.detail.save.requiredSalePrice": "단가는 0보다 큰값을 입력해주세요.",
|
"estimate.detail.save.requiredSalePrice": "단가는 0보다 큰값을 입력해주세요.",
|
||||||
"estimate.detail.reset.alertMsg": "초기화 되었습니다.",
|
"estimate.detail.reset.alertMsg": "초기화 되었습니다.",
|
||||||
"estimate.detail.reset.confirmMsg": "수기 변경(저장)한 견적 정보가 초기화되고, 최근 저장된 도면정보가 반영됩니다. 정말로 초기화하시겠습니까?",
|
"estimate.detail.reset.confirmMsg": "수기 변경(저장)한 견적 정보가 초기화되고, 최근 저장된 도면정보가 반영됩니다. 정말로 초기화하시겠습니까?",
|
||||||
"estimate.detail.lock.alertMsg": "견적서를 [잠금]하면, 수정할 수 없습니다. 견적서를 수정하려면 잠금해제를 하십시오",
|
"estimate.detail.lock.alertMsg": "견적서를 [잠금]하면, 수정할 수 없습니다. <br />견적서를 수정하려면 잠금해제를 하십시오.",
|
||||||
"estimate.detail.unlock.alertMsg": "견적서를 수정하고, 저장하십시오",
|
"estimate.detail.unlock.alertMsg": "[잠금해제]하면 견적서를 수정할 수 있습니다. <br />해제하시겠습니까?",
|
||||||
|
"estimate.detail.unlock.confirmBtnName": "해제",
|
||||||
"estimate.detail.alert.delFile": "첨부파일을 완전히 삭제하려면 [저장]버튼을 클릭하십시오.",
|
"estimate.detail.alert.delFile": "첨부파일을 완전히 삭제하려면 [저장]버튼을 클릭하십시오.",
|
||||||
"estimate.detail.alert.selectDelItem": "삭제할 제품을 선택하세요.",
|
"estimate.detail.alert.selectDelItem": "삭제할 제품을 선택하세요.",
|
||||||
"estimate.menu.move.valid1": "회로를 나누지 않았기 때문에 견적서를 호출할 수 없습니다.",
|
"estimate.menu.move.valid1": "회로를 나누지 않았기 때문에 견적서를 호출할 수 없습니다.",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user