alert -> swalFire 변경

This commit is contained in:
basssy 2025-02-07 12:25:23 +09:00
parent 990ce68672
commit a3aa1cd216
3 changed files with 65 additions and 16 deletions

View File

@ -19,10 +19,10 @@ import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from
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 { correntObjectNoState } from '@/store/settingAtom'
import { useRouter, useSearchParams } from 'next/navigation' import { useSearchParams } from 'next/navigation'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
import { usePlan } from '@/hooks/usePlan' import { usePlan } from '@/hooks/usePlan'
import { usePopup } from '@/hooks/usePopup' import { usePopup } from '@/hooks/usePopup'
import { useSwal } from '@/hooks/useSwal'
export default function Estimate({}) { export default function Estimate({}) {
const [uniqueData, setUniqueData] = useState([]) const [uniqueData, setUniqueData] = useState([])
@ -33,6 +33,8 @@ export default function Estimate({}) {
const [objectNo, setObjectNo] = useState('') // const [objectNo, setObjectNo] = useState('') //
const [planNo, setPlanNo] = useState('') // const [planNo, setPlanNo] = useState('') //
const { swalFire } = useSwal()
const [files, setFiles] = useState([]) // const [files, setFiles] = useState([]) //
const [originFiles, setOriginFiles] = useState([]) // const [originFiles, setOriginFiles] = useState([]) //
@ -347,7 +349,11 @@ export default function Estimate({}) {
setEstimateContextState({ setEstimateContextState({
originFiles: originFiles, originFiles: originFiles,
}) })
alert(getMessage('estimate.detail.alert.delFile'))
swalFire({
text: getMessage('estimate.detail.alert.delFile'),
type: 'alert',
})
} }
// option && // option &&
@ -359,7 +365,6 @@ export default function Estimate({}) {
docTpCd: estimateContextState?.estimateType, docTpCd: estimateContextState?.estimateType,
} }
// console.log('param::::::::::', param)
const apiUrl = `/api/estimate/price/store-price-list?${queryStringFormatter(param)}` const apiUrl = `/api/estimate/price/store-price-list?${queryStringFormatter(param)}`
get({ url: apiUrl }).then((res) => { get({ url: apiUrl }).then((res) => {
if (isNotEmptyArray(res?.data)) { if (isNotEmptyArray(res?.data)) {
@ -477,7 +482,11 @@ export default function Estimate({}) {
if (!pass) { if (!pass) {
//Pricing . Pricing . //Pricing . Pricing .
return alert(getMessage('estimate.detail.showPrice.pricingBtn.noItemId')) return swalFire({
text: getMessage('estimate.detail.showPrice.pricingBtn.noItemId'),
type: 'alert',
icon: 'warning',
})
} }
} }
@ -788,7 +797,11 @@ export default function Estimate({}) {
const removeItem = () => { const removeItem = () => {
const array = [...selection] const array = [...selection]
if (isEmptyArray(array)) { if (isEmptyArray(array)) {
return alert(getMessage('estimate.detail.alert.selectDelItem')) return swalFire({
text: getMessage('estimate.detail.alert.selectDelItem'),
type: 'alert',
icon: 'warning',
})
} }
let delList = [] let delList = []
estimateContextState.itemList.filter((row) => { estimateContextState.itemList.filter((row) => {
@ -818,7 +831,11 @@ export default function Estimate({}) {
}) })
if (delCnt === updateList.length) { if (delCnt === updateList.length) {
return alert(getMessage('estimate.detail.save.requiredItem')) return swalFire({
text: getMessage('estimate.detail.save.requiredItem'),
type: 'alert',
icon: 'warning',
})
} }
setEstimateContextState({ setEstimateContextState({

View File

@ -6,9 +6,12 @@ import { useRecoilValue, useRecoilState } from 'recoil'
import { useAxios } from '@/hooks/useAxios' 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'
export default function ChangePasswordPop(props) { export default function ChangePasswordPop(props) {
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const { swalFire } = useSwal()
const { patch } = useAxios(globalLocaleState) const { patch } = useAxios(globalLocaleState)
const { getMessage } = useMessage() const { getMessage } = useMessage()
const [sessionState, setSessionState] = useRecoilState(sessionStore) const [sessionState, setSessionState] = useRecoilState(sessionStore)
@ -55,22 +58,38 @@ export default function ChangePasswordPop(props) {
// //
if (_password1.trim() === '') { if (_password1.trim() === '') {
alert(getMessage('main.popup.login.validate3')) swalFire({
title: getMessage('main.popup.login.validate3'),
type: 'alert',
icon: 'error',
})
return false return false
} }
if (_password2.trim() === '') { if (_password2.trim() === '') {
alert(getMessage('main.popup.login.validate3')) swalFire({
title: getMessage('main.popup.login.validate3'),
type: 'alert',
icon: 'error',
})
return false return false
} }
if (_password1 !== _password2) { if (_password1 !== _password2) {
alert(getMessage('main.popup.login.validate1')) swalFire({
title: getMessage('main.popup.login.validate4'),
type: 'alert',
icon: 'error',
})
return false return false
} }
// // 10 = 20
if (checkLength(_password1) > 10) { if (checkLength(_password1) > 20) {
return alert(getMessage('main.popup.login.validate2')) swalFire({
title: getMessage('main.popup.login.validate1'),
type: 'alert',
icon: 'error',
})
} }
const param = { const param = {
@ -83,7 +102,10 @@ export default function ChangePasswordPop(props) {
.then((res) => { .then((res) => {
if (res?.result?.code === 200) { if (res?.result?.code === 200) {
if (res?.result?.resultCode === 'S') { if (res?.result?.resultCode === 'S') {
alert(getMessage('main.popup.login.success')) swalFire({
title: getMessage('main.popup.login.success'),
type: 'alert',
})
const result = { ...sessionState, pwdInitYn: 'Y' } const result = { ...sessionState, pwdInitYn: 'Y' }
setSession(result) setSession(result)
setSessionState(result) setSessionState(result)
@ -130,6 +152,7 @@ export default function ChangePasswordPop(props) {
autoComplete="off" autoComplete="off"
onChange={checkValue} onChange={checkValue}
onKeyUp={checkValue} onKeyUp={checkValue}
maxLength={20}
/> />
</div> </div>
</div> </div>
@ -150,6 +173,7 @@ export default function ChangePasswordPop(props) {
autoComplete="off" autoComplete="off"
onChange={checkValue} onChange={checkValue}
onKeyUp={checkValue} onKeyUp={checkValue}
maxLength={20}
/> />
</div> </div>
</div> </div>

View File

@ -410,11 +410,19 @@ export const useEstimateController = (planNo) => {
*/ */
const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId) => { const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId) => {
if (saleStoreId === '') { if (saleStoreId === '') {
return alert(getMessage('estimate.detail.productFeaturesPopup.requiredStoreId')) return swalFire({
text: getMessage('estimate.detail.productFeaturesPopup.requiredStoreId'),
type: 'alert',
icon: 'warning',
})
} }
if (copyReceiveUser.trim().length === 0) { if (copyReceiveUser.trim().length === 0) {
return alert(getMessage('estimate.detail.productFeaturesPopup.requiredReceiveUser')) return swalFire({
text: getMessage('estimate.detail.productFeaturesPopup.requiredReceiveUser'),
type: 'alert',
icon: 'warning',
})
} }
const params = { const params = {
saleStoreId: session.storeId, saleStoreId: session.storeId,