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

Revamped the vendors dashboard Page #175

Open
wants to merge 1 commit into
base: master
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
125 changes: 80 additions & 45 deletions src/components/VendorDashboard/VendorDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Link } from 'react-router-dom';
import 'antd/dist/antd.css';
import './Vendordashboard.css';
import { connect } from 'react-redux';
import { Typography, Icon, Row, Col, Button, PageHeader, Table, Divider } from 'antd';
import { Icon, Row, Col, Button, PageHeader, Table, Divider, Card, Tabs } from 'antd';
import { getServices } from '../../redux/actions/vendorActions';
const { Title } = Typography;
const { TabPane } = Tabs;

class VendorDashboard extends Component {
getVendorServices = (id) => {
Expand All @@ -21,21 +21,25 @@ class VendorDashboard extends Component {
{
title: 'Service name',
dataIndex: 'servicename',
width: 100,
key: 'servicename',
},
{
title: 'Phone',
dataIndex: 'phone',
width: 100,
key: 'phone',
},
{
title: 'Address',
dataIndex: 'address',
width: 100,
key: 'address',
},
{
title: 'Action',
key: 'action',
width: 100,
render: (text, record) => (
<span>
<Link to="/VendorSalesPage">Edit</Link>
Expand All @@ -47,57 +51,88 @@ class VendorDashboard extends Component {
];

const { isAuthenticated, user, services } = this.props;

if (isAuthenticated && user.isVendor === true) {
let data = [];
data = services.map((data,index)=>{
const {location,contact} = data
const {businessName,building,city,state,street} = location;
const {mobile} = contact;
let avgrating = 0;
for (const [, value] of services.entries()) {
avgrating += value.rating;
}
avgrating /= services.length;
avgrating = avgrating.toString();
data = services.map((data, index) => {
const { location, contact } = data
const { businessName, building, city, state, street } = location;
const { mobile } = contact;

return {
key: index.toString(),
servicename: businessName,
phone: mobile,
address: building + ", " + street + ", " + city + ", " + state
};
});
return {
key: index.toString(),
servicename: businessName,
phone: mobile,
address: building + ", " + street + ", " + city + ", " + state
};
});
return (
<Fragment>
<div className="v-dashboard-container">
<Row gutter={300} type="flex" justify="space-around" align="middle">
<Col className="gutter-row" span={6}>
<img
src="https://images.pexels.com/photos/556416/pexels-photo-556416.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=150&w=150"
alt=""
className="image1"
/>
<Button
className="v-dashboard-btn"
type="primary"
icon="camera"
size="large"
>
Change Profile Pic
<div className="v-dashboard-container gutter-example">
<Row gutter={16} type="flex" justify="space-around" align="middle">
<Col className="gutter-row" xs={24} sm={24} md={24} lg={8} xl={8}>
<Card title={user.name} style={{ width: '100%' }} >
<img
src="https://images.unsplash.com/photo-1554652297-6e7a24cf8fde?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1025&q=80"
alt=""
className="image1"
/>
<Button
className="v-dashboard-btn"
type="primary"
icon="camera"
size="large"
>
Change Profile Pic
</Button>
</Col>
<Col className="gutter-row" span={18}>
<div className="gutter-box">
<Title style={{ textAlign: "center" }}>Welcome: {user.name}</Title>
<hr />
</div>
<Row gutter={16} type="flex" justify="space-around">
<Col span={12}>
<p><strong>Location</strong></p>
</Col>
<Col span={12}>
<p>Patna, Bihar</p>
</Col>
</Row>
<Row gutter={16} type="flex" justify="space-around">
<Col span={12}>
<p><strong>Email Address</strong></p>
</Col>
<Col span={12}>
<p>{user.email}</p>
</Col>
</Row>
<Row gutter={16} type="flex" justify="space-around">
<Col span={12}>
<p><strong>Average Rating</strong></p>
</Col>
<Col span={12}>
<p>{avgrating}</p>
</Col>
</Row>
</Card>
</Col>
<Col xs={24} sm={24} md={24} lg={16} xl={16}>
<Card title="Details" style={{ width: '100%' }}>
<Tabs type="card">
<TabPane tab="Services" key="1">
<PageHeader onBack={() => null} title="Your Listings" subTitle="Your Listings upto now" />
<Table columns={columns} dataSource={data} pagination={false} scroll={{ x: '100%' }} />
<Link to='/VendorSalespage'>
<Button type="primary" size="large"
className="v-dashboard-btn"
>
<Icon type="folder-add" /><span>Add new service</span></Button>
</Link>
</TabPane>
</Tabs>
</Card>
</Col>
</Row>
<div className="content">
<PageHeader onBack={() => null} title="Your Listings" subTitle="Your Listings upto now" />
<Table columns={columns} dataSource={data} pagination={false} />
<Link to='/VendorSalespage'>
<Button type="primary" size="large"
className="v-dashboard-btn"
>
<Icon type="folder-add" /><span>Add new service</span></Button>
</Link>
</div>
</div>
</Fragment>
)
Expand Down
22 changes: 15 additions & 7 deletions src/components/VendorDashboard/Vendordashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
border: 0;
}
.image1 {
border-radius: 50%;
width: 320px;
height: 320px;
border: solid 2px black;
display: inline-block;
max-width: 100%;
height: auto;
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.v-dashboard-container{
margin: 60px 10%;
}
.v-dashboard-btn{
margin: 30px 45px;
margin: 15px 0;
padding: 0 10px;
text-align: center;
font-size: 20px;
max-width: 100%;
}
.ant-col .ant-typography{
font-family: monospace;
}
}