Fixed icons in table

This commit is contained in:
2024-08-10 19:56:32 +02:00
parent d0c653d61a
commit 083ec5253a
4 changed files with 20 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
class Job < ApplicationRecord
belongs_to :operator, class_name: 'User', optional: true
belongs_to :costumer, class_name: 'User', optional: true
belongs_to :operator, class_name: "User", optional: true
belongs_to :costumer, class_name: "User", optional: true
has_one_attached :pdf, dependent: :purge
@@ -29,11 +29,11 @@ class Job < ApplicationRecord
scope :created_today, -> { created_on_day(Time.now) }
scope :created_on_day, lambda { |date|
where('created_at >= ? AND created_at <= ?', date.beginning_of_day, date.end_of_day)
where("created_at >= ? AND created_at <= ?", date.beginning_of_day, date.end_of_day)
}
scope :upgraded_today, -> { upgraded_on_day(Time.now) }
scope :upgraded_on_day, lambda { |date|
where('upgraded_at >= ? AND upgraded_at <= ?', date.beginning_of_day, date.end_of_day)
where("upgraded_at >= ? AND upgraded_at <= ?", date.beginning_of_day, date.end_of_day)
}
# Returns all jobs with status: open print ready_for_pickup and jobs from today with status: paid canceled
# paid: only updated_at today
@@ -42,7 +42,7 @@ class Job < ApplicationRecord
# NOTE: use Time.now instead of Date.today to take the timezone into account
where(status: %i[open printing ready_for_pickup])
.or(Job.where(status: %i[paid canceled])
.where('status_changed_at >= ?', Time.now.beginning_of_day))
.where("status_changed_at >= ?", Time.now.beginning_of_day))
# .in_status_order
.order(created_at: :desc)
.order(:costumer_firstname, :costumer_lastname)
@@ -50,17 +50,17 @@ class Job < ApplicationRecord
# .references(:pdf_attachment, :blob) # creates big join table
end
def fullname
[costumer_firstname, ' ', costumer_lastname].join
def costumer_fullname
[ costumer_firstname, " ", costumer_lastname ].join
end
def acceptable_pdf
return unless pdf.attached?
acceptable_types = ['application/pdf']
acceptable_types = [ "application/pdf" ]
errors.add(:pdf, 'is too big') unless pdf.blob.byte_size <= 100.megabyte
errors.add(:pdf, 'must be a PDF') unless acceptable_types.include?(pdf.content_type)
errors.add(:pdf, "is too big") unless pdf.blob.byte_size <= 100.megabyte
errors.add(:pdf, "must be a PDF") unless acceptable_types.include?(pdf.content_type)
end
def able_to_cancel?