update consultation show
This commit is contained in:
parent
74992c6607
commit
4faade463c
@ -191,6 +191,16 @@
|
||||
|
||||
|
||||
%h3 Lignes de produits
|
||||
.mb-3
|
||||
- if @price_document.cc_label == "Consultation fournisseur"
|
||||
= link_to ic(:clipboard) + " Copier le text", "#", class: "btn btn-primary", "data-document" => @price_document.id, onclick: 'copyPriceLines(event)'
|
||||
- existing_order = PriceDocument.where(doc_ref_id: @price_document.id, cc_label: "Commande achat")
|
||||
|
||||
- if existing_order.present?
|
||||
= link_to ic(:eye) + " Afficher la commande", admin_price_document_path(existing_order.first), class: "btn btn-tertiary"
|
||||
- else
|
||||
= link_to "Generer la commande", buy_order_create_admin_price_document_path(@price_document), class: "btn btn-primary"
|
||||
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
@ -213,16 +223,17 @@
|
||||
|
||||
|
||||
|
||||
|
||||
%td
|
||||
=price_line.p_product_ref.p_product.s_brand.name
|
||||
|
||||
%td
|
||||
%td{class: "p_product_ref_cc_name_#{@price_document.id}"}
|
||||
=link_to price_line.p_product_ref.cc_name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product
|
||||
|
||||
%td.numeraire
|
||||
%td.numeraire{class: "price_line_qte_#{@price_document.id}"}
|
||||
=price_line.qte
|
||||
|
||||
%td.numeraire
|
||||
%td.numeraire{class: "price_line_price_u_ht_#{@price_document.id}"}
|
||||
=number_to_currency price_line.price_u_ht
|
||||
|
||||
|
||||
@ -382,7 +393,7 @@
|
||||
= semantic_form_for [:admin, price_document_consult], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
||||
= form.button "Valider modifications", type: :submit, class: "btn btn-primary m-2"
|
||||
= link_to ic(:clipboard) + " Copier le text", "#", class: "btn btn-primary", "data-document" => price_document_consult.id, onclick: 'copyPriceLines(event)'
|
||||
- existing_order = PriceDocument.where(doc_ref_id: price_document_consult.id)
|
||||
- existing_order = PriceDocument.where(doc_ref_id: price_document_consult.id, cc_label: "Commande achat")
|
||||
- if existing_order.present?
|
||||
= link_to ic(:eye) + " Afficher la commande", admin_price_document_path(existing_order.first), class: "btn btn-tertiary"
|
||||
- else
|
||||
@ -399,18 +410,22 @@
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
:javascript
|
||||
const copyPriceLines = (event) => {
|
||||
event.preventDefault()
|
||||
let priceDocumentId = event.target.dataset.document
|
||||
let names = $(`.p_product_ref_cc_name_${priceDocumentId}`)
|
||||
let qtes = $(`.input_price_line_qte_${priceDocumentId}`)
|
||||
let qtes_input = $(`.input_price_line_qte_${priceDocumentId}`)
|
||||
let qtes = $(`.price_line_qte_${priceDocumentId}`)
|
||||
let prices = $(`.price_line_price_u_ht_${priceDocumentId}`)
|
||||
|
||||
let table = []
|
||||
names.each(function( i ) {
|
||||
let row = []
|
||||
row.push(qtes[i].valueAsNumber)
|
||||
if(qtes_input.length > 0) {
|
||||
row.push(qtes_input[i].valueAsNumber)
|
||||
}else{
|
||||
row.push(qtes[i].innerText.slice(0, -2))
|
||||
}
|
||||
row.push(" X ")
|
||||
row.push(names[i].innerText)
|
||||
row.push(" @ ")
|
||||
|
Reference in New Issue
Block a user