Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21_Final_Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanelle Lunod
MIS21_Final_Project
Commits
1b0bc1c6
Commit
1b0bc1c6
authored
Jul 16, 2018
by
Chanelle Lunod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
cafc98c4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
67 deletions
+15
-67
orders_controller.rb
app/controllers/orders_controller.rb
+0
-25
application.html.erb
app/views/layouts/application.html.erb
+4
-0
new.html.erb
app/views/orders/new.html.erb
+0
-8
index.html.erb
app/views/supplies/index.html.erb
+11
-18
new.html.erb
app/views/supplies/new.html.erb
+0
-10
routes.rb
config/routes.rb
+0
-6
No files found.
app/controllers/orders_controller.rb
View file @
1b0bc1c6
class
OrdersController
<
ApplicationController
def
new
@orders
=
Order
.
new
end
def
create
@orders
=
Order
.
new
(
product_params
)
if
@orders
.
save
redirect_to
products_path
,
notice:
"You have successfully placed a new order"
else
render
'new'
end
end
def
show
if
params
[
:status
]
==
'Active'
@products
=
Product
.
Active
else
@products
=
Product
.
Inactive
end
end
end
\ No newline at end of file
app/views/layouts/application.html.erb
View file @
1b0bc1c6
...
...
@@ -12,6 +12,10 @@
</head>
<body>
<style>
background-color
:
#ccfff2
font-family
:
'Calibri'
;
</style>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<%=
link_to
"Main"
,
root_path
,
class:
"navbar-brand"
%>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
...
...
app/views/orders/new.html.erb
View file @
1b0bc1c6
<h1>
New Order
</h1>
<%=
simple_form_for
@order
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:quantity
,
as: :integer
%>
<%=
f
.
button
:submit
,
"Add Order"
,
class:
"btn btn-primary"
%>
<%
end
%>
\ No newline at end of file
app/views/supplies/index.html.erb
View file @
1b0bc1c6
<h1>
Supplies
</h1>
<div>
<%=
link_to
"Add New Supply"
,
new_product_supply_path
,
class:
"btn btn-primary"
%>
</div>
<h1>
Transactions
</h1>
<br>
<%
if
@
supplie
s
.
empty?
%>
<%
if
@
product
s
.
empty?
%>
<small>
No
supplies available
.
No
products have been created
.
</small>
<%
else
%>
<table
class=
"table"
>
<thead>
<th>
Name
</th>
<th>
Description
</th>
<th>
Date Added
</th>
<th>
Quantity
</th>
<th>
Status
</th>
<th>
Time Created
</th>
<th
colspan=
"4"
></th>
</thead>
<tbody>
<%
@
supplies
.
each
do
|
supply
|
%>
<%
@
products
.
each
do
|
product
|
%>
<tr>
<td>
<%=
link_to
supply
.
name
,
supply_path
(
supply
)
%>
</td>
<td>
<%=
supply
.
description
%>
<%=
link_to
product
.
name
,
product_path
(
product
)
%>
</td>
<td>
<%=
time_ago_in_words
(
supply
.
created_at
)
%>
ago
<%=
product
.
description
%>
</td>
<td>
<%=
supply
.
quantity
%>
<%=
product
.
status
%>
</td>
<td>
<%=
link_to
"Edit"
,
edit_product_path
(
product
),
class:
"btn btn-primary"
%>
<%=
time_ago_in_words
(
product
.
created_at
)
%>
ago
</td>
</tr>
<%
end
%>
...
...
app/views/supplies/new.html.erb
View file @
1b0bc1c6
<h1>
New Supply
</h1>
<%=
simple_form_for
@supply
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:quantity
,
as: :integer
%>
<%=
f
.
button
:submit
,
"Add Supply"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back"
,
supplies_path
,
class:
"btn btn-default"
%>
<%
end
%>
config/routes.rb
View file @
1b0bc1c6
Rails
.
application
.
routes
.
draw
do
get
'orders/new'
get
'orders/create'
get
'supplies/index'
get
'supplies/new'
get
'supplies/create'
get
'comments/new'
devise_for
:admin_users
devise_scope
:admin_user
do
authenticated
:admin_user
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment