add new files
This commit is contained in:
BIN
app/.DS_Store
vendored
Normal file
BIN
app/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
app/assets/.DS_Store
vendored
Normal file
BIN
app/assets/.DS_Store
vendored
Normal file
Binary file not shown.
3
app/assets/javascripts/api/auth.coffee
Normal file
3
app/assets/javascripts/api/auth.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/api/batch.coffee
Normal file
3
app/assets/javascripts/api/batch.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/api/batch_line_items.coffee
Normal file
3
app/assets/javascripts/api/batch_line_items.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/api/encoder.coffee
Normal file
3
app/assets/javascripts/api/encoder.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/api/encoders.coffee
Normal file
3
app/assets/javascripts/api/encoders.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/batch_line_items.coffee
Normal file
3
app/assets/javascripts/batch_line_items.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/batches.coffee
Normal file
3
app/assets/javascripts/batches.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/encoders.coffee
Normal file
3
app/assets/javascripts/encoders.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/home.coffee
Normal file
3
app/assets/javascripts/home.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/users.coffee
Normal file
3
app/assets/javascripts/users.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/stylesheets/api/auth.scss
Normal file
3
app/assets/stylesheets/api/auth.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the api/auth controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/api/batch.scss
Normal file
3
app/assets/stylesheets/api/batch.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the api/batch controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/api/batch_line_items.scss
Normal file
3
app/assets/stylesheets/api/batch_line_items.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the api/batch_line_items controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/api/encoder.scss
Normal file
3
app/assets/stylesheets/api/encoder.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the api/encoder controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/api/encoders.scss
Normal file
3
app/assets/stylesheets/api/encoders.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the api/encoders controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
17
app/assets/stylesheets/application.scss
Normal file
17
app/assets/stylesheets/application.scss
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
@import "bootstrap.v4a2.min";
|
||||
@import "bootstrap-multiselect";
|
||||
3
app/assets/stylesheets/batch_line_items.scss
Normal file
3
app/assets/stylesheets/batch_line_items.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the batch_line_items controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/batches.scss
Normal file
3
app/assets/stylesheets/batches.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the batches controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/encoders.scss
Normal file
3
app/assets/stylesheets/encoders.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the encoders controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/home.scss
Normal file
3
app/assets/stylesheets/home.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the home controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
89
app/assets/stylesheets/scaffolds.scss
Normal file
89
app/assets/stylesheets/scaffolds.scss
Normal file
@@ -0,0 +1,89 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
margin: 33px;
|
||||
}
|
||||
|
||||
p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
margin: 33px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
|
||||
&:visited {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
th {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-bottom: 7px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
div {
|
||||
&.field, &.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
ul li {
|
||||
font-size: 12px;
|
||||
list-style: square;
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
}
|
||||
259
app/assets/stylesheets/style.css
Normal file
259
app/assets/stylesheets/style.css
Normal file
@@ -0,0 +1,259 @@
|
||||
#nav_bar {
|
||||
z-index: 999;
|
||||
}
|
||||
hr
|
||||
{
|
||||
color: #999;
|
||||
margin-top: -10px;
|
||||
padding: 0px 30px;
|
||||
}
|
||||
.nav_space {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.title {
|
||||
font-size: 17px;
|
||||
}
|
||||
.more {
|
||||
font-size: 12px;
|
||||
}
|
||||
.color_block {
|
||||
background-color: #eee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.text_block {
|
||||
margin: 0px 10px;
|
||||
}
|
||||
.account_block {
|
||||
float: left;
|
||||
width:240px;
|
||||
margin: 0 30px 30px 0;
|
||||
}
|
||||
.account_block a{
|
||||
text-decoration: none;
|
||||
color :#000;
|
||||
}
|
||||
.grad {
|
||||
background: #eee; /* For browsers that do not support gradients */
|
||||
background: -webkit-linear-gradient(#fff, #ddd); /* For Safari 5.1 to 6.0 */
|
||||
background: -o-linear-gradient(#fff, #ddd); /* For Opera 11.1 to 12.0 */
|
||||
background: -moz-linear-gradient(#fff, #ddd); /* For Firefox 3.6 to 15 */
|
||||
background: linear-gradient(#fff, #ddd); /* Standard syntax */
|
||||
}
|
||||
.logout a{
|
||||
text-decoration: none;
|
||||
color : #fff;
|
||||
}
|
||||
/*for mobile view*/
|
||||
@media (max-device-width: 799px) {
|
||||
.desktop {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.content_block_m {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
overflow: auto;
|
||||
}
|
||||
.left_block_m {
|
||||
width: 100%;
|
||||
padding-right: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.left_block_m th{
|
||||
text-align: right;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.left_block_m td{
|
||||
padding-left: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.left_block_m td hr{
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
padding: 0px 15px 0 0;
|
||||
}
|
||||
.right_block_m {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
padding-top: 30px;
|
||||
border-top: 1px dotted #ccc;
|
||||
}
|
||||
.avalible_money_m {
|
||||
width: 100%;
|
||||
}
|
||||
.right_block_m hr{
|
||||
color: #999;
|
||||
margin-top: 10px;
|
||||
padding: 0px 30px;
|
||||
|
||||
}
|
||||
}
|
||||
/*end for mobile view*/
|
||||
|
||||
/*for desktop view*/
|
||||
@media (min-device-width: 800px) {
|
||||
.mobile{
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.content_block {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
overflow: auto;
|
||||
}
|
||||
.left_block {
|
||||
float: left;
|
||||
padding-right: 20px;
|
||||
border-right: 0.1em solid #eee;
|
||||
text-align: center;
|
||||
width: 35%;
|
||||
}
|
||||
.left_block th{
|
||||
text-align: right;
|
||||
padding-left: 10px;
|
||||
width: 50%;
|
||||
}
|
||||
.left_block td{
|
||||
padding-left: 10px;
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.left_block td hr{
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
padding: 0px 15px 0 0;
|
||||
}
|
||||
.right_block {
|
||||
margin-left: 20px;
|
||||
display: inline-block;
|
||||
width: 60%;
|
||||
}
|
||||
.avalible_money {
|
||||
float: right;
|
||||
width: 60%;
|
||||
}
|
||||
.right_block hr{
|
||||
color: #999;
|
||||
margin-top: 10px;
|
||||
padding: 0px 30px;
|
||||
|
||||
}
|
||||
}
|
||||
/*end of desktop view*/
|
||||
.notice {
|
||||
padding-top: 7px;
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
}
|
||||
.gallery {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
overflow: auto;
|
||||
}
|
||||
.gallery ul {
|
||||
list-style-type: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.gallery ul li {
|
||||
float: left;
|
||||
width: 100px;
|
||||
height: 90px;
|
||||
}
|
||||
.img_container {
|
||||
padding :5px;
|
||||
}
|
||||
.gallery ul li .img_text{
|
||||
max-width: 80px !important;
|
||||
height: 20px !important;
|
||||
margin: 0 auto;
|
||||
text-align:center;
|
||||
line-height:8px;
|
||||
font-weight: 200;
|
||||
font-size: 10px;
|
||||
}
|
||||
.list_group {
|
||||
display: inline-block;
|
||||
margin-left: -20px;
|
||||
overflow: auto;
|
||||
}
|
||||
.list_group ul li {
|
||||
padding: 10px 5px;
|
||||
float: left;
|
||||
list-style: none;
|
||||
font-size: 12px;
|
||||
}
|
||||
.circle{
|
||||
-webkit-border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
margin-top: 7px;
|
||||
border-radius:5px;
|
||||
border:1px solid #ccc;
|
||||
width:5px;
|
||||
height:5px;
|
||||
}
|
||||
|
||||
.dl_horizontal {
|
||||
display: block;
|
||||
}
|
||||
.dl_horizontal dl dt{
|
||||
text-align: right;
|
||||
}
|
||||
.dl_horizontal dl dd{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.txt_uppercase {
|
||||
text-transform: uppercase; }
|
||||
.top-content{
|
||||
margin-top: 40px;
|
||||
}
|
||||
.content{
|
||||
margin-top: 45px;
|
||||
}
|
||||
.btn-reset-filter{
|
||||
margin-top: 35px;
|
||||
}
|
||||
.btn-list{
|
||||
margin-top: 31px;
|
||||
}
|
||||
.content .show >.row{
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.btn-show-action,.btn-action{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.btn-show-action{
|
||||
padding-left: 5px;
|
||||
}
|
||||
.form-group{
|
||||
margin-bottom: 23px;
|
||||
}
|
||||
.center{
|
||||
text-align: center;
|
||||
}
|
||||
.right{
|
||||
float:right;
|
||||
}
|
||||
.hide{
|
||||
display: none;
|
||||
}
|
||||
.show{
|
||||
display: block;
|
||||
}
|
||||
.spacer-30{
|
||||
margin-top: 30px;
|
||||
}
|
||||
.container ul.nav>.nav-item{
|
||||
padding-left: 30px;
|
||||
}
|
||||
.container ul.nav>.nav-item:first-child{
|
||||
padding-left: 80px;
|
||||
}
|
||||
3
app/assets/stylesheets/users.scss
Normal file
3
app/assets/stylesheets/users.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the users controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
29
app/controllers/api/auth_controller.rb
Normal file
29
app/controllers/api/auth_controller.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
class Api::AuthController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
def login
|
||||
username = params[:username]
|
||||
access = params[:access_code]
|
||||
|
||||
user = Member.find_by_email(username)
|
||||
if user && user.valid_password?(access)
|
||||
user.session_token = SecureRandom.hex
|
||||
if user.save
|
||||
@out=true,user.session_token
|
||||
else
|
||||
@out=false,"Error occurs in login process."
|
||||
end
|
||||
else
|
||||
@out=false,"Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
def logout
|
||||
login_token = params[:session_token]
|
||||
@user = Member.find_by_session_token(login_token)
|
||||
if !@user.nil?
|
||||
@user.session_token = nil
|
||||
if @user.save
|
||||
return @user
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
57
app/controllers/api/batch_line_items_controller.rb
Normal file
57
app/controllers/api/batch_line_items_controller.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
class Api::BatchLineItemsController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
def register
|
||||
batch_id=params[:batch_id]
|
||||
session_token=params[:session_token]
|
||||
manufacture_uid = params[:manufacture_uid]
|
||||
card_type = params[:card_type]
|
||||
user_id=""
|
||||
|
||||
check_member= Member.authenticate_session_token(session_token)
|
||||
if !check_member.nil?
|
||||
encrypt_key=""
|
||||
find_user=User.find_by_id(check_member.user_id)
|
||||
if !find_user.nil?
|
||||
encrypt_key=find_user.secrect_key
|
||||
user_id=find_user.id
|
||||
end
|
||||
if !encrypt_key.nil?
|
||||
str="manufacture_uid="+manufacture_uid.to_s+"&serial_no="+serial_no.to_s
|
||||
|
||||
digest_data= Digest::MD5.hexdigest(str)
|
||||
hex_data=digest_data.hex
|
||||
hex_str=hex_data.to_s
|
||||
wristband_code=hex_str[0..15]
|
||||
|
||||
check_manufacture = BatchLineItem.find_by_manufacture_uid_and_wristband_code(manufacture_uid,wristband_code)
|
||||
if check_manufacture.nil?
|
||||
serial_no=BatchLineItem.generate_serial_no(user_id.to_s)
|
||||
|
||||
batchLineItem=BatchLineItem.new
|
||||
batchLineItem.wristband_code=wristband_code
|
||||
batchLineItem.serial_no=serial_no
|
||||
batchLineItem.batch_id=batch_id
|
||||
batchLineItem.manufacture_uid = manufacture_uid
|
||||
batchLineItem.card_type = card_type
|
||||
|
||||
if batchLineItem.save
|
||||
lookup=Lookup.find_by_name('generate_serial_no')
|
||||
max_serail_no=lookup.max_value
|
||||
lookup.max_value=max_serail_no.to_i+1
|
||||
lookup.save
|
||||
|
||||
@out = true,batchLineItem.serial_no,batchLineItem.wristband_code
|
||||
else
|
||||
@out=false,'Error occurs in registration encoder!'
|
||||
end
|
||||
else
|
||||
@out=false,'Wristband code is already exists!'
|
||||
end
|
||||
else
|
||||
@out=false,'Invalid Encryption Key!'
|
||||
end
|
||||
else
|
||||
@out=false,'Sorry!Unauthorized user!'
|
||||
end
|
||||
end
|
||||
end
|
||||
73
app/controllers/api/batches_controller.rb
Normal file
73
app/controllers/api/batches_controller.rb
Normal file
@@ -0,0 +1,73 @@
|
||||
class Api::BatchesController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
def create
|
||||
session_token=params[:session_token]
|
||||
check_member= Member.authenticate_session_token(session_token)
|
||||
if !check_member.nil?
|
||||
date = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
created_by = params[:created_by]
|
||||
order_ref = params[:order_ref]
|
||||
card_qty = params[:card_qty]
|
||||
user_id=check_member.user_id
|
||||
batch = Batch.create_batch(created_by,date,order_ref,card_qty,user_id)
|
||||
if !batch.nil?
|
||||
@out=true,batch.id
|
||||
else
|
||||
@out=false,'Error occurs in creating batch!'
|
||||
end
|
||||
else
|
||||
@out = false, "Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
def batch_end
|
||||
session_token=params[:session_token]
|
||||
batch_id=params[:batch_id]
|
||||
|
||||
is_authorize= Member.authenticate_session_token(session_token)
|
||||
|
||||
if is_authorize
|
||||
batch=Batch.find_by_id(batch_id)
|
||||
if !batch.nil?
|
||||
batch.batch_end_time = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
batch.batch_end = true
|
||||
if batch.save
|
||||
@out=true,"Batch end process is successfully finished."
|
||||
else
|
||||
@out=false,'Error occurs in batch end process!'
|
||||
end
|
||||
else
|
||||
@out=false,'Invalid batch no!'
|
||||
end
|
||||
else
|
||||
@out = false, "Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
def resume_batch
|
||||
session_token=params[:session_token]
|
||||
batch_id=params[:batch_id]
|
||||
|
||||
is_authorize= Member.authenticate_session_token(session_token)
|
||||
if is_authorize
|
||||
batch=Batch.find_by_id(batch_id)
|
||||
tickets=batch.tickets.count
|
||||
@out=true,tickets
|
||||
else
|
||||
@out = false, "Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
def batch_progress_list
|
||||
created_by=params[:created_by]
|
||||
|
||||
if !created_by.nil?
|
||||
batches = Batch.where('batch_end is null and created_by=?', created_by)
|
||||
puts batches
|
||||
if !batches.blank?
|
||||
@out=true,batches
|
||||
else
|
||||
@out = false, "No Batch"
|
||||
end
|
||||
else
|
||||
@out = false, "Sorry!Unauthorized user!"
|
||||
end
|
||||
end
|
||||
end
|
||||
36
app/controllers/batch_line_items_controller.rb
Normal file
36
app/controllers/batch_line_items_controller.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
class BatchLineItemsController < ApplicationController
|
||||
require "csv"
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_action :authenticate_member!
|
||||
def index
|
||||
@batches=Batch.all
|
||||
@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id').select('batch_line_items.*,batches.order_ref as batch_name').page(params[:page]).per(2)
|
||||
end
|
||||
def create
|
||||
batch_list=params[:batch]
|
||||
if ! batch_list.nil?
|
||||
batch_list.each do |batch|
|
||||
find_batch=Batch.find_by_id(batch)
|
||||
if !find_batch.nil?
|
||||
export_count=find_batch.export_count
|
||||
find_batch.export_count=export_count.to_i+1
|
||||
find_batch.save
|
||||
end
|
||||
end
|
||||
@batchLineItems = BatchLineItem.where('batch_id in (?) ',batch_list).select('*')
|
||||
else
|
||||
user_id=current_member.user_id
|
||||
batches=Batch.all
|
||||
batches.each do |batch|
|
||||
export_count=batch.export_count
|
||||
batch.export_count=export_count.to_i+1
|
||||
batch.save
|
||||
end
|
||||
@batchLineItems = BatchLineItem.all.select('serial_no,wristband_code,batch_id,manufacture_uid,card_type')
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv { send_data @batchLineItems.to_csv(user_id), filename: "encoder-#{Date.today}.csv" }
|
||||
end
|
||||
end
|
||||
end
|
||||
5
app/controllers/batches_controller.rb
Normal file
5
app/controllers/batches_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class BatchesController < ApplicationController
|
||||
def index
|
||||
@batches=Batch.all.page(params[:page]).per(2)
|
||||
end
|
||||
end
|
||||
10
app/controllers/home_controller.rb
Normal file
10
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class HomeController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
|
||||
def index
|
||||
redirect_to new_member_session_path
|
||||
end
|
||||
def dashboard
|
||||
@users=User.all
|
||||
end
|
||||
end
|
||||
98
app/controllers/users_controller.rb
Normal file
98
app/controllers/users_controller.rb
Normal file
@@ -0,0 +1,98 @@
|
||||
class UsersController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /users
|
||||
# GET /users.json
|
||||
def index
|
||||
@users = User.all.page(params[:page])
|
||||
end
|
||||
|
||||
# GET /users/1
|
||||
# GET /users/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /users/new
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
# GET /users/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /users
|
||||
# POST /users.json
|
||||
def create
|
||||
@user = User.new(user_params)
|
||||
email=params[:registered_email]
|
||||
@user.is_active=true
|
||||
respond_to do |format|
|
||||
if @user.save
|
||||
member_id= current_member.id
|
||||
member=Member.find_by_email(email)
|
||||
|
||||
if !member.nil?
|
||||
member.user_id =@user.id
|
||||
member.save
|
||||
end
|
||||
|
||||
format.html { redirect_to @user, notice: 'User was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @user }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @user.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /users/1
|
||||
# PATCH/PUT /users/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @user.update(user_params)
|
||||
format.html { redirect_to @user, notice: 'User was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @user }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @user.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /users/1
|
||||
# DELETE /users/1.json
|
||||
def destroy
|
||||
@user.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
def check_registered_email
|
||||
registered_email = params[:registered_email]
|
||||
member =Member.find_by_email(registered_email)
|
||||
if !member.nil?
|
||||
if member.user_id.nil?
|
||||
render json: {:status => 'true'}
|
||||
else
|
||||
user = User.find_by_id(member.user_id)
|
||||
render json: {:status => 'false',:data => user}
|
||||
end
|
||||
else
|
||||
render json: {:status => 'false',:data => nil}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active,:secrect_key)
|
||||
end
|
||||
end
|
||||
2
app/helpers/api/auth_helper.rb
Normal file
2
app/helpers/api/auth_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::AuthHelper
|
||||
end
|
||||
2
app/helpers/api/batch_helper.rb
Normal file
2
app/helpers/api/batch_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::BatchHelper
|
||||
end
|
||||
2
app/helpers/api/batch_line_items_helper.rb
Normal file
2
app/helpers/api/batch_line_items_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::BatchLineItemsHelper
|
||||
end
|
||||
2
app/helpers/api/encoder_helper.rb
Normal file
2
app/helpers/api/encoder_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::EncoderHelper
|
||||
end
|
||||
2
app/helpers/api/encoders_helper.rb
Normal file
2
app/helpers/api/encoders_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::EncodersHelper
|
||||
end
|
||||
2
app/helpers/batch_line_items_helper.rb
Normal file
2
app/helpers/batch_line_items_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module BatchLineItemsHelper
|
||||
end
|
||||
2
app/helpers/batches_helper.rb
Normal file
2
app/helpers/batches_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module BatchesHelper
|
||||
end
|
||||
2
app/helpers/encoders_helper.rb
Normal file
2
app/helpers/encoders_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module EncodersHelper
|
||||
end
|
||||
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module HomeHelper
|
||||
end
|
||||
2
app/helpers/users_helper.rb
Normal file
2
app/helpers/users_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module UsersHelper
|
||||
end
|
||||
22
app/models/batch.rb
Normal file
22
app/models/batch.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class Batch < ApplicationRecord
|
||||
has_many :batch_line_item
|
||||
|
||||
def self.create_batch(created_by,date,order_ref, card_qty,user_id)
|
||||
batch = Batch.new
|
||||
batch.created_by = created_by
|
||||
batch.order_ref = order_ref
|
||||
batch.date = date
|
||||
batch.batch_start = true
|
||||
batch.batch_start_time=DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
batch.qty_processing = card_qty.to_i
|
||||
batch.qty_success = 0
|
||||
batch.qty_fail = 0
|
||||
batch.user_id=user_id
|
||||
batch.export_count=0
|
||||
if batch.save
|
||||
return batch
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
89
app/models/batch_line_item.rb
Normal file
89
app/models/batch_line_item.rb
Normal file
@@ -0,0 +1,89 @@
|
||||
class BatchLineItem < ApplicationRecord
|
||||
belongs_to :batch
|
||||
attr_accessor :wristband_token
|
||||
|
||||
def self.generate_account_no
|
||||
super_merchant = "101"
|
||||
account_type='1'
|
||||
location='101'
|
||||
|
||||
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||
random_account_no = (0...9).map { o[rand(o.length)] }.join
|
||||
|
||||
account_no = super_merchant+account_type+location+random_account_no
|
||||
find_account_no = BatchLineItem.find_by_wristband_code(account_no)
|
||||
if !find_account_no.nil?
|
||||
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||
random_account_no = (0...9).map { o[rand(o.length)] }.join
|
||||
account_no = super_merchant+account_type+location+random_account_no
|
||||
end
|
||||
return account_no
|
||||
end
|
||||
|
||||
def self.generate_serial_no(user_id)
|
||||
find_lookup=Lookup.find_by_name('generate_serial_no')
|
||||
if !find_lookup.nil?
|
||||
max_value=find_lookup.max_value
|
||||
max_value=max_value +1
|
||||
prefix=find_lookup.prefix
|
||||
max_length=find_lookup.max_length
|
||||
sufix_len=max_length-prefix.length
|
||||
sufix_str="0" * sufix_len
|
||||
value_len= max_value.to_s.length
|
||||
start=0
|
||||
ends=sufix_len-value_len-1
|
||||
sufix_str= sufix_str[start..ends]
|
||||
prefix=prefix[start..2]
|
||||
prefix_str=prefix.to_s + user_id.to_s
|
||||
|
||||
serial_no=prefix_str.to_s+sufix_str+max_value.to_s
|
||||
return serial_no
|
||||
end
|
||||
end
|
||||
def self.to_csv(user_id)
|
||||
encrypt_key=""
|
||||
|
||||
find_user=User.find_by_id(user_id)
|
||||
if !find_user.nil?
|
||||
encrypt_key=find_user.secrect_key
|
||||
end
|
||||
attributes = %w{serial_no wristband_code batch_id manufacture_uid card_type wristband_token}
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << attributes
|
||||
all.each do |encoder|
|
||||
str="manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
|
||||
encryptd_data=BatchLineItem.encrypted(str,encrypt_key)
|
||||
encoder.wristband_token=encryptd_data
|
||||
|
||||
csv << attributes.map{ |attr| encoder.send(attr)}
|
||||
end
|
||||
end
|
||||
end
|
||||
def self.encrypted(message,encrypt_key)
|
||||
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
||||
cipher.encrypt
|
||||
|
||||
key = Digest::SHA1.hexdigest(encrypt_key)
|
||||
iv =encrypt_key
|
||||
|
||||
cipher.key = encrypt_key
|
||||
cipher.iv = encrypt_key
|
||||
|
||||
encrypted = cipher.update(message)
|
||||
encrypted << cipher.final
|
||||
|
||||
encrypted=Base64.encode64(encrypted)
|
||||
|
||||
return encrypted
|
||||
end
|
||||
# def self.encrypted(data,encrypt_key)
|
||||
# crypt = ActiveSupport::MessageEncryptor.new(encrypt_key)
|
||||
# encrypted_data = crypt.encrypt_and_sign(data)
|
||||
# encrypted_data=Digest::MD5.hexdigest(encrypted_data)
|
||||
|
||||
# data=encrypted_data.hex
|
||||
# data=data.to_s
|
||||
|
||||
# return data[0..15]
|
||||
# end
|
||||
end
|
||||
2
app/models/lookup.rb
Normal file
2
app/models/lookup.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Lookup < ApplicationRecord
|
||||
end
|
||||
21
app/models/member.rb
Normal file
21
app/models/member.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class Member < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
belongs_to :user,optional: true
|
||||
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable,:uid, :confirmable, :lockable
|
||||
|
||||
def self.authenticate_session_token(token)
|
||||
if token.nil? || token.blank? || token.to_s == ' '
|
||||
return false
|
||||
else
|
||||
mem = Member.find_by_session_token(token)
|
||||
if mem.nil?
|
||||
return false
|
||||
else
|
||||
return mem
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
4
app/models/user.rb
Normal file
4
app/models/user.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class User < ApplicationRecord
|
||||
has_many :members
|
||||
validates :name, presence: { message: "Please enter name." }
|
||||
end
|
||||
BIN
app/views/.DS_Store
vendored
Normal file
BIN
app/views/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
app/views/api/.DS_Store
vendored
Normal file
BIN
app/views/api/.DS_Store
vendored
Normal file
Binary file not shown.
7
app/views/api/auth/login.json.jbuilder
Normal file
7
app/views/api/auth/login.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :data, @out[1]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
end
|
||||
7
app/views/api/auth/logout.json.jbuilder
Normal file
7
app/views/api/auth/logout.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if (@user)
|
||||
json.status true
|
||||
json.extract! @user, :id
|
||||
else
|
||||
json.status false
|
||||
json.message "Logout Failed."
|
||||
end
|
||||
8
app/views/api/batch_line_items/register.json.jbuilder
Normal file
8
app/views/api/batch_line_items/register.json.jbuilder
Normal file
@@ -0,0 +1,8 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :serial_no, @out[1]
|
||||
json.set! :wristband_code, @out[2]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
end
|
||||
2
app/views/api/batches/batch_end.json.jbuilder
Normal file
2
app/views/api/batches/batch_end.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
7
app/views/api/batches/batch_progress_list.json.jbuilder
Normal file
7
app/views/api/batches/batch_progress_list.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :data, @out[1]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
end
|
||||
7
app/views/api/batches/create.json.jbuilder
Normal file
7
app/views/api/batches/create.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :data, @out[1]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
end
|
||||
7
app/views/api/batches/resume_batch.json.jbuilder
Normal file
7
app/views/api/batches/resume_batch.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @out[0] == true
|
||||
json.set! :status, @out[0]
|
||||
json.set! :data, @out[1]
|
||||
else
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message,@out[1]
|
||||
end
|
||||
0
app/views/batch_line_items/create.csv.erb
Normal file
0
app/views/batch_line_items/create.csv.erb
Normal file
0
app/views/batch_line_items/create.html.erb
Normal file
0
app/views/batch_line_items/create.html.erb
Normal file
66
app/views/batch_line_items/index.html.erb
Normal file
66
app/views/batch_line_items/index.html.erb
Normal file
@@ -0,0 +1,66 @@
|
||||
<div class="row ">
|
||||
<nav class="breadcrumb">
|
||||
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
|
||||
<a class="breadcrumb-item active" href="#">Batch Line Item List</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row top-content">
|
||||
<%= form_tag export_path(:format => :csv),:method => :post do%>
|
||||
<div class="col-lg-7">
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<label><strong>Choose Batch:</strong></label>
|
||||
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple" >
|
||||
<% @batches.each do |batch| %>
|
||||
<option value="<%= batch.id %>"><%= batch.order_ref %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
<%= button_tag "Export CSV",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>Batch Line Item List</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table" style="border-top:none">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Serail No</th>
|
||||
<th>Wristband Code</th>
|
||||
<th>Manufacture UID</th>
|
||||
<th>Batch No</th>
|
||||
<th>Card Type</th>
|
||||
<th>Created At </th>
|
||||
<th>Update At </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @batchLineItems.each do |item| %>
|
||||
<tr>
|
||||
<td><%= item.serial_no rescue '' %></td>
|
||||
<td><%= item.wristband_code rescue '' %></td>
|
||||
<td><%= item.manufacture_uid rescue '' %></td>
|
||||
<td><%= item.batch_name rescue '' %></td>
|
||||
<td><%= item.card_type rescue '' %></td>
|
||||
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||
<td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%=paginate @batchLineItems %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#batch').multiselect()
|
||||
$("#batch").multiselect("refresh");
|
||||
|
||||
})
|
||||
</script>
|
||||
42
app/views/batches/index.html.erb
Normal file
42
app/views/batches/index.html.erb
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="row ">
|
||||
<nav class="breadcrumb">
|
||||
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
|
||||
<a class="breadcrumb-item active" href="#">Batches</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>Batch List</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table" style="border-top:none">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order Ref</th>
|
||||
<th>Created By</th>
|
||||
<th>Qty Processing</th>
|
||||
<th>Qty Success</th>
|
||||
<th>Qty Fail</th>
|
||||
<th>Export Count</th>
|
||||
<th>Creatd At</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @batches.each do |batch| %>
|
||||
<tr>
|
||||
<td><%= batch.order_ref rescue '' %></td>
|
||||
<td><%= batch.created_by rescue '' %></td>
|
||||
<td><%= batch.qty_processing rescue '' %></td>
|
||||
<td><%= batch.qty_success rescue '' %></td>
|
||||
<td><%= batch.qty_fail rescue '' %></td>
|
||||
<td><%= batch.export_count %></td>
|
||||
<td><%= batch.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @batches %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
17
app/views/devise/confirmations/new.html.erb
Normal file
17
app/views/devise/confirmations/new.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" >
|
||||
<h4>Resend confirmation instructions</h4>
|
||||
<div class="form-group">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email),:class =>"form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend confirmation instructions" ,:class=> "btn btn-lg btn-primary btn-block"%>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>Welcome <%= @email %>!</p>
|
||||
|
||||
<p>You can confirm your account email through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
||||
3
app/views/devise/mailer/password_change.html.erb
Normal file
3
app/views/devise/mailer/password_change.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>We're contacting you to notify you that your password has been changed.</p>
|
||||
@@ -0,0 +1,8 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
||||
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
||||
25
app/views/devise/passwords/edit.html.erb
Normal file
25
app/views/devise/passwords/edit.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||
<% end %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change my password" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
18
app/views/devise/passwords/new.html.erb
Normal file
18
app/views/devise/passwords/new.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" >
|
||||
<h4>Forgot your password?</h4>
|
||||
<div class="form-group">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true,:class =>"form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Send me reset password instructions" ,:class=> "btn btn-lg btn-primary btn-block"%>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
<% end %>
|
||||
43
app/views/devise/registrations/edit.html.erb
Normal file
43
app/views/devise/registrations/edit.html.erb
Normal file
@@ -0,0 +1,43 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
<% if @minimum_password_length %>
|
||||
<br />
|
||||
<em><%= @minimum_password_length %> characters minimum</em>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Update" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
28
app/views/devise/registrations/new.html.erb
Normal file
28
app/views/devise/registrations/new.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" >
|
||||
<h4>Sign up</h4>
|
||||
<div class="form-group">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true,:class =>"form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :password %>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" ,:class =>"form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off",:class =>"form-control" %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit "Sign up" ,:class=> "btn btn-lg btn-primary btn-block"%>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
28
app/views/devise/sessions/new.html.erb
Normal file
28
app/views/devise/sessions/new.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<div class="content">
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" >
|
||||
<h4>Log in</h4>
|
||||
<div class ="form-group" >
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true ,:class =>"form-control" %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<%= f.label :password %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" ,:class=>"form-control" %>
|
||||
</div>
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div class ="form-group" >
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me %>
|
||||
</div>
|
||||
<% end -%>
|
||||
<div class="actions">
|
||||
<%= f.submit "Log in" ,:class=> "btn btn-lg btn-primary btn-block"%>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
25
app/views/devise/shared/_links.html.erb
Normal file
25
app/views/devise/shared/_links.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
16
app/views/devise/unlocks/new.html.erb
Normal file
16
app/views/devise/unlocks/new.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6">
|
||||
<h4>Resend unlock instructions</h4>
|
||||
<div class="form-group">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true ,:class =>"form-control"%>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend unlock instructions",:class=> "btn btn-lg btn-primary btn-block" %>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
<% end %>
|
||||
34
app/views/home/dashboard.html.erb
Normal file
34
app/views/home/dashboard.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>User List</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table" style="border-top:none">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Nrc</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th>Address</th>
|
||||
<th>Status</th>
|
||||
<th>Created At </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user.name rescue '' %></td>
|
||||
<td><%= user.nrc rescue '' %></td>
|
||||
<td><%= user.email rescue '' %></td>
|
||||
<td><%= user.phone rescue '' %></td>
|
||||
<td><%= user.address rescue '' %></td>
|
||||
<td><%= user.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
35
app/views/layouts/_navigation.html.erb
Normal file
35
app/views/layouts/_navigation.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<nav class="navbar navbar-dark navbar-fixed-top" style="background:#1E90FF">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="/">Nemo Encoder</a>
|
||||
</div>
|
||||
<% if member_signed_in? %>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item">
|
||||
<%= link_to "Home", dashboard_path, :class => "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "Batches",batches_path, :class => "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "Issued Batch Item",batch_line_items_path, :class => "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "User",users_path, :class => "nav-link" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="float-xs-right">
|
||||
<ul class="nav navbar-nav right">
|
||||
<li class="nav-item"><%= link_to "Logout", destroy_member_session_path, :tabindex =>"-1", :class => "nav-link", :method => :delete %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="float-xs-right">
|
||||
<ul class="nav navbar-nav right">
|
||||
<li class="nav-item"><%= link_to "Login", new_member_session_path, :tabindex =>"-1", :class => "nav-link" %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</nav>
|
||||
130
app/views/users/_form.html.erb
Normal file
130
app/views/users/_form.html.erb
Normal file
@@ -0,0 +1,130 @@
|
||||
|
||||
<%= simple_form_for(@user) do |f| %>
|
||||
<nav class="breadcrumb">
|
||||
<a class="breadcrumb-item" href="<%= dashboard_path %>">Home</a>
|
||||
<a class="breadcrumb-item active" href="<%= users_path %>">User</a>
|
||||
<a class="breadcrumb-item active" href="#">
|
||||
<% if !@user.id.nil? %>
|
||||
Edit
|
||||
<% else %>
|
||||
New
|
||||
<% end %>
|
||||
</a>
|
||||
</nav>
|
||||
<div class="content">
|
||||
<% if @user.id.nil? %>
|
||||
<div class="row">
|
||||
<div class="col-md-5" >
|
||||
<div class="form-group">
|
||||
<label for="email" class="string optional control-label">Registered Email:</label>
|
||||
<input type="text" id="registered_email" name="registered_email" class="form-control" placeholder="Please enter member mail">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<label for="email" class="string optional control-label"> </label>
|
||||
<button type="button" class="btn btn-primary" style="float:right;" id="check_email" >Check</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="col-md-6" id="textbox_group">
|
||||
<div class ="form-group" >
|
||||
<label for="name" class="string optional control-label">Name:</label>
|
||||
<%= f.input :name ,:label =>false,:error => false,:placeholder =>'Please enter user name',input_html: { class: "form-control" } %>
|
||||
<%= f.error :name ,style: 'color: red' %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label for="nrc" class="string optional control-label">NRC:</label>
|
||||
<%= f.input :nrc ,:error=>false,:label =>false,:placeholder =>'Please enter user NRC',input_html: { class: "form-control" } %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label for="email" class="string optional control-label">Email:</label>
|
||||
<%= f.input :email ,:error=>false,:label =>false ,:placeholder =>'Please enter user email',input_html: { class: "form-control" } %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label for="phone" class="string optional control-label">Phone:</label>
|
||||
<%= f.input :phone,:error=>false,:label =>false,:placeholder =>'Please enter user phone',input_html: { class: "form-control" } %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label for="address" class="string optional control-label">Address:</label>
|
||||
<%= f.input :address,:error=>false,:label =>false,:placeholder =>'Please enter user address',input_html: { class: "form-control" } %>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label for="secret_key" class="string optional control-label">Secrect Key:</label>
|
||||
<%= f.input :secrect_key,:error=>false,:label =>false,:placeholder =>'Please enter user secret key',input_html: { class: "form-control" } %>
|
||||
</div>
|
||||
<% if !@user.id.nil? %>
|
||||
<div class ="form-group" >
|
||||
<label for="is_active" class="string optional control-label">Active:</label>
|
||||
<%= f.check_box :is_active %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class ="form-group" >
|
||||
<label></label>
|
||||
<div class="actions">
|
||||
<%= f.button :submit, :class => 'btn btn-primary',:id =>'btn_submit' %>
|
||||
<%= link_to 'Cancel', users_path ,:class => 'btn btn-primary',:id => 'btnback' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<script >
|
||||
$(document).ready(function() {
|
||||
status='disabled'
|
||||
name=$("#user_name").val()
|
||||
if (name.trim() !=""){
|
||||
status=''
|
||||
}
|
||||
enable_control(status)
|
||||
|
||||
$("#check_email").click(function(){
|
||||
registered_email = $("#registered_email").val();
|
||||
$.ajax({
|
||||
type:'get',
|
||||
url: '<%= check_registered_email_path %>',
|
||||
data:'registered_email='+ registered_email ,
|
||||
success:function(result){
|
||||
// $("#show-data").html('')
|
||||
if (result.status == 'true'){
|
||||
enable_control(false)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.data === null){
|
||||
enable_control(true)
|
||||
}
|
||||
else
|
||||
{
|
||||
$(result.data).each(function(i){
|
||||
name = result.data.name
|
||||
nrc =result.data.nrc
|
||||
phone =result.data.phone
|
||||
address =result.data.address
|
||||
email = result.data.email
|
||||
|
||||
$("#user_name").val(name)
|
||||
$("#user_email").val(email)
|
||||
$("#user_nrc").val(nrc)
|
||||
$("#user_phone").val(email)
|
||||
$("#user_address").val(address)
|
||||
$("#btn_submit").hide()
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
function enable_control(status){
|
||||
$("#user_name").prop('disabled',status);
|
||||
$("#user_email").prop('disabled',status);
|
||||
$("#user_nrc").prop('disabled',status);
|
||||
$("#user_phone").prop('disabled',status);
|
||||
$("#user_address").prop('disabled',status);
|
||||
$("#btn_submit").prop('disabled',status)
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
2
app/views/users/_user.json.jbuilder
Normal file
2
app/views/users/_user.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! user, :id, :created_at, :updated_at
|
||||
json.url user_url(user, format: :json)
|
||||
1
app/views/users/edit.html.erb
Normal file
1
app/views/users/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render 'form' %>
|
||||
54
app/views/users/index.html.erb
Normal file
54
app/views/users/index.html.erb
Normal file
@@ -0,0 +1,54 @@
|
||||
<div class="row ">
|
||||
<nav class="breadcrumb">
|
||||
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
|
||||
<a class="breadcrumb-item active" href="#">Users</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row top-content">
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_user_path,:class => 'btn btn-primary' %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>User List</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table" style="border-top:none">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Nrc</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th>Address</th>
|
||||
<th>Status</th>
|
||||
<th>Created At </th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user.name rescue '' %></td>
|
||||
<td><%= user.nrc rescue '' %></td>
|
||||
<td><%= user.email rescue '' %></td>
|
||||
<td><%= user.phone rescue '' %></td>
|
||||
<td><%= user.address rescue '' %></td>
|
||||
<td><%= user.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||
<td>
|
||||
<%= link_to 'Detail',
|
||||
user_path(user), :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
edit_user_path(user), :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to 'Delete', user_path(user), method: :delete, data: { confirm: 'Are you sure?' },:class => 'btn btn-primary btn-sm' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%=paginate @users %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/users/index.json.jbuilder
Normal file
1
app/views/users/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @users, partial: 'users/user', as: :user
|
||||
1
app/views/users/new.html.erb
Normal file
1
app/views/users/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render 'form' %>
|
||||
51
app/views/users/show.html.erb
Normal file
51
app/views/users/show.html.erb
Normal file
@@ -0,0 +1,51 @@
|
||||
<div class="row">
|
||||
<nav class="breadcrumb">
|
||||
<a class="breadcrumb-item" href="<%= dashboard_path %>">Home</a>
|
||||
<a class="breadcrumb-item active" href="<%= users_path %>">Users</a>
|
||||
<a class="breadcrumb-item active" href="#">Show</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="col-lg-6 show">
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>Name:</strong></div>
|
||||
<div class="col-lg-8 uppercase"><%= @user.name %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>NRC:</strong></div>
|
||||
<div class="col-lg-8"><%= @user.nrc %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>Email:</strong></div>
|
||||
<div class="col-lg-8"><%= @user.email %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>Phone:</strong></div>
|
||||
<div class="col-lg-8"><%= @user.phone %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>Address:</strong></div>
|
||||
<div class="col-lg-8"><%= @user.address %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4"><strong>Active:</strong></div>
|
||||
<div class="col-lg-8">
|
||||
|
||||
<% if @user.is_active %>
|
||||
<input type="checkbox" checked disabled="true" />
|
||||
<% else %>
|
||||
<input type="checkbox" disabled="true"/>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-lg-4 btn-show-action">
|
||||
<%= link_to 'Edit', edit_user_path(@user),:class => 'btn btn-primary' %>
|
||||
<%= link_to 'Back', users_path ,:class => 'btn btn-primary'%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/users/show.json.jbuilder
Normal file
1
app/views/users/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "users/user", user: @user
|
||||
Reference in New Issue
Block a user