Store location name, group name and tax group description in order
Also delete compiled entry JS and add a Makefile
This commit is contained in:
parent
a82e75999b
commit
1e4aadee06
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ jon/config.json
|
||||
elm-stuff/
|
||||
venv/
|
||||
.venv/
|
||||
jon/static/*.js
|
||||
|
6
Makefile
Normal file
6
Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
.PHONY: frontend
|
||||
|
||||
frontend: jon/static/entry.js
|
||||
|
||||
jon/static/entry.js: $(shell find $(SOURCEDIR) -name '*.c')
|
||||
elm make --optimize frontend/Entry.elm --output $@
|
13
README.md
13
README.md
@ -11,6 +11,19 @@ pip install -r requirements.txt
|
||||
You should probably use a virtualenv for that.
|
||||
I develop `jon` using Python 3.10 but it should work with older versions as well.
|
||||
|
||||
### Building Frontend JS
|
||||
|
||||
Most of jon works without JS but there are some features that require it.
|
||||
The frontend code lives in `./frontend` and is written using Elm, a functional language that compiles to JS.
|
||||
To compile the Elm code to `.js` files, first make sure that the Elm compiler is installed:
|
||||
|
||||
```
|
||||
elm --version
|
||||
# 0.19.1
|
||||
```
|
||||
|
||||
Then run `make frontend`.
|
||||
|
||||
## Running
|
||||
|
||||
```
|
||||
|
@ -227,15 +227,33 @@ view { globals, state } = case state of
|
||||
]
|
||||
, div [ class "form-input" ]
|
||||
[ label [ for "group" ] [ text "Gruppe" ]
|
||||
, Select.view [ name "group", id "group" ] SetGroup model.group
|
||||
, Select.view [ name "group-id", id "group" ] SetGroup model.group
|
||||
, input
|
||||
[ type_ "hidden"
|
||||
, name "group-name"
|
||||
, value <| (Select.get model.group).name
|
||||
]
|
||||
[]
|
||||
]
|
||||
, div [ class "form-input" ]
|
||||
[ label [ for "location" ] [ text "Raum" ]
|
||||
, Select.view [ name "location", id "location" ] SetLocation model.location
|
||||
, Select.view [ name "location-id", id "location" ] SetLocation model.location
|
||||
, input
|
||||
[ type_ "hidden"
|
||||
, name "location-name"
|
||||
, value <| (Select.get model.location).name
|
||||
]
|
||||
[]
|
||||
]
|
||||
, div [ class "form-input" ]
|
||||
[ label [ for "tax-group" ] [ text "Steuergruppe" ]
|
||||
, Select.view [ name "tax-group", id "tax-group" ] SetTaxGroup model.taxGroup
|
||||
, Select.view [ name "tax-group-id", id "tax-group" ] SetTaxGroup model.taxGroup
|
||||
, input
|
||||
[ type_ "hidden"
|
||||
, name "tax-group-description"
|
||||
, value <| (Select.get model.taxGroup).description
|
||||
]
|
||||
[]
|
||||
]
|
||||
, Html.map CalculatorMsg <| Calculator.view model.calculator (Select.get model.taxGroup)
|
||||
, div [ class "form-input" ]
|
||||
|
15
jon/entry.py
15
jon/entry.py
@ -37,9 +37,15 @@ def new_order():
|
||||
barcode = request.form["barcode"]
|
||||
name = request.form["name"]
|
||||
sales_units = int(request.form["sales-units"])
|
||||
group_id = int(request.form["group"])
|
||||
location_id = int(request.form["location"])
|
||||
tax_group_id = int(request.form["tax-group"])
|
||||
group_id = int(request.form["group-id"])
|
||||
# group_name, location_name and tax_group_description are not
|
||||
# necessarily needed here but storing them makes it easier to
|
||||
# render the list of orders.
|
||||
group_name = request.form["group-name"]
|
||||
location_id = int(request.form["location-id"])
|
||||
location_name = request.form["location-name"]
|
||||
tax_group_id = int(request.form["tax-group-id"])
|
||||
tax_group_description = request.form["tax-group-description"]
|
||||
net_unit_price = float(request.form["net-unit-price"])
|
||||
gross_unit_price = float(request.form["gross-unit-price"])
|
||||
except:
|
||||
@ -52,8 +58,11 @@ def new_order():
|
||||
"name": name,
|
||||
"sales_units": sales_units,
|
||||
"group_id": group_id,
|
||||
"group_name": group_name,
|
||||
"location_id": location_id,
|
||||
"location_name": location_name,
|
||||
"tax_group_id": tax_group_id,
|
||||
"tax_group_description": tax_group_description,
|
||||
"net_unit_price": net_unit_price,
|
||||
"gross_unit_price": gross_unit_price
|
||||
})
|
||||
|
12418
jon/static/entry.js
12418
jon/static/entry.js
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,9 @@
|
||||
<th>Barcode</th>
|
||||
<th>Name</th>
|
||||
<th>Eingekauft</th>
|
||||
<th>Gruppen-ID</th>
|
||||
<th>Raum-ID</th>
|
||||
<th>Steuergruppen-ID</th>
|
||||
<th>Gruppe</th>
|
||||
<th>Raum</th>
|
||||
<th>Steuergruppe</th>
|
||||
<th>EK-Preis (Netto)</th>
|
||||
<th>VK-Preis (Brutto)</th>
|
||||
<th>Aktionen</th>
|
||||
@ -20,9 +20,9 @@
|
||||
<td><code>{{ cart_item.barcode }}</code></td>
|
||||
<td>{{ cart_item.name }}</td>
|
||||
<td class="--align-right">{{ cart_item.sales_units }}</td>
|
||||
<td class="--align-right">{{ cart_item.group_id }}</td>
|
||||
<td class="--align-right">{{ cart_item.location_id }}</td>
|
||||
<td class="--align-right">{{ cart_item.tax_group_id }}</td>
|
||||
<td class="--align-right">{{ cart_item.group_name }} ({{ cart_item.group_id }})</td>
|
||||
<td class="--align-right">{{ cart_item.location_name }} ({{ cart_item.location_id }})</td>
|
||||
<td class="--align-right">{{ cart_item.tax_group_description }} ({{ cart_item.tax_group_id }})</td>
|
||||
<td class="--align-right">{{ format_currency(cart_item.net_unit_price) }}</td>
|
||||
<td class="--align-right">{{ format_currency(cart_item.gross_unit_price) }}</td>
|
||||
<td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user