diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 151495f..61f60a8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,6 +5,7 @@ module ApplicationHelper options[:nocomment] = true options[:variant] ||= :outline #options[:class] = options.fetch(:class, nil) + options[:class] = "size-5" unless options[:class] path = options.fetch(:path, "icons/#{options[:variant]}/#{name}.svg") icon = path inline_svg_tag(icon, options) diff --git a/app/models/job.rb b/app/models/job.rb index eb2f999..9da1b8c 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -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? diff --git a/app/views/jobs/_job_tr.html.erb b/app/views/jobs/_job_tr.html.erb index 33fbe87..2ff2f27 100644 --- a/app/views/jobs/_job_tr.html.erb +++ b/app/views/jobs/_job_tr.html.erb @@ -2,10 +2,10 @@ <%= job.id %> - <%= job.fullname %> - + <%= job.costumer_fullname %> + <% if job.pdf.attached? %> - <%= image_tag url_for(job.pdf.preview(resize_to_limit: [100, 100])) %> + <%= image_tag url_for(job.pdf.preview(resize_to_limit: [100, 100])) %> <% end %> @@ -22,12 +22,14 @@ <%= job.costum_qm_plan.round(2) %> m² <%= job.cost.round(2) %> € - <%= job.status %> + <%= job.status %> - <%= link_to icon("pencil", class: "size-5 inline"), edit_job_path(job), classe: "p-1.5 ml-2 rounded-lg bg-gray-300 bg-opacity-50 font-medium" %> + <%= link_to icon("pencil-square", class: "size-5 inline"), edit_job_path(job), classe: "p-1.5 ml-2 rounded-lg bg-gray-300 bg-opacity-50 font-medium" %> <% if job.able_to_cancel? %> - <%= button_to "Abbrechen", cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, class: "p-1.5 inline ml-2 rounded-lg bg-gray-100 font-medium" %> + <%= button_to icon("x-circle", class: "text-hsrm-red size-5 inline"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %> + <% else %> + <%= icon("x-circle", class: "text-hsrm-gray text-opacity-50 size-5 inline") %> <% end %> diff --git a/config/tailwind.config.js b/config/tailwind.config.js index c8f31b7..59fd7ca 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -12,14 +12,13 @@ module.exports = { fontFamily: { sans: ["Inter var", ...defaultTheme.fontFamily.sans], }, - }, - extend: { colors: { "hsrm-red": "#c20008", "hsrm-red-dark": "#af0007", "hsrm-red-light": "#e20009", "hsrm-gray": "#3a3a3a", "hsrm-gray-dark": "#212121", + "hsrm-gray-light": "#4e4e4e", "status-open": "#111827", // gray-900 "status-open-light": "#d1d5db", // gray-300 "status-printing": "#713f12", // yellow-900