pedro-psb / pypos-canteen

Point os sale web app aimed to work on a low budget canteen setup.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

As a cashier I want to be able to sell products

pedro-psb opened this issue · comments

This is a core feature. Most of the work is about the UI/UX, but there are some details about the transaction db model aswell.

Todo

  • UI Draft
  • API endpoints / DB Schema
  • Learn HTMX
  • UI Functional (using js)
  • Use case: Normal
  • Use case: Extensions

Use Case

Normal

  • 1 Visit POS page and see avaliable products
  • 2 Add products to cart
  • 3 Checkout: Select payment method and discounts
  • 4 Finalize/register order

Extensions

  • 2.1 Add some product then remove other
  • 2.2 Add some product then change quantity
  • 2.3 Remove product (regardless it quantity)
  • 2.4 Remove all products
  • 3.1 Cancel checkout

API

Add Transaction

canteen/pos/add_transaction:
  products: [(product_id, qtn), ...  ]
  payment_method: method_id
  discount: 0

To-do later

  • [feature improvment] Keyboard shorcuts schema to select item, payment, checkout, cancel, etc
  • [feature] Add combos entity to bundle some set of products and a given discount.
  • [bug] Payment method selector isn't working (because they are bootstrap badges)

HTMX would need to comunicate to the backend server to update the order items and total price. It seemed overkill, so I decided to learn JS basics and implement it.

By now I've made a working prototype that adds the important data to be sent (products, discount, etc) inside hidden inputs wrapping the send button. This way I can use the flask url_for to specify the endpoint.

Also, the code needs much refactoring and could have some cool transitions. Maybe I can use htmx to communicate with js functions instead of sending api request (for transitions and stuff). Or again, I could simply learn some other js framework for that.