Browse Source

update profile for super admin

pull/1/head
wahyuun 6 months ago
parent
commit
ca29b6a68b
  1. 19
      src/views/SimproV2/Settings/components/Plan/Container1.js

19
src/views/SimproV2/Settings/components/Plan/Container1.js

@ -8,7 +8,6 @@ import moment from "moment";
const Container1 = () => {
const token = localStorage.getItem("token")
const user_id = localStorage.getItem("user_id")
let company_id = '', configApp = '';
const role = window.localStorage.getItem('role_name');
const [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]);
@ -17,9 +16,9 @@ const Container1 = () => {
const givenDate = new Date(transaction.exp_ospro);
const createdDate = new Date(transaction.created_at)
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') {
company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp'));
@ -33,8 +32,10 @@ const Container1 = () => {
useEffect(()=>{
getDataProyek();
getDataTransaction();
getLimitInformation();
if(role !== 'Super Admin') {
getDataTransaction();
}
},[])
const getDataProyek = async () => {
@ -88,13 +89,13 @@ const Container1 = () => {
}
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
.get(url, config)
.then((res) => res)
.catch((error) => error.response);
if (result.data) {
setLimitInformation(result.data);
setLimitInformation(role !== 'Super Admin' ? parseFloat(result.data) : 0);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
@ -169,13 +170,13 @@ const Container1 = () => {
</div>
</div>
<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 className={styles.days2}>
<div className={styles.storageParent}>
<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 className={styles.rectangleParent}>
<div className={styles.frameChild} />
@ -192,7 +193,7 @@ const Container1 = () => {
</div>
</div>
<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 className={styles.days3}>

Loading…
Cancel
Save