|
|
@ -8,7 +8,6 @@ import moment from "moment"; |
|
|
|
const Container1 = () => { |
|
|
|
const Container1 = () => { |
|
|
|
const token = localStorage.getItem("token") |
|
|
|
const token = localStorage.getItem("token") |
|
|
|
const user_id = localStorage.getItem("user_id") |
|
|
|
const user_id = localStorage.getItem("user_id") |
|
|
|
let company_id = '', configApp = ''; |
|
|
|
|
|
|
|
const role = window.localStorage.getItem('role_name'); |
|
|
|
const role = window.localStorage.getItem('role_name'); |
|
|
|
const [totalPage, setTotalPage] = useState(0); |
|
|
|
const [totalPage, setTotalPage] = useState(0); |
|
|
|
const [transaction, setTransaction] = useState([]); |
|
|
|
const [transaction, setTransaction] = useState([]); |
|
|
@ -17,9 +16,9 @@ const Container1 = () => { |
|
|
|
const givenDate = new Date(transaction.exp_ospro); |
|
|
|
const givenDate = new Date(transaction.exp_ospro); |
|
|
|
const createdDate = new Date(transaction.created_at) |
|
|
|
const createdDate = new Date(transaction.created_at) |
|
|
|
const differenceInMillis = givenDate.getTime() - currentDate.getTime(); |
|
|
|
const differenceInMillis = givenDate.getTime() - currentDate.getTime(); |
|
|
|
|
|
|
|
const differenceInDays = role !== 'Super Admin' ? Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)) : 30; |
|
|
|
|
|
|
|
|
|
|
|
const differenceInDays = Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)); |
|
|
|
let company_id = '', configApp = ''; |
|
|
|
|
|
|
|
|
|
|
|
if(role !== 'Super Admin') { |
|
|
|
if(role !== 'Super Admin') { |
|
|
|
company_id = localStorage.getItem("company_id"); |
|
|
|
company_id = localStorage.getItem("company_id"); |
|
|
|
configApp = JSON.parse(window.localStorage.getItem('configApp')); |
|
|
|
configApp = JSON.parse(window.localStorage.getItem('configApp')); |
|
|
@ -33,8 +32,10 @@ const Container1 = () => { |
|
|
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
useEffect(()=>{ |
|
|
|
getDataProyek(); |
|
|
|
getDataProyek(); |
|
|
|
getDataTransaction(); |
|
|
|
|
|
|
|
getLimitInformation(); |
|
|
|
getLimitInformation(); |
|
|
|
|
|
|
|
if(role !== 'Super Admin') { |
|
|
|
|
|
|
|
getDataTransaction(); |
|
|
|
|
|
|
|
} |
|
|
|
},[]) |
|
|
|
},[]) |
|
|
|
|
|
|
|
|
|
|
|
const getDataProyek = async () => { |
|
|
|
const getDataProyek = async () => { |
|
|
@ -88,13 +89,13 @@ const Container1 = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getLimitInformation = async () => { |
|
|
|
const getLimitInformation = async () => { |
|
|
|
const url = STORAGE_LIMIT_INFORMATION(configApp.company_name); |
|
|
|
const url = STORAGE_LIMIT_INFORMATION(role !== 'Super Admin' ? configApp.company_name : 'Super Admin'); |
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.get(url, config) |
|
|
|
.get(url, config) |
|
|
|
.then((res) => res) |
|
|
|
.then((res) => res) |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
if (result.data) { |
|
|
|
if (result.data) { |
|
|
|
setLimitInformation(result.data); |
|
|
|
setLimitInformation(role !== 'Super Admin' ? parseFloat(result.data) : 0); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
} |
|
|
|
} |
|
|
@ -169,13 +170,13 @@ const Container1 = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.daysRemainingUntil}> |
|
|
|
<div className={styles.daysRemainingUntil}> |
|
|
|
{Math.abs(differenceInDays)} days remaining until your plan requires update |
|
|
|
{ role !== 'Super Admin' ? Math.abs(differenceInDays) : 0} days remaining until your plan requires update |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.days2}> |
|
|
|
<div className={styles.days2}> |
|
|
|
<div className={styles.storageParent}> |
|
|
|
<div className={styles.storageParent}> |
|
|
|
<div className={styles.storage}>Storage</div> |
|
|
|
<div className={styles.storage}>Storage</div> |
|
|
|
<div className={styles.of500mb}>{storage} of {transaction.type_paket === 'Basic' ? 500 : 50}MB</div> |
|
|
|
<div className={styles.of500mb}>{storage} of {transaction?.type_paket === 'Basic' ? 500 : 50}MB</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.rectangleParent}> |
|
|
|
<div className={styles.rectangleParent}> |
|
|
|
<div className={styles.frameChild} /> |
|
|
|
<div className={styles.frameChild} /> |
|
|
@ -192,7 +193,7 @@ const Container1 = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.storageRemainingUntil}> |
|
|
|
<div className={styles.storageRemainingUntil}> |
|
|
|
{((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2)}% storage remaining until your plan requires update |
|
|
|
{(((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2))}% has been filled until your plan requires an update |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.days3}> |
|
|
|
<div className={styles.days3}> |
|
|
|