chefboyrd.views package

Submodules

chefboyrd.views.feedbackM module

This view is specifically for the administrative staff’s management of the feedback.

written by: Seo Bo Shim, Jarod Morin tested by: Seo Bo Shim debugged by: Seo Bo Shim

class chefboyrd.views.feedbackM.DateSpecifyForm(formdata=<object object>, **kwargs)[source]

Bases: flask_wtf.form.FlaskForm

WTforms object for the date-time form submission for the DB query

date_time_from = <UnboundField(DateTimeField, ('Time From',), {})>
date_time_to = <UnboundField(DateTimeField, ('Time To',), {})>
class chefboyrd.views.feedbackM.ItemTable(items, classes=None, thead_classes=None, sort_by=None, sort_reverse=False, no_items=None, table_id=None, border=False)[source]

Bases: flask_table.table.Table

FlaskTable object for organizing feedback info into a table

body = <flask_table.columns.Col object>
time = <flask_table.columns.Col object>
chefboyrd.views.feedbackM.delete_feedback()[source]

Calls the delete_feedback function, returns a message confirming # of feedback entries deleted

Returns:Confirmation string
Return type:res(str)
chefboyrd.views.feedbackM.delete_twilio_feedback()[source]

Wipe all message history on twilio since a specified time. Only needs to be called once to clear data.

Returns:Confirmation string
Return type:res(str)
chefboyrd.views.feedbackM.feedback_table(role)[source]

By default displays a webpage for user to make feedback DB query. Display a table of feedback sent in during a specified date-time range. Also, depending on whether category flags are specified, this page will only display that category table: table of feedback to display form: form that specifies the query instructions.

Parameters:role (str) – correct role of user in this context acquired from the require_role wrapper
Returns:The template to display with the appropriate parameters
Return type:template
chefboyrd.views.feedbackM.send_sms_route()[source]

This is the directory we need to configure twilio for. Configure Webhook POST for https://{webserver}/feedbackM/twiliosms When Twilio makes a POST request, db will be updated with new sms messages from today

Returns:Confirmation string
Return type:res(str)
chefboyrd.views.feedbackM.update_all_sms()[source]

Update sms data from external Twilio database

Returns:Confirmation string
Return type:res(str)

chefboyrd.views.prediction_dash module

Prediction dashboard for the manager interface

Will allow you to predict ingredient usage between two chosen dates

chefboyrd.views.prediction_dash.prediction_index(role)[source]

Renders the index page of the prediction page

chefboyrd.views.reservationH module

Reservation dashboard for the manager interface

class chefboyrd.views.reservationH.ItemTable(items, classes=None, thead_classes=None, sort_by=None, sort_reverse=False, no_items=None, table_id=None, border=False)[source]

Bases: flask_table.table.Table

This is a itemTable class that generates text/html automatically to create a table for created reservations

cancel = <flask_table.columns.ButtonCol object>
guests = <flask_table.columns.Col object>
html_attrs = {'class': 'table table-striped'}
name = <flask_table.columns.Col object>
phone = <flask_table.columns.Col object>
table = <flask_table.columns.Col object>
time = <flask_table.columns.Col object>
class chefboyrd.views.reservationH.ReservationForm(formdata=<object object>, **kwargs)[source]

Bases: flask_wtf.form.FlaskForm

This is the form that displays fields to make a reservation

length = <UnboundField(IntegerField, ('Reservation Length(Minutes)', [<wtforms.validators.NumberRange object>]), {})>
name = <UnboundField(StringField, ('Name', [<wtforms.validators.Length object>]), {})>
num = <UnboundField(IntegerField, ('Guests', [<wtforms.validators.NumberRange object>]), {})>
phone = <UnboundField(PhoneNumberField, ('Phone Number', [<wtforms.validators.DataRequired object>]), {})>
start = <UnboundField(DateTimeField, ('Time and Date',), {})>
chefboyrd.views.reservationH.cancel()[source]

This handles when a user needs to cancel a reservation.

chefboyrd.views.reservationH.resH_index(role)[source]

Renders the index page of the reservation page

chefboyrd.views.root module

This is a sample blueprint for a homepage

Because we’re going to have multiple views for the project we need a way to break them up easily within our application. Flask provides us with this neat tool called blueprints where we’re able to define, essentially, chunks of our APIs or programs as blueprints with functions, then map the predefined functions to specific routes in our application. (See the __init__.py file) for blueprint registering.

To create a new routable location as part of the view you need to first create the blueprint for the module. This is done with the following code

page = Blueprint(‘main’, __name__, template_folder=’templates’)

Then you can use the function decorator @page.route(...) to decorate methods in order to create the views. See the example below. I think the code is relatively straightforward.

Read the flask documentation if you have issues. Particularly the following pages:

Dive deeper into the documentation for a better understanding of how this all works.

chefboyrd.views.root.new_cust(name)[source]

Creates a new customer

Parameters:name (str) – String representing the name
chefboyrd.views.root.show()[source]

Render Homepage

chefboyrd.views.root.showhello()[source]

Super basic function. Always shows “Hi”

chefboyrd.views.stat_dash module

Statistics dashboard for the manager interface

Will be able to render dashboards which include statistics from the database of the Point of sale system and other data systems for the business.

chefboyrd.views.stat_dash.create_jinja_object(fig)[source]
chefboyrd.views.stat_dash.dash_index(role)[source]

Renders the index page of the dashboards

chefboyrd.views.stat_dash.get_datauri(fig)[source]

Build an image data URI

chefboyrd.views.table_manager module

Table dashboard for the manager interface TO DO: Limit reservation times to after date,limit guests based on table(going to be hard)hmm

class chefboyrd.views.table_manager.ItemTable(items, classes=None, thead_classes=None, sort_by=None, sort_reverse=False, no_items=None, table_id=None, border=False)[source]

Bases: flask_table.table.Table

This itemTable class generates a table of the created reservations. It also has buttons to cancel or confirm a reservation

cancel = <flask_table.columns.ButtonCol object>
confirm = <flask_table.columns.ButtonCol object>
guests = <flask_table.columns.Col object>
html_attrs = {'class': 'table table-striped'}
name = <flask_table.columns.Col object>
phone = <flask_table.columns.Col object>
table = <flask_table.columns.Col object>
time = <flask_table.columns.Col object>
chefboyrd.views.table_manager.add_table()[source]

This handles when a user adds a table to the layout.

chefboyrd.views.table_manager.cancel()[source]

This handles when a user needs to cancel a reservation.

chefboyrd.views.table_manager.change_table()[source]

This handles when a user needs to change the status of a table.

chefboyrd.views.table_manager.confirm()[source]

This handles when a user needs to confirm a reservation.

chefboyrd.views.table_manager.del_table()[source]

This handles when a user adds a table to the layout.

chefboyrd.views.table_manager.table_manager_index(role)[source]

Renders the index page of the table management page

chefboyrd.views.table_manager.update_table()[source]

This handles when we need to change the position of a table.

Module contents