7
Live orders
LiveA shop's order feed. New orders land in place and changed rows flash, in every open window, without a reload.
Open this page in a second window, then select a few orders and mark them shipped.
Orders
Revenue
To ship
Shipped
Latest orders, by amount
| Order |
Placed
| Customer |
Amount
| Status | |
|---|---|---|---|---|---|
| #24831 | 23:12:24 |
PS
Pranav Singh
Ahmedabad
| ₹8,926 | new | |
| #41812 | 23:12:22 |
KJ
Kartik Jain
Nagpur
| ₹23,642 | new | |
| #66113 | 23:12:19 |
AA
Arjun Agarwal
Ahmedabad
| ₹8,206 | new | |
| #79529 | 23:12:15 |
NM
Nandini Mukherjee
Madurai
| ₹9,430 | new | |
| #99872 | 23:12:13 |
AP
Aman Pillai
Rajkot
| ₹10,883 | new | |
| #55063 | 23:12:03 |
NP
Neha Pandey
Mysore
| ₹7,504 | new | |
| #44917 | 23:11:59 |
HB
Harsh Bhattacharya
Dehradun
| ₹3,850 | new | |
| #92849 | 23:06:38 |
AA
Abhishek Agarwal
Ghaziabad
| ₹16,998 | new | |
| #89003 | 23:06:33 |
HP
Hitesh Patel
Visakhapatnam
| ₹7,024 | new | |
| #20895 | 23:06:26 |
AM
Amit Mehta
Meerut
| ₹8,713 | new |
# In your LiveView
def mount(_params, _session, socket) do
# Rows update by themselves: the feed calls LiveTable.broadcast/3 whenever orders change.
socket = LiveTable.subscribe(socket, Demo.PubSub, Feed.topic())
{:ok, assign(socket, :stats, if(connected?(socket), do: Feed.watch()))}
end
def fields do
[
id: %{label: "ID", hidden: true},
number: %{label: "Order", searchable: true, component: &fresh/1},
inserted_at: %{label: "Placed", sortable: true, renderer: &time/1},
customer: %{label: "Customer", searchable: true, renderer: &customer/2},
amount: %{label: "Amount", sortable: true, renderer: &money/1},
status: %{label: "Status", component: &fresh/1},
city: %{label: "City", sortable: true, hidden: true},
updated_at: %{label: "Updated", hidden: true}
]
end
def filters do
[
status:
Select.new(:status, "status", %{
label: "Status",
mode: :tags,
options: for(s <- Order.statuses(), do: %{label: String.capitalize(s), value: s})
}),
big:
Boolean.new(:amount, "big", %{
label: "Over ₹10,000",
condition: dynamic([o], o.amount > 10_000)
})
]
end
def bulk_actions do
[
pack: %{label: "Mark packed", handler: &move(&1, &2, "packed")},
ship: %{label: "Mark shipped", handler: &move(&1, &2, "shipped")}
]
end
def table_options do
%{
pagination: %{sizes: [10, 25], default_size: 10},
sorting: %{default_sort: [inserted_at: :desc]},
search: %{placeholder: "Search order or customer"},
exports: %{enabled: false}
}
end