Skip to content

Commit

Permalink
Bug fix 39382
Browse files Browse the repository at this point in the history
  • Loading branch information
Younggregs committed Nov 26, 2018
1 parent c137134 commit 8340f9f
Show file tree
Hide file tree
Showing 15 changed files with 324 additions and 50 deletions.
28 changes: 28 additions & 0 deletions src/components/village/Bank Account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { Grid , Row, Col } from 'react-bootstrap';
import Navigation from './neighborhoods/Navigation.js';
import BankAccountForm from './neighborhoods/blocks/houses/Bank Account Form.js';
import Footer from './neighborhoods/Footer.js';
import GotoTop from './neighborhoods/blocks/houses/Goto Top.js';
import Copyright from './neighborhoods/blocks/houses/Copyright.js';


export default class BankAccount extends React.Component {
render() {
return (
<section className="edit-profile">
<Navigation logged_in={true} profile_id= {this.props.match.params.profile_id}/>
<Grid>
<br /><Row>
<Col lg={6} lgOffset={3} md={6} mdOffset={3} sm={12} xs={12}>
<BankAccountForm profile_id= {this.props.match.params.profile_id}/>
</Col>
</Row><br /><br />
</Grid>
<GotoTop/>
<Footer/>
<Copyright/>
</section>
)
}
}
3 changes: 2 additions & 1 deletion src/components/village/EShop List.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class EshopList extends React.Component {


async componentDidMount() {
this.setState({ isLoading: true})
try {
const res = await fetch('https://www.iwansell.com/api/eshop_list/' + this.props.match.params.campus_id + '/');
const eshop_list = await res.json();
Expand Down Expand Up @@ -193,7 +194,7 @@ emptyResult(){
<span>
<hr />
<div>
<p className="eshop-name"><Link to={`/eshop/${ item.id } `}>
<p className="eshop-name"><Link to={`/eshop/${ item.id }`}>
{item.name}
</Link>
</p>
Expand Down
16 changes: 8 additions & 8 deletions src/components/village/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default class Profile extends React.Component {


const auth = localStorage.getItem('auth_code')

try {
const res = await fetch('https://www.iwansell.com/api/is_myprofile/' + this.props.match.params.profile_id + '/', {

credentials: 'same-origin',
mode: 'cors',
headers : {
Expand All @@ -33,7 +33,7 @@ export default class Profile extends React.Component {
this.setState({
is_myprofile
});

} catch (e) {
console.log(e);
}
Expand All @@ -42,7 +42,7 @@ export default class Profile extends React.Component {

try {
const res = await fetch('https://www.iwansell.com/api/isloggedin/', {

credentials: 'same-origin',
mode: 'cors',
headers : {
Expand All @@ -60,14 +60,14 @@ export default class Profile extends React.Component {

}


render() {
return (
<div className="profile">
<Navigation logged_in = {this.state.loggedin} account_id= {this.props.match.params.profile_id}/>
<ProfileDetails logged_in = {this.state.loggedin} is_myprofile={this.state.is_myprofile} profile_id= {this.props.match.params.profile_id}/>
<Navigation logged_in = {this.state.isloggedin} account_id= {this.props.match.params.profile_id}/>
<ProfileDetails logged_in = {this.state.isloggedin} is_myprofile={this.state.is_myprofile} profile_id= {this.props.match.params.profile_id}/>
<GotoTop/>
<Footer/>
<Footer logged_in = {this.state.isloggedin}/>
<Copyright/>
</div>
)
Expand Down
9 changes: 9 additions & 0 deletions src/components/village/neighborhoods/blocks/houses/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export default class About extends React.Component {
<p><Link to = "/product_valuation">
Business Mode
</Link></p>
<p><Link to = "/newproduct">
Upload item for sell
</Link></p>
<p><Link to = "/productmanager">
Sell your item
</Link></p>
<p><Link to = "/buyer_transaction_window">
Buy an item
</Link></p>
<p><Link to = "/logout">
Logout
</Link></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import React from 'react';
import { Redirect } from 'react-router-dom'
import { Button,FormGroup, FormControl, HelpBlock } from 'react-bootstrap';
import Heading from './Heading'
import Spinner from 'react-activity/lib/Spinner';
import 'react-activity/lib/Spinner/Spinner.css';


export default class BankAccountForm extends React.Component {

state = {
isLoading: false,
message : [],
banklist: []
}

async componentWillMount(){
this.setState({ isLoading: true})

const auth = localStorage.getItem('auth_code')


try {
const res = await fetch('https://www.iwansell.com/api/bank_account/', {
headers : {
'Authorization' : 'Token ' + auth
}

})
const banklist = await res.json();
this.setState({
banklist
});

} catch (e) {
console.log(e);
}


this.setState({ isLoading: false})
}



async update(){

this.setState({ isLoading: true})
const auth = localStorage.getItem('auth_code')

var account_number = document.getElementById("account_number").value

var formData = new FormData()
formData.append('account_number', account_number)

try {
const res = await fetch('https://www.iwansell.com/api/bank_account/', {


body : formData,
method: 'POST',
headers : {
'Authorization' : 'Token ' + auth
}

})
const banklist = await res.json();
this.setState({
banklist
});

} catch (e) {
console.log(e);
}

false

}


emptyResult(){

var empty_set = false

if(this.state.banklist.length <= 0 ){
empty_set = true
}

return empty_set


}







render(){

const formInstance = (
<section className="edit-profile-form">
<Heading title="Add Bank Account"/>

{this.state.isLoading ? (
<Spinner color="#ff0000" size={32}/>
) : (
<div>
{this.emptyResult() ? (
<p>Its empty here, add bank account</p>
) : (

<div>
{this.state.banklist.map(item =>
<div>
<p>{item.account_number}</p>
<p>{item.account_name}</p>
</div>
)}
</div>

)}
</div>
)}





<form>
<FormGroup>
<FormControl
id="account_number"
type="text"
label="Account Number"
name="account_number"
placeholder="eg 0838320302"

/>
<HelpBlock>Add Account Number here for faster electronic transaction</HelpBlock>
</FormGroup>

{this.state.message.error_message ? (
<p className="err-msg">{this.state.message.error_message}</p>
) : (
<span></span>
)}

{this.state.message.code ? (
<p className="success-msg">Success!</p>
) : (
<span></span>
)}

{this.state.isLoading ? (
<Spinner color="#ff0000" size={32}/>
) : (
<div/>
)}

<Button onClick={this.update.bind(this)}>add new</Button>
</form>
</section>
);

return (formInstance);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class EShopAdmin extends React.Component {

<p>
<div>
<Link to ={`/eshop_rr/${ this.props.eshop_id } `}>
<Link to ={`/eshop_rr/${ this.props.eshop_id }`}>
<p className="profile-name">Ratings-Reviews
<span className="heart-glyphs">
<Rating
Expand All @@ -47,7 +47,7 @@ export default class EShopAdmin extends React.Component {
</Link>
</p>
<p>
<Link to ={`/soldproduct/${ this.props.eshop_id } `}>
<Link to ={`/soldproduct/${ this.props.eshop_id }`}>
<Button>Sold products</Button>
</Link>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async componentWillMount(){

<p>
<div>
<Link to ={`/eshop_rr/${ this.props.eshop_id } `}>
<Link to ={`/eshop_rr/${ this.props.eshop_id }`}>
<p className="profile-name">Ratings-Reviews
<span className="heart-glyphs">
<Rating
Expand All @@ -93,7 +93,7 @@ async componentWillMount(){
</div>
</p>

<p className="boss">Boss : <Link to={`/profile/${ this.state.boss_info.id } `}>{this.state.boss_info.boss}</Link></p>
<p className="boss">Boss : <Link to={`/profile/${ this.state.boss_info.id }`}>{this.state.boss_info.boss}</Link></p>
<p className="profile-name">Mobile : {this.state.boss_info.phone}</p>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ emptyResult(){

) : (

<p>
<p><b>Category</b> :

{this.state.eshop_category.map(item => (

<b><i>{item.category_name}</i></b>
<b><i> {item.category_name}</i></b>

))}

Expand Down
19 changes: 16 additions & 3 deletions src/components/village/neighborhoods/blocks/houses/Edit Campus.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import React from 'react';
import { Redirect } from 'react-router-dom'
import { Button,FormGroup, FormControl, HelpBlock, ControlLabel } from 'react-bootstrap';
import Heading from './Heading'

import Spinner from 'react-activity/lib/Spinner';
import 'react-activity/lib/Spinner/Spinner.css';

export default class EditCampus extends React.Component {

state = {
isLoading: false,
message : [],
campuslist: [],
campus_code: null
}

async componentWillMount(){

this.setState({ isLoading: true })
const auth = localStorage.getItem('auth_code')


Expand Down Expand Up @@ -45,11 +47,15 @@ export default class EditCampus extends React.Component {
console.log(e);
}

this.setState({ isLoading: false})


}

async update(){

this.setState({ isLoading: true})

const auth = localStorage.getItem('auth_code')

var campus = document.getElementById("campus").value
Expand Down Expand Up @@ -77,6 +83,7 @@ export default class EditCampus extends React.Component {
console.log(e);
}

this.setState({ isLoading: false })

}

Expand Down Expand Up @@ -110,11 +117,17 @@ const formInstance = (
)}

{this.state.message.code ? (
<span><Redirect to={`/profile/${ this.props.profile_id }`}/></span>
<p className="success-msg">Success!</p>
) : (
<span></span>
)}

{this.state.isLoading ? (
<Spinner color="#ff0000" size={32}/>
) : (
<div/>
)}

<Button bsStyle="success" onClick={this.update.bind(this)}>update campus</Button>
</form>
</section>
Expand Down
Loading

0 comments on commit 8340f9f

Please sign in to comment.