Moving PCS

This commit is contained in:
Jadowyne Ulve 2025-10-08 10:18:31 -05:00
parent cbfe74c868
commit d261076fd4
9 changed files with 1999 additions and 1671 deletions

View File

@ -45,7 +45,11 @@ def items():
def item(item_uuid):
sites = [SitesModel.select_tuple('', {'key': site})['site_name'] for site in session['user'].get('user_sites', [])]
units = UnitsModel.select_tuples('')
return render_template("item_new.html", item_uuid=item_uuid, units=units, current_site=session['selected_site'], sites=sites)
item_types = [['Single', 'single'], ['Linked List', 'list'], ['Linked Item', 'link']]
item_subtypes = [['Food', 'FOOD'], ['Food PLU', 'FOOD_PLU'], ['Other', 'OTHER'], ['Medicinal', 'MEDICINE'], ['Hygenic', 'HYGENIC']]
current_site = session['selected_site']
item = ItemsModel.get_item_by_uuid(current_site, {"item_uuid": item_uuid})
return render_template("itemEdit.html", item=item, units=units, item_types=item_types, item_subtypes=item_subtypes, current_site=session['selected_site'], sites=sites)
@items_api.route("/transaction")
@access_api.login_required

View File

@ -0,0 +1,94 @@
class LogisticsInfo {
constructor(data){
this.item_auto_issue_location = data.item_default_expiration;
this.item_auto_issue_zone = data.item_expires;
this.item_primary_location = data.item_food_groups;
this.item_primary_zone = data.item_ingredients;
this.item_uuid = data.item_uuid;
}
update(data) {
Object.keys(data).forEach((key) => {
if(Object.prototype.hasOwnProperty.call(this, key)){
this[key] = data[key]
}
})
}
}
class FoodInfo {
constructor(data){
this.item_default_expiration = data.item_default_expiration;
this.item_expires = data.item_expires;
this.item_food_groups = data.item_food_groups;
this.item_ingredients = data.item_ingredients;
this.item_nutrients = data.item_nutrients;
this.item_uuid = data.item_uuid;
}
update(data) {
Object.keys(data).forEach((key) => {
if(Object.prototype.hasOwnProperty.call(this, key)){
this[key] = data[key]
}
})
}
}
class ItemInfo {
constructor(data){
this.item_uuid = data.item_uuid;
this.item_uom = data.item_uom;
this.item_packaging = data.item_packaging;
this.item_uom_quantity = data.item_uom_quantity;
this.item_cost = data.item_cost;
this.item_safety_stock = data.item_safety_stock;
this.item_lead_time_days = data.item_lead_time_days;
this.item_ai_pick = data.item_ai_pick;
this.item_prefixes = data.item_prefixes;
this.conversions = data.conversions;
this.prefixes = data.prefixes;
}
update(data) {
Object.keys(data).forEach((key) => {
if(Object.prototype.hasOwnProperty.call(this, key)){
this[key] = data[key]
}
})
}
}
class InventoryItem {
constructor(data){
this.item_uuid = data.item_uuid; // string
this.item_created_at = data.item_created_at; // date
this.item_updated_at = data.item_updated_at; // date
this.item_name = data.item_name; // string
this.item_description = data.item_description; // string
this.item_tags = data.item_tags; // array
this.item_links = data.item_links; // dict
this.item_brand_uuid = data.item_brand_uuid; // uuid
this.item_category = data.item_category; // string
this.item_search_string = data.item_search_string; // string
this.item_inactive = data.item_inactive; // bool
this.item_locations = data.item_locations; // array
this.item_barcodes = data.item_barcodes; // array
}
update(data) {
Object.keys(data).forEach((key) => {
if(Object.prototype.hasOwnProperty.call(this, key)){
this[key] = data[key]
}
})
}
toString() {
return JSON.stringify(this, null, 2);
}
}
export { InventoryItem, ItemInfo, FoodInfo, LogisticsInfo };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
<title id="title"></title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
<!-- Material Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<!-- Material Symbols - Outlined Set -->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
<!-- Material Symbols - Rounded Set -->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded" rel="stylesheet" />
<!-- Material Symbols - Sharp Set -->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp" rel="stylesheet" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/uikit.min.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/pantry.css') }}"/>
{% if session['user']['user_flags']['darkmode'] %}
<link id="dark-mode" rel="stylesheet" href="{{ url_for('static', filename='css/dark-mode.css') }}"/>
{% endif %}
<script src="{{ url_for('static', filename='js/uikit.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/uikit-icons.min.js') }}"></script>
</head>
<style>
.add-button{
width: 100%;
border-radius: 10px;
margin-top: 10px;
background-color: transparent;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
height: 40px;
}
.add-button:hover{
background-color: whitesmoke;
}
</style>
<style>
:root {
--primary-color: {{ session['user']['user_flags']['styles']['primary_color']}};
}
</style>
{% if session['user']['user_flags']['darkmode'] %}
<body class="uk-light">
{% else %}
<body>
{% endif %}
<nav class="uk-navbar-container">
<div class="uk-container uk-container-expand">
<div class="uk-navbar uk-navbar-primary">
<!-- Application Navigation-->
<div class="uk-navbar-left">
<ul class="uk-navbar-nav">
<li>
<a href>Apps</a>
<div class="uk-navbar-dropdown" uk-drop="mode: click; multi:false">
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a href="/planner">Planner</a></li>
<li><a href="/recipes">Recipes</a></li>
<li><a href="/shopping-lists">Shopping Lists</a></li>
<li class="uk-nav-header">Logistics</li>
<li><a href="/items">Items</a></li>
<li><a href="/items/transaction">Transaction</a></li>
<li><a href="/receipts">Receipts</a></li>
<li class="uk-nav-header">Points of Ease</li>
<li><a href="/poe/scanner">Transaction Scanner</a></li>
<li><a href="/poe/receipts">Receipts Scanner</a></li>
</ul>
</div>
</li>
</ul>
</div>
<!-- Breadcrumbs Navigation -->
<div class="uk-navbar-center uk-visible@m">
<ul class="uk-breadcrumb uk-margin-remove">
<li class="uk-disabled" style="cursor: pointer;"><span><strong>{{current_site}}</strong></span>
<div uk-dropdown="mode: hover">
<ul class="uk-nav uk-dropdown-nav">
<li class="uk-nav-header">Select Site</li>
<li class="uk-nav-divider"></li>
{% for site in sites %}
{% if site == current_site %}
<li><a class="uk-disabled" href="#">{{site}}</a></li>
{% else %}
<li><a onclick="changeSite('{{site}}')">{{site}}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</li>
<li style="cursor: default; user-select: none;" class="uk-disabled"><span>Logistics</span></li>
<li class="uk-disabled"><span>Items</span></li>
<li class="uk-disabled"><span>Editing</span></li>
</ul>
</div>
<!-- Profile/Management Navigation-->
<div class="uk-navbar-right">
<ul class="uk-navbar-nav">
<li>
<a href="#">
<img src="{{session['user']['user_profile_pic_url']}}" alt="Profile Picture" class="profile-pic uk-visible@m" style="width: 40px; height: 40px; border-radius: 50%; margin-right: 5px;">
{{username}}
</a>
<div class="uk-navbar-dropdown" uk-drop="mode: click; multi:false">
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a href="/profile">Profile</a></li>
<li><a onclick="toggleDarkMode()">Dark Mode</a></li>
<li><a href="/site-management">Site Management</a></li>
<li><a href="/administration">System Management</a></li>
<li><a href="/access/logout">Logout</a></li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</nav>
<div class="uk-container">
<div class="uk-section">
<div uk-grid>
<div class="uk-width-1-1">
<p>The following information can be edited for the selected item. While editing your changes are not saved, you MUST press the save button in order
for the changes to be saved.
</p>
</div>
<div class="uk-width-1-1">
<label class="uk-form-label">Item Name</label>
<input class="uk-input uk-text-lead uk-form-large" type="text" placeholder="Input" aria-label="Input" value={{item['item_name']}}>
</div>
<div class="uk-width-1-1">
<p class="uk-text-meta">Item UUID: {{item['item_uuid']}}</p>
</div>
<div class="uk-width-1-1 uk-margin-remove-top">
<p class="uk-text-meta">Created At: {{item['item_created_at']}}</p>
</div>
<div class="uk-width-1-1 uk-margin-remove-top">
<p class="uk-text-meta">Last Updated: {{item['item_updated_at']}}</p>
</div>
<div class="uk-width-1-1">
<label class="uk-form-label">Item Description</label>
<textarea class="uk-textarea" rows="5" placeholder="" aria-label="Textarea" value={{item['item_description']}}></textarea>
</div>
<div class="uk-width-1-1">
<label class="uk-form-label">Item Category</label>
<select id="item_subtype_input" class="uk-select" aria-label="Select">
{% for type in item_subtypes %}
<option value="{{type[1]}}"
{% if type[1] == item['item_category'] %}selected="selected"{% endif %}>
{{type[0]}}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
</body>
<script type="module" src="{{ url_for('items_api.static', filename='itemEditHandler.js') }}"></script>
<script>const passed_item = {{item|tojson}}</script>
</html>

View File

@ -153,12 +153,18 @@
<div uk-grid>
<div class="uk-width-1-2">
<caption>Item Type</caption>
<select onchange="selectChanged('row_type')" id="itemTypeSelect" class="uk-select">
<select onchange="updateItemType()" id="itemTypeSelect" class="uk-select">
{% for type in item_types %}
<option value={{type[1]}}>{{type[0]}}</option>
{% endfor %}
</select>
</div>
<div class="uk-width-1-2">
<caption>Item Subtype</caption>
<select onchange="selectChanged('item_type')" id="itemSubTypeSelect" class="uk-select">
<select onchange="updateItemSubtype()" id="itemSubTypeSelect" class="uk-select">
{% for type in item_subtypes %}
<option value={{type[1]}}>{{type[0]}}</option>
{% endfor %}
</select>
</div>
</div>
@ -166,8 +172,9 @@
<!-- Item Description -->
<div class="uk-width-1-1 uk-margin">
<label class="uk-form-label" for="itemDescription">SKU Description</label>
<textarea onchange="descriptionChanged()" id="itemDescription" name="test" class="uk-textarea" placeholder="This is the items description..."></textarea>
<textarea id="itemDescription" name="test" class="uk-textarea" placeholder="This is the items description..."></textarea>
</div>
<!-- Tags -->
<div class="uk-width-1-1 uk-margin">
<p style="color: red;" class="uk-hidden@s">Tags are currently hidden on smaller screens for development reasons...</p>
@ -176,13 +183,13 @@
<thead>
<tr>
<th class="uk-table-expand">Tags</th>
<th class="uk-width-1-4 uk-text-nowrap"><input onkeydown="addTag(event)" class="uk-input uk-form-small" type="text" id="tagInput" placeholder="Add a tag..."></th>
<th class="uk-width-1-4 uk-text-nowrap"><input class="uk-input uk-form-small" type="text" id="tagInput" placeholder="Add a tag..."></th>
</tr>
</thead>
<tbody>
<tr>
<td id="tagsRow" class="uk-table-expand"></td>
<td class="uk-text-nowrap"><button onclick="addTag(event)" class="uk-align-right uk-button uk-button-small uk-button-default">Add Tag</button></td>
<td class="uk-text-nowrap"><button class="uk-align-right uk-button uk-button-small uk-button-default">Add Tag</button></td>
</tr>
</tbody>
</table>
@ -790,6 +797,6 @@
</body>
<script src="{{ url_for('items_api.static', filename='itemEditHandler.js') }}"></script>
<script type="module" src="{{ url_for('items_api.static', filename='itemEditHandler.js') }}"></script>
<script>const item_uuid = {{item_uuid|tojson}}</script>
</html>

8
requirements.txt Normal file
View File

@ -0,0 +1,8 @@
flask
flask_assets
authlib
psycopg2
pywebpush
pymupdf
openfoodfacts
flasgger