Add delete function, fix some text
This commit is contained in:
		@@ -196,6 +196,11 @@ def delete_item(itm):
 | 
				
			|||||||
    #item.delete(itm)
 | 
					    #item.delete(itm)
 | 
				
			||||||
    itm.delete_instance()
 | 
					    itm.delete_instance()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def delete_item_id(barcode):
 | 
				
			||||||
 | 
					    #item.delete(itm)
 | 
				
			||||||
 | 
					    itm = get_item(barcode)
 | 
				
			||||||
 | 
					    itm.delete_instance()
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
def item_location_str(itm):
 | 
					def item_location_str(itm):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        return itm.loc.name
 | 
					        return itm.loc.name
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,9 +16,9 @@ class Footer(rio.Component):
 | 
				
			|||||||
    def build(self) -> rio.Component:
 | 
					    def build(self) -> rio.Component:
 | 
				
			||||||
        return rio.Card(
 | 
					        return rio.Card(
 | 
				
			||||||
            content=rio.Column(
 | 
					            content=rio.Column(
 | 
				
			||||||
                rio.Text("Buzzwordz Inc."),
 | 
					                rio.Text("Validation Lab"),
 | 
				
			||||||
                rio.Text(
 | 
					                rio.Text(
 | 
				
			||||||
                    "Hyper Dyper Website",
 | 
					                    "Inventory Management system",
 | 
				
			||||||
                    style="dim",
 | 
					                    style="dim",
 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
                spacing=1,
 | 
					                spacing=1,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,7 +54,7 @@ class AddLocationPage(rio.Component):
 | 
				
			|||||||
                await asyncio.sleep(2)
 | 
					                await asyncio.sleep(2)
 | 
				
			||||||
                self.popup_show = False
 | 
					                self.popup_show = False
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                self.popup_message = "\n  Part added!  \n\n"
 | 
					                self.popup_message = "\n  Location added!  \n\n"
 | 
				
			||||||
                self.popup_show = True
 | 
					                self.popup_show = True
 | 
				
			||||||
                self.popup_color = 'success'
 | 
					                self.popup_color = 'success'
 | 
				
			||||||
                self.name: str = ""
 | 
					                self.name: str = ""
 | 
				
			||||||
@@ -76,7 +76,7 @@ class AddLocationPage(rio.Component):
 | 
				
			|||||||
        return rio.Column(
 | 
					        return rio.Column(
 | 
				
			||||||
            rio.Popup(
 | 
					            rio.Popup(
 | 
				
			||||||
                anchor=rio.Text(
 | 
					                anchor=rio.Text(
 | 
				
			||||||
                    text="Add a part below:",
 | 
					                    text="Add a location below:",
 | 
				
			||||||
                    style='heading1',
 | 
					                    style='heading1',
 | 
				
			||||||
                    align_x = 0.5
 | 
					                    align_x = 0.5
 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,9 +130,13 @@ class BrowsePage(rio.Component):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    async def _delete_edit_popup(self):
 | 
					    async def _delete_edit_popup(self):
 | 
				
			||||||
        self.edit_show = False
 | 
					        self.edit_show = False
 | 
				
			||||||
        self.info_show = False
 | 
					        self.info_show = True
 | 
				
			||||||
        # TODO: delete here
 | 
					 | 
				
			||||||
        await self.force_refresh()
 | 
					        await self.force_refresh()
 | 
				
			||||||
 | 
					        await delete_item_id(self.ibarcode)
 | 
				
			||||||
 | 
					        await self._search()
 | 
				
			||||||
 | 
					        await asyncio.sleep(1)
 | 
				
			||||||
 | 
					        self.popup_show = False
 | 
				
			||||||
 | 
					        await self._search()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def _open_edit_popup(self, code: str) -> str | None:
 | 
					    async def _open_edit_popup(self, code: str) -> str | None:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user