Add edit page, dialog based item page. Consider switching to popups.
parent
2a8de79adb
commit
27169ff8a0
@ -1,63 +0,0 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dataclasses import KW_ONLY, field
|
|
||||||
from typing import * # type: ignore
|
|
||||||
|
|
||||||
import rio
|
|
||||||
|
|
||||||
from .. import components as comps
|
|
||||||
|
|
||||||
class AboutPage(rio.Component):
|
|
||||||
"""
|
|
||||||
A sample page, which displays a humorous description of the company.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def build(self) -> rio.Component:
|
|
||||||
return rio.Markdown(
|
|
||||||
"""
|
|
||||||
# About Us
|
|
||||||
|
|
||||||
Welcome to Buzzwordz Inc.! Unleashing Synergistic Paradigms for Unprecedented
|
|
||||||
Excellence since the day after yesterday.
|
|
||||||
|
|
||||||
## About Our Company
|
|
||||||
|
|
||||||
At buzzwordz, we are all talk and no action. Our mission is to be the vanguards
|
|
||||||
of industry-leading solutions, leveraging bleeding-edge technologies to catapult
|
|
||||||
your business into the stratosphere of success. Our unparalleled team of ninjas,
|
|
||||||
gurus, and rockstars is dedicated to disrupting the status quo and actualizing
|
|
||||||
your wildest business dreams. We live, breathe, and eat operational excellence
|
|
||||||
and groundbreaking innovation.
|
|
||||||
|
|
||||||
## Synergistic Consulting
|
|
||||||
|
|
||||||
Unlock your business's quantum potential with our bespoke, game-changing
|
|
||||||
strategies. Our consulting services synergize cross-functional paradigms to
|
|
||||||
create a holistic ecosystem of perpetual growth and exponential ROI. Did I
|
|
||||||
mention paradigm-shifts? We've got those too.
|
|
||||||
|
|
||||||
## Agile Hyper-Development
|
|
||||||
|
|
||||||
We turn moonshot ideas into reality with our agile, ninja-level development
|
|
||||||
techniques. Our team of coding wizards crafts robust, scalable, and future-proof
|
|
||||||
solutions that redefine industry standards. 24/7 Proactive Hyper-Support
|
|
||||||
|
|
||||||
Experience next-gen support that anticipates your needs before you do. Our
|
|
||||||
omnipresent customer happiness engineers ensure seamless integration,
|
|
||||||
frictionless operation, and infinite satisfaction, day and night.
|
|
||||||
|
|
||||||
Embark on a journey of transformational growth and stratospheric success. Don't
|
|
||||||
delay, give us your money today.
|
|
||||||
|
|
||||||
Phone: (123) 456-7890
|
|
||||||
|
|
||||||
Email: info@yourwebsite.com
|
|
||||||
|
|
||||||
Address: 123 Main Street, City, Country
|
|
||||||
""",
|
|
||||||
width=60,
|
|
||||||
margin_bottom=4,
|
|
||||||
align_x=0.5,
|
|
||||||
align_y=0,
|
|
||||||
)
|
|
||||||
|
|
@ -0,0 +1,118 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import KW_ONLY, field
|
||||||
|
from typing import * # type: ignore
|
||||||
|
|
||||||
|
import rio
|
||||||
|
import datetime
|
||||||
|
from mac_vendor_lookup import AsyncMacLookup
|
||||||
|
|
||||||
|
from db_classes import *
|
||||||
|
from .. import components as comps
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
class AddLocationPage(rio.Component):
|
||||||
|
code: str = ""
|
||||||
|
popup_message: str = ""
|
||||||
|
popup_show: bool = False
|
||||||
|
popup_color: str = 'warning'
|
||||||
|
description: str = ""
|
||||||
|
name: str = ""
|
||||||
|
parent_code: str = ""
|
||||||
|
parent: str = ""
|
||||||
|
|
||||||
|
@rio.event.periodic(1)
|
||||||
|
def set_office_init(self):
|
||||||
|
self.office = self.session[comps.Settings].office
|
||||||
|
#print("Populated:", self.office)
|
||||||
|
|
||||||
|
async def _update_location(self, event: rio.TextInputChangeEvent):
|
||||||
|
print("Checking " + self.parent)
|
||||||
|
if get_location_id(self.parent) != False:
|
||||||
|
self.parent_code = self.parent
|
||||||
|
print("Found location " + get_location_id(self.parent).name)
|
||||||
|
self.parent = get_location_id(self.parent).name
|
||||||
|
|
||||||
|
async def add_part(self):
|
||||||
|
if self.code == "":
|
||||||
|
# FAIL
|
||||||
|
self.popup_message = "\n Missing barcode! \n\n"
|
||||||
|
self.popup_show = True
|
||||||
|
self.popup_color = 'danger'
|
||||||
|
await asyncio.sleep(1)
|
||||||
|
self.popup_show = False
|
||||||
|
else:
|
||||||
|
# OK, add part
|
||||||
|
if get_location_id(self.parent_code) != False:
|
||||||
|
self.parent = get_location_id(self.parent_code)
|
||||||
|
else:
|
||||||
|
self.parent = None
|
||||||
|
if create_location(name=self.name, barcode=self.code, parent=self.parent, description=self.description) == False:
|
||||||
|
self.popup_message = "\n Duplicate barcode! \n\n"
|
||||||
|
self.popup_show = True
|
||||||
|
self.popup_color = 'warning'
|
||||||
|
await asyncio.sleep(2)
|
||||||
|
self.popup_show = False
|
||||||
|
else:
|
||||||
|
self.popup_message = "\n Part added! \n\n"
|
||||||
|
self.popup_show = True
|
||||||
|
self.popup_color = 'success'
|
||||||
|
self.name: str = ""
|
||||||
|
self.code: str = ""
|
||||||
|
self.description: str = ""
|
||||||
|
self.parent_code: str = ""
|
||||||
|
self.parent: str = ""
|
||||||
|
await asyncio.sleep(2)
|
||||||
|
self.popup_show = False
|
||||||
|
|
||||||
|
|
||||||
|
async def _add_part_enter(self, event: rio.TextInputConfirmEvent):
|
||||||
|
await self.add_part()
|
||||||
|
|
||||||
|
async def _add_part_button(self):
|
||||||
|
await self.add_part()
|
||||||
|
|
||||||
|
def build(self) -> rio.Component:
|
||||||
|
return rio.Column(
|
||||||
|
rio.Popup(
|
||||||
|
anchor=rio.Text(
|
||||||
|
text="Add a part below:",
|
||||||
|
style='heading1',
|
||||||
|
align_x = 0.5
|
||||||
|
),
|
||||||
|
color=self.bind().popup_color,
|
||||||
|
is_open=self.bind().popup_show,
|
||||||
|
content=rio.Text(
|
||||||
|
text=self.bind().popup_message,
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
rio.TextInput(
|
||||||
|
label="Barcode",
|
||||||
|
text=self.bind().code
|
||||||
|
),
|
||||||
|
rio.TextInput(
|
||||||
|
label="Parent Location (optional)",
|
||||||
|
text=self.bind().parent,
|
||||||
|
on_change=self._update_location
|
||||||
|
),
|
||||||
|
rio.TextInput(
|
||||||
|
label="Location Name",
|
||||||
|
text=self.bind().name
|
||||||
|
),
|
||||||
|
rio.MultiLineTextInput(
|
||||||
|
label="Description (optional)",
|
||||||
|
text=self.bind().description
|
||||||
|
),
|
||||||
|
rio.Button(
|
||||||
|
content="Add",
|
||||||
|
on_press=self._add_part_button
|
||||||
|
),
|
||||||
|
|
||||||
|
spacing=2,
|
||||||
|
min_width=60,
|
||||||
|
margin_bottom=4,
|
||||||
|
align_x=0.5,
|
||||||
|
align_y=0,
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import KW_ONLY, field
|
||||||
|
from typing import * # type: ignore
|
||||||
|
|
||||||
|
import rio
|
||||||
|
|
||||||
|
from .. import components as comps
|
||||||
|
|
||||||
|
class SettingsPage(rio.Component):
|
||||||
|
"""
|
||||||
|
A sample page, which displays a humorous description of the company.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def build(self) -> rio.Component:
|
||||||
|
return rio.Markdown(
|
||||||
|
"""
|
||||||
|
Belden Inventory manager v0.5
|
||||||
|
WIP
|
||||||
|
""",
|
||||||
|
min_width=60,
|
||||||
|
margin_bottom=4,
|
||||||
|
align_x=0.5,
|
||||||
|
align_y=0,
|
||||||
|
)
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
peewee
|
peewee
|
||||||
pymysql
|
pymysql
|
||||||
flask
|
rio-ui==0.10.4
|
||||||
rio-ui
|
meilisearch #==0.31.5
|
||||||
meilisearch
|
|
||||||
mac-vendor-lookup
|
mac-vendor-lookup
|
Loading…
Reference in New Issue