T01 이 작성한 물건 T01아닌 사용자가 로그인했을때 버튼 숨김 처리

This commit is contained in:
basssy 2025-01-07 09:35:11 +09:00
parent 6e17d07074
commit e5d48b6b68
2 changed files with 37 additions and 22 deletions

View File

@ -41,12 +41,12 @@ export default function MainPage(mainPageProps) {
if (searchRadioType === 'object') {
setStuffSearch({
...stuffSearch,
schObjectNo: searchTxt,
schObjectNo: searchTxt.trim(),
code: 'M',
})
router.push('/management/stuff', { scroll: false })
} else {
setSearchForm({ ...searchForm, searchValue: searchTxt, mainFlag: 'Y' })
setSearchForm({ ...searchForm, searchValue: searchTxt.trim(), mainFlag: 'Y' })
router.push('/community/faq')
}
}

View File

@ -34,6 +34,8 @@ export default function StuffDetail() {
const [popPlanNo, setPopPlanNo] = useState('1') //default 1
const [showButton, setShowButton] = useState('') //, ,
//
const { commonCode, findCommonCode } = useCommonCode()
const [selOptions, setSelOptions] = useState('') // 1
@ -266,7 +268,11 @@ export default function StuffDetail() {
display: 'none',
}
}
//createUser T01 T01
if (managementState?.createUser === 'T01' && session?.userId !== 'T01') {
//createUser T01 T01
setShowButton('none')
}
return (
<>
<div className="grid-cell-btn">
@ -318,8 +324,16 @@ export default function StuffDetail() {
setIsFormValid(true)
}
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
// console.log('res::::', res.data)
if (res.status === 200) {
// console.log(res.data.createUser)
// console.log(session)
if (res?.data?.createUser === 'T01') {
if (session?.userId !== 'T01') {
//createUser T01 T01
setShowButton('none')
}
}
if (isObjectNotEmpty(res.data)) {
let surfaceTypeValue
if (res.data.surfaceType === 'Ⅲ・Ⅳ') {
@ -1475,11 +1489,11 @@ export default function StuffDetail() {
</div>
<div className="left-unit-box">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave}>
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
@ -1514,7 +1528,7 @@ export default function StuffDetail() {
)) ||
null}
</div>
<Button type="button" className="btn-origin grey" onPress={onSearchDesignRequestPopOpen}>
<Button type="button" className="btn-origin grey" onPress={onSearchDesignRequestPopOpen} style={{ display: showButton }}>
{getMessage('stuff.planReqPopup.title')}
</Button>
</div>
@ -1751,7 +1765,7 @@ export default function StuffDetail() {
<div className="input-wrap mr5" style={{ width: '200px' }}>
<input type="text" className="input-light" disabled value={form.watch('zipNo') || ''} />
</div>
<Button className="btn-origin grey" onPress={onSearchPostNumberPopOpen}>
<Button className="btn-origin grey" onPress={onSearchPostNumberPopOpen} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.addressPop')}
</Button>
<div className="guide">{getMessage('stuff.detail.btn.addressPop.guide')}</div>
@ -1841,7 +1855,7 @@ export default function StuffDetail() {
></Select>
</div>
<span className="mr10">{getMessage('stuff.detail.standardWindSpeedIdSpan')}</span>
<Button type="button" className="btn-origin grey" onPress={onSearchWindSpeedPopOpen}>
<Button type="button" className="btn-origin grey" onPress={onSearchWindSpeedPopOpen} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.windSpeedPop')}
</Button>
</div>
@ -1963,11 +1977,11 @@ export default function StuffDetail() {
</div>
<div className="sub-right-footer">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave}>
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
@ -1995,10 +2009,10 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.moveList')}
</button>
</Link>
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
<Button type="button" className="btn-origin grey" onPress={onDelete}>
<Button type="button" className="btn-origin grey" onPress={onDelete} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.delete')}
</Button>
</div>
@ -2007,11 +2021,11 @@ export default function StuffDetail() {
<>
<div className="left-unit-box">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave}>
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
@ -2045,12 +2059,13 @@ export default function StuffDetail() {
onClick={() => {
form.setValue('planReqNo', '')
}}
style={{ display: showButton }}
></button>
) : null}
</div>
{managementState?.tempFlg === '1' ? (
<>
<Button className="btn-origin grey" onPress={onSearchDesignRequestPopOpen}>
<Button className="btn-origin grey" onPress={onSearchDesignRequestPopOpen} style={{ display: showButton }}>
{getMessage('stuff.planReqPopup.title')}
</Button>
</>
@ -2306,7 +2321,7 @@ export default function StuffDetail() {
<div className="input-wrap mr5" style={{ width: '200px' }}>
<input type="text" className="input-light" disabled value={form.watch('zipNo') || ''} />
</div>
<Button className="btn-origin grey" onPress={onSearchPostNumberPopOpen}>
<Button className="btn-origin grey" onPress={onSearchPostNumberPopOpen} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.addressPop')}
</Button>
<div className="guide">{getMessage('stuff.detail.btn.addressPop.guide')}</div>
@ -2401,7 +2416,7 @@ export default function StuffDetail() {
></Select>
</div>
<span className="mr10">{getMessage('stuff.detail.standardWindSpeedIdSpan')}</span>
<Button type="button" className="btn-origin grey" onPress={onSearchWindSpeedPopOpen}>
<Button type="button" className="btn-origin grey" onPress={onSearchWindSpeedPopOpen} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.windSpeedPop')}
</Button>
</div>
@ -2571,10 +2586,10 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.moveList')}
</button>
</Link>
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
<Button type="button" className="btn-origin grey" onPress={onDelete}>
<Button type="button" className="btn-origin grey" onPress={onDelete} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.delete')}
</Button>
</div>
@ -2583,11 +2598,11 @@ export default function StuffDetail() {
<>
<div className="sub-right-footer">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave}>
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5">
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}