11import Button from "../../../../../Components/Button" ;
22import ConfettiExplosion from "react-confetti-explosion" ;
33import { MdOutlineKeyboardArrowUp } from "react-icons/md" ;
4- import { convertToPersian , getFieldTranslationByNames } from "../../../../../Services/Utility/index" ;
4+ import {
5+ convertToPersian ,
6+ getFieldTranslationByNames ,
7+ } from "../../../../../Services/Utility/index" ;
58import line from "../../../../../Assets/images/profile/Line.png" ;
69import person from "../../../../../Assets/images/profile/slide.png" ;
710import pscpng from "../../../../../Assets/images/profile/psc.gif" ;
811import rialpng from "../../../../../Assets/images/profile/rial.gif" ;
912import styled from "styled-components" ;
1013import { useState , useEffect , useRef } from "react" ;
1114import { useLanguage } from "../../../../../Services/Reducers/LanguageContext" ;
12- import { Info , proposerContainer , BasePrice , Prices , RejectButton , Text } from "../suggestionStyles" ;
15+ import {
16+ Info ,
17+ proposerContainer ,
18+ BasePrice ,
19+ Prices ,
20+ RejectButton ,
21+ Text ,
22+ } from "../suggestionStyles" ;
1323import useRequest from "../../../../../Services/Hooks/useRequest/index" ;
1424import { useNavigate } from "react-router-dom" ;
1525import { useAccountSecurity } from "../../../../../Services/Reducers/accountSecurityContext" ;
@@ -48,7 +58,7 @@ const Time = styled.div`
4858 font-weight: 600;
4959 }
5060 h3 {
51- color:${ ( props ) => ( props . theme . colors . newColors . shades [ 30 ] ) } ;
61+ color: ${ ( props ) => props . theme . colors . newColors . shades [ 30 ] } ;
5262 font-size: 18px;
5363 font-weight: 500;
5464 margin-top: 4px;
@@ -61,9 +71,11 @@ const Days = styled.div`
6171 align-items: center;
6272 gap: 16px;
6373 padding-bottom: 16px;
64- border-bottom: 1px solid ${ ( props ) => ( props . theme . colors . newColors . otherColors . inputBorder ) } ;
74+ border-bottom: 1px solid
75+ ${ ( props ) => props . theme . colors . newColors . otherColors . inputBorder } ;
6576 button {
66- background-color: ${ ( props ) => ( props . theme . colors . newColors . otherColors . iconBg ) } ;
77+ background-color: ${ ( props ) =>
78+ props . theme . colors . newColors . otherColors . iconBg } ;
6779 white-space: nowrap;
6880 font-size: 16px;
6981 padding: 8px;
@@ -97,7 +109,6 @@ const Remained = styled.div`
97109 font-weight: 400;
98110` ;
99111const StyledArrowUp = styled ( MdOutlineKeyboardArrowUp ) `
100-
101112 color: ${ ( { percent } ) => ( percent > 0 ? "#18C08F" : "#FF0000" ) } ;
102113 rotate: ${ ( { percent } ) => ( percent > 0 ? "" : "180deg" ) } ;
103114` ;
@@ -111,7 +122,7 @@ const Proposer = ({
111122 onReject,
112123 onAccept,
113124 property,
114- id
125+ id,
115126} ) => {
116127 const { selectedItemId } = useAccountSecurity ( ) ;
117128 const itemRef = useRef ( null ) ;
@@ -135,28 +146,47 @@ const Proposer = ({
135146 if ( ! id ) return console . error ( "Error: id is undefined!" ) ;
136147
137148 try {
138- await Request ( `buy-requests/add-grace-period/${ id } ` , "POST" , new FormData ( ) . append ( "grace_period" , selectedDay . toString ( ) ) , {
139- headers : { "Content-Type" : "multipart/form-data" } ,
140- } , "production" ) ;
149+ await Request (
150+ `buy-requests/add-grace-period/${ id } ` ,
151+ "POST" ,
152+ new FormData ( ) . append ( "grace_period" , selectedDay . toString ( ) ) ,
153+ {
154+ headers : { "Content-Type" : "application/json" } ,
155+ } ,
156+ "production"
157+ ) ;
141158 setDay ( selectedDay ) ;
142159 } catch ( error ) {
143160 console . error ( "Error caught:" , error ) ;
144161 navigate ( "/metaverse/confirmation" , {
145- state : { locationPage : "profile-4" , sectionId : "received-suggestion" , itemId : id } ,
162+ state : {
163+ locationPage : "profile-4" ,
164+ sectionId : "received-suggestion" ,
165+ itemId : id ,
166+ } ,
146167 } ) ;
147168 }
148169 } ;
149170
150-
151171 return (
152172 < Container >
153173 < Info isPersian = { isPersian } >
154174 < Header >
155175 < Person >
156- < img src = { property . profile_photo } alt = { code } width = { 60 } height = { 60 } />
176+ < img
177+ src = { property . profile_photo }
178+ alt = { code }
179+ width = { 60 }
180+ height = { 60 }
181+ />
157182 < div >
158183 < p > { getFieldTranslationByNames ( "768" ) } </ p >
159- < a target = "blank" href = { `https://rgb.irpsc.com/fa/citizen/${ code } ` } > { code . toUpperCase ( ) } </ a >
184+ < a
185+ target = "blank"
186+ href = { `https://rgb.irpsc.com/fa/citizen/${ code } ` }
187+ >
188+ { code . toUpperCase ( ) }
189+ </ a >
160190 </ div >
161191 </ Person >
162192 < Time >
@@ -191,13 +221,14 @@ const Proposer = ({
191221 < >
192222 { isExpanded ? information : `${ information . slice ( 0 , 277 ) } ...` } { " " }
193223 < span onClick = { handleToggle } >
194- { isExpanded ? getFieldTranslationByNames ( "884" ) : getFieldTranslationByNames ( "774" ) }
224+ { isExpanded
225+ ? getFieldTranslationByNames ( "884" )
226+ : getFieldTranslationByNames ( "774" ) }
195227 </ span >
196228 </ >
197229 ) : (
198230 information || ""
199231 ) }
200-
201232 </ p >
202233 </ Text >
203234 </ Info >
@@ -208,7 +239,9 @@ const Proposer = ({
208239 onClick = { ( ) => {
209240 handleGracePeriod ( 7 ) ;
210241 } }
211- label = { `${ convertToPersian ( 7 ) } ${ getFieldTranslationByNames ( "772" ) } ` }
242+ label = { `${ convertToPersian ( 7 ) } ${ getFieldTranslationByNames (
243+ "772"
244+ ) } `}
212245 color = "#3B3B3B"
213246 textColor = "#949494"
214247 full
@@ -217,18 +250,20 @@ const Proposer = ({
217250 onClick = { ( ) => {
218251 handleGracePeriod ( 1 ) ;
219252 } }
220- label = { `${ convertToPersian ( 1 ) } ${ getFieldTranslationByNames ( "772" ) } ` }
253+ label = { `${ convertToPersian ( 1 ) } ${ getFieldTranslationByNames (
254+ "772"
255+ ) } `}
221256 color = "#3B3B3B"
222257 textColor = "#949494"
223258 full
224259 />
225260 </ Days >
226-
227-
228261 ) }
229262 { day !== 0 && (
230263 < Div >
231- < Remained > { convertToPersian ( day ) } { getFieldTranslationByNames ( "1413" ) } </ Remained >
264+ < Remained >
265+ { convertToPersian ( day ) } { getFieldTranslationByNames ( "1413" ) }
266+ </ Remained >
232267 </ Div >
233268 ) }
234269 < Buttons >
@@ -249,51 +284,48 @@ const Proposer = ({
249284 height = "100vh"
250285 width = { 400 }
251286 style = { {
252- position : "absolute" ,
253- left : "50%" ,
254- top : "50%" ,
255- transform : "translate(-50%, -50%)" ,
287+ position : "absolute" ,
288+ left : "50%" ,
289+ top : "50%" ,
290+ transform : "translate(-50%, -50%)" ,
256291 } }
257292 />
258-
259-
260293 ) }
261294 </ RejectButton >
262- < div style = { { position :"relative" } } >
263- < Button
264- label = { getFieldTranslationByNames ( "776" ) }
265- color = "#18C08F"
266- textColor = "#FFFFFF"
267- onClick = { ( ) => {
268- setIsExplodingAccept ( true ) ;
295+ < div style = { { position : "relative" } } >
296+ < Button
297+ label = { getFieldTranslationByNames ( "776" ) }
298+ color = "#18C08F"
299+ textColor = "#FFFFFF"
300+ onClick = { ( ) => {
301+ setIsExplodingAccept ( true ) ;
269302
270- onAccept ( ) ;
271- } }
272- full
273- />
303+ onAccept ( ) ;
304+ } }
305+ full
306+ />
274307
275- { isExplodingAccept && (
276-
277- < ConfettiExplosion
278- zIndex = { 10 }
279- particleCount = { 150 }
280- duration = { 3000 }
281- colors = { [ "#18C08F" ] }
282- particleSize = { 5 }
283- height = "100vh"
284- width = { 400 }
285- style = { {
286- position : "absolute" ,
287- left : "50%" ,
288- top : "50%" ,
289- transform : "translate(-50%, -50%)" ,
290- } }
291- />
292- ) }
293- </ div >
308+ { isExplodingAccept && (
309+ < ConfettiExplosion
310+ zIndex = { 10 }
311+ particleCount = { 150 }
312+ duration = { 3000 }
313+ colors = { [ "#18C08F" ] }
314+ particleSize = { 5 }
315+ height = "100vh"
316+ width = { 400 }
317+ style = { {
318+ position : "absolute" ,
319+ left : "50%" ,
320+ top : "50%" ,
321+ transform : "translate(-50%, -50%)" ,
322+ } }
323+ />
324+ ) }
325+ </ div >
294326 </ Buttons >
295327 </ ProposalStatus >
296- </ Container >
328+ </ Container >
297329 ) ;
298330} ;
299331
0 commit comments