HTMX Building Supply — HTMX

Fill Mbak Endah's Laravel files so htmx serves village orders: headers, CSRF, SSE. 14 levels, played right in the browser with nothing to install.

What the levels ask

  1. Mrs. Sari wants to pour a new floor for her stall and asks: is there cement left? Mr. Tono still uses the old page, which calls fetch, gets JSON, then writes the number with JavaScript. On the new page, make the Cek stok semen button ask Laravel for a piece of HTML and put it in the stock paragraph, with no JavaScript of your own.
  2. The order form is there: name, goods, quantity, and an Order button. Mrs. Sari orders 10 sacks of cement. Mr. Tono orders a truckload of sand, then remembers he needs paint and orders again on the same page. Make the form send orders through htmx: every order stored in Laravel, and its receipt showing where receipts go.
  3. The order page now has a delivery address card at the top, separate from the order form. Rara orders cement for her mother's stall and writes the address in that card. Bagas forgets the address. Make the address travel with the order, and decide what Laravel answers when a field is missing: Bagas must see what is missing without losing what he already typed.
  4. One bar of signal. Mr. Tono taps Order twice because his thumb shakes. The shop's modem is stuck for Mrs. Yanti: the page stays silent for more than three seconds, so she taps once more. The truck must not deliver twice. Every form already carries a random key in a hidden field. Set up the form and the controller's save line.
  5. The /stok address is used two ways. Mr. Tono taps Lihat stok on the home page: htmx asks for /stok and pastes the answer under the button. Mrs. Ida opens /stok straight from a link in the neighbourhood's WhatsApp group. Pick the condition in the controller that makes Laravel answer the bare list to htmx and the whole page to an ordinary visit.
  6. Ms. Endah's till screen has a small badge at the top (how many goods are running low) and the stock table below it. Both load from the same address, /stok/ringkas, when the page opens. After the sand truck arrives she taps Segarkan, which refreshes the badge. Pick the header the controller reads and the value it compares with, so the badge always gets the badge.
  7. To save villagers' data, Laravel lets phones keep the /stok answer for a minute. Mr. Tono opens /stok from WhatsApp on his Android phone, goes back to the home page, then taps Lihat stok. Mrs. Ida opens /stok, goes back to the home page, then opens /stok again a little later. Add one header to the /stok answer so both get the right thing and Mrs. Ida's data stays saved.
  8. Mrs. Sari orders 3 tins of paint. She wants to send the receipt to her husband on WhatsApp, so after ordering her phone must be on the receipt page with its own address, /nota/{id}. Pick the controller's answer once the order is stored.
  9. Bagas types a quantity of 0 because he does not know yet how many bricks Mr. Dodi needs. Laravel refuses with status 422 and one error line. Mr. Tono orders as usual. This page loads the official response-targets extension from jsDelivr. Switch that extension on and decide where the error line goes.
  10. Mr. Tono cancels his sand order from his phone, at the shop's internet address, and it works. Ms. Endah cancels Mrs. Sari's cement order on the till laptop, which opens the shop's server over the shop's WiFi at http://kasir.lan. Fill the page's head and its <main> so the cancel works in both places.
  11. Ms. Endah filters the order list: cement only, to work out this afternoon's truckload. The filter asks for /pesanan?barang=semen through htmx and pastes the answer into the list. Mrs. Ida opens the /pesanan?barang=semen that Ms. Endah pasted in the WhatsApp group. The pesanan.index view already has an @fragment('daftar'). Pick the controller's answer.
  12. A TV in the shop's yard shows the loading board: which order is going onto the truck now. The board uses the sse extension and connects to /papan/aliran, which sends the queue every second, three times. Mr. Jaya reads the board; in a moment Ms. Endah marks the neighbourhood head's bricks as loaded, and the board must move on to the next order. Pick what the stream sends and which event the board pastes.

And more, 14 levels in all.