dorsale 3.1.7 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/app/assets/javascripts/dorsale/common/comments.coffee +18 -20
  4. data/app/assets/javascripts/dorsale/common/datepicker.coffee +1 -1
  5. data/app/assets/javascripts/dorsale/common/forms.coffee +1 -1
  6. data/app/assets/javascripts/dorsale/common/modals.coffee +1 -1
  7. data/app/assets/javascripts/dorsale/common/tabs_loader.coffee +1 -1
  8. data/app/assets/javascripts/dorsale/common/tags.coffee +1 -1
  9. data/app/assets/javascripts/dorsale/common/tooltips.coffee +1 -1
  10. data/app/assets/javascripts/dorsale/dependencies.coffee +2 -0
  11. data/app/assets/javascripts/dorsale/engines/billing_machine.coffee +1 -1
  12. data/app/assets/stylesheets/dorsale/all.sass +1 -1
  13. data/app/assets/stylesheets/dorsale/common/comments.sass +1 -1
  14. data/app/assets/stylesheets/dorsale/common/filters.sass +16 -1
  15. data/app/assets/stylesheets/dorsale/common/styles.sass +3 -0
  16. data/app/assets/stylesheets/dorsale/engines/customer_vault.sass +2 -2
  17. data/app/assets/stylesheets/dorsale/engines/expense_gun.sass +3 -0
  18. data/app/assets/stylesheets/dorsale/engines/flyboy.sass +4 -0
  19. data/app/assets/stylesheets/dorsale/print.sass +73 -0
  20. data/app/controllers/dorsale/alexandrie/attachments_controller.rb +0 -4
  21. data/app/controllers/dorsale/application_controller.rb +12 -0
  22. data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -5
  23. data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -4
  24. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +0 -4
  25. data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -4
  26. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +0 -4
  27. data/app/controllers/dorsale/comments_controller.rb +30 -55
  28. data/app/controllers/dorsale/customer_vault/links_controller.rb +5 -5
  29. data/app/controllers/dorsale/customer_vault/people_controller.rb +9 -11
  30. data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -4
  31. data/app/controllers/dorsale/expense_gun/expenses_controller.rb +1 -5
  32. data/app/controllers/dorsale/flyboy/folders_controller.rb +0 -4
  33. data/app/controllers/dorsale/flyboy/tasks_controller.rb +0 -4
  34. data/app/controllers/dorsale/users_controller.rb +7 -11
  35. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
  36. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
  37. data/app/helpers/dorsale/all_helpers.rb +1 -0
  38. data/app/helpers/dorsale/billing_machine/application_helper.rb +23 -0
  39. data/app/helpers/dorsale/comments_helper.rb +14 -2
  40. data/app/helpers/dorsale/flyboy/application_helper.rb +4 -0
  41. data/app/helpers/dorsale/text_helper.rb +12 -7
  42. data/app/libs/dorsale/sortable_uuid_generator.rb +11 -0
  43. data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +2 -4
  44. data/app/models/concerns/dorsale/active_record_uuid_concern.rb +15 -0
  45. data/app/models/concerns/dorsale/default_values_concern.rb +13 -0
  46. data/app/models/dorsale/alexandrie/attachment.rb +3 -3
  47. data/app/models/dorsale/application_record.rb +11 -0
  48. data/app/models/dorsale/billing_machine/invoice.rb +13 -13
  49. data/app/models/dorsale/billing_machine/invoice_line.rb +3 -9
  50. data/app/models/dorsale/billing_machine/quotation.rb +6 -12
  51. data/app/models/dorsale/billing_machine/quotation_line.rb +3 -8
  52. data/app/models/dorsale/customer_vault/person.rb +5 -4
  53. data/app/models/dorsale/expense_gun/expense.rb +3 -4
  54. data/app/models/dorsale/expense_gun/expense_line.rb +4 -5
  55. data/app/models/dorsale/flyboy/folder.rb +2 -3
  56. data/app/models/dorsale/flyboy/task.rb +5 -6
  57. data/app/models/dorsale/flyboy/task_comment.rb +3 -8
  58. data/app/models/dorsale/users/active.rb +1 -1
  59. data/app/policies/dorsale/billing_machine/invoice_policy_helper.rb +5 -0
  60. data/app/policies/dorsale/comment_policy_helper.rb +21 -0
  61. data/app/serializers/dorsale/serializers/xlsx.rb +13 -2
  62. data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -1
  63. data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +1 -1
  64. data/app/views/dorsale/billing_machine/invoices/_form.html.slim +1 -1
  65. data/app/views/dorsale/billing_machine/invoices/_header_infos.html.slim +9 -4
  66. data/app/views/dorsale/billing_machine/invoices/_list.html.slim +3 -2
  67. data/app/views/dorsale/billing_machine/invoices/email.html.slim +6 -0
  68. data/app/views/dorsale/billing_machine/invoices/index.html.slim +1 -1
  69. data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +41 -0
  70. data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +1 -1
  71. data/app/views/dorsale/billing_machine/quotations/_list.html.slim +4 -3
  72. data/app/views/dorsale/comments/_comment.html.slim +2 -2
  73. data/app/views/dorsale/comments/_comments.html.slim +5 -0
  74. data/app/views/dorsale/comments/_form.html.slim +5 -6
  75. data/app/views/dorsale/comments/_list.html.slim +1 -1
  76. data/app/views/dorsale/comments/edit.html.slim +1 -1
  77. data/app/views/dorsale/customer_vault/links/edit.html.slim +13 -17
  78. data/app/views/dorsale/customer_vault/links/index.html.slim +10 -0
  79. data/app/views/dorsale/customer_vault/links/new.html.slim +10 -14
  80. data/app/views/dorsale/customer_vault/people/_actions.html.slim +2 -2
  81. data/app/views/dorsale/customer_vault/people/_data_context.html.slim +1 -1
  82. data/app/views/dorsale/customer_vault/people/_index_tabs.html.slim +2 -2
  83. data/app/views/dorsale/customer_vault/people/_show_layout.html.slim +10 -0
  84. data/app/views/dorsale/customer_vault/people/_tabs.html.slim +24 -0
  85. data/app/views/dorsale/customer_vault/people/activity.slim +2 -3
  86. data/app/views/dorsale/customer_vault/people/edit.html.slim +1 -0
  87. data/app/views/dorsale/customer_vault/people/index.html.slim +2 -2
  88. data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +49 -0
  89. data/app/views/dorsale/customer_vault/people/invoices.html.slim +5 -0
  90. data/app/views/dorsale/customer_vault/people/show.html.slim +5 -26
  91. data/app/views/dorsale/customer_vault/people/tasks.html.slim +4 -0
  92. data/app/views/dorsale/expense_gun/categories/_list.html.slim +4 -1
  93. data/app/views/dorsale/expense_gun/expenses/_list.html.slim +1 -1
  94. data/app/views/dorsale/expense_gun/expenses/show.html.slim +3 -3
  95. data/app/views/dorsale/flyboy/_filters.html.slim +3 -0
  96. data/app/views/dorsale/flyboy/folders/_form.html.slim +3 -1
  97. data/app/views/dorsale/flyboy/folders/_list.html.slim +2 -2
  98. data/app/views/dorsale/flyboy/task_comments/_list.html.slim +2 -2
  99. data/app/views/dorsale/flyboy/tasks/_form.html.slim +4 -1
  100. data/app/views/dorsale/flyboy/tasks/_list.html.slim +1 -1
  101. data/app/views/dorsale/flyboy/tasks/_summary_list.html.slim +6 -5
  102. data/app/views/dorsale/flyboy/tasks/index.html.slim +2 -4
  103. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +23 -0
  104. data/app/views/dorsale/flyboy/tasks/summary.html.slim +0 -2
  105. data/config/locales/common.en.yml +2 -0
  106. data/config/locales/common.fr.yml +2 -0
  107. data/config/locales/customer_vault.en.yml +0 -6
  108. data/config/locales/customer_vault.fr.yml +0 -6
  109. data/config/locales/flyboy.en.yml +2 -0
  110. data/config/locales/flyboy.fr.yml +2 -0
  111. data/config/routes.rb +7 -2
  112. data/db/migrate/20161118071317_dorsale_add_missing_indexes.rb +25 -0
  113. data/features/billing_machine_invoices.feature +4 -2
  114. data/features/customer_vault_invoices.feature +10 -0
  115. data/features/customer_vault_tasks.feature +1 -1
  116. data/features/flyboy_tasks.feature +3 -15
  117. data/features/step_definitions/billing_machine_invoices_steps.rb +2 -6
  118. data/features/step_definitions/billing_machine_quotations_steps.rb +5 -5
  119. data/features/step_definitions/common_steps.rb +7 -1
  120. data/features/step_definitions/customer_vault_corporations_steps.rb +7 -7
  121. data/features/step_definitions/customer_vault_filters_steps.rb +3 -3
  122. data/features/step_definitions/customer_vault_individuals_steps.rb +1 -1
  123. data/features/step_definitions/customer_vault_invoices_steps.rb +7 -0
  124. data/features/step_definitions/customer_vault_links_steps.rb +5 -3
  125. data/features/step_definitions/customer_vault_people_steps.rb +1 -1
  126. data/features/step_definitions/customer_vault_search_steps.rb +4 -4
  127. data/features/step_definitions/customer_vault_tasks_steps.rb +6 -16
  128. data/features/step_definitions/expense_gun_expenses_steps.rb +2 -2
  129. data/features/step_definitions/flyboy_folders_steps.rb +5 -5
  130. data/features/step_definitions/flyboy_tasks_steps.rb +5 -29
  131. data/lib/dorsale/engine.rb +6 -1
  132. data/lib/dorsale/polymorphic_id.rb +1 -1
  133. data/lib/dorsale/version.rb +1 -1
  134. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +3 -4
  135. data/spec/controllers/dorsale/comments_controller_spec.rb +3 -3
  136. data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +10 -0
  137. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +1 -13
  138. data/spec/factories/dorsale_comments.rb +3 -3
  139. data/spec/helpers/dorsale/text_helper_spec.rb +15 -0
  140. data/spec/{lib → libs}/active_record_comma_type_cast_spec.rb +0 -0
  141. data/spec/{lib → libs/dorsale}/polymorphic_id_spec.rb +0 -0
  142. data/spec/libs/dorsale/sortable_uuid_generator_spec.rb +29 -0
  143. data/spec/rails_helper.rb +2 -0
  144. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +15 -0
  145. metadata +54 -18
  146. data/app/pdfs/dorsale/flyboy/roadmap.rb +0 -47
  147. data/app/views/dorsale/billing_machine/invoices/index.csv.ruby +0 -46
  148. data/app/views/dorsale/comments/_loader.html.slim +0 -5
  149. data/app/views/dorsale/comments/index.html.slim +0 -11
  150. data/app/views/dorsale/customer_vault/people/_activity_tab.html.slim +0 -4
  151. data/app/views/dorsale/customer_vault/people/_comment.html.slim +0 -1
  152. data/app/views/dorsale/customer_vault/people/_links_tab.html.slim +0 -7
  153. data/app/views/dorsale/customer_vault/people/_tasks_tab.html.slim +0 -1
  154. data/app/views/dorsale/customer_vault/people/index.xls.slim +0 -24
  155. data/app/views/dorsale/flyboy/tasks/index.csv.ruby +0 -24
  156. data/app/views/dorsale/flyboy/tasks/index.pdf.ruby +0 -6
  157. data/app/views/dorsale/flyboy/tasks/index.xls.erb +0 -29
@@ -28,16 +28,8 @@ class Dorsale::BillingMachine::Quotation < ::Dorsale::ApplicationRecord
28
28
  order(unique_index: :desc)
29
29
  }
30
30
 
31
- def initialize(*)
32
- super
33
- self.state = STATES.first if state.nil?
34
- self.date = Time.zone.now.to_date if date.nil?
35
- assign_default_values
36
- end
37
-
38
31
  before_create :assign_unique_index
39
32
  before_create :assign_tracking_id
40
- before_validation :assign_default_values
41
33
 
42
34
  def assign_unique_index
43
35
  if unique_index.nil?
@@ -50,10 +42,12 @@ class Dorsale::BillingMachine::Quotation < ::Dorsale::ApplicationRecord
50
42
  end
51
43
 
52
44
  def assign_default_values
53
- self.expires_at = date + 1.month if expires_at.nil?
54
- self.commercial_discount = 0 if commercial_discount.nil?
55
- self.vat_amount = 0 if vat_amount.nil?
56
- self.total_excluding_taxes = 0 if total_excluding_taxes
45
+ assign_default :state, STATES.first
46
+ assign_default :date, Time.zone.now.to_date
47
+ assign_default :expires_at, date + 1.month
48
+ assign_default :commercial_discount, 0
49
+ assign_default :vat_amount, 0
50
+ assign_default :total_excluding_taxes, 0
57
51
  end
58
52
 
59
53
  before_save :update_totals
@@ -9,17 +9,12 @@ class Dorsale::BillingMachine::QuotationLine < ::Dorsale::ApplicationRecord
9
9
  order(:created_at => :asc)
10
10
  }
11
11
 
12
- def initialize(*)
13
- super
14
- assign_default_values
15
- end
16
-
17
12
  before_validation :update_total
18
13
 
19
14
  def assign_default_values
20
- self.quantity ||= 0
21
- self.unit_price ||= 0
22
- self.vat_rate ||= ::Dorsale::BillingMachine::DEFAULT_VAT_RATE
15
+ assign_default :quantity, 0
16
+ assign_default :unit_price, 0
17
+ assign_default :vat_rate, ::Dorsale::BillingMachine::DEFAULT_VAT_RATE
23
18
  end
24
19
 
25
20
  def update_total
@@ -11,20 +11,21 @@ class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
11
11
  Dorsale::CustomerVault::PersonPolicy
12
12
  end
13
13
 
14
- def initialize(*)
14
+ after_initialize :verify_class
15
+
16
+ def verify_class
15
17
  if self.class == ::Dorsale::CustomerVault::Person
16
18
  # self.abstract_class does not work with STI
17
19
  raise "Cannot directly instantiate Person class"
18
- else
19
- super
20
20
  end
21
21
  end
22
22
 
23
23
  acts_as_taggable
24
24
 
25
- has_many :comments, -> { order(id: :desc) }, class_name: ::Dorsale::Comment, as: :commentable, dependent: :destroy
25
+ has_many :comments, -> { order(created_at: :desc, id: :desc) }, class_name: ::Dorsale::Comment, as: :commentable, dependent: :destroy
26
26
  has_one :address, class_name: ::Dorsale::Address, as: :addressable, inverse_of: :addressable, dependent: :destroy
27
27
  has_many :tasks, class_name: ::Dorsale::Flyboy::Task, as: :taskable, dependent: :destroy
28
+ has_many :invoices, class_name: ::Dorsale::BillingMachine::Invoice, as: :customer
28
29
  accepts_nested_attributes_for :address, allow_destroy: true
29
30
 
30
31
  after_destroy :destroy_links
@@ -20,12 +20,11 @@ class Dorsale::ExpenseGun::Expense < ::Dorsale::ApplicationRecord
20
20
  :reject_if => proc { |attr| attr["name"].blank? }
21
21
 
22
22
  default_scope -> {
23
- order(id: :desc)
23
+ order(created_at: :desc, id: :desc)
24
24
  }
25
25
 
26
- def initialize(*args)
27
- super
28
- self.date = Time.zone.now.to_date if self.date.nil?
26
+ def assign_default_values
27
+ assign_default :date, Time.zone.now.to_date
29
28
  end
30
29
 
31
30
  # Sum of line amounts
@@ -4,11 +4,6 @@ class Dorsale::ExpenseGun::ExpenseLine < ::Dorsale::ApplicationRecord
4
4
  belongs_to :expense, class_name: ::Dorsale::ExpenseGun::Expense
5
5
  belongs_to :category, class_name: ::Dorsale::ExpenseGun::Category
6
6
 
7
- def initialize(*)
8
- super
9
- self.company_part = 100 if company_part.nil?
10
- end
11
-
12
7
  validates :expense, presence: true
13
8
  validates :name, presence: true
14
9
  validates :date, presence: true
@@ -17,6 +12,10 @@ class Dorsale::ExpenseGun::ExpenseLine < ::Dorsale::ApplicationRecord
17
12
  validates :vat, presence: true, numericality: {greater_than_or_equal_to: 0}
18
13
  validates :company_part, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100.0}
19
14
 
15
+ def assign_default_values
16
+ assign_default :company_part, 100
17
+ end
18
+
20
19
  def employee_payback
21
20
  (total_all_taxes * company_part / 100)
22
21
  end
@@ -30,9 +30,8 @@ class Dorsale::Flyboy::Folder < ::Dorsale::ApplicationRecord
30
30
  in: proc { ::Dorsale::Flyboy::Folder.aasm.states.map(&:to_s) }
31
31
  }
32
32
 
33
- def initialize(*args)
34
- super
35
- self.progress = 0 if progress.nil?
33
+ def assign_default_values
34
+ assign_default :progress, 0
36
35
  end
37
36
 
38
37
  def no_undone_tasks?
@@ -51,12 +51,11 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
51
51
  end
52
52
  end
53
53
 
54
- def initialize(*args)
55
- super
56
- self.done = false if done.nil?
57
- self.reminder = Time.zone.now.to_date + snooze_default_reminder if reminder.nil?
58
- self.term = Time.zone.now.to_date + snooze_default_term if term.nil?
59
- self.progress = 0 if progress.nil?
54
+ def assign_default_values
55
+ assign_default :progress, 0
56
+ assign_default :done, false
57
+ assign_default :reminder, Time.zone.now.to_date + snooze_default_reminder
58
+ assign_default :term, Time.zone.now.to_date + snooze_default_term
60
59
  end
61
60
 
62
61
  after_save :update_taskable_progress!
@@ -12,14 +12,9 @@ class Dorsale::Flyboy::TaskComment < ::Dorsale::ApplicationRecord
12
12
 
13
13
  default_scope -> { order("created_at DESC") }
14
14
 
15
- def initialize(*args)
16
- super
17
-
18
- self.date = Time.zone.now if date.nil?
19
-
20
- if progress.nil?
21
- self.progress = task ? task.progress : 0
22
- end
15
+ def assign_default_values
16
+ assign_default :date, Time.zone.now
17
+ assign_default :progress, (task ? task.progress : 0)
23
18
  end
24
19
 
25
20
  after_create :update_task_progress
@@ -17,4 +17,4 @@ module Dorsale::Users::Active
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -9,4 +9,9 @@ module Dorsale::BillingMachine::InvoicePolicyHelper
9
9
  :copy?,
10
10
  :email?,
11
11
  ]
12
+
13
+ def email?
14
+ return false if invoice.customer.try(:email).nil?
15
+ super
16
+ end
12
17
  end
@@ -4,4 +4,25 @@ module Dorsale::CommentPolicyHelper
4
4
  :update?,
5
5
  :delete?,
6
6
  ]
7
+
8
+ def create?
9
+ return false unless can_read_commentable?
10
+ super
11
+ end
12
+
13
+ def update?
14
+ return false unless can_read_commentable?
15
+ super
16
+ end
17
+
18
+ def delete?
19
+ return false unless can_read_commentable?
20
+ super
21
+ end
22
+
23
+ private
24
+
25
+ def can_read_commentable?
26
+ policy(comment.commentable).read?
27
+ end
7
28
  end
@@ -13,8 +13,19 @@ class Dorsale::Serializers::XLSX < Dorsale::Serializers::Base
13
13
  @xlsx ||= Axlsx::Package.new do |p|
14
14
  p.workbook.add_worksheet do |sheet|
15
15
  data.each do |line|
16
- types = [:string] * line.length
17
- sheet.add_row(line, types: types)
16
+ values = line.map do |value|
17
+ if value.is_a?(Integer)
18
+ value
19
+ elsif value.is_a?(Numeric)
20
+ value.to_f # Fix BigDecimal
21
+ elsif value == true || value == false
22
+ I18n.t(value.to_s)
23
+ else
24
+ value.to_s
25
+ end
26
+ end
27
+
28
+ sheet.add_row(values)
18
29
  end
19
30
  end
20
31
 
@@ -26,7 +26,7 @@
26
26
  = info document, :date
27
27
  hr
28
28
  - if document.customer.present?
29
- = document.customer.name
29
+ = document.customer
30
30
  br
31
31
 
32
32
  - if document.customer.address.street.present?
@@ -1,6 +1,6 @@
1
1
  = filters_form do |f|
2
2
  = f.input(:customer_guid,
3
- :collection => @people.map { |p| [p.name, p.guid] },
3
+ :collection => @people.map { |p| [p.to_s, p.guid] },
4
4
  :include_blank => t("filters.all_customers"),
5
5
  )
6
6
 
@@ -24,7 +24,7 @@
24
24
  .well
25
25
  = f.input :date, html5: true
26
26
  hr
27
- = f.input :customer_guid, collection: @people.map{ |e| [e.name, e.guid] }
27
+ = f.input :customer_guid, collection: @people.map{ |e| [e.to_s, e.guid] }
28
28
 
29
29
  table#lines-table
30
30
  thead
@@ -1,4 +1,9 @@
1
- .well: .row
2
- .col-md-4 = info @statistics, :total_excluding_taxes, helper: :bm_currency
3
- .col-md-4 = info @statistics, :vat_amount, helper: :bm_currency
4
- .col-md-4 = info @statistics, :total_including_taxes, helper: :bm_currency
1
+ .well.text-center
2
+ .row
3
+ .col-md-4 = info @statistics, :total_excluding_taxes, helper: :bm_currency
4
+ .col-md-4 = info @statistics, :vat_amount, helper: :bm_currency
5
+ .col-md-4 = info @statistics, :total_including_taxes, helper: :bm_currency
6
+
7
+ - if params[:controller].end_with?("invoices")
8
+ hr
9
+ = billing_machine_invoices_chart
@@ -16,7 +16,7 @@ table.default.invoices
16
16
  th.hidden-xs
17
17
  = ::Dorsale::BillingMachine::Invoice.t(:total_including_taxes)
18
18
 
19
- th
19
+ th.actions
20
20
  = t("actions.actions")
21
21
 
22
22
  tbody
@@ -29,7 +29,8 @@ table.default.invoices
29
29
  = invoice.tracking_id
30
30
 
31
31
  td.customer_name
32
- = invoice.customer.try(:name)
32
+ - if invoice.customer
33
+ = link_to invoice.customer, invoice.customer
33
34
 
34
35
  td.total_excluding_taxes
35
36
  = bm_currency invoice.total_excluding_taxes
@@ -10,6 +10,12 @@
10
10
  :input_html => {value: @subject},
11
11
  )
12
12
 
13
+ = f.input(:from,
14
+ :disabled => true,
15
+ :label => t("attributes.email_from"),
16
+ :input_html => {value: "#{current_user} <#{current_user.email}>"},
17
+ )
18
+
13
19
  = f.input(:to,
14
20
  :disabled => true,
15
21
  :label => t("attributes.email_to"),
@@ -15,7 +15,7 @@
15
15
  = create_button dorsale.new_billing_machine_invoice_path
16
16
 
17
17
  - if policy(::Dorsale::BillingMachine::Invoice).export?
18
- = download_button dorsale.billing_machine_invoices_path(format: :csv), action: :export_csv
18
+ = download_button dorsale.billing_machine_invoices_path(format: :xlsx), download: "#{model.ts}.xlsx"
19
19
 
20
20
  - content_for :table
21
21
  = render "dorsale/billing_machine/invoices/list", invoices: @invoices
@@ -0,0 +1,41 @@
1
+ data = [
2
+ [
3
+ Dorsale::BillingMachine::Invoice.t(:date),
4
+ Dorsale::BillingMachine::Invoice.t(:tracking_id),
5
+ Dorsale::BillingMachine::Invoice.t(:label),
6
+ Dorsale::CustomerVault::Person.t(:name),
7
+ Dorsale::CustomerVault::Person.t(:street),
8
+ Dorsale::CustomerVault::Person.t(:street_bis),
9
+ Dorsale::CustomerVault::Person.t(:zip),
10
+ Dorsale::CustomerVault::Person.t(:city),
11
+ Dorsale::CustomerVault::Person.t(:country),
12
+ Dorsale::BillingMachine::Invoice.t(:commercial_discount),
13
+ Dorsale::BillingMachine::Invoice.t(:total_excluding_taxes),
14
+ Dorsale::BillingMachine::Invoice.t(:vat_amount),
15
+ Dorsale::BillingMachine::Invoice.t(:total_including_taxes),
16
+ Dorsale::BillingMachine::Invoice.t(:advance),
17
+ Dorsale::BillingMachine::Invoice.t(:balance),
18
+ ]
19
+ ]
20
+
21
+ @invoices_without_pagination.each do |invoice|
22
+ data << [
23
+ invoice.date,
24
+ invoice.tracking_id,
25
+ invoice.label,
26
+ invoice.customer.try(:name),
27
+ invoice.customer.try(:address).try(:street),
28
+ invoice.customer.try(:address).try(:street_bis),
29
+ invoice.customer.try(:address).try(:zip),
30
+ invoice.customer.try(:address).try(:city),
31
+ invoice.customer.try(:address).try(:country),
32
+ invoice.commercial_discount,
33
+ invoice.total_excluding_taxes,
34
+ invoice.vat_amount,
35
+ invoice.total_including_taxes,
36
+ invoice.advance,
37
+ invoice.balance,
38
+ ]
39
+ end
40
+
41
+ Dorsale::Serializers::XLSX.new(data).render_inline
@@ -1,6 +1,6 @@
1
1
  = filters_form do |f|
2
2
  = f.input(:customer_guid,
3
- :collection => @people.map { |p| [p.name, p.guid] },
3
+ :collection => @people.map { |p| [p.to_s, p.guid] },
4
4
  :include_blank => t("filters.all_customers"),
5
5
  )
6
6
 
@@ -19,7 +19,7 @@ table.default.quotations
19
19
  th.hidden-xs
20
20
  = ::Dorsale::BillingMachine::Quotation.t(:state)
21
21
 
22
- th
22
+ th.actions
23
23
  = t("actions.actions")
24
24
 
25
25
  tbody
@@ -32,7 +32,8 @@ table.default.quotations
32
32
  = quotation.tracking_id
33
33
 
34
34
  td.customer_name
35
- = quotation.customer.try(:name)
35
+ - if quotation.customer
36
+ = link_to quotation.customer, quotation.customer
36
37
 
37
38
  td.total_excluding_taxes
38
39
  = bm_currency quotation.total_excluding_taxes
@@ -40,7 +41,7 @@ table.default.quotations
40
41
  td.hidden-xs.total_including_taxes
41
42
  = bm_currency quotation.total_including_taxes
42
43
 
43
- td
44
+ td.hidden-xs
44
45
  = quotation.t("state.#{quotation.state}")
45
46
 
46
47
  td.actions
@@ -14,13 +14,13 @@
14
14
  p.infos
15
15
  span.commentable-container
16
16
  span.commentable
17
- = link_to comment.commentable.name, engine_polymorphic_path(comment.commentable)
17
+ = link_to comment.commentable, engine_polymorphic_path(comment.commentable)
18
18
 
19
19
  span.separator
20
20
  = " - "
21
21
 
22
22
  span.date
23
- = l(comment.created_at)
23
+ = date(comment.created_at)
24
24
 
25
25
  = " "
26
26
  = ::Dorsale::Comment.t(:written_by)
@@ -0,0 +1,5 @@
1
+ #dorsale-comments
2
+ - if policy(new_comment).create?
3
+ = render "dorsale/comments/form", comment: new_comment
4
+
5
+ = render "dorsale/comments/list", comments: comments
@@ -1,11 +1,10 @@
1
- = simple_form_for [dorsale, @comment], remote: true do |f|
2
- - if defined?(commentable)
3
- input type="hidden" name="commentable_id" value=commentable.id
4
- input type="hidden" name="commentable_type" value=commentable.class
1
+ = simple_form_for [dorsale, comment], remote: true do |f|
2
+ = f.hidden_field :commentable_id
3
+ = f.hidden_field :commentable_type
5
4
 
6
5
  .comment
7
- - if @comment.author.try(:avatar_url).present?
8
- = image_tag @comment.author.avatar_url, class: "avatar"
6
+ - if comment.author.try(:avatar_url).present?
7
+ = image_tag comment.author.avatar_url, class: "avatar"
9
8
  - else
10
9
  = image_tag "dorsale/avatar.png", class: "avatar"
11
10