Skip to content

Commit

Permalink
Recorrect the error with date when creating appointment
Browse files Browse the repository at this point in the history
  • Loading branch information
yapa-ymtl committed Nov 5, 2020
1 parent 1653cf6 commit c3af7d7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/components/ClientAppointmentCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class ClientAppointmentCard extends Component {
this.props.service.crntState==="cancled"?
(
<Card body outline color="danger">
<CardTitle><b>{this.props.service.title}</b></CardTitle>
<CardTitle><b>{this.props.service.title}</b><i style={{fontSize:13}}> at {this.state.businessName}</i></CardTitle>
<CardText>
<Row>
<Col sm="10" xs="12">
Expand All @@ -71,15 +71,15 @@ export default class ClientAppointmentCard extends Component {
(
this.props.service.crntState==="done"?
(
<Card body outline color="danger">
<CardTitle><b>{this.props.service.title}</b></CardTitle>
<Card body outline color="success">
<CardTitle><b>{this.props.service.title}</b><i style={{fontSize:13}}> at {this.state.businessName}</i></CardTitle>
<CardText>
<Row>
<Col sm="10" xs="12">
{this.props.service.description}
</Col>
<Col sm="2" xs="2">
<MDBBtn size="sm" color="danger" disabled={true} >Cancled</MDBBtn>
<MDBBtn size="sm" color="success" disabled={true} >Done</MDBBtn>
<CancleModal show={this.state.addCancleModelShow} onHide={addCancleModelClose} fromChild={this.recieveChildValue}/>
</Col>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignUpBusiness.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class SignuBusiness extends Component{
email: this.state.email,
RegNo:this.state.registration_num,
businessTypes:this.state.business_type,
type:this.state.business_type,
type:"business",
imageURL:"https://firebasestorage.googleapis.com/v0/b/appointme-17cfe.appspot.com/o/profilePic%2Fgroup%20dp.png?alt=media&token=52b8eef0-465a-46c5-b2ce-a2b4367bac24",
workingDays:this.state.workingDays,
startTime:"06:00",
Expand Down
33 changes: 21 additions & 12 deletions src/components/appnmntModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,35 @@ class Appointment extends Component {
this.setState({
number:num,
})
}).catch((error)=>{
if(error)
{
console.log("eroor");
this.setState({
number:1,
})
}
else{
console.log("no erojoajj");
}
})
});


}

dateChanged=(newDate)=>{
var dateDirect=newDate.getFullYear()+'/'+(newDate.getMonth()+1)+'/'+newDate.getDate();

firebase.database().ref('Appointments/'+this.state.businessId+'/'+dateDirect+'/variables').once('value').then((snapshot)=> {
var num=(snapshot.val().count)+1;
this.setState({
number:num,
})
}).catch((error)=>
{
this.setState({
number:1,
})
});
}

handleChange=(e)=>{
this.setState({
[e.target.id]:e.target.value
})
if(e.target.id==="date")
{
this.dateChanged(e.target.value);
}
}

handleSelect=(e)=>{
Expand Down
19 changes: 12 additions & 7 deletions src/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ class Home extends Component {
if(data_list)
{
var keys=Object.keys(data_list);

var j=0;
for(var i=0;i<keys.length;i++)
{
data_array[i]=data_list[keys[i]];
data_array[i].key=keys[i];
if(data_list[keys[i]].crntState==="to be")
{
data_array[j]=data_list[keys[i]];
data_array[j].key=keys[i];
j++;
}
}
this.setState({
serviceList:data_array,
Expand Down Expand Up @@ -101,7 +107,6 @@ class Home extends Component {
if(data_list)
{
var keys=Object.keys(data_list);

var j=0;
for(var i=0;i<keys.length;i++)
{
Expand Down Expand Up @@ -163,7 +168,7 @@ class Home extends Component {
<div class="py-5"style={{backgroundColor:'rgba(253,237,236,0.7)',borderRadius:10} }>
<h2 className="card-title h2 my-4 py-2" style={{color:'black'}}>Why are you wasting time in a queue?</h2>
<p className="mb-4 pb-2 px-md-5 mx-md-5" style={styleParagraph}>Make an appointment easily from the world best appointment website. It will make your job easier</p>
<MDBBtn rounded size="lg" className="btn "gradient="aqua"><MDBIcon icon="plus" className="ml-2" onclick={this.makeAppointment} /> Make an appointment</MDBBtn>
{/* <MDBBtn rounded size="lg" className="btn "gradient="aqua"><MDBIcon icon="plus" className="ml-2" onclick={this.makeAppointment} /> Make an appointment</MDBBtn> */}
</div>
</div>
</div>
Expand All @@ -172,9 +177,9 @@ class Home extends Component {
{
this.props.authenticated==="business"?
(
<div>
{this.state.noAppointment?<h2 >No appointments today </h2>:{apponointments}}
</div>
<>
{this.state.noAppointment?<div >No appointments today </div>:<div>{apponointments}</div>}
</>
):
(
<>
Expand Down
4 changes: 2 additions & 2 deletions src/components/homePage/appointmentCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import {Card, CardImg, CardTitle, CardText, CardColumns,CardSubtitle, CardBody} from 'reactstrap';
import {Card, CardImg, CardTitle, CardText, CardColumns,Badge,CardSubtitle, CardBody} from 'reactstrap';
import { MDBBtn } from "mdbreact";

export default class appointmentCard extends Component {
Expand All @@ -9,7 +9,7 @@ export default class appointmentCard extends Component {
return (
<div class="container" style={{marginTop:13}}>
<Card body outline color="info">
<CardTitle><b>{this.props.service.title}</b></CardTitle>
<CardTitle><Badge style={{fontSize:23}}> {this.props.service.number}</Badge><b>{this.props.service.title}</b></CardTitle>
<CardText>
{this.props.service.description}
</CardText>
Expand Down

0 comments on commit c3af7d7

Please sign in to comment.