update new code
parent
2fa95cd51c
commit
d6105f97b3
|
|
@ -15,6 +15,8 @@ public class DbTableClass
|
||||||
[Key]
|
[Key]
|
||||||
public int kolProjectPrice_sn { get; set; }
|
public int kolProjectPrice_sn { get; set; }
|
||||||
public string kolProjectPrice_uid { get; set; } = "";
|
public string kolProjectPrice_uid { get; set; } = "";
|
||||||
|
|
||||||
|
public string kolProject_uid { get; set; } = "";
|
||||||
public string optionItem_uid { get; set; } = "";
|
public string optionItem_uid { get; set; } = "";
|
||||||
public string mediaItem_uid { get; set; } = "";
|
public string mediaItem_uid { get; set; } = "";
|
||||||
public string kolProjectPrice_other { get; set; } = "";
|
public string kolProjectPrice_other { get; set; } = "";
|
||||||
|
|
|
||||||
|
|
@ -415,10 +415,10 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 10%;"> 合作平台 </th>
|
<th style="width: 10%;"> 合作平台 </th>
|
||||||
<th style="width: 25%;"> 規格 </th>
|
<th style="width: 30%;"> 規格 </th>
|
||||||
<th style="width: 12%;"> 數量 </th>
|
<th style="width: 10%; text-align: right;"> 數量 </th>
|
||||||
<th style="width: 12%;"> 報價 </th>
|
<th style="width: 10%; text-align: right;"> 報價 </th>
|
||||||
<th> 資料日期</th>
|
<th> 報價日期</th>
|
||||||
<th style="width: 18%;"></th>
|
<th style="width: 18%;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -559,7 +559,7 @@
|
||||||
</form><!-- /.modal -->
|
</form><!-- /.modal -->
|
||||||
<!-- .modal -->
|
<!-- .modal -->
|
||||||
<form id="clientKolProjectMediaPriceEditForm" name="clientKolProjectMediaPriceEditForm">
|
<form id="clientKolProjectMediaPriceEditForm" name="clientKolProjectMediaPriceEditForm">
|
||||||
<div class="modal fade" id="clientKolProjectMediaPriceEditModal" tabindex="-1" role="dialog" aria-labelledby="clientKolProjectMediaPriceEditModalLabel" data-backdrop="static" aria-hidden="true">
|
<div class="modal fade" id="clientKolProjectMediaPriceEditModal" tabindex="-1" role="dialog" aria-labelledby="clientKolProjectMediaPriceEditFormLabel" data-backdrop="static" aria-hidden="true">
|
||||||
<!-- .modal-dialog -->
|
<!-- .modal-dialog -->
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<!-- .modal-content -->
|
<!-- .modal-content -->
|
||||||
|
|
@ -567,17 +567,17 @@
|
||||||
<!-- .modal-header -->
|
<!-- .modal-header -->
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h6 id="socialModalLabel" class="modal-title inline-editable">
|
<h6 id="socialModalLabel" class="modal-title inline-editable">
|
||||||
<span class="sr-only">合作形式與報價</span> <input id="option_name" type="text" class="form-control form-control-lg" value="" placeholder="合作形式與報價" readonly="readonly " required="">
|
<span class="sr-only">合作形式與報價</span> <input id="optionCooper_name" type="text" class="form-control form-control-lg" value="" placeholder="合作形式與報價" readonly="readonly" required="">
|
||||||
</h6>
|
</h6>
|
||||||
</div><!-- /.modal-header -->
|
</div><!-- /.modal-header -->
|
||||||
<!-- .modal-body -->
|
<!-- .modal-body -->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" id="kolProjectPrice_method" />
|
<input type="hidden" id="kolProjectPrice_method" />
|
||||||
<input type="hidden" id="kolProjectPrice_uid" />
|
<input type="hidden" id="kolProjectPrice_uid" />
|
||||||
<input type="hidden" id="optionItem_uid" />
|
<input type="hidden" id="kolProjectPrice_optionItem_uid" />
|
||||||
<input type="hidden" id="mediaItem_uid" />
|
<input type="hidden" id="kolProjectPrice_mediaItem_uid" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="cnCountry"> 媒體平台 </label> <select id="kolProjectMedia_select" class="custom-select d-block w-100">
|
<label for="cnCountry"> 合作平台 </label> <select id="kolProjectMedia_select" class="custom-select d-block w-100">
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -615,7 +615,7 @@
|
||||||
</div><!-- /.modal-body -->
|
</div><!-- /.modal-body -->
|
||||||
<!-- .modal-footer -->
|
<!-- .modal-footer -->
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" id="optionItemDialogSaveBtn" class="btn btn-primary">Save</button> <button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
|
<button type="button" id="kolProjectPriceDialogSaveBtn" class="btn btn-primary">Save</button> <button type="button" class="btn btn-light" data-toggle="modal" data-target="#clientKolProjectMediaPriceEditModal" >Close</button>
|
||||||
</div><!-- /.modal-footer -->
|
</div><!-- /.modal-footer -->
|
||||||
</div><!-- /.modal-content -->
|
</div><!-- /.modal-content -->
|
||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
|
|
|
||||||
|
|
@ -288,3 +288,50 @@ function checkUrl(url) {
|
||||||
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
||||||
return !!pattern.test(url);
|
return !!pattern.test(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//數字處理為有千分位
|
||||||
|
function AppendComma(n) {
|
||||||
|
if (!/^((-*\d+)|(0))$/.test(n)) {
|
||||||
|
var newValue = /^((-*\d+)|(0))$/.exec(n);
|
||||||
|
if (newValue != null) {
|
||||||
|
if (parseInt(newValue, 10)) {
|
||||||
|
n = newValue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (parseInt(n, 10) == 0) {
|
||||||
|
n = '0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n = parseInt(n, 10).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
n += '';
|
||||||
|
var arr = n.split('.');
|
||||||
|
var re = /(\d{1,3})(?=(\d{3})+$)/g;
|
||||||
|
return arr[0].replace(re, '$1,') + (arr.length == 2 ? '.' + arr[1] : '');
|
||||||
|
}
|
||||||
|
//將有千分位的數值轉為一般數字
|
||||||
|
function RemoveComma(n) {
|
||||||
|
return n.replace(/[,]+/g, '');
|
||||||
|
}
|
||||||
|
//調整千分位
|
||||||
|
function AdjustComma(item, length) {
|
||||||
|
var originalValue = $.trim($(item).val()).length > length
|
||||||
|
? $.trim($(item).val()).substr(0, length)
|
||||||
|
: $.trim($(item).val());
|
||||||
|
|
||||||
|
$(item).val(AppendComma(originalValue));
|
||||||
|
}
|
||||||
|
//動態調整輸入欄位的長度
|
||||||
|
function TextAreaLength(item, length) {
|
||||||
|
if (item.value.length > length) {
|
||||||
|
item.value = item.value.substring(0, length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ var delMedia;
|
||||||
var mainTable;
|
var mainTable;
|
||||||
var mainRowID;
|
var mainRowID;
|
||||||
var mainPos;
|
var mainPos;
|
||||||
|
var specTr;
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
delMedia = '';
|
delMedia = '';
|
||||||
loadTagsInput();
|
loadTagsInput();
|
||||||
|
|
@ -251,6 +252,63 @@ $(document).ready(function () {
|
||||||
$('#clientNewModal').modal('toggle');
|
$('#clientNewModal').modal('toggle');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//報價規則儲存
|
||||||
|
$('#kolProjectPriceDialogSaveBtn').on('click', function () {
|
||||||
|
var method = $('#kolProjectPrice_method').val();
|
||||||
|
var kolProjectPrice_uid = $('#kolProjectPrice_uid').val();
|
||||||
|
var kolProjectMedia_selectText = $("#kolProjectMedia_select option:selected").text();
|
||||||
|
var kolProjectMedia_select = $("#kolProjectMedia_select").val();
|
||||||
|
var kolProjectSpec_select = $("#kolProjectSpec_select").val();
|
||||||
|
var kolProjectSpec_selectText = $("#kolProjectSpec_select option:selected").text();
|
||||||
|
var optionItem_uid = $("#kolProjectPrice_optionItem_uid").val();
|
||||||
|
var kolProjectPrice_mediaItem_uid = $("#kolProjectPrice_mediaItem_uid").val();
|
||||||
|
var kolProjectPrice_other = $("#kolProjectPrice_other").val();
|
||||||
|
var kolProjectPrice_num = $("#kolProjectPrice_num").val();
|
||||||
|
var kolProjectPrice_cost = $("#kolProjectPrice_cost").val();
|
||||||
|
var kolProjectPrice_date = $("#kolProjectPrice_date").val();
|
||||||
|
|
||||||
|
var err_msg = "";
|
||||||
|
|
||||||
|
if (kolProjectMedia_select == "") {
|
||||||
|
err_msg += "請選擇合作平台\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kolProjectSpec_select == "") {
|
||||||
|
err_msg += "請選擇規格\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kolProjectPrice_cost.isNumber() == false) {
|
||||||
|
kolProjectPrice_cost = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err_msg != "") {
|
||||||
|
alert(err_msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method == 'add') {
|
||||||
|
var trHtml = "";
|
||||||
|
trHtml += '<tr>';
|
||||||
|
trHtml += ' <td class="align-middle"> ' + kolProjectMedia_selectText + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle"> ' + kolProjectSpec_selectText + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle" style="text-align: right;"> ' + kolProjectPrice_num + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle" style="text-align: right;"> ' + AppendComma(kolProjectPrice_cost) + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle"> ' + kolProjectPrice_date + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle" style="display: none;"> ' + kolProjectPrice_other + ' </td>';
|
||||||
|
trHtml += ' <td class="align-middle text-right">';
|
||||||
|
trHtml += ' <input type="hidden" data-name="other" style="display: none;" other-value="' + kolProjectPrice_other + '">';
|
||||||
|
trHtml += ' <button type="button" data-uid="" media-uid="' + kolProjectMedia_select + '" mediaItem-uid="' + kolProjectSpec_select + '" data-method="edit" onclick="specButtonClick(this);" class="btn btn-sm btn-icon btn-secondary" data-toggle="modal" data-target="#clientContactEditModal"><i class="fa fa-pencil-alt"></i> <span class="sr-only">Edit</span></button>';
|
||||||
|
trHtml += ' <button type="button" data-uid="" media-uid="' + kolProjectMedia_select + '" mediaItem-uid="' + kolProjectSpec_select + '" data-method="del" onclick="specButtonClick(this);" class="btn btn-sm btn-icon btn-secondary"><i class="far fa-trash-alt"></i> <span class="sr-only">Remove</span></button>';
|
||||||
|
trHtml += ' </td>';
|
||||||
|
trHtml += '</tr>';
|
||||||
|
|
||||||
|
$('#price_table tbody').append(trHtml);
|
||||||
|
$('#clientKolProjectMediaPriceEditModal').modal('toggle');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$("#project_year").on('change', function () {
|
$("#project_year").on('change', function () {
|
||||||
loadprojectList();
|
loadprojectList();
|
||||||
});
|
});
|
||||||
|
|
@ -281,6 +339,7 @@ $(document).ready(function () {
|
||||||
$('#kolProjectPrice_method').val('add');
|
$('#kolProjectPrice_method').val('add');
|
||||||
$('#kolProjectSpec_other').val('');
|
$('#kolProjectSpec_other').val('');
|
||||||
$('#kolProjectSpec_other').hide();
|
$('#kolProjectSpec_other').hide();
|
||||||
|
loadkolMediaSpec();
|
||||||
$('#clientKolProjectMediaPriceEditModal').modal('toggle');
|
$('#clientKolProjectMediaPriceEditModal').modal('toggle');
|
||||||
});
|
});
|
||||||
function loadDataTable() {
|
function loadDataTable() {
|
||||||
|
|
@ -640,6 +699,35 @@ function loadCooperateItem() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function specButtonClick(obj) {
|
||||||
|
specTr = $(obj).closest('tr');
|
||||||
|
|
||||||
|
var dataMethod = obj.getAttribute('data-method');
|
||||||
|
var mediaItem_uid = obj.getAttribute('mediaItem-uid');
|
||||||
|
var mediaUid = obj.getAttribute('media-uid');
|
||||||
|
var other = specTr.find('td').eq(5).text().trim();
|
||||||
|
var kolProjectMedia_selectText = specTr.find('td').eq(0).text().trim();
|
||||||
|
var kolProjectSpec_selectText = specTr.find('td').eq(1).text().trim();
|
||||||
|
var kolProjectPrice_num = specTr.find('td').eq(2).text().trim();
|
||||||
|
var kolProjectPrice_cost = RemoveComma(specTr.find('td').eq(3).text().trim());
|
||||||
|
var kolProjectPrice_date = specTr.find('td').eq(4).text().trim();
|
||||||
|
|
||||||
|
if (dataMethod == 'edit') {
|
||||||
|
$('#kolProjectPrice_method').val('edit');
|
||||||
|
$('#k#lProjectPrice_optionItem_uid').val(mediaUid);
|
||||||
|
$('#kolProjectPrice_mediaItem_uid').val(mediaItem_uid);
|
||||||
|
|
||||||
|
$('#kolProjectMedia_select').val(mediaUid).trigger('change');
|
||||||
|
$('#kolProjectPrice_other').val(other).trigger('change');
|
||||||
|
$('#kolProjectPrice_num').val(kolProjectPrice_num).trigger('change');
|
||||||
|
$('#kolProjectPrice_cost').val(kolProjectPrice_cost).trigger('change');
|
||||||
|
$('#kolProjectPrice_date').val(kolProjectPrice_date).trigger('change');
|
||||||
|
$('#kolProjectSpec_select').val(mediaItem_uid).trigger('change');
|
||||||
|
|
||||||
|
$('#clientKolProjectMediaPriceEditModal').modal('toggle');
|
||||||
|
}
|
||||||
|
}
|
||||||
function buttonClick2(obj) {
|
function buttonClick2(obj) {
|
||||||
var type = obj.getAttribute('data-method');
|
var type = obj.getAttribute('data-method');
|
||||||
var uid = obj.getAttribute('data-uid');
|
var uid = obj.getAttribute('data-uid');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue