Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add delivery date #145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Order(Base):
product_quantity = Column('Product Quantity', Integer)
order_date = Column('Order Date', DateTime)
shipping_date = Column('Shipping Date', DateTime)
delivery_date = Column('Delivery Date', DateTime)

# define routes
# route to display orders
Expand Down Expand Up @@ -85,6 +86,7 @@ def add_order():
product_quantity = request.form.get('product_quantity')
order_date = request.form.get('order_date')
shipping_date = request.form.get('shipping_date')
delivery_date = request.form['delivery date']

# Create a session to interact with the database
session = Session()
Expand All @@ -99,6 +101,7 @@ def add_order():
product_quantity=product_quantity,
order_date=order_date,
shipping_date=shipping_date
delivery_date=delivery_date
)

# Add the new order to the session and commit to the database
Expand Down
5 changes: 5 additions & 0 deletions templates/orders.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h2 class="tab-title">Order List</h2>
<th>Product Quantity</th>
<th>Order Date</th>
<th>Shipping Date</th>
<th>Delivery Date</th>
</tr>
</thead>
<tbody>
Expand All @@ -40,6 +41,7 @@ <h2 class="tab-title">Order List</h2>
<td>{{ order.product_quantity }}</td>
<td>{{ order.order_date }}</td>
<td>{{ order.shipping_date }}</td>
<td>{{ order.delivery_date }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down Expand Up @@ -74,6 +76,9 @@ <h2 class="tab-title">Add New Order</h2>
<label for="shipping_date">Shipping Date:</label>
<input type="text" id="shipping_date" name="shipping_date" required><br>
<input type="submit" value="Add Order">
<label for="delivery_date">Delivery Date:</label>
<input type="date" id="delivery_date" name="delivery_date"><br></br>
<input type="submit" value="Add Order">
</form>
</div>
</div>
Expand Down