물건상세 소스정리

This commit is contained in:
basssy 2025-02-28 10:07:23 +09:00
parent d58646efd4
commit ec0f63de78

View File

@ -3,7 +3,7 @@
import { useState, useEffect, useRef, useContext } from 'react' import { useState, useEffect, useRef, useContext } from 'react'
import { useRouter, useSearchParams } from 'next/navigation' import { useRouter, useSearchParams } from 'next/navigation'
import { Button } from '@nextui-org/react' import { Button } from '@nextui-org/react'
import Select, { components } from 'react-select' import Select from 'react-select'
import { useAxios } from '@/hooks/useAxios' import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
@ -1404,6 +1404,11 @@ export default function StuffDetail() {
}) })
.catch((error) => { .catch((error) => {
setIsGlobalLoading(false) setIsGlobalLoading(false)
swalFire({
text: error?.response?.data?.message,
type: 'alert',
icon: 'error',
})
console.log('error::::::', error) console.log('error::::::', error)
}) })
} else { } else {
@ -1432,6 +1437,11 @@ export default function StuffDetail() {
}) })
.catch((error) => { .catch((error) => {
setIsGlobalLoading(false) setIsGlobalLoading(false)
swalFire({
text: error?.response?.data?.message,
type: 'alert',
icon: 'error',
})
console.log('error::::::', error) console.log('error::::::', error)
}) })
} }
@ -1523,6 +1533,11 @@ export default function StuffDetail() {
}) })
.catch((error) => { .catch((error) => {
setIsGlobalLoading(false) setIsGlobalLoading(false)
swalFire({
text: error?.response?.data?.message,
type: 'alert',
icon: 'error',
})
console.log('error::::::', error) console.log('error::::::', error)
}) })
} else { } else {
@ -1542,6 +1557,11 @@ export default function StuffDetail() {
}) })
.catch((error) => { .catch((error) => {
setIsGlobalLoading(false) setIsGlobalLoading(false)
swalFire({
text: error?.response?.data?.message,
type: 'alert',
icon: 'error',
})
console.log('error::::::', error) console.log('error::::::', error)
}) })
} }
@ -1606,8 +1626,13 @@ export default function StuffDetail() {
router.push('/management/stuff', { scroll: false }) router.push('/management/stuff', { scroll: false })
}) })
.catch((error) => { .catch((error) => {
console.log('error::::::', error)
setIsGlobalLoading(false) setIsGlobalLoading(false)
swalFire({
text: error?.response?.data?.message,
type: 'alert',
icon: 'error',
})
console.log('error::::::', error)
}) })
}, },
}) })
@ -1691,15 +1716,12 @@ export default function StuffDetail() {
{getMessage('stuff.detail.required')} {getMessage('stuff.detail.required')}
</div> </div>
<div className="left-unit-box"> <div className="left-unit-box">
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}> <Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')} {getMessage('stuff.detail.btn.tempSave')}
</Button> </Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
{/* )} */}
<button <button
type="button" type="button"
className="btn-origin grey" className="btn-origin grey"
@ -2190,15 +2212,12 @@ export default function StuffDetail() {
</table> </table>
</div> </div>
<div className="sub-right-footer"> <div className="sub-right-footer">
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}> <Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')} {getMessage('stuff.detail.btn.tempSave')}
</Button> </Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
{/* )} */}
<button <button
type="button" type="button"
className="btn-origin grey" className="btn-origin grey"
@ -2244,15 +2263,12 @@ export default function StuffDetail() {
) : ( ) : (
<> <>
<div className="left-unit-box"> <div className="left-unit-box">
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}> <Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')} {getMessage('stuff.detail.btn.tempSave')}
</Button> </Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
{/* )} */}
<button <button
type="button" type="button"
className="btn-origin grey" className="btn-origin grey"
@ -2387,7 +2403,6 @@ export default function StuffDetail() {
<> <>
<div className="select-wrap mr5" style={{ width: '567px' }}> <div className="select-wrap mr5" style={{ width: '567px' }}>
<Select <Select
// menuPlacement={'auto'}
id="long-value-select1" id="long-value-select1"
instanceId="long-value-select1" instanceId="long-value-select1"
className="react-select-custom" className="react-select-custom"
@ -2444,7 +2459,6 @@ export default function StuffDetail() {
value={showSaleStoreList.filter(function (option) { value={showSaleStoreList.filter(function (option) {
return option.saleStoreId === selOptions return option.saleStoreId === selOptions
})} })}
// components={{ Option: CustomOption }}
/> />
</div> </div>
<div className="input-wrap" style={{ width: '216px' }}> <div className="input-wrap" style={{ width: '216px' }}>
@ -2479,7 +2493,6 @@ export default function StuffDetail() {
return option.saleStoreId return option.saleStoreId
} }
})} })}
// components={{ Option: CustomOption }}
/> />
</div> </div>
<div className="input-wrap" style={{ width: '216px' }}> <div className="input-wrap" style={{ width: '216px' }}>
@ -2534,7 +2547,6 @@ export default function StuffDetail() {
value={otherSaleStoreList.filter(function (option) { value={otherSaleStoreList.filter(function (option) {
return option.saleStoreId === otherSelOptions return option.saleStoreId === otherSelOptions
})} })}
// components={{ Option: CustomOption2 }}
/> />
</div> </div>
<div className="input-wrap" style={{ width: '216px' }}> <div className="input-wrap" style={{ width: '216px' }}>
@ -2829,15 +2841,12 @@ export default function StuffDetail() {
) : ( ) : (
<> <>
<div className="sub-right-footer"> <div className="sub-right-footer">
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}> <Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')} {getMessage('stuff.detail.btn.tempSave')}
</Button> </Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
{/* )} */}
<button <button
type="button" type="button"
className="btn-origin grey" className="btn-origin grey"