add new files
This commit is contained in:
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