vyapari 0.1.5dev9 → 0.1.5dev10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/vyapari/store_manager/base_controller.rb +3 -0
  3. data/app/controllers/vyapari/store_manager/dashboard_controller.rb +1 -0
  4. data/app/controllers/vyapari/store_manager/reports/invoices_controller.rb +206 -101
  5. data/app/controllers/vyapari/store_manager/reports/sales_controller.rb +299 -0
  6. data/app/controllers/vyapari/store_manager/reports/stock_controller.rb +1 -1
  7. data/app/controllers/vyapari/terminal_staff/dashboard_controller.rb +2 -1
  8. data/app/models/bank_account.rb +44 -0
  9. data/app/models/brand.rb +8 -13
  10. data/app/models/category.rb +3 -3
  11. data/app/models/contact.rb +72 -0
  12. data/app/models/country.rb +6 -4
  13. data/app/models/exchange_rate.rb +2 -2
  14. data/app/models/invoice.rb +12 -8
  15. data/app/models/line_item.rb +3 -3
  16. data/app/models/product.rb +3 -3
  17. data/app/models/region.rb +11 -17
  18. data/app/models/stock_bundle.rb +4 -4
  19. data/app/models/stock_entry.rb +8 -7
  20. data/app/models/store.rb +52 -21
  21. data/app/models/supplier.rb +19 -25
  22. data/app/models/terminal.rb +3 -3
  23. data/app/models/vyapari/application_record.rb +1 -2
  24. data/app/views/layouts/vyapari/_store_manager_menu.html.erb +24 -5
  25. data/app/views/layouts/vyapari/_terminal_staff_menu.html.erb +6 -3
  26. data/app/views/layouts/vyapari/store_manager.html.erb +4 -4
  27. data/app/views/vyapari/store_manager/dashboard/_sales_counts.html.erb +90 -0
  28. data/app/views/vyapari/store_manager/dashboard/_stock_counts.html.erb +63 -0
  29. data/app/views/vyapari/store_manager/dashboard/_terminals.html.erb +23 -0
  30. data/app/views/vyapari/store_manager/dashboard/index.html.erb +51 -79
  31. data/app/views/vyapari/store_manager/reports/invoices/_index.html.erb +65 -0
  32. data/app/views/vyapari/store_manager/reports/invoices/index.html.erb +105 -0
  33. data/app/views/vyapari/store_manager/reports/sales/_index.html.erb +64 -0
  34. data/app/views/vyapari/store_manager/reports/sales/index.html.erb +105 -0
  35. data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +61 -18
  36. data/config/routes.rb +2 -0
  37. data/db/migrate/20170000000203_create_contacts.rb +1 -1
  38. data/db/migrate/20170000000206_create_stores.rb +1 -1
  39. data/lib/vyapari/version.rb +1 -1
  40. metadata +16 -6
@@ -2,14 +2,15 @@ class Supplier < Vyapari::ApplicationRecord
2
2
 
3
3
  # Validations
4
4
  validates :name, presence: true, length: {minimum: 2, maximum: 250}, allow_blank: false
5
- validates :code, presence: true, uniqueness: true, length: {minimum: 2, maximum: 24}, allow_blank: false
6
- validates :address, presence: true, length: {minimum: 3, maximum: 1024}, allow_blank: true
7
- validates :city, presence: true, length: {minimum: 2, maximum: 56}, allow_blank: true
5
+ validates :code, presence: true, uniqueness: true, length: {minimum: 2, maximum: 24}
6
+ validates :address, length: {minimum: 6, maximum: 1024}
7
+ validates :city, length: {minimum: 2, maximum: 56}
8
8
  validates :country, presence: true
9
9
 
10
10
  # Associations
11
11
  belongs_to :country
12
- has_many :products
12
+ has_many :stock_entries
13
+ has_many :products, through: :stock_entries
13
14
 
14
15
  # ------------------
15
16
  # Class Methods
@@ -20,12 +21,15 @@ class Supplier < Vyapari::ApplicationRecord
20
21
  # == Examples
21
22
  # >>> obj.search(query)
22
23
  # => ActiveRecord::Relation object
23
- scope :search, lambda {|query| joins(:country).where("LOWER(name) LIKE LOWER('%#{query}%') OR
24
- LOWER(code) LIKE LOWER('%#{query}%') OR
25
- LOWER(address) LIKE LOWER('%#{query}%') OR
26
- LOWER(city) LIKE LOWER('%#{query}%')")}
24
+ scope :search, lambda {|query| joins(:country).where("LOWER(suppliers.name) LIKE LOWER('%#{query}%') OR
25
+ LOWER(suppliers.code) LIKE LOWER('%#{query}%') OR
26
+ LOWER(suppliers.address) LIKE LOWER('%#{query}%') OR
27
+ LOWER(suppliers.city) LIKE LOWER('%#{query}%') OR
28
+ LOWER(countries.name) LIKE LOWER('%#{query}%')")}
29
+
30
+ # Import Methods
31
+ # ---------------
27
32
 
28
-
29
33
  def self.save_row_data(row)
30
34
 
31
35
  row.headers.each{ |cell| row[cell] = row[cell].to_s.strip }
@@ -58,7 +62,7 @@ class Supplier < Vyapari::ApplicationRecord
58
62
  # ------------------
59
63
 
60
64
  def display_name
61
- self.country ? "#{self.code_was}-#{self.name_was}, #{self.country.name}" : "#{self.code_was}-#{self.name_was}"
65
+ "#{self.code_was}-#{self.name_was}"
62
66
  end
63
67
 
64
68
  def can_be_edited?
@@ -66,20 +70,10 @@ class Supplier < Vyapari::ApplicationRecord
66
70
  end
67
71
 
68
72
  def can_be_deleted?
69
- # if self.products.any?
70
- # #self.errors.add(:base, DELETE_MESSAGE)
71
- # return false
72
- # else
73
- # return true
74
- # end
75
- return true
76
- end
77
-
78
- def report_heading
79
- rh = []
80
- rh << self.company.try(:name) if self.company.name
81
- rh << self.display_name
82
- rh.join(", ")
73
+ if self.stock_entries.any?
74
+ return false
75
+ else
76
+ return true
77
+ end
83
78
  end
84
-
85
79
  end
@@ -5,13 +5,13 @@ class Terminal < Vyapari::ApplicationRecord
5
5
  INACTIVE = "inactive"
6
6
  CLOSED = "closed"
7
7
 
8
- STATUS_HASH = {"Active" => ACTIVE, "Inactive" => INACTIVE, "Closed" => CLOSED}
9
- STATUS_HASH_REVERSE = {ACTIVE => "Active", INACTIVE => "Inactive", CLOSED => "Closed"}
8
+ STATUS = {"Active" => ACTIVE, "Inactive" => INACTIVE, "Closed" => CLOSED}
9
+ STATUS_REVERSE = {ACTIVE => "Active", INACTIVE => "Inactive", CLOSED => "Closed"}
10
10
 
11
11
  # Validations
12
12
  validates :name, presence: true, length: {minimum: 2, maximum: 250}, allow_blank: false
13
13
  validates :code, presence: true, uniqueness: true, length: {minimum: 2, maximum: 24}, allow_blank: false
14
- validates :status, :presence=> true, :inclusion => {:in => STATUS_HASH_REVERSE.keys, :presence_of => :status, :message => "%{value} is not a valid status" }
14
+ validates :status, :presence=> true, :inclusion => {:in => STATUS_REVERSE.keys, :presence_of => :status, :message => "%{value} is not a valid status" }
15
15
 
16
16
  # Associations
17
17
  belongs_to :store
@@ -2,9 +2,8 @@ module Vyapari
2
2
  class ApplicationRecord < ActiveRecord::Base
3
3
  self.abstract_class = true
4
4
 
5
- require 'kuppayam/importer.rb'
6
5
  extend Kuppayam::Importer
7
- extend KuppayamValidators
6
+ extend Kuppayam::Validators
8
7
  end
9
8
  end
10
9
 
@@ -5,8 +5,8 @@
5
5
  <!-- Navbar Brand -->
6
6
  <div class="navbar-brand">
7
7
  <a href="dashboard-1.html" class="logo">
8
- <img src="/assets/kuppayam/logo.png" width="80" alt="" class="hidden-xs" />
9
- <img src="/assets/kuppayam/logo.png" width="80" alt="" class="visible-xs" />
8
+ <img src="/assets/kuppayam/logo.png" width="180" alt="" class="hidden-xs" />
9
+ <img src="/assets/kuppayam/logo.png" width="180" alt="" class="visible-xs" />
10
10
  </a>
11
11
  <a href="#" data-toggle="settings-pane" data-animate="true">
12
12
  <i class="linecons-cog"></i>
@@ -43,9 +43,28 @@
43
43
  </li>
44
44
 
45
45
  <li class="<%= nav_active?('store_manager/stock') ? 'active' : '' %>">
46
- <%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Manage Stock</span>"), vyapari.store_manager_stock_entries_path(@store) %>
46
+ <%= link_to raw("<i class=\"fa-truck\"></i> <span class='title'>Manage Stock</span>"), vyapari.store_manager_stock_entries_path(@store) %>
47
47
  </li>
48
48
 
49
+ <!-- Reports -->
50
+ <li class="<%= nav_active?('store_manager/reports') ? 'active' : '' %>">
51
+ <a href="#">
52
+ <i class="fa-list"></i>
53
+ <span class="title">Reports</span>
54
+ </a>
55
+ <ul>
56
+ <li>
57
+ <%= link_to raw("<i class=\"fa-shopping-cart\"></i> <span class='title'>Sales Report</span>"), vyapari.store_manager_sales_report_path(@store) %>
58
+ </li>
59
+ <li>
60
+ <%= link_to raw("<i class=\"fa-book\"></i> <span class='title'>Invoice Report</span>"), vyapari.store_manager_invoices_report_path(@store) %>
61
+ </li>
62
+ <!-- <li>
63
+ <%#= link_to raw("<i class=\"fa-truck\"></i> <span class='title'>Stock Report</span>"), vyapari.store_manager_stock_report_path(@store) %>
64
+ </li> -->
65
+ </ul>
66
+ </li>
67
+
49
68
  <!-- Admin -->
50
69
  <% if @current_user.has_role?("Site Admin") %>
51
70
  <li class="<%= nav_active?('admin/dashboard') ? 'active' : '' %>">
@@ -53,9 +72,9 @@
53
72
  </li>
54
73
  <% end %>
55
74
 
56
- <!-- Log out -->
75
+ <!-- Change Store -->
57
76
  <li class="<%= nav_class("user/dashboard") %>">
58
- <%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Change Store/Terminal</span>"), vyapari.user_dashboard_path %>
77
+ <%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Change Store</span>"), vyapari.user_dashboard_path %>
59
78
  </li>
60
79
 
61
80
 
@@ -5,8 +5,8 @@
5
5
  <!-- Navbar Brand -->
6
6
  <div class="navbar-brand">
7
7
  <a href="dashboard-1.html" class="logo">
8
- <img src="/assets/kuppayam/logo.png" width="80" alt="" class="hidden-xs" />
9
- <img src="/assets/kuppayam/logo.png" width="80" alt="" class="visible-xs" />
8
+ <img src="/assets/kuppayam/logo.png" width="180" alt="" class="hidden-xs" />
9
+ <img src="/assets/kuppayam/logo.png" width="180" alt="" class="visible-xs" />
10
10
  </a>
11
11
  <a href="#" data-toggle="settings-pane" data-animate="true">
12
12
  <i class="linecons-cog"></i>
@@ -42,18 +42,21 @@
42
42
 
43
43
  <%= nav_class("terminal_staff/invoices") %>
44
44
 
45
+ <!-- Manage Invoices -->
45
46
  <li class="<%= nav_class("terminal_staff/invoices") %>">
46
47
  <%= link_to raw("<i class=\"fa-book\"></i> <span class='title'>Invoices</span>"), vyapari.terminal_staff_invoices_path(@terminal) %>
47
48
  </li>
48
49
 
50
+ <!-- Admin -->
49
51
  <% if @current_user.has_role?("Site Admin") %>
50
52
  <li class="<%= nav_active?('admin/dashboard') ? 'active' : '' %>">
51
53
  <%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Admin Dashboard</span>"), vyapari.admin_dashboard_url %>
52
54
  </li>
53
55
  <% end %>
54
56
 
57
+ <!-- Change Terminal -->
55
58
  <li class="<%= nav_class("user/dashboard") %>">
56
- <%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Change Store/Terminal</span>"), vyapari.user_dashboard_path %>
59
+ <%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Change Terminal</span>"), vyapari.user_dashboard_path %>
57
60
  </li>
58
61
 
59
62
  </ul>
@@ -2,19 +2,19 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <!-- Head -->
5
- <%= render :partial=>"/layouts/kuppayam/head" -%>
5
+ <%= render :partial=>"layouts/kuppayam/head" -%>
6
6
  </head>
7
7
 
8
8
  <body class="page-body">
9
9
 
10
- <%= render :partial=>"/layouts/vyapari/store_manager_menu" -%>
10
+ <%= render :partial=>"layouts/vyapari/store_manager_menu" -%>
11
11
 
12
12
  <div class="page-container">
13
13
 
14
14
  <div class="main-content">
15
15
 
16
16
  <!-- Heading & Breadcrumbs -->
17
- <%= render :partial=>"/layouts/kuppayam/heading" -%>
17
+ <%= render :partial=>"layouts/kuppayam/heading" -%>
18
18
 
19
19
  <%#* Show flash messages if controller has set any. -%>
20
20
  <div id="div_flash_message" class="mt-10">
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
 
29
29
  <!-- Footer -->
30
- <%= render :partial=>"/layouts/kuppayam/footer" -%>
30
+ <%= render :partial=>"layouts/kuppayam/footer" -%>
31
31
 
32
32
  </div>
33
33
 
@@ -0,0 +1,90 @@
1
+ <%
2
+
3
+ total_invoice_amount = @store.invoices.dated(@date).active.sum(:net_total_amount)
4
+
5
+ total_invoices = @store.invoices.dated(@date).active.count
6
+
7
+ total_cash = @store.invoices.dated(@date).active.cash_invoices.sum(:net_total_amount)
8
+
9
+ total_cash_invoices = @store.invoices.dated(@date).active.where(payment_method: :cash).count
10
+
11
+ total_credit = @store.invoices.dated(@date).active.credit_card_invoices.sum(:net_total_amount)
12
+
13
+ total_credit_card_invoices = @store.invoices.dated(@date).active.where(payment_method: :credit_card).count
14
+
15
+ %>
16
+
17
+ <div class="row">
18
+
19
+ <div class="col-sm-3">
20
+
21
+ <div class="xe-widget xe-counter-block xe-counter-block-green" data-suffix="k" data-count=".num" data-from="0" data-to="310" data-duration="4" data-easing="false">
22
+ <div class="xe-upper">
23
+
24
+ <div class="xe-icon">
25
+ <i class="fa-money"></i>
26
+ </div>
27
+ <div class="xe-label">
28
+ <strong class="num"><%= number_to_currency total_invoice_amount, unit: "AED " %></strong>
29
+ <span>Total Sales Today</span>
30
+ </div>
31
+
32
+ </div>
33
+ <div class="xe-lower">
34
+ <div class="border"></div>
35
+
36
+ <span>Total Invoices Today: <b><%= total_invoices %></b></span>
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="col-sm-3">
42
+
43
+ <div class="xe-widget xe-counter-block xe-counter-block-white" data-suffix="k" data-count=".num" data-from="0" data-to="310" data-duration="4" data-easing="false">
44
+ <div class="xe-upper">
45
+
46
+ <div class="xe-icon">
47
+ <i class="fa-money"></i>
48
+ </div>
49
+ <div class="xe-label">
50
+ <strong class="num"><%= number_to_currency total_cash, unit: "AED " %></strong>
51
+ <span>Total Cash Sales Today</span>
52
+ </div>
53
+
54
+ </div>
55
+ <div class="xe-lower">
56
+ <div class="border"></div>
57
+
58
+ <span>Total Cash Invoices Today: <b><%= total_cash_invoices %></b></span>
59
+
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <div class="col-sm-3">
65
+
66
+ <div class="xe-widget xe-counter-block xe-counter-block-white" data-suffix="k" data-count=".num" data-from="0" data-to="310" data-duration="4" data-easing="false">
67
+ <div class="xe-upper">
68
+
69
+ <div class="xe-icon">
70
+ <i class="fa-credit-card"></i>
71
+ </div>
72
+ <div class="xe-label">
73
+ <strong class="num"><%= number_to_currency total_credit, unit: "AED " %></strong>
74
+ <span>Total Credit Card Sales Today</span>
75
+ </div>
76
+ </div>
77
+ <div class="xe-lower">
78
+ <div class="border"></div>
79
+ <span>Total Credit Card Invoices Today: <b><%= total_credit_card_invoices %></b></span>
80
+ </div>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="col-sm-3">
85
+ <%#= link_to raw("<i class=\"fa-book mr-10\"></i> Create Invoice"), new_terminal_staff_invoice_path(@terminal), remote: true, class: "btn btn-success btn-lg btn-block hidden-xs", style: "height:50px" %>
86
+
87
+ <%#= link_to raw("<i class=\"fa-book mr-10\"></i> Manage Invoices"), terminal_staff_invoices_path(@terminal), class: "btn btn-primary btn-only-hover btn-lg btn-block", style: "height:50px", target: "_blank" %>
88
+ </div>
89
+
90
+ </div>
@@ -0,0 +1,63 @@
1
+ <div class="row">
2
+
3
+ <div class="col-sm-3">
4
+ <div class="xe-widget xe-counter xe-counter-info" data-count=".num" data-from="1" data-to="117" data-suffix="k" data-duration="3" data-easing="false">
5
+ <div class="xe-icon">
6
+ <i class="fa-truck"></i>
7
+ </div>
8
+ <div class="xe-label">
9
+ <strong class="num"><%= @store.total_quantity_of_products_in_stock %></strong>
10
+ <span>TOTAL QUANTITY IN STOCK</span>
11
+ </div>
12
+ </div>
13
+ </div>
14
+
15
+ <div class="col-sm-3">
16
+ <div class="xe-widget xe-counter xe-counter-gray" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
17
+ <div class="xe-icon">
18
+ <i class="fa-bookmark"></i>
19
+ </div>
20
+ <div class="xe-label">
21
+ <strong class="num"><%= @store.total_no_of_products_in_stock %></strong>
22
+ <span>TOTAL NO OF PRODUCTS</span>
23
+ </div>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="col-sm-3">
28
+ <div class="xe-widget xe-counter xe-counter-success" data-count=".num" data-from="0" data-to="99.9" data-suffix="%" data-duration="2">
29
+ <div class="xe-icon">
30
+ <i class="fa-shopping-cart"></i>
31
+ </div>
32
+ <div class="xe-label">
33
+ <strong class="num"><%= @store.sold_items_count(@date) %></strong>
34
+ <span>ITEMS SOLD TODAY</span>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <!-- <div class="col-sm-3">
40
+ <div class="xe-widget xe-counter xe-counter-danger" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
41
+ <div class="xe-icon">
42
+ <i class="fa-ban"></i>
43
+ </div>
44
+ <div class="xe-label">
45
+ <strong class="num"><%#= @store.damaged_items_count(@date) %></strong>
46
+ <span>ITEMS DAMAGED TODAY</span>
47
+ </div>
48
+ </div>
49
+ </div>
50
+
51
+ <div class="col-sm-3">
52
+ <div class="xe-widget xe-counter xe-counter-gray" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
53
+ <div class="xe-icon">
54
+ <i class="fa-bookmark"></i>
55
+ </div>
56
+ <div class="xe-label">
57
+ <strong class="num"><%#= @store.reserved_items_count(@date) %></strong>
58
+ <span>RESERVED</span>
59
+ </div>
60
+ </div>
61
+ </div> -->
62
+
63
+ </div>
@@ -0,0 +1,23 @@
1
+
2
+
3
+ <div class="row">
4
+
5
+ <% @store.terminals.each do |terminal| %>
6
+ <div class="col-sm-3">
7
+
8
+ <div class="xe-widget xe-vertical-counter xe-vertical-counter-primary" data-count=".num" data-from="0" data-to="442" data-suffix=" TB" data-duration="5">
9
+ <div class="xe-icon">
10
+ <i class="fa-desktop"></i>
11
+ </div>
12
+
13
+ <div class="xe-label">
14
+ <strong class="num"><%= terminal.code %></strong>
15
+ <span><%= terminal.name %></span>
16
+ <span><%= link_to "Log In", terminal_staff_dashboard_path(terminal), class: "btn btn-primary btn-white btn-block mt-20" %></span>
17
+ </div>
18
+ </div>
19
+
20
+ </div>
21
+ <% end %>
22
+
23
+ </div>
@@ -1,92 +1,64 @@
1
- <%
2
- #total_no_of_products_in_stock = @store.stock_entries.active.count
3
- #in_stock_count = @store.stock_entries.in_stock.count
4
- #damaged_count = @store.stock_entries.damaged.count
5
- #reserved_count = @store.stock_entries.reserved.count
6
- %>
7
-
8
- <div class="chart-item-bg-2">
9
- <div class="chart-item-num" data-count="this" data-from="0" data-to="98" data-suffix="%" data-duration="2">
10
- <i class="fa-truck"></i>
11
- <%= @store.total_no_of_products_in_stock %> <span style="font-size:20px">Products</span>
12
- </div>
13
- <div class="chart-item-desc">
14
- <%= link_to raw("<i class=\"fa-truck mr-10\"></i> View Stock"), store_manager_stock_entries_path(@store), class: "btn btn-success btn-lg btn-block", style: "height:50px" %>
15
- <%= link_to raw("<i class=\"fa-upload mr-10\"></i> Import Stock"), store_manager_stock_bundles_path(@store), class: "btn btn-success btn-lg btn-block", style: "height:50px" %>
1
+ <div class="row calendar-env">
2
+ <div class="col-md-12 text-center">
3
+ <div class="btn-group" style="margin:auto;">
4
+
5
+ <%= link_to raw("<i class=\"fa fa-arrow-left\"></i>"), store_manager_dashboard_path(@store, date: (@date - 1.day)), class: "btn btn-white", style: "font-size: 20px;" %>
6
+
7
+ <input type="text" name="reportdate" value="<%= @date.strftime("%m-%d-%Y") %>" class="btn btn-white" style="height:42px;" />
8
+
9
+ <%= link_to raw("<i class=\"fa fa-arrow-right\"></i>"), store_manager_dashboard_path(@store, date: (@date + 1.day)), class: "btn btn-white", style: "font-size: 20px;" %>
10
+ </div>
16
11
  </div>
17
12
  </div>
18
13
 
19
- <div class="row">
20
- <div class="col-sm-3">
21
-
22
- <div class="xe-widget xe-counter xe-counter-info" data-count=".num" data-from="1" data-to="117" data-suffix="k" data-duration="3" data-easing="false">
23
- <div class="xe-icon">
24
- <i class="fa-truck"></i>
25
- </div>
26
- <div class="xe-label">
27
- <strong class="num"><%= @store.in_stock_items_count_as_of_now %></strong>
28
- <span>TOTAL QUANTITY IN STOCK</span>
29
- </div>
30
- </div>
14
+ <script type="text/javascript">
15
+ $(function() {
16
+
17
+ $('input[name="reportdate"]').daterangepicker({
18
+ singleDatePicker: true,
19
+ showDropdowns: true
20
+ },
31
21
 
32
- <div class="xe-widget xe-counter xe-counter-success" data-count=".num" data-from="0" data-to="99.9" data-suffix="%" data-duration="2">
33
- <div class="xe-icon">
34
- <i class="fa-shopping-cart"></i>
35
- </div>
36
- <div class="xe-label">
37
- <strong class="num"><%= @store.sold_items_count_for_today %></strong>
38
- <span>ITEMS SOLD TODAY</span>
39
- </div>
40
- </div>
22
+ function(start, end, label) {
23
+ var urlWithoutParams = location.protocol + '//' + location.host + location.pathname;
24
+ var params = { locale:'en', date:start.format('DD-MM-YYYY') };
25
+ var dateParam = jQuery.param(params);
26
+ window.location.href = urlWithoutParams + "?" + dateParam;
27
+ });
28
+ });
29
+ </script>
41
30
 
42
- <div class="xe-widget xe-counter xe-counter-danger" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
43
- <div class="xe-icon">
44
- <i class="fa-ban"></i>
45
- </div>
46
- <div class="xe-label">
47
- <strong class="num"><%= @store.damaged_items_count_for_today %></strong>
48
- <span>ITEMS DAMAGED TODAY</span>
49
- </div>
50
- </div>
31
+ <div class="row mt-40 mb-40">
32
+ <div class="col-sm-12">
33
+ <h3>Sales Summary</h3>
34
+ </div>
35
+ </div>
51
36
 
52
- <div class="xe-widget xe-counter xe-counter-gray" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
53
- <div class="xe-icon">
54
- <i class="fa-bookmark"></i>
55
- </div>
56
- <div class="xe-label">
57
- <strong class="num"><%= @store.reserved_items_count_for_today %></strong>
58
- <span>RESERVED</span>
59
- </div>
60
- </div>
37
+ <div id="div_store_dashboard_sales_counts">
38
+ <%= render :partial=>"vyapari/store_manager/dashboard/sales_counts" -%>
39
+ </div>
61
40
 
41
+ <div class="row mt-40 mb-40">
42
+ <div class="col-sm-6">
43
+ <h3>Stock Summary</h3>
44
+ </div>
45
+ <div class="col-sm-6">
46
+ <%= link_to raw("<i class=\"fa-truck mr-10\"></i> View Stock"), store_manager_stock_entries_path(@store), class: "btn btn-primary pull-right ml-10 mt-20" %>
47
+ <%= link_to raw("<i class=\"fa-upload mr-10\"></i> Import Stock"), store_manager_stock_bundles_path(@store), class: "btn btn-secondary pull-right mt-20" %>
62
48
  </div>
49
+ </div>
63
50
 
64
- <div class="col-sm-9">
65
51
 
66
- <div class="panel panel-default" style="width:100%;min-height:405px;">
67
- <div class="panel-heading">Terminals</div>
68
- <table class="table">
69
- <thead>
70
- <tr>
71
- <th style="width:60%">Name</th>
72
- <th>Code</th>
73
- <th style="text-align:center">Actions</th>
74
- </tr>
75
- </thead>
76
- <tbody>
77
- <% @store.terminals.each do |terminal| %>
78
- <tr>
79
- <td><%= terminal.name %></td>
80
- <td><%= terminal.code %></td>
81
- <td style="text-align:center">
82
- <%= link_to "Log In", terminal_staff_dashboard_path(terminal), class: "btn btn-primary btn-success pr-30 pl-30" %>
83
- </td>
84
- </tr>
85
- <% end %>
86
- </tbody>
87
- </table>
88
- </div>
52
+ <div id="div_store_dashboard_stock_counts">
53
+ <%= render :partial=>"vyapari/store_manager/dashboard/stock_counts" -%>
54
+ </div>
89
55
 
56
+ <div class="row mt-40 mb-40">
57
+ <div class="col-sm-12">
58
+ <h3>Terminals</h3>
90
59
  </div>
91
-
60
+ </div>
61
+
62
+ <div id="div_store_dashboard_terminals" class="mb-100">
63
+ <%= render :partial=>"vyapari/store_manager/dashboard/terminals" -%>
92
64
  </div>
@@ -0,0 +1,65 @@
1
+ <div class="table-responsive table-scrollable">
2
+ <table class="table table-striped table-condensed table-bordered">
3
+ <thead>
4
+ <tr>
5
+ <% @columns.each do |col_item| %>
6
+ <% next unless @selected_columns.include?(col_item[:column_name]) %>
7
+ <th style="text-align: center;"><%= col_item[:display_name] %></th>
8
+ <% end %>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+
13
+ <% cols_except_id = @columns.reject{|item| item[:column_name] == :id}.select{|item| @selected_columns.include?(item[:column_name]) } %>
14
+
15
+ <% @results.each_with_index do |result, i| %>
16
+ <tr>
17
+ <th scope="row" style="text-align: center;"><%= i + 1 %></th>
18
+
19
+ <% cols_except_id.each do |col_item| %>
20
+
21
+ <% case col_item[:column_type] %>
22
+ <% when :string, :integer %>
23
+ <td style="text-align: <%= col_item[:align] %>;">
24
+ <%= result.send(col_item[:column_name]) %>
25
+ </td>
26
+ <% when :status %>
27
+ <td style="text-align: <%= col_item[:align] %>;">
28
+ <%= result.send(col_item[:column_name]).titleize %>
29
+ </td>
30
+ <% when :currency %>
31
+ <td style="text-align: <%= col_item[:align] %>;">
32
+ <%= number_to_currency(result.send(col_item[:column_name]), unit: "") %>
33
+ </td>
34
+ <% when :date %>
35
+ <td style="text-align: <%= col_item[:align] %>;"><%= result.send(col_item[:column_name]).strftime("%d-%m-%Y") %>
36
+ </td>
37
+ <% else %>
38
+ <td style="text-align: <%= col_item[:align] %>;"><%= result.send(col_item[:column_name]) %>
39
+ </td>
40
+ <% end %>
41
+
42
+ <% end %>
43
+
44
+ </tr>
45
+ <% end %>
46
+
47
+ </tbody>
48
+
49
+ <tfoot>
50
+ <% if @total && @total.first && @total.first.net_total_amount %>
51
+ <tr>
52
+ <td></td>
53
+ <% cols_except_id.each do |col_item| %>
54
+ <% if col_item[:column_name] == :net_total_amount %>
55
+ <td style="font-weight: bold;text-align: <%= col_item[:align] %>;"><%= number_to_currency @total.first.net_total_amount.to_s, unit: "AED " %></td>
56
+ <% else %>
57
+ <td></td>
58
+ <% end %>
59
+ <% end %>
60
+ </tr>
61
+ <% end %>
62
+ </tfoot>
63
+
64
+ </table>
65
+ </div>