emile 10 months ago
parent bf3cb3401b
commit a8354ec105

@ -48,7 +48,7 @@
</p>
<div class="w-full flex flex-col justify-center items-center text-center">
<p class="text-osiblue font-poppinsLight text-[17px] s:text-2xl font-semibold">$89</p>
<p class="text-osiblue font-poppinsLight text-[17px] s:text-2xl font-semibold">$9</p>
<p class="text-gray-500">monthly/restaurant</p>
</div>
</div>
@ -61,7 +61,7 @@
</p>
<div class="w-full flex flex-col justify-center items-center text-center">
<p class="text-osiblue font-poppinsLight text-[17px] s:text-2xl font-semibold">$169</p>
<p class="text-osiblue font-poppinsLight text-[17px] s:text-2xl font-semibold">$29</p>
<p class="text-gray-500">monthly/restaurant</p>
</div>
</div>

@ -139,7 +139,7 @@
<p class="text-secondosiblue uppercase font-poppinsBold text-2xl text-center">Standard</p>
<div class="w-full flex flex-col justify-center items-center">
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$7/month</p>
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$9/month</p>
</div>
{% if not active_order_item_standard %}
@ -255,7 +255,7 @@
<p class="text-secondosiblue uppercase font-poppinsBold text-2xl text-center">Premium</p>
<div class="w-full flex flex-col justify-center items-center">
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$24/month</p>
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$29/month</p>
</div>
{% if not active_order_item_premium %}
@ -493,7 +493,7 @@
<p class="text-secondosiblue uppercase font-poppinsBold text-xl text-center">Standard</p>
<div class="w-full flex flex-col justify-center items-center">
<p class="text-osiblue font-poppinsLight text-xl font-semibold">$7/month</p>
<p class="text-osiblue font-poppinsLight text-xl font-semibold">$9/month</p>
</div>
{% if not active_order_item_standard %}
@ -610,7 +610,7 @@
<p class="text-secondosiblue uppercase font-poppinsBold text-xl text-center">Premium</p>
<div class="w-full flex flex-col justify-center items-center">
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$24/month</p>
<p class="text-osiblue font-poppinsLight text-2xl font-semibold">$29/month</p>
</div>
{% if not active_order_item_premium %}

Binary file not shown.

@ -10,7 +10,14 @@ import threading
class OnlineUserConsumer(WebsocketConsumer):
def connect(self):
self.user = self.scope['user']
existing_connection = Connection.objects.filter(user=self.user).last()
if existing_connection:
self.connection = existing_connection
self.connection.online = True
self.connection.disconnected = False
self.connection.save()
else:
self.connection = Connection.objects.create(user=self.user, online=True)
async_to_sync(self.channel_layer.group_add)(
'online_users', self.channel_name
@ -34,10 +41,25 @@ class OnlineUserConsumer(WebsocketConsumer):
self.modify_online_user()
def modify_online_user(self):
connections = Connection.objects.all()
online_connections = connections.filter(online=True)
offline_connections = connections.filter(online=False, last_seen__isnull=False).order_by('-last_seen')[:5]
sorted_connections = list(online_connections) + list(offline_connections)
online_users_ids = [connection.user.id for connection in online_connections]
customer_connections = []
staff_connections = []
for connection in sorted_connections:
if hasattr(connection.user, 'customerprofile'):
customer_connections.append(connection)
elif hasattr(connection.user, 'staffprofile'):
staff_connections.append(connection)
print(staff_connections)
event = {
'type': 'online_user_connection_handler',
'staff_connections': staff_connections,
'customer_connections': customer_connections,
'online_users_ids': online_users_ids
}
async_to_sync(self.channel_layer.group_send)(
'online_users', event
@ -45,13 +67,14 @@ class OnlineUserConsumer(WebsocketConsumer):
def online_user_connection_handler(self, event):
context = {
'staff_connections': event['staff_connections'],
'customer_connections': event['customer_connections'],
}
html = render_to_string("details_templates/partials/recently-online.html", context=context)
self.send(text_data=json.dumps({
'event_type': 'online_user_status',
'html': html,
'online_users_ids': event.get('online_users_ids', [])
}))

Loading…
Cancel
Save