vyapari 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +49 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/vyapari_manifest.js +2 -0
  6. data/app/assets/javascripts/vyapari/application.js +13 -0
  7. data/app/assets/stylesheets/vyapari/application.css +15 -0
  8. data/app/controllers/vyapari/admin/base_controller.rb +17 -0
  9. data/app/controllers/vyapari/admin/countries_controller.rb +64 -0
  10. data/app/controllers/vyapari/admin/dashboard_controller.rb +26 -0
  11. data/app/controllers/vyapari/admin/exchange_rates_controller.rb +70 -0
  12. data/app/controllers/vyapari/admin/regions_controller.rb +67 -0
  13. data/app/controllers/vyapari/admin/resource_controller.rb +15 -0
  14. data/app/controllers/vyapari/admin/users_controller.rb +130 -0
  15. data/app/controllers/vyapari/application_controller.rb +13 -0
  16. data/app/helpers/vyapari/application_helper.rb +4 -0
  17. data/app/jobs/vyapari/application_job.rb +4 -0
  18. data/app/mailers/vyapari/application_mailer.rb +6 -0
  19. data/app/models/brand.rb +114 -0
  20. data/app/models/category.rb +116 -0
  21. data/app/models/country.rb +45 -0
  22. data/app/models/exchange_rate.rb +38 -0
  23. data/app/models/product.rb +139 -0
  24. data/app/models/region.rb +58 -0
  25. data/app/models/vyapari/application_record.rb +6 -0
  26. data/app/views/layouts/kuppayam/_footer.html.erb +25 -0
  27. data/app/views/layouts/kuppayam/_header.html.erb +43 -0
  28. data/app/views/layouts/kuppayam/_navbar.html.erb +55 -0
  29. data/app/views/layouts/kuppayam/_sidebar.html.erb +136 -0
  30. data/app/views/vyapari/admin/countries/_form.html.erb +24 -0
  31. data/app/views/vyapari/admin/countries/_index.html.erb +51 -0
  32. data/app/views/vyapari/admin/countries/_row.html.erb +26 -0
  33. data/app/views/vyapari/admin/countries/_show.html.erb +73 -0
  34. data/app/views/vyapari/admin/countries/index.html.erb +32 -0
  35. data/app/views/vyapari/admin/dashboard/index.html.erb +52 -0
  36. data/app/views/vyapari/admin/exchange_rates/_form.html.erb +28 -0
  37. data/app/views/vyapari/admin/exchange_rates/_index.html.erb +57 -0
  38. data/app/views/vyapari/admin/exchange_rates/_row.html.erb +30 -0
  39. data/app/views/vyapari/admin/exchange_rates/_show.html.erb +72 -0
  40. data/app/views/vyapari/admin/exchange_rates/index.html.erb +32 -0
  41. data/app/views/vyapari/admin/regions/_form.html.erb +28 -0
  42. data/app/views/vyapari/admin/regions/_index.html.erb +54 -0
  43. data/app/views/vyapari/admin/regions/_row.html.erb +28 -0
  44. data/app/views/vyapari/admin/regions/_show.html.erb +74 -0
  45. data/app/views/vyapari/admin/regions/index.html.erb +32 -0
  46. data/app/views/vyapari/admin/users/_form.html.erb +39 -0
  47. data/app/views/vyapari/admin/users/_index.html.erb +101 -0
  48. data/app/views/vyapari/admin/users/_row.html.erb +72 -0
  49. data/app/views/vyapari/admin/users/_show.html.erb +199 -0
  50. data/app/views/vyapari/admin/users/index.html.erb +64 -0
  51. data/config/routes.rb +28 -0
  52. data/db/migrate/20170000000200_create_exchange_rates.rb +16 -0
  53. data/db/migrate/20170000000201_create_countries.rb +12 -0
  54. data/db/migrate/20170000000202_create_regions.rb +16 -0
  55. data/lib/tasks/vyapari_tasks.rake +4 -0
  56. data/lib/vyapari/engine.rb +20 -0
  57. data/lib/vyapari/version.rb +3 -0
  58. data/lib/vyapari.rb +5 -0
  59. metadata +401 -0
@@ -0,0 +1,74 @@
1
+ <div id="div_region_show">
2
+
3
+ <div class="row">
4
+
5
+ <div class="col-md-9 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
6
+
7
+ <div class="visible-sm visible-xs mt-50"></div>
8
+
9
+ <%= theme_panel_heading(@region.display_name) %>
10
+ <%= theme_panel_sub_heading(@region.code, "#") %>
11
+ <%= theme_panel_description(@region.country.name) if @region.country %>
12
+
13
+ <%= clear_tag(10) %>
14
+
15
+ <div class="visible-sm visible-xs mb-50"></div>
16
+
17
+ </div>
18
+
19
+ <div class="col-md-3 col-sm-12 col-xs-12">
20
+
21
+ <% edit_link = edit_admin_region_path(id: @region.id) %>
22
+ <% delete_link = admin_region_path(id: @region.id) %>
23
+
24
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @region.can_be_edited? %>
25
+
26
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, region: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @region.can_be_deleted? %>
27
+
28
+ <div class="visible-sm visible-xs mb-50"></div>
29
+
30
+ </div>
31
+
32
+ </div>
33
+
34
+ <%= clear_tag(50) %>
35
+
36
+ <ul class="nav nav-pills">
37
+ <li class="active">
38
+ <a href="#technical_details" data-toggle="tab" aria-expanded="false">
39
+ <span class="visible-xs"><i class="fa-database"></i></span>
40
+ <span class="hidden-xs">Technical Details</span>
41
+ </a>
42
+ </li>
43
+ </ul>
44
+
45
+ <div class="tab-content">
46
+ <div class="tab-pane active" id="technical_details">
47
+
48
+ <%= clear_tag(20) %>
49
+
50
+ <div class="table-responsive">
51
+ <table class="table table-striped table-condensed table-bordered mb-30">
52
+ <tbody>
53
+
54
+ <tr>
55
+ <th>ID</th><td colspan="3"><%= @region.id %></td>
56
+ </tr>
57
+
58
+ <tr>
59
+ <th>Created At</th><td><%= @region.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @region.created_at %></td>
60
+ <th>Updated At</th><td><%= @region.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @region.updated_at %></td>
61
+ </tr>
62
+
63
+ </tbody>
64
+ </table>
65
+
66
+ </div>
67
+
68
+ </div>
69
+ </div>
70
+
71
+ <%= link_to "Close", "#", onclick: "closeGenericModal();", class: "btn btn-primary pull-right" %>
72
+
73
+ <%= clear_tag %>
74
+ </div>
@@ -0,0 +1,32 @@
1
+ <div class="row">
2
+
3
+ <div class="col-md-12">
4
+
5
+ <ul class="nav nav-tabs">
6
+ </ul>
7
+ <div class="tab-content">
8
+ <div class="tab-pane active">
9
+
10
+ <div id="div_region_action_buttons">
11
+ <div class="row">
12
+ <div class="col-md-4">
13
+ <%= link_to raw("<i class='fa fa-plus mr-10'></i><span class='btn-text'> New Region</span>"), new_admin_region_path, :class=>"btn btn-primary pull-left mb-5", :remote=>true %>
14
+ </div>
15
+ <div class="col-md-8">
16
+ <%= search_form_kuppayam(Region, admin_regions_path, text: @filters[:query]) %>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ <%= clear_tag(10) %>
21
+
22
+ <div id="div_region_index">
23
+ <%= render :partial=>"vyapari/admin/regions/index" %>
24
+ </div>
25
+ <%= clear_tag(10) %>
26
+
27
+ </div>
28
+ </div>
29
+
30
+ </div>
31
+
32
+ </div>
@@ -0,0 +1,39 @@
1
+ <%= form_for([:admin, @user], :html => {:id=>"form_user", :class=>"mb-0 form-horizontal", :role => "form", :method => (@user.new_record? ? :post : :put), :remote=>true}) do |f| %>
2
+
3
+ <div id="user_form_error">
4
+ <%= @user.errors[:base].to_sentence %>
5
+ </div>
6
+
7
+ <div class="form-inputs mb-30 mt-30">
8
+
9
+ <div class="row">
10
+ <div class="col-md-6 col-xs-12">
11
+ <%= theme_form_field(@user, :name) %>
12
+ <%= theme_form_field(@user, :username) %>
13
+ <%= theme_form_field(@user, :email) %>
14
+ <%= theme_form_field(@user, :designation, required: false) %>
15
+ </div>
16
+
17
+ <div class="col-md-6 col-xs-12">
18
+ <%= theme_form_field(@user, :phone, required: false) %>
19
+ <% if @user.new_record? %>
20
+ <%= theme_form_field(@user, :password, required: true, html_options: {type: :password}) %>
21
+ <%= theme_form_field(@user, :password_confirmation, required: true, html_options: {type: :password}, label: "Retype Password") %>
22
+ <% end %>
23
+ </div>
24
+ </div>
25
+
26
+ </div>
27
+
28
+ <div>
29
+
30
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
31
+
32
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
33
+
34
+ </div>
35
+ <%= clear_tag(10) %>
36
+ </div>
37
+
38
+ <% end %>
39
+
@@ -0,0 +1,101 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:10px">#</th>
6
+ <th style="text-align: center;width:30px">Image</th>
7
+ <th>Name</th>
8
+ <th class="hidden-xs hidden-sm">Username</th>
9
+ <th class="hidden-xs hidden-sm">Email</th>
10
+ <% if @current_user.is_super_admin? %>
11
+ <th class="hidden-xs hidden-sm">Role</th>
12
+ <% end %>
13
+ <th>Status</th>
14
+ <th style="text-align: center;" colspan="2">Actions</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @users.each_with_index do |user, i| %>
19
+
20
+ <% edit_link = edit_admin_user_path(id: user.id) %>
21
+ <% delete_link = admin_user_path(id: user.id) %>
22
+
23
+ <tr id="tr_user_<%= user.id %>">
24
+
25
+ <!-- <td class="user-cb">
26
+ <input type="checkbox" class="cbr" name="users[]" value="1" checked />
27
+ </td> -->
28
+
29
+ <th scope="row" style="text-align: center;">
30
+ <% if i < 0 %>
31
+ <i class="fa fa-check text-success"></i>
32
+ <% else %>
33
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
34
+ <% end %>
35
+ </th>
36
+
37
+ <td class="user-image">
38
+ <%= link_to(admin_user_path(user), remote: true) do %>
39
+ <%= display_image(user, "profile_picture.image.small.url", width: "120", height: "auto", class: "img-rectangle", alt: user.display_name) %>
40
+ <% end %>
41
+ </td>
42
+
43
+ <td class="user-name"><%= link_to user.name, admin_user_path(user), remote: true %></td>
44
+
45
+ <td class="hidden-xs hidden-sm"><%= link_to user.username, admin_user_path(user), remote: true %></td>
46
+
47
+ <td class="hidden-xs hidden-sm"><%= link_to user.email, admin_user_path(user), remote: true, class: "email" %></td>
48
+
49
+ <% if @current_user.is_super_admin? %>
50
+ <td class="hidden-xs hidden-sm">
51
+ <% if user.super_admin %>
52
+ <span class="mr-10 mt-5 label label-warning">Super Admin</span>
53
+ <% else %>
54
+ <span class="mr-10 mt-5 label label-default">Normal</span>
55
+ <% end %>
56
+ </td>
57
+ <% end %>
58
+
59
+ <td>
60
+ <% if user.pending? %>
61
+ <span class="ml-5 mt-5 label label-default">Pending</span>
62
+ <% elsif user.approved? %>
63
+ <span class="ml-5 mt-5 label label-success">Approved</span>
64
+ <% elsif user.suspended? %>
65
+ <span class="ml-5 mt-5 label label-danger">Suspended</span>
66
+ <% end %>
67
+ </td>
68
+
69
+ <td class="action-links" style="width:15%">
70
+
71
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if user.can_be_edited? %>
72
+
73
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if user.can_be_deleted? && (@current_user != user) %>
74
+
75
+ </td>
76
+
77
+ <td class="action-links" style="width:15%">
78
+
79
+ <!-- Approve -->
80
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_admin_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_approved? %>
81
+
82
+ <!-- Mark as Pending -->
83
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_admin_user_path(:id =>user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_marked_as_pending? %>
84
+
85
+ <!-- Suspend -->
86
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_admin_user_path(:id =>user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_suspended? %>
87
+
88
+ </td>
89
+
90
+ </tr>
91
+ <% end %>
92
+ </tbody>
93
+ </table>
94
+ </div>
95
+
96
+ <div class="row">
97
+ <div class="col-sm-12">
98
+ <%= paginate_kuppayam(@users) %>
99
+ </div>
100
+ </div>
101
+
@@ -0,0 +1,72 @@
1
+ <% edit_link = edit_admin_user_path(id: user.id) %>
2
+ <% delete_link = admin_user_path(id: user.id) %>
3
+
4
+ <tr id="tr_user_<%= user.id %>">
5
+
6
+ <!-- <td class="user-cb">
7
+ <input type="checkbox" class="cbr" name="users[]" value="1" checked />
8
+ </td> -->
9
+
10
+ <th scope="row" style="text-align: center;">
11
+ <% if i < 0 %>
12
+ <i class="fa fa-check text-success"></i>
13
+ <% else %>
14
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
15
+ <% end %>
16
+ </th>
17
+
18
+ <td class="user-image hidden-xs hidden-sm">
19
+ <%= link_to(admin_user_path(user), remote: true) do %>
20
+ <%= display_image(user, "profile_picture.image.small.url", width: "120", height: "auto", class: "img-rectangle", alt: user.display_name) %>
21
+ <% end %>
22
+ </td>
23
+
24
+ <td class="user-name"><%= link_to user.name, admin_user_path(user), remote: true %></td>
25
+
26
+ <td class="hidden-xs hidden-sm"><%= link_to user.username, admin_user_path(user), remote: true %></td>
27
+
28
+ <td class="hidden-xs hidden-sm"><%= link_to user.email, admin_user_path(user), remote: true, class: "email" %></td>
29
+
30
+ <% if @current_user.is_super_admin? %>
31
+ <td class="hidden-xs hidden-sm">
32
+ <% if user.super_admin %>
33
+ <span class="mr-10 mt-5 label label-warning">Super Admin</span>
34
+ <% else %>
35
+ <span class="mr-10 mt-5 label label-default">Normal</span>
36
+ <% end %>
37
+ </td>
38
+ <% end %>
39
+
40
+ <td>
41
+ <% if user.pending? %>
42
+ <span class="ml-5 mt-5 label label-default">Pending</span>
43
+ <% elsif user.approved? %>
44
+ <span class="ml-5 mt-5 label label-success">Approved</span>
45
+ <% elsif user.suspended? %>
46
+ <span class="ml-5 mt-5 label label-danger">Suspended</span>
47
+ <% end %>
48
+ </td>
49
+
50
+ <td class="action-links" style="width:15%">
51
+
52
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if @user.can_be_edited? %>
53
+
54
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @user.can_be_deleted? && (@current_user != user) %>
55
+
56
+ </td>
57
+
58
+ <td class="action-links" style="width:15%">
59
+
60
+ <!-- Approve -->
61
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_admin_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_approved? %>
62
+
63
+ <!-- Mark as Pending -->
64
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_admin_user_path(:id =>user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_marked_as_pending? %>
65
+
66
+ <!-- Suspend -->
67
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_admin_user_path(:id =>user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_suspended? %>
68
+
69
+ </td>
70
+
71
+ </tr>
72
+
@@ -0,0 +1,199 @@
1
+ <div id="div_user_show">
2
+ <% status_hash = {approved: "success", pending: "default", suspended: "danger"} %>
3
+
4
+ <div class="row">
5
+
6
+ <div class="col-md-3 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
7
+
8
+ <%= edit_image(@user,
9
+ "profile_picture.image.large.url",
10
+ upload_image_link(@user, :profile_picture, nil ),
11
+ remove_image_link(@user, :profile_picture, nil ),
12
+ image_options: {assoc_name: :profile_picture }) %>
13
+ </div>
14
+
15
+ <div class="col-md-6 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
16
+
17
+ <div class="visible-sm visible-xs mt-50"></div>
18
+
19
+ <%= theme_panel_heading(@user.name) %>
20
+ <%= theme_panel_sub_heading(@user.designation, "#") if @user.designation %>
21
+
22
+ <%= clear_tag(10) %>
23
+
24
+ <span class="ml-5 mt-5 label label-<%= status_hash[@user.status.to_sym] %>"><%= @user.status.titleize %></span>
25
+
26
+ <% if @user.super_admin %>
27
+ <span class="mr-10 mt-5 label label-warning">Super Admin</span>
28
+ <% else %>
29
+ <span class="mr-10 mt-5 label label-default">Normal</span>
30
+ <% end %>
31
+
32
+ <%= clear_tag(10) %>
33
+
34
+ <!-- <div class="mt-20" style="max-width: 100%;overflow: auto;max-height: 500px;">
35
+ <%#= raw(@user.biography) %>
36
+ </div> -->
37
+
38
+ <div class="visible-sm visible-xs mb-50"></div>
39
+
40
+ </div>
41
+
42
+ <div class="col-md-3 col-sm-12 col-xs-12">
43
+
44
+ <% edit_link = edit_admin_user_path(id: @user.id) %>
45
+ <% delete_link = admin_user_path(id: @user.id) %>
46
+
47
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @user.can_be_edited? %>
48
+
49
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @user.can_be_deleted? && (@current_user != @user) %>
50
+
51
+ <% if @current_user.super_admin? %>
52
+
53
+ <%= link_to raw("<i class=\"linecons-paper-plane\"></i> Masquerade"), masquerade_admin_user_path(@user), method: :put, data: { confirm: "Are you sure? Do you really want to logout current session and login as #{@user.name}?" }, class: "btn btn-block btn-gray btn-only-hover" if @current_user != @user %>
54
+
55
+ <!-- Remove Super Admin -->
56
+ <%= link_to raw("<i class=\"fa fa-remove mr-5\"></i> Remove Super Admin"), remove_super_admin_admin_user_path(id: @user.id), method: :put, :remote=>true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-danger btn-only-hover" if @user.super_admin? && (@current_user != @user) %>
57
+
58
+ <!-- Make Super Admin -->
59
+ <%= link_to raw("<i class=\"fa fa-plus-square mr-5\"></i> Make Super Admin"), make_super_admin_admin_user_path(id: @user.id), method: :put, remote: true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-gray btn-only-hover" unless @user.super_admin? %>
60
+
61
+ <% end %>
62
+
63
+ <!-- Approve -->
64
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_admin_user_path(:id =>@user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-success btn-only-hover" if @user.can_be_approved? %>
65
+
66
+ <!-- Mark as Pending -->
67
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_admin_user_path(:id =>@user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-gray btn-only-hover" if @user.can_be_marked_as_pending? && (@current_user != @user) %>
68
+
69
+ <!-- Suspend -->
70
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_admin_user_path(:id =>@user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-danger btn-only-hover" if @user.can_be_suspended? && (@current_user != @user) %>
71
+
72
+ <div class="visible-sm visible-xs mb-50"></div>
73
+
74
+ </div>
75
+
76
+ </div>
77
+
78
+ <%= clear_tag(50) %>
79
+
80
+ <ul class="nav nav-pills">
81
+ <li class="active">
82
+ <a href="#user_details" data-toggle="tab" aria-expanded="true">
83
+ <span class="visible-xs"><i class="fa-info"></i></span>
84
+ <span class="hidden-xs">User Details</span>
85
+ </a>
86
+ </li>
87
+ <li class="">
88
+ <a href="#technical_details" data-toggle="tab" aria-expanded="false">
89
+ <span class="visible-xs"><i class="fa-database"></i></span>
90
+ <span class="hidden-xs">Technical Details</span>
91
+ </a>
92
+ </li>
93
+ </ul>
94
+
95
+ <div class="tab-content">
96
+ <div class="tab-pane active" id="user_details">
97
+
98
+ <%= clear_tag(20) %>
99
+
100
+ <div class="table-responsive mt-30">
101
+ <table class="table table-striped table-condensed table-bordered">
102
+ <tbody>
103
+
104
+ <tr>
105
+ <th>Username</th><td><%= @user.username %></td>
106
+ <th>Email</th><td><%= @user.email %></td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <th>Phone</th><td><%= @user.phone %></td>
111
+ <th>Designation</th><td><%= @user.designation %></td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <th>Super Admim?</th><td><%= @user.super_admin %></td>
116
+ <th>Status</th><td><%= @user.status.titleize %></td>
117
+ </tr>
118
+
119
+ </tbody>
120
+ </table>
121
+ </div>
122
+
123
+ </div>
124
+
125
+ <div class="tab-pane" id="technical_details">
126
+
127
+ <%= clear_tag(20) %>
128
+
129
+ <div class="table-responsive">
130
+ <table class="table table-striped table-condensed table-bordered mb-30">
131
+ <tbody>
132
+
133
+ <tr>
134
+ <th style="width:20%;">Sign In Count</th><td style="width:30%;"><%= @user.sign_in_count %></td>
135
+ <th style="width:20%;">Remember User</th><td style="width:30%;"><%= @user.remember_created_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.remember_created_at %></td>
136
+ </tr>
137
+
138
+ <tr>
139
+ <th>Current Sign In At</th><td><%= @user.current_sign_in_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.current_sign_in_at %></td>
140
+ <th>Last Sign In At</th><td><%= @user.last_sign_in_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.last_sign_in_at %></td>
141
+ </tr>
142
+
143
+ <tr>
144
+ <th>Current Sign In IP</th><td><%= @user.current_sign_in_ip %></td>
145
+ <th>Last Sign In IP</th><td><%= @user.last_sign_in_ip %></td>
146
+ </tr>
147
+
148
+ </tbody>
149
+ </table>
150
+
151
+ <table class="table table-striped table-condensed table-bordered">
152
+ <tbody>
153
+
154
+ <tr>
155
+ <th style="width:20%;">Reset Password Token</th><td style="width:30%;"><%= @user.reset_password_token %></td>
156
+ <th style="width:20%;">Reset Password Sent At</th><td style="width:30%;"><%= @user.reset_password_sent_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.reset_password_sent_at %></td>
157
+ </tr>
158
+
159
+ <tr>
160
+ <th>Locked At</th><td colspan="3"><%= @user.locked_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.locked_at %></td>
161
+ </tr>
162
+
163
+ <tr>
164
+ <th>Failed Attempts</th><td><%= @user.failed_attempts %></td>
165
+ <th>Unlock Token</th><td><%= @user.unlock_token %></td>
166
+ </tr>
167
+
168
+ <tr>
169
+ <th>Confirmation Token</th><td><%= @user.confirmation_token %></td>
170
+ <th>Confirmation Token Sent At</th><td><%= @user.confirmed_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.confirmed_at %></td>
171
+ </tr>
172
+
173
+ <tr>
174
+ <th>Confirmation Sent At</th><td><%= @user.confirmation_sent_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.confirmation_sent_at %></td>
175
+ <th>Uncomfirmed Email</th><td><%= @user.unconfirmed_email %></td>
176
+ </tr>
177
+
178
+ <tr>
179
+ <th>Auth Token</th><td><%= @user.auth_token %></td>
180
+ <th>Token Created At</th><td><%= @user.token_created_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.token_created_at %></td>
181
+ </tr>
182
+
183
+ <tr>
184
+ <th>Created At</th><td><%= @user.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.created_at %></td>
185
+ <th>Updated At</th><td><%= @user.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @user.updated_at %></td>
186
+ </tr>
187
+
188
+ </tbody>
189
+ </table>
190
+ </div>
191
+
192
+ </div>
193
+
194
+ </div>
195
+
196
+ <%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
197
+
198
+ <%= clear_tag %>
199
+ </div>
@@ -0,0 +1,64 @@
1
+ <div class="row">
2
+
3
+ <div class="col-md-12">
4
+ <ul class="nav nav-tabs">
5
+
6
+ <%# Show Admin tab only for admins %>
7
+ <% if @current_user.is_super_admin? %>
8
+ <li class="<%= @super_admin == false ? 'active' : '' %>">
9
+ <%= link_to "Users", admin_users_path(sa: '0') %>
10
+ </li>
11
+ <li class="<%= @super_admin == true ? 'active' : '' %>">
12
+ <%= link_to "Administrators", admin_users_path(sa: '1') %>
13
+ </li>
14
+ <% else %>
15
+ <li class="active">
16
+ <%= link_to "Users", admin_users_path(sa: '0') %>
17
+ </li>
18
+ <% end %>
19
+
20
+ </ul>
21
+
22
+ <div class="tab-content">
23
+ <div class="tab-pane active">
24
+
25
+ <div id="div_user_action_buttons">
26
+ <div class="row">
27
+ <div class="col-md-6">
28
+
29
+ <%= theme_button('Add a User', 'plus', new_admin_user_path(), classes: "pull-left", btn_type: "success") %>
30
+
31
+ <%= theme_button('Refresh', 'refresh', admin_users_path(), classes: "pull-left ml-10", btn_type: "white") %>
32
+
33
+ <!-- Single button -->
34
+ <div class="ml-10 btn-group">
35
+ <button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
36
+ More Actions <span class="caret"></span>
37
+ </button>
38
+ <ul class="dropdown-menu">
39
+ <li><a href="#">Import Users</a></li>
40
+ <li><a href="#">Import History</a></li>
41
+ <li role="separator" class="divider"></li>
42
+ <li><a href="#">Export Users</a></li>
43
+ </ul>
44
+ </div>
45
+
46
+ </div>
47
+ <div class="col-md-6">
48
+ <%= search_form_kuppayam(User, admin_users_path, text: @filters[:query]) %>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <%= clear_tag(10) %>
53
+
54
+ <div id="div_user_index">
55
+ <%= render :partial=>"usman/admin/users/index" %>
56
+ </div>
57
+ <%= clear_tag(10) %>
58
+
59
+ </div>
60
+ </div>
61
+
62
+ </div>
63
+
64
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,28 @@
1
+ Vyapari::Engine.routes.draw do
2
+
3
+ mount Usman::Engine => "/"
4
+
5
+ namespace :admin do
6
+
7
+ get '/dashboard', to: "dashboard#index", as: :dashboard
8
+
9
+ # Admin Routes
10
+ resources :countries
11
+ resources :regions
12
+ resources :exchange_rates
13
+
14
+ # Stock Management Routes
15
+ resources :suppliers
16
+ resources :stores
17
+ resources :brands
18
+
19
+ resources :categories do
20
+ member do
21
+ put :update_status, as: :update_status
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+
28
+ end
@@ -0,0 +1,16 @@
1
+ class CreateExchangeRates < ActiveRecord::Migration
2
+ def change
3
+ create_table(:exchange_rates) do |t|
4
+
5
+ t.string :currency_name, limit: 4
6
+ t.decimal :value, :precision => 16, :scale => 4
7
+ t.datetime :effective_date
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_reference :exchange_rates, :country
13
+ add_index :exchange_rates, [:currency_name, :country_id]
14
+
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ class CreateCountries < ActiveRecord::Migration
2
+ def change
3
+ create_table(:countries) do |t|
4
+
5
+ t.string :name, limit: 128
6
+ t.string :code, limit: 16
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :countries, :code, :unique => true
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ class CreateRegions < ActiveRecord::Migration
2
+ def change
3
+ create_table(:regions) do |t|
4
+
5
+ t.string :name, limit: 128
6
+ t.string :code, limit: 16
7
+
8
+ t.references :country, index: true
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :regions, :name
14
+ add_index :regions, :code, :unique => true
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :vyapari do
3
+ # # Task goes here
4
+ # end