from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout


class POSApp(App):
  def build(self):
    # Main layout
    main_layout = BoxLayout(orientation='horizontal')

    # Left navigation bar
    left_nav = BoxLayout(orientation='vertical', size_hint=(0.2, 1))
    left_nav.add_widget(Button(text='Inventory'))
    left_nav.add_widget(Button(text='Orders'))
    left_nav.add_widget(Button(text='Reports'))
    main_layout.add_widget(left_nav)

    # Central content area
    content_area = ScrollView(size_hint=(0.6, 1))
    grid = GridLayout(cols=3, spacing=10, size_hint_y=None)
    grid.bind(minimum_height=grid.setter('height'))

    # Add some sample content (replace with actual data from API)
    for i in range(20):
      card = BoxLayout(orientation='vertical', size_hint_y=None, height=200)
      card.add_widget(Label(text=f'Item {i}'))
      card.add_widget(Label(text=f'Price: ${i*10}'))
      card.add_widget(Label(text=f'Stock: {i*5}'))
      grid.add_widget(card)

    content_area.add_widget(grid)
    main_layout.add_widget(content_area)

    # Right preview panel (initially hidden)
    right_panel = BoxLayout(orientation='vertical', size_hint=(0.2, 1))
    right_panel.add_widget(Label(text='Preview Panel'))
    main_layout.add_widget(right_panel)

    return main_layout


def main():
  POSApp().run()
