Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tenant val, req count #112

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let config = {
MONGO_URL: `mongodb://admin:[email protected].mongodb.net:27017,cluster0-shard-00-01.evrtj.mongodb.net:27017,cluster0-shard-00-02.evrtj.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-xnzvxt-shard-0&authSource=admin&retryWrites=true&w=majority`,
MONGO_URL: `mongodb+srv://Anuj:[email protected].mongodb.net/?retryWrites=true&w=majority`,
DB_CONNECTION_RETTEMPT_LIMIT_NODE: 5,
SECRET_KEY: "jksdo"
}
Expand Down
2 changes: 2 additions & 0 deletions idpass.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[email protected]
p4n7j07c
8 changes: 6 additions & 2 deletions pages/auth/TenantSignUp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Head from 'next/head'
import Head from "next/head";
import Image from "next/image";
import React, { useContext, useEffect, useState } from "react";
import Tenant from "../../public/images/tenant.png";
Expand Down Expand Up @@ -46,7 +46,11 @@ function Tenant_Signup() {

const onSubmit = (e) => {
e.preventDefault();
submitHandler(details);
if (!details.contact.match(`[0-9]{10}`)) {
alert("Please provide valid phone number");
} else {
submitHandler(details);
}
};

if (state.userInfo) {
Expand Down
59 changes: 44 additions & 15 deletions pages/charges/ParticularSiteCharges.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,21 @@ export default function ParticularSiteCharges() {
{state.particularSiteCharges?.length <= 0 ? (
<div>
<Header header="Total Charges" />
No charges to display
<NameLabel
label="Alias Name"
details={router.query?.name}
/>
<div
style={({ width: "500px" }, { margin: "500px" })}
className="m-5"
>
<strong className="shadow-lg p-5 m-5 a-center">
No charges to display
</strong>
</div>
</div>
) : (
<div className="p_right">
<div>
<Header header="Total Charges" />

<NameLabel
Expand All @@ -129,22 +140,40 @@ export default function ParticularSiteCharges() {
details={state.particularSiteCharges[0]?.site_id?.Type}
/>
<NameLabel label="Address" details={getAddress()} />

{state.particularSiteCharges.map((data, index) => {
console.log(data);
return (
<TotalchargesCard
key={index}
description={data.description}
siteDetails={data.site_id}
/>
);
})}
<div className="row">
{state.particularSiteCharges.map((data, index) => {
if (data.isPaid) {
return (
<div className="col-3 text-white">
<TotalchargesCard
key={index}
date={data.createdAt}
description={data.description}
siteDetails={data.site_id}
color="bg-success"
/>
</div>
);
} else {
return (
<div className="col-3 text-white">
<TotalchargesCard
key={index}
date={data.createdAt}
description={data.description}
siteDetails={data.site_id}
color="bg-warning"
/>
</div>
);
}
})}
</div>
</div>
)}
<div className="tc">
{/* <div className="tc">
<Image src={Total_Charges} alt="TC" />
</div>
</div> */}
</div>
</div>
</div>
Expand Down
15 changes: 13 additions & 2 deletions pages/charges/components/totalChargesCard.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from "react";
import Moment from "react-moment";

const TotalchargesCard = (props) => {
var totalCharges = 0;

return (
<div className="p_card1">
// return <button className={`btn ${props.classNameProp}`}>{props.name}</button>;

// <div className="p_card1 `${props.color}`">

<div className={`p_card1 ${props.color}`}>
<div className="p_cardb">
<table cellPadding="4" cellSpacing="4" border="0">
<thead>
Expand All @@ -17,16 +22,22 @@ const TotalchargesCard = (props) => {
<td>Rent:</td>
<td>{props.siteDetails?.rent}</td>
</tr>
<tr>
<td>Created on:</td>
<td><Moment format="MMMM Do YYYY">{props.date}</Moment></td>
</tr>
{props.description
? Object.keys(props.description).map((data, index) => {
if (data != 'rent') {
totalCharges += parseInt(props.description[data]);
return (
<tr key={index}>
<td>{data}:</td>
<td>{props.description[data]}</td>
</tr>
);
})
}
})
: ""}
</tbody>
<tfoot>
Expand Down
4 changes: 2 additions & 2 deletions pages/editprofile/EditTenant.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ function EditTenant() {
})}

{/* History */}
<div className="row a-edit-content a-row-wrapper">
{/* <div className="row a-edit-content a-row-wrapper">
<div className="col-lg-4 col-sm-12">
<span className="a-edit-left-title">History</span>
</div>
Expand All @@ -461,7 +461,7 @@ function EditTenant() {
No History
</span>
</div>
</div>
</div> */}

{/* Change Password */}
<div className="row a-edit-content a-row-wrapper">
Expand Down
4 changes: 2 additions & 2 deletions pages/editprofile/components/EditBirthday.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function EditBirthday(props) {
name="date"
className="form-select form-select-sm"
aria-label="form-select"
style={{ width: "80px" }}
style={{ width: "100px" }}
onChange={onChange}
>
{runCallback(() => {
Expand Down Expand Up @@ -126,7 +126,7 @@ function EditBirthday(props) {
name="year"
className="form-select form-select-sm"
aria-label="form-select"
style={{ width: "80px" }}
style={{ width: "100px" }}
onChange={onChange}
>
{runCallback(() => {
Expand Down
16 changes: 8 additions & 8 deletions pages/homepage/HomePage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Head from 'next/head'
import Head from "next/head";
import HomePageBanner from "./components/HomePageBanner";
import Features from "./components/Features";
import GetStarted from "./components/GetStarted";
Expand All @@ -23,13 +23,13 @@ function HomePage() {
<title>Home Page</title>
</Head>
<HomePageBanner />
<div className="Parent">
<Taskbar />
<div className="S_right">
<Features />
<GetStarted />
</div>
</div>
{/* <div className="Parent">
<Taskbar /> */}
{/* <div className="S_right"> */}
<Features />
<GetStarted />
{/* </div>
</div> */}
</>
);
}
Expand Down
2 changes: 0 additions & 2 deletions pages/landing/ParticularSiteCharges.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export default function ParticularSiteC() {
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
const { dispatch, state } = useContext(Store);



const getAllCharges = async () => {
console.log("get all called");
closeSnackbar();
Expand Down
3 changes: 2 additions & 1 deletion pages/landing/components/ChargesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ChargesList = (props) => {
// });
console.log(res);
if (res.data?.success) {
props.refreshPage();
enqueueSnackbar("Paid Successfully", { variant: "success" });
}
});
Expand Down Expand Up @@ -94,8 +95,8 @@ const ChargesList = (props) => {
<td>{TitleCaseFormatter(data.site_id?.alias_name)}</td>
<td>{TitleCaseFormatter(address)}</td>
<td>{rent}</td>
<td>{totalCharges - rent}</td>
<td>{totalCharges}</td>
<td>{rent + totalCharges}</td>
<td>
{data?.isPaid ? (
<button className="btn btn-success" disabled>
Expand Down
42 changes: 42 additions & 0 deletions pages/landing/components/Identity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
// import { TitleCaseFormatter } from "../../../utility/functions/Formatters/TitleCaseFormatter";

// const Identity = (props) => {
// return (
// <div className="S_landing">
// <div className="S_leftbar">
// <div className="S_identity">
// <img
// className="S_profile img-fluid"
// src="/images/Profile.svg"
// alt="Profile"
// />
// <div className="name">
// {TitleCaseFormatter(props.userDetails?.firstName)}
// </div>
// </div>
// <div className="S_menu">
// <div className="S_option S_option1" onClick={() => props.onShow1()}>
// <i className="fas fa-tachometer-alt-fastest"></i>
// <span>Your Sites</span>
// </div>
// <div className="S_option S_option1" onClick={() => props.onShow2()}>
// <i className="fab fa-buffer"></i>
// <span>Requests</span>
// </div>
// </div>
// </div>
// </div>
// );
// };

// export default Identity;

import { TitleCaseFormatter } from "../../../utility/functions/Formatters/TitleCaseFormatter";
import { useState } from "react";
import { useEffect } from "react";

const Identity = (props) => {
return (
Expand All @@ -22,6 +57,13 @@ const Identity = (props) => {
<div className="S_option S_option1" onClick={() => props.onShow2()}>
<i className="fab fa-buffer"></i>
<span>Requests</span>
{props.getCount() == 0 ? (
""
) : (
<i className="fas fa-bell a-set-icon">
<span className="a-set-count"> {props.getCount()}</span>
</i>
)}
</div>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions pages/landing/components/LandingCardButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { useRouter } from "next/router";
import NormalBootstrapButton from "./NormalBootstrapButton";

function LandingCardButton(props) {
const router = useRouter()
const router = useRouter();
const goToDetailsPage = () => {
router.push(props.link)
}
if (router)
router.push(props.link);
};
return (
<div className="a-landing-card-button" onClick={goToDetailsPage}>
<NormalBootstrapButton
Expand Down
51 changes: 40 additions & 11 deletions pages/landing/components/LandingPageCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function LandingPageCard(props) {
console.log(res);
if (res.data?.success) {
enqueueSnackbar("Site left", { variant: "success" });
router.push("/profile/tenant");
router.push("/profile/tenant");
}
});
} catch (err) {
Expand All @@ -38,7 +38,7 @@ function LandingPageCard(props) {
return (
<section className="a-card">
<div
className={`container shadow-lg text-white a-landing-card mt-5 ${props.cclass}`}
className={`container shadow-lg a-landing-card mt-5 ${props.cclass}`}
style={{ width: "65vw" }}
>
<div className="row justify-content-md-center p-3">
Expand All @@ -52,7 +52,7 @@ function LandingPageCard(props) {
<div className="col col-lg-8">
<div className="card-body a-card-body">
<h5 className="card-title a-landing-card-title">
<span className="a-landing-card-heading"> Alias Name: </span>
<span className="a-landing-card-heading"> Site Name: </span>
<span className="a-landing-card-data">{props.alias}</span>
</h5>
<div className="card-text">
Expand All @@ -75,7 +75,36 @@ function LandingPageCard(props) {
<div>
<div className="a-button-container">
<div>
<LandingCardButton
<div className="row">
<div className="col">
<LandingCardButton
classNameProp={props.class1}
name={props.text1}
link={`/charges/ParticularSiteCharges?site_id=${props.site_id}&name=${props.alias}`}
/>
</div>
<div className="col">
<LandingCardButton
classNameProp={props.class2}
name={props.text2}
/>
</div>
<div className="col">
{/* <LandingCardButton
classNameProp={props.class3}
name={props.text3}
/> */}
</div>
<div className="col">
<button
className="btn btn-danger a-landing-card-button"
onClick={leaveHandler}
>
Leave
</button>
</div>
</div>
{/* <LandingCardButton
classNameProp={props.class1}
name={props.text1}
link={`/charges/ParticularSiteCharges?site_id=${props.site_id}`}
Expand All @@ -89,13 +118,13 @@ function LandingPageCard(props) {
name={props.text3}
/>
<div className="a-landing-card-button">
<button
className="btn btn-danger a-landing-card-button"
onClick={leaveHandler}
>
Leave
</button>
</div>
<button
className="btn btn-danger a-landing-card-button"
onClick={leaveHandler}
>
Leave
</button>
</div> */}
</div>
</div>
</div>
Expand Down
Loading