mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-07 05:49:04 +00:00
Implement last order always shown on robot profile
This commit is contained in:
parent
60944ea716
commit
1b4d42cfdf
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from re import T
|
from re import T
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum, Q
|
||||||
from rest_framework import status, viewsets
|
from rest_framework import status, viewsets
|
||||||
from rest_framework.generics import CreateAPIView, ListAPIView
|
from rest_framework.generics import CreateAPIView, ListAPIView
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
@ -768,6 +768,10 @@ class InfoView(ListAPIView):
|
|||||||
request.user)
|
request.user)
|
||||||
if not has_no_active_order:
|
if not has_no_active_order:
|
||||||
context["active_order_id"] = order.id
|
context["active_order_id"] = order.id
|
||||||
|
else:
|
||||||
|
last_order = Order.objects.filter(Q(maker=request.user) | Q(taker=request.user)).last()
|
||||||
|
if last_order:
|
||||||
|
context["last_order_id"] = last_order.id
|
||||||
|
|
||||||
return Response(context, status.HTTP_200_OK)
|
return Response(context, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -69,7 +69,9 @@ class BottomBar extends Component {
|
|||||||
this.setState(null)
|
this.setState(null)
|
||||||
fetch('/api/info/')
|
fetch('/api/info/')
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => this.setState(data) & this.setState({active_order_id: data.active_order_id ? data.active_order_id : null})
|
.then((data) => this.setState(data)
|
||||||
|
& this.setState({active_order_id: data.active_order_id ? data.active_order_id : null,
|
||||||
|
last_order_id: data.last_order_id ? data.last_order_id : null})
|
||||||
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +307,7 @@ class BottomBar extends Component {
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<Divider/>
|
<Divider/>
|
||||||
|
|
||||||
{this.state.active_order_id ?
|
{this.state.active_order_id ?
|
||||||
<ListItemButton onClick={this.handleClickCloseProfile} to={'/order/'+this.state.active_order_id} component={LinkRouter}>
|
<ListItemButton onClick={this.handleClickCloseProfile} to={'/order/'+this.state.active_order_id} component={LinkRouter}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
@ -315,10 +318,20 @@ class BottomBar extends Component {
|
|||||||
<ListItemText primary={t("One active order #{{orderID}}",{orderID: this.state.active_order_id})} secondary={t("Your current order")}/>
|
<ListItemText primary={t("One active order #{{orderID}}",{orderID: this.state.active_order_id})} secondary={t("Your current order")}/>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
:
|
:
|
||||||
<ListItem>
|
|
||||||
<ListItemIcon><NumbersIcon/></ListItemIcon>
|
this.state.last_order_id ?
|
||||||
<ListItemText primary={t("No active orders")} secondary={t("Your current order")}/>
|
<ListItemButton onClick={this.handleClickCloseProfile} to={'/order/'+this.state.last_order_id} component={LinkRouter}>
|
||||||
</ListItem>
|
<ListItemIcon>
|
||||||
|
<NumbersIcon color="primary"/>
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={t("Your last order #{{orderID}}",{orderID: this.state.last_order_id})} secondary={t("Inactive order")}/>
|
||||||
|
</ListItemButton>
|
||||||
|
:
|
||||||
|
<ListItem>
|
||||||
|
<ListItemIcon><NumbersIcon/></ListItemIcon>
|
||||||
|
<ListItemText primary={t("No active orders")} secondary={t("You do not have previous orders")}/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
|
@ -172,7 +172,9 @@
|
|||||||
"Taker fee":"Comisión del tomador",
|
"Taker fee":"Comisión del tomador",
|
||||||
"Number of public BUY orders": "Nº de órdenes públicas de COMPRA",
|
"Number of public BUY orders": "Nº de órdenes públicas de COMPRA",
|
||||||
"Number of public SELL orders": "Nº de órdenes públicas de VENTA",
|
"Number of public SELL orders": "Nº de órdenes públicas de VENTA",
|
||||||
|
"Your last order #{{orderID}}":"Tu última orden #{{orderID}}",
|
||||||
|
"Inactive order":"Orden inactiva",
|
||||||
|
"You do not have previous orders":"No tienes órdenes previas",
|
||||||
|
|
||||||
"ORDER PAGE - OrderPage.js": "Order details page",
|
"ORDER PAGE - OrderPage.js": "Order details page",
|
||||||
"Order Box": "Orden",
|
"Order Box": "Orden",
|
||||||
|
Loading…
Reference in New Issue
Block a user