|
|
@ -753,17 +753,9 @@ $option_str .= "</tbody></table>"; |
|
|
|
|
|
|
|
$("#optionModal").modal('show'); |
|
|
|
var jobj = $(this); // 父視窗 |
|
|
|
$("#optionModal .modal-body td").unbind().click(function() { |
|
|
|
$("#optionModal .modal-body td").off().click(function(){ |
|
|
|
var pobj = $(this).closest('td').parent(); |
|
|
|
// console.log(pobj.find('input[name=optionID]').val()); |
|
|
|
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html())); |
|
|
|
console.log(pobj.find('td').eq(0).html()); |
|
|
|
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')'); |
|
|
|
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html()); |
|
|
|
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, ""))); |
|
|
|
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html()); |
|
|
|
$("#optionModal").modal('hide'); |
|
|
|
|
|
|
|
selectOptionFn(pobj, jobj) |
|
|
|
}); |
|
|
|
}); |
|
|
|
$("#optionFaciModal").on("hidden.bs.modal", function() { |
|
|
@ -1281,8 +1273,8 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
|
|
<th scope="col" nowrap>定價</th> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<template x-for="option in options"> |
|
|
|
<tbody id="selectModalBody" x-ref="selectModalBody"> |
|
|
|
<template x-for="option in options" :key="option.id"> |
|
|
|
<tr style="cursor:pointer"> |
|
|
|
<td x-text='option.id' name="optionID"></td> |
|
|
|
<td x-text="option.group_name"> </td> |
|
|
@ -2534,4 +2526,18 @@ include "../footer.php"; |
|
|
|
|
|
|
|
<script> |
|
|
|
const options = [...<?php echo json_encode($options); ?>]; |
|
|
|
|
|
|
|
function selectOptionFn(pobj, jobj){ |
|
|
|
// var pobj = $(this).closest('td').parent(); |
|
|
|
console.log(pobj); |
|
|
|
// console.log(pobj.find('input[name=optionID]').val()); |
|
|
|
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html())); |
|
|
|
console.log(pobj.find('td').eq(0).html()); |
|
|
|
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')'); |
|
|
|
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html()); |
|
|
|
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, ""))); |
|
|
|
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html()); |
|
|
|
$("#optionModal").modal('hide'); |
|
|
|
|
|
|
|
} |
|
|
|
</script> |