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
34538002
Commit
34538002
authored
Jul 20, 2018
by
Chanelle Lunod
Browse files
Options
Browse Files
Download
Plain Diff
initial commit
parents
7eb1cfec
d1dbca7c
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
256 additions
and
121 deletions
+256
-121
application.css.scss
app/assets/stylesheets/application.css.scss
+3
-1
orders_controller.rb
app/controllers/orders_controller.rb
+8
-8
products_controller.rb
app/controllers/products_controller.rb
+0
-2
supplies_controller.rb
app/controllers/supplies_controller.rb
+9
-9
application.html.erb
app/views/layouts/application.html.erb
+189
-42
new.html.erb
app/views/orders/new.html.erb
+4
-4
edit.html.erb
app/views/products/edit.html.erb
+0
-1
index.html.erb
app/views/products/index.html.erb
+29
-30
new.html.erb
app/views/products/new.html.erb
+0
-1
index.html.erb
app/views/publics/index.html.erb
+6
-4
new.html.erb
app/views/supplies/new.html.erb
+6
-4
routes.rb
config/routes.rb
+2
-0
orders_controller_test.rb
test/controllers/orders_controller_test.rb
+0
-5
supplies_controller_test.rb
test/controllers/supplies_controller_test.rb
+0
-10
No files found.
app/assets/stylesheets/application.css.scss
View file @
34538002
...
...
@@ -5,4 +5,6 @@
@import
"bootstrap"
;
#container
{
padding-top
:
5rem
;
}
body
{
background-color
:
#d9e6f2
;}
body
{
background-color
:
#000000
;
}
app/controllers/orders_controller.rb
View file @
34538002
...
...
@@ -6,15 +6,15 @@ class OrdersController < ApplicationController
def
new
@product
=
Product
.
find_by
(
id:
params
[
:product_id
])
@order
=
@order
.
transactions
.
new
@order
=
@product
.
transactions
.
new
end
def
create
@product
=
Product
.
find_by
(
id:
params
[
:product_id
])
@order
=
@order
.
transactions
.
new
(
supply
_params
)
@order
=
@product
.
transactions
.
new
(
order
_params
)
@order
.
mode
=
"Order"
@order
.
user_id
=
current_user
.
id
@order
.
quantity
=
@order
.
quantity
*
-
1
@order
.
quantity
=
@order
.
quantity
if
@product
.
save
redirect_to
authenticated_user_root_path
,
notice:
"You have successfully placed a new order"
...
...
app/controllers/products_controller.rb
View file @
34538002
class
ProductsController
<
ApplicationController
before_action
:authenticate_admin_user!
def
index
@products
=
Product
.
all
@products
=
Product
.
where
([
"name LIKE ?"
,
"%
#{
params
[
:search
]
}
%"
])
...
...
app/controllers/supplies_controller.rb
View file @
34538002
...
...
@@ -14,7 +14,7 @@ class SuppliesController < ApplicationController
@supply
=
@product
.
transactions
.
new
(
supply_params
)
@supply
.
mode
=
"Supply"
@supply
.
user_id
=
current_user
.
id
@supply
.
quantity
=
@supply
.
quantity
@supply
.
quantity
=
@supply
.
quantity
if
@product
.
save
redirect_to
authenticated_user_root_path
,
notice:
"You have successfully added a new supply."
...
...
app/views/layouts/application.html.erb
View file @
34538002
...
...
@@ -3,6 +3,9 @@
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<link
rel=
"stylesheet"
href=
"https://www.w3schools.com/w3css/4/w3.css"
>
<link
rel=
"stylesheet"
href=
"https://fonts.googleapis.com/css?family=Montserrat"
>
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
>
<title>
PRODUCTS
</title>
<%=
csrf_meta_tags
%>
<%=
csp_meta_tag
%>
...
...
@@ -13,27 +16,63 @@
<body>
<style>
body
,
h2
,
h3
,
h4
,
h5
,
h6
{
font-family
:
"Montserrat"
,
sans-serif
}
h1
{
font-family
:
"Clibri"
,
sans-serif
}
.w3-row-padding
img
{
margin-bottom
:
12px
}
.w3-sidebar
{
width
:
120px
;
background
:
#222
;}
#main
{
margin-left
:
120px
}
@media
only
screen
and
(
max-width
:
600px
)
{
#main
{
margin-left
:
0
}}
</style>
<!-- <style>
background-color: #ccfff2
font-family:'Calibri';
</style>
<nav
class=
"navbar navbar-expand-xl navbar-dark bg-dark"
>
<%=
link_to
"HOME"
,
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"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
</style> -->
<body
class=
"w3-black"
>
<nav
class=
"w3-sidebar w3-bar-block w3-small w3-hide-small w3-center"
>
<!-- Avatar image in top left corner -->
<img
src=
"https://218run.com/wp-content/uploads/2013/10/yonex_logo_wp-300x300.jpg"
style=
"width:100%"
>
<a
href=
"#"
class=
"w3-bar-item w3-button w3-padding-large w3-black"
>
<i
class=
"fa fa-home w3-xxlarge"
></i>
<p>
HOME
</p>
</a>
<a
href=
"#signin"
class=
"w3-bar-item w3-button w3-padding-large w3-hover-black"
>
<i
class=
"fa fa-user w3-xxlarge"
></i>
<p>
SIGN IN
</p>
</a>
<a
href=
"#products"
class=
"w3-bar-item w3-button w3-padding-large w3-hover-black"
>
<i
class=
"fa fa-eye w3-xxlarge"
></i>
<p>
PRODUCTS
</p>
</a>
<a
href=
"#contact"
class=
"w3-bar-item w3-button w3-padding-large w3-hover-black"
>
<i
class=
"fa fa-envelope w3-xxlarge"
></i>
<p>
CONTACT
</p>
</a>
<a
href=
"#search"
class=
"w3-bar-item w3-button w3-padding-large w3-hover-black"
>
<i
class=
"fa fa-search w3-xxlarge"
></i>
<p>
SEARCH
</p>
</a>
</nav>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav mr-auto"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"#"
>
Sign In
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"#"
>
Inventory
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"#"
>
Transactions
</a>
</li>
</ul>
<div
class=
"w3-top w3-hide-large w3-hide-medium"
id=
"myNavbar"
>
<div
class=
"w3-bar w3-black w3-opacity w3-hover-opacity-off w3-center w3-small"
>
<a
href=
"#"
class=
"w3-bar-item w3-button"
style=
"width:25% !important"
>
HOME
</a>
<a
href=
"#signin"
class=
"w3-bar-item w3-button"
style=
"width:25% !important"
>
SIGN IN
</a>
<a
href=
"#products"
class=
"w3-bar-item w3-button"
style=
"width:25% !important"
>
PRODUCTS
</a>
<a
href=
"#contact"
class=
"w3-bar-item w3-button"
style=
"width:25% !important"
>
CONTACT
</a>
<a
href=
"#search"
class=
"w3-bar-item w3-button"
style=
"width:25% !important"
>
SEARCH
</a>
</div>
</div>
<div
class=
"w3-padding-large"
id=
"main"
>
<!-- Header/Home -->
<header
class=
"w3-container w3-padding-32 w3-center w3-black"
id=
"home"
>
<h1
class=
"w3-jumbo"
><span
class=
"w3-hide-small"
>
YONEX
</h1>
<p>
"The #1 trusted brand by all athletes accross the globe."
</p>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/duovsvt_ldlcw_YYSRSRC.jpg"
alt=
"boy"
class=
"w3-image"
width=
"992"
height=
"1108"
>
</header>
</span>
<div
class=
"w3-content w3-justify w3-text-white w3-padding-64"
id=
"signin"
>
<span
class=
"navbar-text"
>
<%
if
user_signed_in?
%>
Logged in as
<strong>
<%=
current_user
.
email
%>
</strong>
.
...
...
@@ -44,22 +83,6 @@
<%=
link_to
"Logout"
,
destroy_admin_user_session_path
,
method: :delete
,
:class
=>
'navbar-link'
%>
<%
end
%>
</span>
<form
class=
"form-inline my-2 my-lg-0"
>
<input
class=
"form-control mr-sm-2"
type=
"search"
placeholder=
"Search"
>
<button
class=
"btn btn-outline-info my-2 my-sm-0"
type=
"submit"
>
Search
</button>
</form>
<%=
form_tag
products_path
,
:method
=>
'get'
do
%>
<%=
text_field_tag
:search
,
params
[
:search
]
%>
<%=
submit_tag
"Search"
%>
<%
end
%>
</div>
</nav>
<div
id=
"google_translate_element"
></div><script
type=
"text/javascript"
>
function
googleTranslateElementInit
()
{
new
google
.
translate
.
TranslateElement
({
pageLanguage
:
'en'
,
includedLanguages
:
'af,ar,da,de,en,es,fi,fr,hi,id,is,ja,ko,mi,ms,my,nl,no,pt,sw,tl,zh-CN'
,
layout
:
google
.
translate
.
TranslateElement
.
InlineLayout
.
HORIZONTAL
},
'google_translate_element'
);
}
</script><script
type=
"text/javascript"
src=
"//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"
></script>
>
<div
class=
"container"
id=
"container"
>
<%
if
notice
%>
...
...
@@ -69,6 +92,130 @@
<p
class=
"alert alert-danger"
>
<%=
alert
%>
</p>
<%
end
%>
<%=
yield
%>
</div><br>
<br>
<br>
<h3
class=
"w3-padding-16 w3-text-light-grey"
>
Our Ratings
</h3>
<p
class=
"w3-wide"
>
Badminton
</p>
<div
class=
"w3-white"
>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:99%"
></div>
</div>
<p
class=
"w3-wide"
>
Golf
</p>
<div
class=
"w3-white"
>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:97%"
></div>
</div>
<p
class=
"w3-wide"
>
Tennis
</p>
<div
class=
"w3-white"
>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:95%"
></div>
</div><br>
<div
class=
"w3-row w3-center w3-padding-16 w3-section w3-light-grey"
>
<div
class=
"w3-quarter w3-section"
>
<span
class=
"w3-xlarge"
>
500+
</span><br>
Partners
</div>
<div
class=
"w3-quarter w3-section"
>
<span
class=
"w3-xlarge"
>
800
</span><br>
Stores Worldwide
</div>
<div
class=
"w3-quarter w3-section"
>
<span
class=
"w3-xlarge"
>
1M++
</span><br>
Happy Athletes
</div>
<div
class=
"w3-quarter w3-section"
>
<span
class=
"w3-xlarge"
>
650+
</span><br>
Distributors
</div>
</div>
</div>
<!-- Portfolio Section -->
<div
class=
"w3-padding-64 w3-content"
id=
"products"
>
<h2
class=
"w3-text-light-grey"
>
Featured
</h2>
<hr
style=
"width:200px"
class=
"w3-opacity"
>
<!-- Grid for photos -->
<div
class=
"w3-row-padding"
style=
"margin:0 -16px"
>
<div
class=
"w3-half"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/DUORA%20Series%20Ad.jpg"
style=
"width:100%"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/Tour%20Racquets%202016.png"
style=
"width:100%"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/NR95DX%20and%20NR70DX%20final.jpg"
style=
"width:100%"
>
</div>
<div
class=
"w3-half"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/duovsvt_version_YYSRSRC.jpg"
style=
"width:100%"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/VTDG-10-and-7.jpg"
style=
"width:100%"
>
<img
src=
"http://www.sunrisecatalogue.com/uploads/posters/ARC10%20Poster.jpg"
style=
"width:100%"
>
</div>
<!-- End photo grid -->
</div>
<!-- End Portfolio Section -->
</div>
<!-- Contact Section -->
<div
class=
"w3-padding-64 w3-content w3-text-grey"
id=
"contact"
>
<h2
class=
"w3-text-light-grey"
>
Contact Us
</h2>
<hr
style=
"width:200px"
class=
"w3-opacity"
>
<div
class=
"w3-section"
>
<p><i
class=
"fa fa-map-marker fa-fw w3-text-white w3-xxlarge w3-margin-right"
></i>
3-23-13 Yushima, Bunkyo-ku, Tokyo 113-8543, Japan
</p>
<p><i
class=
"fa fa-phone fa-fw w3-text-white w3-xxlarge w3-margin-right"
></i>
Phone: +00 12345
</p>
<p><i
class=
"fa fa-envelope fa-fw w3-text-white w3-xxlarge w3-margin-right"
>
</i>
Email: yonex@obf.ateneo.edu
</p>
</div><br>
<p>
If you have any questions, send us an email:
</p>
<form
action=
"/action_page.php"
target=
"_blank"
>
<p><input
class=
"w3-input w3-padding-16"
type=
"text"
placeholder=
"Name"
required
name=
"Name"
></p>
<p><input
class=
"w3-input w3-padding-16"
type=
"text"
placeholder=
"Email"
required
name=
"Email"
></p>
<p><input
class=
"w3-input w3-padding-16"
type=
"text"
placeholder=
"Subject"
required
name=
"Subject"
></p>
<p><input
class=
"w3-input w3-padding-16"
type=
"text"
placeholder=
"Message"
required
name=
"Message"
></p>
<p>
<button
class=
"w3-button w3-light-grey w3-padding-large"
type=
"submit"
>
<i
class=
"fa fa-paper-plane"
></i>
SEND EMAIL
</button>
</p>
</form>
</div>
<!-- End Contact Section -->
<div
class=
"w3-padding-64 w3-content w3-text-white"
>
<h2>
Our Founders
</h2>
<br>
<img
src=
"https://scontent.fmnl4-4.fna.fbcdn.net/v/t31.0-8/26758507_10208855439018286_1377917175667961785_o.jpg?_nc_cat=0&oh=ff30e6770ff054370e1fa725ffe1580d&oe=5BD55DF1"
alt=
"Avatar"
class=
"w3-left w3-circle w3-margin-right"
style=
"width:80px"
>
<p><span
class=
"w3-large w3-margin-right"
>
Andrea Dolendo -
</span>
Chief Executive Officer
</p><br>
<img
src=
"https://scontent.fmnl4-4.fna.fbcdn.net/v/t31.0-8/26232467_10204296200921706_5390473562677293564_o.jpg?_nc_cat=0&oh=e91a4fb887a4bd2437830cb9bb5999f0&oe=5C126350"
alt=
"Avatar"
class=
"w3-left w3-circle w3-margin-right"
style=
"width:80px"
>
<p><span
class=
"w3-large w3-margin-right"
>
Chanelle Lunod -
</span>
Chief Operating Officer
</p>
</div>
<!-- End About Section -->
<!-- Footer -->
<footer
class=
"w3-content w3-padding-64 w3-text-grey w3-xlarge"
>
<i
class=
"fa fa-facebook-official w3-hover-opacity"
></i>
<i
class=
"fa fa-instagram w3-hover-opacity"
></i>
<i
class=
"fa fa-snapchat w3-hover-opacity"
></i>
<i
class=
"fa fa-pinterest-p w3-hover-opacity"
></i>
<i
class=
"fa fa-twitter w3-hover-opacity"
></i>
<i
class=
"fa fa-linkedin w3-hover-opacity"
></i>
<p
class=
"w3-medium"
>
Powered by
<a
href=
"https://www.w3schools.com/w3css/default.asp"
target=
"_blank"
class=
"w3-hover-text-green"
>
w3.css
</a></p>
<!-- End footer -->
<div
id=
"google_translate_element"
></div><script
type=
"text/javascript"
>
function
googleTranslateElementInit
()
{
new
google
.
translate
.
TranslateElement
({
pageLanguage
:
'en'
,
includedLanguages
:
'af,ar,da,de,en,es,fi,fr,hi,id,is,ja,ko,mi,ms,my,nl,no,pt,sw,tl,zh-CN'
,
layout
:
google
.
translate
.
TranslateElement
.
InlineLayout
.
HORIZONTAL
},
'google_translate_element'
);
}
</script><script
type=
"text/javascript"
src=
"//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"
></script>
</footer>
</div>
</nav>
<!-- Search Section -->
<div
class=
"w3-padding-64 w3-content w3-text-grey"
id=
"search"
>
<h2
class=
"w3-text-light-grey"
>
Search Products
</h2>
<%=
form_tag
products_path
,
:method
=>
'get'
do
%>
<%=
text_field_tag
:search
,
params
[
:search
]
%>
<%=
submit_tag
"Search"
,
class:
'btn btn-outline-info my-2 my-sm-0'
%>
<%
end
%>
</div>
</body>
</html>
app/views/orders/new.html.erb
View file @
34538002
<h1>
New Order
</h1>
<%=
simple_form_for
@post
do
|
f
|
%>
<%=
f
.
input
:quantity
,
as: :integer
%>
<%=
f
.
button
:submit
,
"Add Supply"
,
class:
"btn btn-info
"
%>
<%=
link_to
"Back"
,
transaction_path
,
class:
"btn
btn-default"
%>
<%=
simple_form_for
([
@product
,
@order
],
url:
product_orders_path
)
do
|
f
|
%>
<%=
f
.
input
:quantity
%>
<%=
f
.
button
:submit
,
"Add Order"
,
class:
"btn btn-primary
"
%>
<%=
link_to
"Back"
,
authenticated_user_root_path
,
class:
"btn-
btn-default"
%>
<%
end
%>
\ No newline at end of file
app/views/products/edit.html.erb
View file @
34538002
...
...
@@ -3,7 +3,6 @@
<%=
simple_form_for
@product
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:status
,
as: :radio_buttons
,
collection:
[[
'Active'
,
'Active'
],
[
'Inactive'
,
'Inactive'
]],
value_method: :first
,
label_method: :second
%>
<%=
f
.
button
:submit
,
"Save"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back"
,
products_path
,
class:
"btn btn-default"
%>
<%
end
%>
app/views/products/index.html.erb
View file @
34538002
...
...
@@ -12,7 +12,7 @@
</small>
<%
else
%>
<table
class =
"table"
,
cellspacing=
"0"
,
cellpadding=
"0"
>
<thead
style=
"background-color: #
333
"
>
<thead
style=
"background-color: #
F08080
"
>
<th>
Name
</th>
<th>
Description
</th>
<th>
Status
</th>
...
...
@@ -36,12 +36,11 @@
</td>
<td>
<%
@supplies
=
0
%>
<%
product
.
transactions
.
each
do
|
trans
action
|
%>
<%
product
.
transactions
.
each
do
|
trans
|
%>
<%
if
trans
.
mode
==
"Supply"
%>
<%
if
trans
.
quantity
==
nil
%>
<%
trans
.
quantity
==
0
%>
<%
end
%>
<%
@supplies
+=
trans
.
quantity
%>
<%
end
%>
<%
end
%>
...
...
@@ -49,21 +48,19 @@
</td>
<td>
<%
@orders
=
0
%>
<%
product
.
transactions
.
each
do
|
transaction
|
%>
<%
if
trans
.
mode
==
"ORDER"
%>
<%
product
.
transactions
.
each
do
|
trans
|
%>
<%
if
trans
.
mode
==
"Order"
%>
<%
if
trans
.
quantity
==
nil
%>
<%
trans
action
.
quantity
==
0
%>
<%
trans
.
quantity
==
0
%>
<%
end
%>
<%
@orders
+=
trans
.
quantity
%>
<%
end
%>
<%
end
%>
<%=
"(
#{
@orders
.
abs
}
)"
%>
<%=
@orders
%>
</td>
<td>
<%
@total
=
0
%>
<%
product
.
transactions
.
each
do
|
trans
action
|
%>
<%
product
.
transactions
.
each
do
|
trans
|
%>
<%
if
trans
.
quantity
==
nil
%>
<%
trans
.
quantity
==
0
%>
<%
end
%>
...
...
@@ -94,9 +91,9 @@
<%
end
%>
</tbody>
</table>
<%
end
%>
<%
end
%>
<%
els
e
%>
<%
els
if
user_signed_in?
%>
<h1>
Transactions
</h1>
<br>
...
...
@@ -106,14 +103,13 @@
</small>
<%
else
%>
<table
class =
"table"
,
cellspacing=
"0"
,
cellpadding=
"0"
>
<thead
style=
"background-color: #
333
"
>
<thead
style=
"background-color: #
76D7C4
"
>
<th>
Name
</th>
<th>
Description
</th>
<th>
Status
</th>
<th>
Supply
</th>
<th>
Order
</th>
<th>
Total
</th>
<th>
Created At
</th>
<th
colspan=
"6"
></th>
</thead>
<tbody>
...
...
@@ -135,7 +131,6 @@
<%
if
trans
.
quantity
==
nil
%>
<%
trans
.
quantity
==
0
%>
<%
end
%>
<%
@supplies
+=
trans
.
quantity
%>
<%
end
%>
<%
end
%>
...
...
@@ -144,15 +139,14 @@
<td>
<%
@orders
=
0
%>
<%
product
.
transactions
.
each
do
|
trans
|
%>
<%
if
trans
.
mode
==
"ORDER
"
%>
<%
if
trans
.
mode
==
"Order
"
%>
<%
if
trans
.
quantity
==
nil
%>
<%
trans
action
.
quantity
==
0
%>
<%
trans
.
quantity
==
0
%>
<%
end
%>
<%
@orders
+=
trans
.
quantity
%>
<%
end
%>
<%
end
%>
<%=
"(
#{
@orders
.
abs
}
)"
%>
<%=
@orders
%>
</td>
<td>
<%
@total
=
0
%>
...
...
@@ -164,16 +158,21 @@
<%
end
%>
<%=
@total
%>
</td>
<td>
<%
if
product
.
status
==
"Active"
%>
<td>
<%=
link_to
"Add Supply"
,
new_product_supply_path
(
product
),
class:
"btn btn-primary"
%>
</td>
<td>
<%=
link_to
"Add Order"
,
new_product_order_path
(
product
),
class:
"btn btn-primary"
%>
</td>
</tr
>
<%
else
%
>
<%
end
%>
</td>
</tr>
<%
end
%>
</tbody>
</table>
<%
end
%>
<%
end
%>
>>>>>>> 6e6754882451c54a2f4e7f2bf5f24cb6d6b1d826
app/views/products/new.html.erb
View file @
34538002
...
...
@@ -3,7 +3,6 @@
<%=
simple_form_for
@product
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:status
,
as: :radio_buttons
,
collection:
[[
'Active'
,
'Active'
],
[
'Inactive'
,
'Inactive'
]],
value_method: :first
,
label_method: :second
%>
<%=
f
.
button
:submit
,
"Create Product"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back"
,
products_path
,
class:
"btn btn-default"
%>
<%
end
%>
app/views/publics/index.html.erb
View file @
34538002
<div
class=
"row"
>
<div
class=
"col"
>
<h3>
Admin
User Log In
</h3>
<h3>
Admin
</h3>
<%=
simple_form_for
:admin_user
,
url:
session_path
(
:admin_user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
...
...
@@ -10,16 +10,18 @@
</div>
<div
class=
"col"
>
<h3>
User
Log In
</h3>
<h3>
User
</h3>
<%=
simple_form_for
:user
,
url:
session_path
(
:user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
submit
'Log In'
,
class:
'btn btn-info'
%>
<%=
f
.
button
:submit
,
"Log In"
,
as: :authenticated_user
,
class:
'btn btn-info'
%>
<%=
link_to
"Sign Up"
,
new_user_registration_path
,
:class
=>
'navbar-link'
%>
<%
end
%>
</div>
</div>
<!-- <body style = "background-image: url(http://www.sunrisecatalogue.com/uploads/posters/duovsvt_ldlcw_YYSRSRC.jpg); background-size: 100%">
</body> -->
</div>
...
...
app/views/supplies/new.html.erb
View file @
34538002
<h1>
New Supply
</h1>
<%=
simple_form_for
@post
do
|
f
|
%>
<%=
f
.
input
:quantity
,
as: :integer
%>
<%=
f
.
button
:submit
,
"Add Supply"
,
class:
"btn btn-info
"
%>
<%=
link_to
"Back"
,
transaction_path
,
class:
"btn
btn-default"
%>
<%=
simple_form_for
([
@product
,
@supply
],
url:
product_supplies_path
)
do
|
f
|
%>
<%=
f
.
input
:quantity
%>
<%=
f
.
button
:submit
,
"Add Supply"
,
class:
"btn btn-primary
"
%>
<%=
link_to
"Back"
,
authenticated_user_root_path
,
class:
"btn-
btn-default"
%>
<%
end
%>
config/routes.rb
View file @
34538002
Rails
.
application
.
routes
.
draw
do
get
'orders/new'
get
'supplies/new'
devise_for
:admin_users
devise_scope
:admin_user
do
authenticated
:admin_user
do
...
...
test/controllers/orders_controller_test.rb
View file @
34538002
...
...
@@ -6,9 +6,4 @@ class OrdersControllerTest < ActionDispatch::IntegrationTest
assert_response
:success
end
test
"should get create"
do
get
orders_create_url
assert_response
:success
end
end
test/controllers/supplies_controller_test.rb
View file @
34538002
require
'test_helper'
class
SuppliesControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should get index"
do
get
supplies_index_url
assert_response
:success
end
test
"should get new"
do
get
supplies_new_url
assert_response
:success
end
test
"should get create"
do
get
supplies_create_url
assert_response
:success
end
end
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