alert => swalFire

This commit is contained in:
basssy 2025-03-05 16:27:41 +09:00
parent 316dc2c4ff
commit c8e18bee17
6 changed files with 29 additions and 18 deletions

View File

@ -46,7 +46,6 @@ export default function Estimate({}) {
const [selection, setSelection] = useState(new Set())
//
// const [hidden, setHidden] = useState(false)
const [hidden, setHidden] = useState(true)
//
@ -569,7 +568,7 @@ export default function Estimate({}) {
return selection.size === getAbledItems(estimateContextState.itemList).length
}
//row
//row
const onChangeSelect = (dispOrder) => {
const newSelection = new Set(selection)
if (newSelection.has(dispOrder)) {
@ -581,10 +580,6 @@ export default function Estimate({}) {
setSelection(newSelection)
}
function formatNumberWithComma(number) {
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
//PKG input
const onChangePkgAsp = (value) => {
if (estimateContextState.estimateType === 'YJSS') {
@ -1140,6 +1135,7 @@ export default function Estimate({}) {
}
}
}, [estimateContextState])
return (
<div className="sub-content estimate">
<div className="sub-content-inner">

View File

@ -119,7 +119,11 @@ export default function ChangePasswordPop(props) {
},
})
} else {
alert(res?.result?.resultMsg)
swalFire({
text: getMessage(res?.result?.resultMsg),
type: 'alert',
icon: 'error',
})
}
} else {
setIsGlobalLoading(false)

View File

@ -75,7 +75,10 @@ export default function Stuff() {
type: 'alert',
})
} catch (err) {
alert(getMessage('stuff.detail.header.failCopy'))
swalFire({
text: getMessage('stuff.detail.header.failCopy'),
type: 'alert',
})
} finally {
textArea.remove()
}

View File

@ -107,7 +107,6 @@ export default function StuffDetail() {
const [areaIdList, setAreaIdList] = useState([]) //
const [isFormValid, setIsFormValid] = useState(false) //,
const [showAddressButtonValid, setShowAddressButtonValid] = useState(false) //
const [showDesignRequestButtonValid, setShowDesignRequestButtonValid] = useState(false) //
const [showWindSpeedButtonValid, setShowWindSpeedButtonValid] = useState(false) //
@ -1094,8 +1093,6 @@ export default function StuffDetail() {
if (!formData.installHeight) {
errors.installHeight = true
}
setIsFormValid(Object.keys(errors).length === 0 ? true : false)
} else {
//
const formData = form.getValues()
@ -1140,8 +1137,6 @@ export default function StuffDetail() {
if (!formData.installHeight) {
errors.installHeight = true
}
setIsFormValid(Object.keys(errors).length === 0 ? true : false)
}
}, [
_receiveUser,

View File

@ -4,7 +4,6 @@ import { useContext, useEffect } from 'react'
import { useMessage } from '@/hooks/useMessage'
import dayjs from 'dayjs'
import { GlobalDataContext } from '@/app/GlobalDataProvider'
// import { ManagementContext } from '@/app/management/ManagementProvider'
import { useSwal } from '@/hooks/useSwal'
export default function StuffHeader() {
const { getMessage } = useMessage()
@ -23,7 +22,10 @@ export default function StuffHeader() {
})
})
.catch(() => {
alert(getMessage('stuff.detail.header.failCopy'))
swalFire({
text: getMessage('stuff.detail.header.failCopy'),
type: 'alert',
})
})
} else {
// Use the 'out of viewport hidden text area' trick
@ -44,7 +46,10 @@ export default function StuffHeader() {
type: 'alert',
})
} catch (err) {
alert(getMessage('stuff.detail.header.failCopy'))
swalFire({
text: getMessage('stuff.detail.header.failCopy'),
type: 'alert',
})
} finally {
textArea.remove()
}

View File

@ -18,6 +18,7 @@ import { isObjectNotEmpty } from '@/util/common-utils'
import { SessionContext } from '@/app/SessionProvider'
import { QcastContext } from '@/app/QcastProvider'
import { useSwal } from '@/hooks/useSwal'
export default function StuffSearchCondition() {
const router = useRouter()
@ -73,17 +74,24 @@ export default function StuffSearchCondition() {
const [otherSaleStoreId, setOtherSaleStoreId] = useState('')
const { setIsGlobalLoading } = useContext(QcastContext)
const { swalFire } = useSwal()
//
const onSubmit = () => {
let diff = dayjs(endDate).diff(startDate, 'day')
if (diff > 366) {
return alert(getMessage('stuff.message.periodError'))
return swalFire({
text: getMessage('stuff.message.periodError'),
type: 'alert',
})
}
if (isNaN(diff)) {
return alert(getMessage('stuff.message.periodError'))
return swalFire({
text: getMessage('stuff.message.periodError'),
type: 'alert',
})
}
setIsGlobalLoading(true)