@ -12,11 +12,10 @@ const Container1 = () => {
const [ totalPage , setTotalPage ] = useState ( 0 ) ;
const [ totalPage , setTotalPage ] = useState ( 0 ) ;
const [ transaction , setTransaction ] = useState ( [ ] ) ;
const [ transaction , setTransaction ] = useState ( [ ] ) ;
const [ storage , setLimitInformation ] = useState ( 0 )
const [ storage , setLimitInformation ] = useState ( 0 )
const currentDate = new Date ( ) ;
const currentDate = new Date ( ) ; // Now date
const givenDate = new Date ( transaction . exp _ospro ) ;
const givenDate = new Date ( transaction . exp _ospro ) ; // Parse exp ospro to date format
const createdDate = new Date ( transaction . created _at )
const differenceInMillis = givenDate . getTime ( ) - currentDate . getTime ( ) ; // Get time difference
const differenceInMillis = givenDate . getTime ( ) - currentDate . getTime ( ) ;
const differenceInDays = role !== 'Super Admin' ? Math . ceil ( differenceInMillis / ( 1000 * 60 * 60 * 24 ) ) : 30 ;
const differenceInDays = role !== 'Super Admin' ? Math . floor ( differenceInMillis / ( 1000 * 60 * 60 * 24 ) ) : 30 ;
let company _id = '' , configApp = '' ;
let company _id = '' , configApp = '' ;
if ( role !== 'Super Admin' ) {
if ( role !== 'Super Admin' ) {
@ -153,16 +152,16 @@ const Container1 = () => {
< div className = { styles . days } >
< div className = { styles . days } >
< div className = { styles . frameYourCurrentPlan } >
< div className = { styles . frameYourCurrentPlan } >
< div className = { styles . days1 } > Days < / d i v >
< div className = { styles . days1 } > Days < / d i v >
< div className = { styles . of30Days } > { 30 - Math . abs ( differenceInDays ) } of 30 Days < / d i v >
< div className = { styles . of30Days } > { role !== 'Super Admin' ? ( 30 - Math . abs ( differenceInDays ) ) + ' Days of 30 Days' : < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l > } < / d i v >
< / d i v >
< / d i v >
< div className = { styles . rectangleFrame } >
< div className = { styles . rectangleFrame } >
< div className = { styles . rectangleFrameChild } / >
< div className = { styles . rectangleFrameChild } / >
< div style = { {
< div style = { {
width : ` ${ ( 400 * ( 30 - Math . abs ( differenceInDays ) ) ) / 30 } px ` ,
width : ` ${ role !== 'Super Admin' ? ( ( 400 * ( 30 - Math . abs ( differenceInDays ) ) ) / 30 ) : 0 } px ` ,
position : 'relative' ,
position : 'relative' ,
backgroundColor : ( ( 30 - Math . abs ( differenceInDays ) ) >= 0 && ( 30 - Math . abs ( differenceInDays ) ) <= 10 ) ? '#59b4c3' :
backgroundColor : role !== 'Super Admin' ? ( ( ( 30 - Math . abs ( differenceInDays ) ) >= 0 && ( 30 - Math . abs ( differenceInDays ) ) <= 10 ) ? '#59b4c3' :
( ( 30 - Math . abs ( differenceInDays ) ) >= 11 && ( 30 - Math . abs ( differenceInDays ) ) <= 20 ) ? '#ffa447' :
( ( 30 - Math . abs ( differenceInDays ) ) >= 11 && ( 30 - Math . abs ( differenceInDays ) ) <= 20 ) ? '#ffa447' :
'#FF4747' ,
'#FF4747' ) : '#59b4c3' ,
zIndex : '1' ,
zIndex : '1' ,
padding : '5px' ,
padding : '5px' ,
borderRadius : '15px'
borderRadius : '15px'
@ -170,22 +169,27 @@ const Container1 = () => {
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . daysRemainingUntil } >
< div className = { styles . daysRemainingUntil } >
{ role !== 'Super Admin' ? Math . abs ( differenceInDays ) : 0 } days remaining until your plan requires updat e
{ role !== 'Super Admin' ? Math . abs ( differenceInDays ) : < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l > } d a y s r e m a i n i n g u n t i l y o u r p l a n r e q u i r e s u p d a t e
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . days2 } >
< div className = { styles . days2 } >
< div className = { styles . storageParent } >
< div className = { styles . storageParent } >
< div className = { styles . storage } > Storage < / d i v >
< div className = { styles . storage } > Storage < / d i v >
< div className = { styles . of500mb } > { storage } of { transaction ? . type _paket === 'Basic' ? 500 : 50 } MB < / d i v >
< div className = { styles . of500mb } >
{ role !== 'Super Admin' ?
( storage + 'MB of ' + ( transaction ? . type _paket === 'Basic' ? '500' : '50' ) ) + 'MB'
: < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l >
}
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . rectangleParent } >
< div className = { styles . rectangleParent } >
< div className = { styles . frameChild } / >
< div className = { styles . frameChild } / >
< div style = { {
< div style = { {
width : ` ${ ( 400 * storage ) / ( transaction . type _paket === 'Basic' ? 500 : 50 ) } px ` ,
width : ` ${ role !== 'Super Admin' ? ( 400 * storage ) / ( transaction . type _paket === 'Basic' ? 500 : 50 ) : 0 } px ` ,
position : 'relative' ,
position : 'relative' ,
backgroundColor : ( storage >= 0 && storage <= ( transaction . type _paket === 'Basic' ? 166.67 : 16.67 ) ) ? '#59b4c3' :
backgroundColor : role !== 'Super Admin' ? ( ( storage >= 0 && storage <= ( transaction . type _paket === 'Basic' ? 166.67 : 16.67 ) ) ? '#59b4c3' :
( storage >= ( transaction . type _paket === 'Basic' ? 166.68 : 16.68 ) && storage <= ( transaction . type _paket === 'Basic' ? 333.33 : 33.33 ) ) ? '#ffa447' :
( storage >= ( transaction . type _paket === 'Basic' ? 166.68 : 16.68 ) && storage <= ( transaction . type _paket === 'Basic' ? 333.33 : 33.33 ) ) ? '#ffa447' :
'#FF4747' ,
'#FF4747' ) : '#59b4c3' ,
zIndex : '1' ,
zIndex : '1' ,
padding : '5px' ,
padding : '5px' ,
borderRadius : '15px'
borderRadius : '15px'
@ -193,22 +197,27 @@ const Container1 = () => {
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . storageRemainingUntil } >
< div className = { styles . storageRemainingUntil } >
{ ( ( ( storage / ( transaction . type _paket === 'Basic' ? 500 : 50 ) ) * 100 ) . toFixed ( 2 ) ) } % has been filled until your plan requires an updat e
{ role !== 'Super Admin' ? ( ( ( storage / ( transaction . type _paket === 'Basic' ? 500 : 50 ) ) * 100 ) . toFixed ( 2 ) ) + '%' : < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l > } h a s b e e n f i l l e d u n t i l y o u r p l a n r e q u i r e s a n u p d a t e
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . days3 } >
< div className = { styles . days3 } >
< div className = { styles . projectParent } >
< div className = { styles . projectParent } >
< div className = { styles . project } > Project < / d i v >
< div className = { styles . project } > Project < / d i v >
< div className = { styles . of10Project } > { parseInt ( totalPage ) } of { transaction . type _paket === "Basic" ? "10" : "1" } Project < / d i v >
< div className = { styles . of10Project } >
{
role !== 'Super Admin' ? ( parseInt ( totalPage ) + ' Project of ' + ( transaction . type _paket === "Basic" ? 10 : 1 ) ) + ' Project'
: < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l >
}
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . rectangleGroup } >
< div className = { styles . rectangleGroup } >
< div className = { styles . frameInner } / >
< div className = { styles . frameInner } / >
< div style = { {
< div style = { {
width : ` ${ ( 400 * parseInt ( totalPage ) ) / ( parseInt ( transaction . type _paket === "Basic" ? 10 : 1 ) ) } px ` ,
width : ` ${ role !== 'Super Admin' ? ( 400 * parseInt ( totalPage ) ) / ( parseInt ( transaction . type _paket === "Basic" ? 10 : 1 ) ) : 0 } px ` ,
position : 'relative' ,
position : 'relative' ,
backgroundColor : transaction . type _paket === "Basic" ? ( parseInt ( totalPage ) >= 0 && parseInt ( totalPage ) <= 3 ) ? '#59b4c3' :
backgroundColor : role !== 'Super Admin' ? ( transaction . type _paket === "Basic" ? ( parseInt ( totalPage ) >= 0 && parseInt ( totalPage ) <= 3 ) ? '#59b4c3' :
( parseInt ( totalPage ) >= 4 && parseInt ( totalPage ) <= 7 ) ? '#ffa447' :
( parseInt ( totalPage ) >= 4 && parseInt ( totalPage ) <= 7 ) ? '#ffa447' :
'#FF4747' : '#FF4747' ,
'#FF4747' : '#FF4747' ) : '#59b4c3' ,
zIndex : '1' ,
zIndex : '1' ,
padding : '5px' ,
padding : '5px' ,
borderRadius : '15px'
borderRadius : '15px'
@ -216,7 +225,7 @@ const Container1 = () => {
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { styles . projectRemainingUntil } >
< div className = { styles . projectRemainingUntil } >
{ parseInt ( transaction . type _paket === "Basic" ? 10 : 1 ) - ( parseInt ( totalPage ) ) } Project remaining until your plan requires updat e
{ role !== 'Super Admin' ? ( transaction . type _paket === "Basic" ? 10 : 1 ) - parseInt ( totalPage ) : < small style = { { fontWeight : 'bold' } } > Unlimited < / s m a l l > } P r o j e c t r e m a i n i n g u n t i l y o u r p l a n r e q u i r e s u p d a t e
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >