Esempio n. 1
0
 def loadData():
     list_box.delete(0, END)
     for booking in BookingController.get()['booking']:
         list_box.insert(
             int(booking['id']), booking['id'] + '.field: ' +
             str(FieldController.read(booking['field_id'])['name']) +
             '.schedule: ' +
             str(ScheduleController.read(booking['schedule_id'])['date']) +
             '.session: ' +
             str(SessionController.read(booking['session_id'])['time']) +
             '.user_id: ' + booking['user_id'] + '.booking_time: ' +
             booking['booking_time'] + '.status: ' + booking['status'])
Esempio n. 2
0
 def checkAvailableSession():
     if selectedScheduleItem == 0 and selectedFieldItem == 0:
         toast('Please select item first')
     else:
         taken_session = []
         session_list_box.delete(0, END)
         for b in BookingController.get()['booking']:
             if b['schedule_id'] == selectedScheduleItem and b[
                     'field_id'] == selectedFieldItem:
                 taken_session.append(b['session_id'])
         for session in SessionController.get()['session']:
             if session['id'] not in taken_session:
                 session_list_box.insert(
                     int(session['id']),
                     session['id'] + '.time: ' + session['time'])
Esempio n. 3
0
def masterView(args):
    global selectedItem
    if isLogin:
        view = Toplevel()
        view.title('System')
        list_box = Listbox(view, width=65)
        list_box.grid(row=1, columnspan=2)
        if args == "Booking":
            for data in BookingController.get()['booking']:
                list_box.insert(
                    int(data['id']), data['id'] + '.field_id: ' +
                    data['field_id'] + '.schedule_id: ' + data['schedule_id'] +
                    '.session_id: ' + data['session_id'] + '.user_id: ' +
                    data['user_id'] + '.booking_time: ' + data['booking_time'])
        elif args == "Fees":
            for data in FeesController.get()['fees']:
                list_box.insert(int(data['id']),
                                data['id'] + '.rate: ' + data['rate'])
        elif args == "Field":
            for data in FieldController.get()['field']:
                list_box.insert(int(data['id']),
                                data['id'] + '.name: ' + data['name'])
        elif args == "Member":
            for data in MemberController.get()['member']:
                list_box.insert(int(data['id']),
                                data['id'] + '.name: ' + data['name'])
        elif args == "Schedule":
            for data in ScheduleController.get()['schedule']:
                list_box.insert(int(data['id']),
                                data['id'] + '.date: ' + data['date'])
        elif args == "Session":
            for data in SessionController.get()['session']:
                list_box.insert(int(data['id']),
                                data['id'] + '.time: ' + data['time'])
        list_box.bind('<<ListboxSelect>>', onSelectItem)
        Button(view, text='Create', width=25, command=lambda: createView(view, args)) \
            .grid(row=2, columnspan=2)
        Button(view, text='Update', width=25, command=lambda: updateView(view, args, selectedItem)) \
            .grid(row=4, columnspan=2)
        Button(view, text='Delete', width=25, command=lambda: deleteView(view, args, selectedItem)) \
            .grid(row=5, columnspan=2)
    else:
        toast("Please Login first")
Esempio n. 4
0
 def loadData():
     if selectedMemberItem == 0:
         toast('Please select member first')
     else:
         list_box.delete(0, END)
         loadedBooking.clear()
         for booking in BookingController.get()['booking']:
             if booking['status'] != 'done' and booking[
                     'user_id'] == selectedMemberItem:
                 loadedBooking.append(booking)
                 list_box.insert(
                     int(booking['id']), booking['id'] + '.field: ' +
                     str(FieldController.read(booking['field_id'])['name'])
                     + '.schedule: ' + str(
                         ScheduleController.read(
                             booking['schedule_id'])['date']) +
                     '.session: ' + str(
                         SessionController.read(
                             booking['session_id'])['time']) +
                     '.user_id: ' + booking['user_id'] + '.booking_time: ' +
                     booking['booking_time'])