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

View File

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

View File

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

View File

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

View File

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

View File

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