From 5d4f43c27fcbd179f9036f69fe10c5737f989880 Mon Sep 17 00:00:00 2001 From: 10994015 Date: Mon, 22 Jan 2024 13:30:51 +0800 Subject: [PATCH] 0122 --- wms/excel-upload.php | 1 + wms/mkt/assets/js/alpine.js | 34 ++++++++++++++++++++++++---- wms/mkt/price_normal-index.php | 6 +++++ wms/mkt/pricereview-create.php | 30 ++++++++++++++---------- wms/mkt/pricereview_facility-api.php | 1 - 5 files changed, 55 insertions(+), 17 deletions(-) diff --git a/wms/excel-upload.php b/wms/excel-upload.php index 222c585b..f9f1bece 100644 --- a/wms/excel-upload.php +++ b/wms/excel-upload.php @@ -3,6 +3,7 @@ include "header.php"; require_once 'PHPExcel/PHPExcel.php'; require_once 'PHPExcel/IOFactory.php'; + $file_name = $_FILES["fileToUpload"]["name"]; $temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; $target_dir = "excel-uploads/"; diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js index adbed315..1f8a2f52 100644 --- a/wms/mkt/assets/js/alpine.js +++ b/wms/mkt/assets/js/alpine.js @@ -199,6 +199,7 @@ const pricereviewOptionSelect = () => { init() { this.optionCategory = 0 this.initButtons(); + this.renderTbody(); console.log(this.options) }, options: options, @@ -253,35 +254,40 @@ const pricereviewOptionSelect = () => { }, optionSubCategory: 1, changeCategory(category, subcategory = 0) { + console.log(this.$refs.selectModalBody); + this.initButtons(category) this.kind = (category == 'sub') ? this.kind : category; - if (subcategory != 0) { this.subkind = subcategory } else { this.subkind = 0 } - if (category == 0) { this.kind = 0; this.subkind = 0; } - this.initButtons(category) + this.searchtext = "" this.reloadOptions(); + }, reloadOptions() { if (this.kind == 0) { this.options = this.orioptions + this.renderTbody(); return; } if (this.subkind == 0) { this.options = this.orioptions.filter(option => option.kind == this.kind) + this.renderTbody(); return; } this.options = this.orioptions.filter(option => option.kind == this.kind && option.subkind == this.subkind) + this.renderTbody(); }, searchOptions(e) { + e = null; this.reloadOptions(); - let val = e.target.value.toLowerCase() + let val = (e== null) ? this.searchtext : e.target.value.toLowerCase() this.options = (this.options).filter(option=>{ if(option.group_name == null) option.group_name = '' if(option.spec == null) option.spec = '' @@ -290,6 +296,26 @@ const pricereviewOptionSelect = () => { if(option.unit == null) option.unit = '' return option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val) }) + }, + renderTbody() { + return + console.log(this.options); + this.$refs.selectModalBody; + let html = ""; + for (let i = 0; i < this.options.length; i++) { + html += "" + html += "" + this.options[i].id + "" + html += "" + this.options[i].group_name + "" + html += "" + this.options[i].spec + "" + html += "" + this.options[i].memo + "" + html += "" + this.options[i].optional + "" + html += "" + this.options[i].unit + "" + html += "" + this.options[i].price + "" + html += ""; + } + + this.$refs.selectModalBody.innerHTML = html; + } } diff --git a/wms/mkt/price_normal-index.php b/wms/mkt/price_normal-index.php index daa4ef37..acd7b3af 100644 --- a/wms/mkt/price_normal-index.php +++ b/wms/mkt/price_normal-index.php @@ -39,6 +39,7 @@ include "../header.php";
+ 下載電子檔(小機房) @@ -369,6 +371,7 @@ include "../header.php";
+ 下載電子檔(小電梯) @@ -532,6 +536,7 @@ include "../header.php";
+ 下載電子檔(小機房貨梯) @@ -653,6 +658,7 @@ include "../header.php";
+ 下載電子檔(平台梯) diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php index 001144b2..8853257f 100644 --- a/wms/mkt/pricereview-create.php +++ b/wms/mkt/pricereview-create.php @@ -753,17 +753,9 @@ $option_str .= "
"; $("#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() + '
(' + 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); 定價 - -