From 955132c3e79f95849729e17b2b656e81884912a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=89=E7=A5=A5=20=E8=A9=B9?= Date: Mon, 19 Aug 2024 02:30:19 +0800 Subject: [PATCH] updates --- Controllers/AuthApiController.cs | 2 + Views/Home/ModalList.cshtml | 128 +++++++++++++++++- Views/Shared/_LooperLayout.cshtml | 6 + .../custom/loadMainItemTypeahead.js | 50 +++++++ wwwroot/assets/javascript/custom/modallist.js | 89 ++++++++++++ 5 files changed, 271 insertions(+), 4 deletions(-) create mode 100644 wwwroot/assets/javascript/custom/loadMainItemTypeahead.js diff --git a/Controllers/AuthApiController.cs b/Controllers/AuthApiController.cs index 26ab05e0..2d0154c1 100644 --- a/Controllers/AuthApiController.cs +++ b/Controllers/AuthApiController.cs @@ -23,6 +23,8 @@ namespace QuotationMaker.Controllers this._httpContextAccessor = httpContextAccessor; } + + [Route("authModalQuotationList")] public ActionResult AuthModalQuotationList(IFormCollection obj) { diff --git a/Views/Home/ModalList.cshtml b/Views/Home/ModalList.cshtml index a3b1cb3c..a2d41333 100644 --- a/Views/Home/ModalList.cshtml +++ b/Views/Home/ModalList.cshtml @@ -46,7 +46,7 @@ -
+ -
- +
+
+ +
-
+
@@ -281,6 +283,89 @@ Add Menu Item
+ +
+
+ Footer Menus +
+ +
+ +
+ +
    +
  1. +
    +
    +
    + +
    +
    +
    +

    + 會員電子報上稿製作 +

    +

    + 協助代為租用多IP發信系統,減少擋信機率 + .年約優惠方案$961美元,匯率$32 + .每月最多發送份數共60,000份 + .超過平台每月6萬封發報限制,則以額外購買額度 0.06元/封 計算 +

    +

    + 單價 NT$3,500, 數量 10, 單位 次 + 小計 NT$35,000 + AC(N) +

    +
    +
    + + + +
    +
    + +
    +
    + +
  2. + +
  3. +
    +
    +
    + +
    +
    +
    +

    + 會員電子報上稿製作 +

    +

    + 協助代為租用多IP發信系統,減少擋信機率 + .年約優惠方案$961美元,匯率$32 + .每月最多發送份數共60,000份 + .超過平台每月6萬封發報限制,則以額外購買額度 0.06元/封 計算 +

    +

    + 單價 NT$3,500, 數量 10, 單位 次 + 小計 NT$35,000 + AC(N) +

    +
    +
    +
    +
    + +
    +
    + +
  4. +
+ + +
@@ -291,4 +376,39 @@
+ + +
+
\ No newline at end of file diff --git a/Views/Shared/_LooperLayout.cshtml b/Views/Shared/_LooperLayout.cshtml index 2b0427fc..13bf052f 100644 --- a/Views/Shared/_LooperLayout.cshtml +++ b/Views/Shared/_LooperLayout.cshtml @@ -194,8 +194,12 @@ + + + + @@ -226,7 +230,9 @@ + + diff --git a/wwwroot/assets/javascript/custom/loadMainItemTypeahead.js b/wwwroot/assets/javascript/custom/loadMainItemTypeahead.js new file mode 100644 index 00000000..bb7ffe2e --- /dev/null +++ b/wwwroot/assets/javascript/custom/loadMainItemTypeahead.js @@ -0,0 +1,50 @@ + $('#modelMainItem_name').typeahead( + { + minLength: 0, + highlight: true, + source: function(request, response) { + var formData = { + dept_uid: $('#dept_select').val() + }; + + $.ajax({ + url: "/AuthApi/authMainItemList", + type: "post", + data: formData, + success: function(data, textStatus, jqXHR) { + if (data.ret == "yes") { + var obj = data.mainItems; + + mainItem_items = []; + function loadMainItemTypeahead() { + mainItem_map = {}; + + $.each(obj, function(i, item) { + var id = item.mainItem_uid; + var name = item.mainItem_name; + mainItem_map[name] = { id: id, name: name }; + mainItem_items.push(name); + }); + response(mainItem_items); + } else { + alert(data.message); + + if (data.err_code == "99999") { + location.href = "/Root/Login"; + } + } + }, + error: function(jqXHR, textStatus, errorThrown) { + alert('ΦAoͿ~Aеy᭫!'); + } + }); + + + }, + updater: function(item) { + $('#parent_mainItem_uid').val(mainItem_map[item].id); + return item; + } + } + ); +} diff --git a/wwwroot/assets/javascript/custom/modallist.js b/wwwroot/assets/javascript/custom/modallist.js index 8a38840c..1c4dc5ca 100644 --- a/wwwroot/assets/javascript/custom/modallist.js +++ b/wwwroot/assets/javascript/custom/modallist.js @@ -5,10 +5,31 @@ var modelProjRowID; var modelQuotationTable; var modelQuotationRowPos; var modelQuotationRowID; + +var mainItem_items = []; +var mainItem_map = {}; $(document).ready(function () { deptList(); loadModelQuotationDataTable(); + $('#dept_select').on('change', function () { + $('#dt-responsive').DataTable().ajax.reload(); + }); + + //新增主項目對話框儲存鈕 + $('#modelMainItemDialogSaveBtn').on('click', function () { + + }); + + //新增主項目鈕 + $('#addModelMainItemBtn').on('click', function () { + $('#modelMainItem_name').typeahead('destroy'); + + loadMainItemTypeahead(); + $('#modelMainItem_method').val('add'); + $('#modelMainItemModal').modal('toggle'); + }); + //新增報價單範本視窗 $('#modelQuotationListNewBtn').on('click', function () { $('#clientModelQuotationPreviewModal').modal('toggle'); @@ -80,6 +101,74 @@ $(document).ready(function () { }); }); +function loadMainItemTypeahead() { + var formData = { + dept_uid: $('#dept_select').val() + } + + $.ajax({ + url: "/AuthApi/authMainItemList", + type: "post", + data: formData, + success: function (data, textStatus, jqXHR) { + if (data.ret == "yes") { + var obj = data.mainItems; + + mainItem_items = []; + mainItem_map = {}; + + $.each(obj, function (i, item) { + var id = item.mainItem_uid; + var name = item.mainItem_name; + mainItem_map[name] = { id: id, name: name }; + mainItem_items.push(name); + }); + + var bh = new Bloodhound({ + local: mainItem_items, + queryTokenizer: Bloodhound.tokenizers.whitespace, + datumTokenizer: Bloodhound.tokenizers.whitespace + }); + + var nflTeamsWithDefaults = function nflTeamsWithDefaults(q, sync) { + if (q === '') { + sync(bh.index.all()); + } else { + bh.search(q, sync); + } + }; + + $('#modelMainItem_name').typeahead( + { + minLength: 0, + highlight: false + }, + { + source: nflTeamsWithDefaults + } + + ); + + $('#modelMainItem_name').bind('typeahead:select', function (ev, suggestion) { + console.log('Selection: ' + suggestion); + console.log('Selection key: ' + mainItem_map[suggestion].id); + }); + + } else { + alert(data.message); + + if (data.err_code == "99999") { + location.href = "/Root/Login"; + } + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('網路或伺服器發生錯誤,請稍後重試!'); + } + }); + + +} function loadModelQuotationDataTable() { var dataTables = { init: function init() {