<div id="<%= dom_id job %>" class="flex flex-row space-x-4 shadow">
  <div>
    <% if @job.pdf.attached? && job.pdf.previewable? %>
        <embed type="application/pdf" src="<%= url_for(@job.pdf) %>" width="600px" height="800px" class="" />
    <% end %>
  </div>
  <div>
    <p class="my-3">
      <strong class="mb-1 font-medium">customer ID:</strong>
      <% if job.customer %>
        <%= link_to_if allowed_to?(:show?, job.customer, namespace: :Admin), "#{job.customer_id} - #{job.customer.name} (#{job.customer.email})", admin_user_path(job.customer) %>
      <% else %>
        -
      <% end %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Creator ID:</strong>
      <% if job.creator %>
        <%= link_to_if allowed_to?(:show?, job.creator, namespace: :Admin, ), "#{job.creator_id} - #{job.creator.name} (#{job.creator.email})", admin_user_path(job.creator) %>
      <% else %>
        -
      <% end %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Operator ID:</strong>
      <% if job.operator %>
        <%= link_to_if allowed_to?(:show?, job.operator, namespace: :Admin), "#{job.operator_id} - #{job.operator.name} (#{job.operator.email})", admin_user_path(job.operator) %>
      <% else %>
        -
      <% end %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Cashier ID:</strong>
      <% if job.cashier %>
        <%= link_to_if allowed_to?(:show?, job.cashier, namespace: :Admin), "#{job.cashier_id} - #{job.cashier.name} (#{job.cashier.email})", admin_user_path(job.cashier) %>
      <% else %>
        -
      <% end %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Kunde:</strong>
      <%= link_to_if job.customer && allowed_to?(:show? , job.customer, namespace: :Admin), "#{job.customer_firstname} #{job.customer_lastname}", ( job.customer ? admin_user_path(job.customer) : "" ) %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Operator:</strong>
      <%= link_to_if job.operator && allowed_to?(:show, job.operator, namespace: :Admin), "#{job.operator_firstname} #{job.operator_lastname}", ( job.operator ? admin_users_path(job.operator) : "" )%>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Kassierer:</strong>
      <%= link_to_if job.cashier && allowed_to?(:show, job.cashier, namespace: :Admin), "#{job.cashier_firstname} #{job.cashier_lastname}", ( job.cashier ? admin_users_path(job.cashier) : "" ) %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Erstellt durch Operator:</strong>
      <%= icon bool_icon(job.created_by_operator), class: "icon #{job.created_by_operator ? "text-green-600" : "text-red-600"}" %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Aktueller Status:</strong>
      <span class="badge badge-status inline text-status-<%= job.status.to_sym %> bg-status-<%= job.status %>-light">
        <%= job.status %>
      </span>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Paid at:</strong>
      <%= job.paid_at %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Printed at:</strong>
      <%= job.printed_at %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Interne Umbuchung:</strong>
      <%= icon bool_icon(job.intern), class: "icon #{job.intern ? "text-green-600" : "text-red-600"}" %>
    </p>
    <p class="my-3">
      <strong class="mb-1 font-medium">Kostenstelle:</strong>
      <%= job.cost_center %>
    </p>
    <p class="my-3">
      <strong class="block mb-1 font-medium">Plans:
        <table class="text-center">
          <tr class="p-2 bg-gray-300">
            <th class="p-2">a0</th>
            <th class="p-2">a1</th>
            <th class="p-2">a2</th>
            <th class="p-2">a3</th>
            <th class="p-2">costum</td>
          </tr>
          <tr>
            <td><%= job.number_of_plans_a0 %></td>
            <td><%= job.number_of_plans_a1 %></td>
            <td><%= job.number_of_plans_a2 %></td>
            <td><%= job.number_of_plans_a3 %></td>
            <td><%= job.costum_qm_plan %> qm</td>
          </tr>
        </table>
      </p>
      <%= link_to "Edit this job", edit_operator_job_path(@job), class: "btn" %>
      <%= link_to "Back to jobs", operator_jobs_path, class: "btn" %>
      <div class="inline-block">
        <%= button_to "Destroy this job", operator_job_path(@job), method: :delete, class: "btn btn-alert inline-block" %>
      </div>
    </div>
  </div>
