Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modern/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ A screen where guests order on their own, then pay at the counter.
Store Settings → *How you serve* (`PosSettings::serviceMode`), or one screen's Manager → Terminals → *How this screen serves* (`TerminalConfig::service`); the setup guide asks on its first page. Code: `app/pos_truck.cpp`.
- **Food truck:** nobody logs in. The session runs as the built-in *Counter* (role cashier: orders and payments, never a manager's), and the screen starts on the menu; after a payment, the menu again. Idle and Log Out don't sign the Counter out. A page it may not open (Manager) goes to the login page for a PIN and opens once someone steps in; their Log Out goes back to the Counter with the order still open. *Ask who's working* makes the first PIN the counter's person (clocked in, credited) until **Switch Person**.
- **Orders:** quick checks on a truck are numbered from 1 each business day (`Check::orderNumber`, label "#27 Maria" once named) and carry the guest's pager (`Check::pager`, + Pager on the check; one waiting order a pager). The **Orders** page (`truckOrders` widget) lists those sent and not picked up: **Ready** (`readyAt`) tells every truck screen "#27 Maria is ready: buzz pager 12", **Picked Up** (`pickedUpAt`) takes it off. A kitchen screen bumping the last of an order calls it too. Pagers are buzzed by hand on the pager system's transmitter.
- **Retail:** logins stay; the menu comes first instead of the floor plan, and the order screen has Log Out where restaurants have Tables. Lines rung in are `kitchenHide` (no tickets, no kitchen screen) and Send is hidden: Pay finishes the sale. A scan on any page rings the item in and goes back to the sale (`LayoutController::scanned`).
- **Retail:** logins stay; the menu comes first instead of the floor plan, and the order screen has Log Out where restaurants have Tables, and Manager (for a manager only: `showWhen.login` `manager`) where they have Send. Lines rung in are `kitchenHide` (no tickets, no kitchen screen) and Send is hidden: Pay finishes the sale. A scan on any page rings the item in and goes back to the sale (`LayoutController::scanned`).
- **Now serving:** on a truck, the customer display shows Ready and Preparing between guests, and a Ready strip while the next guest orders (`CustomerDisplay.qml`, from `truckOrders`).
- **Offline:** a screen's offline kit carries `firstOrderNumber`, a hundred on from the store's last order for each screen, so orders taken offline never share a number with the store's. `setCustomer` and `setPager` work offline; taken in, the order keeps its number, name and pager.
- Buttons can show for one way only: `showWhen.service` (`restaurant`, `foodTruck`, `retail`, or several with commas).
Expand Down
1 change: 1 addition & 0 deletions modern/docs/manual/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ <h2>How you serve: restaurant, food truck or retail</h2>
<li><b>Food truck</b>: nobody logs in (below).</li>
<li><b>Retail</b>: staff still log in, so each sale is the cashier's. After login they start on the menu instead of the floor plan, and the order screen has <b>Log Out</b> where restaurants have Tables.
<ul>
<li><b>Manager's pages:</b> when a manager is logged in, the order screen has <b>Manager</b> where restaurants have Send. It opens the Manager menu: the Dashboard, reports and the rest, and <b>Settings</b> → How you serve to switch the store back to restaurant. A cashier doesn't see it: they log out, and the manager logs in.</li>
<li><b>Scan from anywhere:</b> a barcode scanned on any screen (even Pay, for the item the customer remembers at the last moment) rings the item in and goes back to the sale. An empty check says <i>Scan or touch an item to start a sale.</i></li>
<li><b>No kitchen:</b> nothing a shop sells goes to a kitchen printer or a kitchen screen, and there's no Send: <b>Pay</b> finishes the sale.</li>
</ul></li>
Expand Down
16 changes: 14 additions & 2 deletions modern/layout/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ QString Layout::fingerprint(const Page &page)

const QStringList &Layout::newStarterButtons()
{
static const QStringList buttons = {u"check-options#tax-exempt"_s};
static const QStringList buttons = {u"check-options#tax-exempt"_s, u"order-template#flow-manager"_s};
return buttons;
}

Expand All @@ -335,10 +335,22 @@ namespace {
// that's free; else into its column of buttons (the same x and width) after
// the one above it in the starter, the column's buttons made shorter to fit
// in the same space (no shorter than a finger: 64 units).
// Shown only where a store serves another way (retail's buttons, a
// restaurant's): never on the same screen, so in the same spot is fine.
bool otherService(const Zone &a, const Zone &b)
{
const auto modes = [](const Zone &z) {
const QString s = z.extra.value(u"showWhen").toObject().value(u"service").toString();
return s.isEmpty() ? QStringList{} : s.split(u',');
};
const QStringList ma = modes(a), mb = modes(b);
return !ma.isEmpty() && !mb.isEmpty() && std::ranges::none_of(ma, [&](const QString &m) { return mb.contains(m); });
}

bool placeNewButton(Page &mine, const Page &fresh, Zone zone)
{
const auto free = [&](const QRect &r) {
return std::ranges::none_of(mine.zones, [&](const Zone &z) { return z.rect.intersects(r); });
return std::ranges::none_of(mine.zones, [&](const Zone &z) { return z.rect.intersects(r) && !otherService(z, zone); });
};
if (free(zone.rect)) {
mine.zones.append(zone);
Expand Down
10 changes: 10 additions & 0 deletions modern/seed/pages/order-template-phone.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@
"h": 130
}
},
{
"id": "flow-manager",
"shared": true,
"rect": {
"x": 370,
"y": 2134,
"w": 338,
"h": 130
}
},
{
"id": "flow-pay",
"shared": true,
Expand Down
30 changes: 30 additions & 0 deletions modern/seed/pages/order-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,30 @@
"service": "restaurant,foodTruck"
}
},
{
"id": "flow-manager",
"kind": "button",
"rect": {
"x": 1486,
"y": 980,
"w": 202,
"h": 84
},
"shape": "rect",
"behavior": "blink",
"label": "Manager",
"actions": [
{
"type": "jump",
"mode": "push",
"role": "manager"
}
],
"showWhen": {
"service": "retail",
"login": "manager"
}
},
{
"id": "flow-pay",
"kind": "button",
Expand Down Expand Up @@ -560,6 +584,12 @@
"y": 16,
"w": 176,
"h": 72
},
"flow-manager": {
"x": 1440,
"y": 980,
"w": 216,
"h": 84
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions modern/tests/test_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,30 @@ TEST_CASE("Starter update: a new starter button joins a page the store edited",
CHECK_FALSE(later.page(u"check-options"_s)->zone(u"tax-exempt"_s));
}

TEST_CASE("Starter update: retail's Manager button joins an order page the store edited", "[layout][starter]")
{
const auto starter = Layout::loadDirectory(QStringLiteral(VTM_SEED_DIR));
REQUIRE(starter);
// The store's order page as it was before the button (and edited here).
Page old = *starter->page(u"order-template"_s);
old.zones.removeIf([](const Zone &z) { return z.id == u"flow-manager"_s; });
const QHash<QString, QString> installed{{u"order-template"_s, Layout::fingerprint(old)}};
for (Zone &z : old.zones)
if (z.id == u"flow-pay"_s)
z.label = u"Checkout"_s; // edited here
Layout saved;
saved.pages = {old};
// Even a store from before buttons were tracked gets it.
const auto update = saved.updateFromStarter(*starter, {u"order-template"_s}, installed);
CHECK(update.buttonsAdded == QStringList{u"order-template#flow-manager"_s});
const Page &p = *saved.page(u"order-template"_s);
const Zone *manager = p.zone(u"flow-manager"_s);
REQUIRE(manager);
// Where Send is (retail has no Send): the two never show on the same screen.
CHECK(manager->rect == p.zone(u"flow-send"_s)->rect);
CHECK(p.zone(u"flow-pay"_s)->label == u"Checkout"_s);
}

TEST_CASE("Store style: Modern and back to Classic, the store's own theme changes kept in each", "[layout][style]")
{
auto l = Layout::loadDirectory(QStringLiteral(VTM_SEED_DIR));
Expand Down
10 changes: 9 additions & 1 deletion modern/tests/test_truck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ TEST_CASE("Restaurant and retail screens keep their own buttons", "[truck][ui]")
};
const QJsonObject tables = rule("order-template", "flow-tables"), orders = rule("order-template", "flow-orders"),
logOut = rule("order-template", "flow-logout"), back = rule("login", "back-to-order"),
switchPerson = rule("login", "switch-person");
switchPerson = rule("login", "switch-person"), manager = rule("order-template", "flow-manager");

// A restaurant: Tables, no truck or retail buttons; logging in goes to the floor.
{
Expand All @@ -586,6 +586,7 @@ TEST_CASE("Restaurant and retail screens keep their own buttons", "[truck][ui]")
CHECK(c.ruleShows(tables));
CHECK_FALSE(c.ruleShows(orders));
CHECK_FALSE(c.ruleShows(logOut));
CHECK_FALSE(c.ruleShows(manager));
CHECK_FALSE(c.ruleShows(back));
CHECK_FALSE(c.ruleShows(switchPerson));
}
Expand All @@ -605,9 +606,16 @@ TEST_CASE("Restaurant and retail screens keep their own buttons", "[truck][ui]")
CHECK_FALSE(c.ruleShows(tables));
CHECK_FALSE(c.ruleShows(orders));
CHECK(c.ruleShows(logOut));
CHECK_FALSE(c.ruleShows(manager)); // a cashier: no way into the manager's pages
c.activate(u"flow-logout"_s);
CHECK_FALSE(pos.loggedIn());
CHECK(c.pageId() == u"login"_s);
// A manager: Manager on the order page, to the manager's pages (and back to restaurant from there).
REQUIRE(pos.loginWithPin(u"1234"_s));
CHECK(c.pageId() == u"index-lunch"_s);
CHECK(c.ruleShows(manager));
c.activate(u"flow-manager"_s);
CHECK(c.pageId() == u"manager"_s);
}
// A truck: Orders; on the PIN page, Back to Ordering and Switch Person.
{
Expand Down
Loading