forked from dk96/QuotationMaker
updates
parent
5542acb4cf
commit
0b95afb125
|
|
@ -29,6 +29,35 @@ namespace QuotationMaker.Controllers
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("getHistoryList")]
|
||||||
|
public ActionResult GetHistoryList(IFormCollection obj) {
|
||||||
|
quotationViewListResult ret = new quotationViewListResult();
|
||||||
|
authToken token = new authToken(this._httpContextAccessor);
|
||||||
|
if (token.user_isLogin == false)
|
||||||
|
{
|
||||||
|
HttpContext.Response.Cookies.Delete("token_key");
|
||||||
|
ret.ret = "no";
|
||||||
|
ret.err_code = "99999";
|
||||||
|
ret.message = "非登入狀態!";
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
string quotation_uid = obj["quotation_uid"].ToString();
|
||||||
|
|
||||||
|
quotation quotation = conn.QueryFirstOrDefault<quotation>("select * from quotation where quotation_isdel = 'N' and quotation_revoke = 'N' and quotation_uid = @quotation_uid ", new { quotation_uid = quotation_uid });
|
||||||
|
|
||||||
|
if (quotation == null) {
|
||||||
|
ret.ret = "no";
|
||||||
|
ret.err_code = "0009";
|
||||||
|
ret.message = "無此筆 quotation_uid 資料!";
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.quotationViews = conn.Query<quotationView>("select * from quotationView where quotation_isdel = 'N' and quotation_uid = @quotation_uid order by quotation_version desc ", new { quotation_uid = quotation_uid }).ToList();
|
||||||
|
ret.ret = "yes";
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
[Route("addEditDelQuotation")]
|
[Route("addEditDelQuotation")]
|
||||||
public ActionResult AddEditDelQuotation(IFormCollection obj) {
|
public ActionResult AddEditDelQuotation(IFormCollection obj) {
|
||||||
quotationDetailResult ret = new quotationDetailResult();
|
quotationDetailResult ret = new quotationDetailResult();
|
||||||
|
|
@ -271,6 +300,23 @@ namespace QuotationMaker.Controllers
|
||||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (method == "history") {
|
||||||
|
quotation objQuotation = conn.QueryFirstOrDefault<quotation>("select * from quotation where quotation_isdel = 'N' and quotation_uid = @quotation_uid and quotation_version = @quotation_version order by quotation_version desc", new { quotation_uid = quotation_uid, quotation_version = quotation_version });
|
||||||
|
|
||||||
|
if (objQuotation == null)
|
||||||
|
{
|
||||||
|
ret.ret = "no";
|
||||||
|
ret.err_code = "0009";
|
||||||
|
ret.message = "此筆資料不存在或已被刪除!";
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.quotationDetail = new quotationDetail(objQuotation);
|
||||||
|
ret.quotationView = conn.QueryFirstOrDefault<quotationView>("select * from quotationView where quotation_isdel = 'N' and quotation_revoke = 'N' and quotation_uid = @quotation_uid ", new { quotation_uid = quotation_uid });
|
||||||
|
ret.ret = "yes";
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
if (method == "get") {
|
if (method == "get") {
|
||||||
quotation objQuotation = conn.QueryFirstOrDefault<quotation>("select * from quotation where quotation_isdel = 'N' and quotation_revoke = 'N' and quotation_uid = @quotation_uid order by quotation_version desc", new { quotation_uid = quotation_uid });
|
quotation objQuotation = conn.QueryFirstOrDefault<quotation>("select * from quotation where quotation_isdel = 'N' and quotation_revoke = 'N' and quotation_uid = @quotation_uid order by quotation_version desc", new { quotation_uid = quotation_uid });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class DbTableClass
|
||||||
[Table("quotation")]
|
[Table("quotation")]
|
||||||
public class quotation
|
public class quotation
|
||||||
{
|
{
|
||||||
[JsonIgnore]
|
|
||||||
[Key]
|
[Key]
|
||||||
public int quotation_sn { get; set; }
|
public int quotation_sn { get; set; }
|
||||||
public string quotation_uid { get; set; } = "";
|
public string quotation_uid { get; set; } = "";
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@
|
||||||
<th> 報價單名稱 </th>
|
<th> 報價單名稱 </th>
|
||||||
<th> 建立時間 </th>
|
<th> 建立時間 </th>
|
||||||
<th> 窗口 </th>
|
<th> 窗口 </th>
|
||||||
<th style="width: 25px;"> </th>
|
<th style="width: 30px;"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|
@ -276,6 +276,58 @@
|
||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div>
|
</div>
|
||||||
</form><!-- /.modal -->
|
</form><!-- /.modal -->
|
||||||
|
<!--歷史版本-->
|
||||||
|
<!-- .modal -->
|
||||||
|
<form id="clientHistoryListForm" name="clientHistoryListForm">
|
||||||
|
<div class="modal fade" id="clientHistoryListModal" tabindex="-1" role="dialog" aria-labelledby="clientHistoryListModalLabel" data-backdrop="static"
|
||||||
|
data-keyboard="false" aria-hidden="true">
|
||||||
|
<!-- .modal-dialog -->
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<!-- .modal-content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<!-- .modal-header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h6 id="clientNewModalLabel" class="modal-title inline-editable">
|
||||||
|
<span class="sr-only">歷史異動列表</span> <input id="HistoryTitle" type="text" class="form-control form-control-lg" placeholder="歷史異動列表" required="">
|
||||||
|
</h6>
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
|
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
</div><!-- /.modal-header -->
|
||||||
|
<!-- .modal-body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" id="now_version" />
|
||||||
|
<!-- .page-section -->
|
||||||
|
<div class="page-section">
|
||||||
|
|
||||||
|
<!-- .card -->
|
||||||
|
<div class="card card-fluid">
|
||||||
|
<!-- .card-body -->
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- .table -->
|
||||||
|
<table id="dt-responsive-history" class="table dt-responsive nowrap w-100">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 100px;"> </th>
|
||||||
|
<th> 建立日期 </th>
|
||||||
|
<th> 報價單名稱 </th>
|
||||||
|
<th> 版本號 </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
</table><!-- /.table -->
|
||||||
|
</div><!-- /.card-body -->
|
||||||
|
</div><!-- /.card -->
|
||||||
|
</div><!-- /.page-section -->
|
||||||
|
</div><!-- /.modal-body -->
|
||||||
|
<!-- .modal-footer -->
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button id="closeBtn" type="button" class="btn btn-light" data-dismiss="modal">關閉</button>
|
||||||
|
</div><!-- /.modal-footer -->
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
</form><!-- /.modal -->
|
||||||
|
|
||||||
<!-- .modal -->
|
<!-- .modal -->
|
||||||
<form id="clientModelQuotationForm" name="clientModelQuotationForm">
|
<form id="clientModelQuotationForm" name="clientModelQuotationForm">
|
||||||
|
|
@ -650,3 +702,38 @@
|
||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div>
|
</div>
|
||||||
</form><!-- /.modal -->
|
</form><!-- /.modal -->
|
||||||
|
|
||||||
|
<!--另存到此專案-->
|
||||||
|
<!-- .modal -->
|
||||||
|
<form id="clientSavetosameForm" name="clientSavetosameForm">
|
||||||
|
<div class="modal fade" id="clientSaveToSameModal" tabindex="-1" role="dialog" aria-labelledby="clientSaveToSameModalLabel" data-backdrop="static"
|
||||||
|
data-keyboard="false" aria-hidden="true">
|
||||||
|
<!-- .modal-dialog -->
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<!-- .modal-content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<!-- .modal-header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h6 id="clientProjectModalLabel" class="modal-title inline-editable">
|
||||||
|
<span class="sr-only"></span> <input id="modelSaveToSameTitle" type="text" class="form-control form-control-lg" placeholder="另存為新報價單至此專案" required="">
|
||||||
|
</h6>
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
|
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
</div><!-- /.modal-header -->
|
||||||
|
<!-- .modal-body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" id="save_to_same_quotation_uid" />
|
||||||
|
<div class="form-label-group">
|
||||||
|
<input type="text" id="save_to_same_quotation_name" class="form-control" value="" placeholder="新報價單名稱" maxlength="45" required=""> <label for="save_to_same_quotation_name">新報價單名稱</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!-- /.modal-body -->
|
||||||
|
<!-- .modal-footer -->
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" id="save_to_same_SaveBtn" class="btn btn-primary">儲存</button> <button id="closeBtn" type="button" class="btn btn-light" data-dismiss="modal">關閉</button>
|
||||||
|
</div><!-- /.modal-footer -->
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
</form><!-- /.modal -->
|
||||||
|
|
@ -6,6 +6,11 @@ var quotationTable;
|
||||||
var quotationRowID;
|
var quotationRowID;
|
||||||
var quotationPos;
|
var quotationPos;
|
||||||
|
|
||||||
|
var historyTable;
|
||||||
|
var historyDataTable;
|
||||||
|
var historyRowID;
|
||||||
|
var historyPos;
|
||||||
|
|
||||||
var quotation_total;
|
var quotation_total;
|
||||||
|
|
||||||
var deledMainItems = [];
|
var deledMainItems = [];
|
||||||
|
|
@ -21,6 +26,7 @@ $(document).ready(function () {
|
||||||
loadyearmonth();
|
loadyearmonth();
|
||||||
loadQuotationTable();
|
loadQuotationTable();
|
||||||
initInvoiceSelectItem();
|
initInvoiceSelectItem();
|
||||||
|
loadHistoryTable();
|
||||||
|
|
||||||
var actualDate = new Date(); // convert to actual date
|
var actualDate = new Date(); // convert to actual date
|
||||||
var prevDate = new Date(actualDate.getFullYear(), actualDate.getMonth() - 13, actualDate.getDate());
|
var prevDate = new Date(actualDate.getFullYear(), actualDate.getMonth() - 13, actualDate.getDate());
|
||||||
|
|
@ -166,6 +172,7 @@ $(document).ready(function () {
|
||||||
$('#quotation_editType_div').show();
|
$('#quotation_editType_div').show();
|
||||||
$('#quotation_sa').val(service_text());
|
$('#quotation_sa').val(service_text());
|
||||||
$('#quotation_method').val('add');
|
$('#quotation_method').val('add');
|
||||||
|
$('#modelQuotationDialogSaveBtn').show();
|
||||||
$('#clientModelQuotationModal').modal("toggle");
|
$('#clientModelQuotationModal').modal("toggle");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1097,6 +1104,67 @@ function loadQuotation_custom() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buttonHistoryClick(obj) {
|
||||||
|
var type = obj.getAttribute('data-method');
|
||||||
|
var quotation_uid = obj.getAttribute('data-uid');
|
||||||
|
var quotation_version = obj.getAttribute('data-version');
|
||||||
|
|
||||||
|
historyRowID = $('#history_' + quotation_uid);
|
||||||
|
|
||||||
|
historyRowPos = historyTable.fnGetPosition($('#history_' + quotation_uid)[0]);
|
||||||
|
|
||||||
|
var quotation_row = historyDataTable.row(historyRowPos).data();
|
||||||
|
|
||||||
|
if (type == 'save_in_same') {
|
||||||
|
$('#save_to_same_quotation_uid').val(quotation_uid);
|
||||||
|
$('#save_to_same_quotation_name').val(quotation_row.quotation_name + ' - Copy').trigger('change');
|
||||||
|
$('#clientSaveToSameModal').modal('toggle');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 'view') {
|
||||||
|
var formData = {
|
||||||
|
method: 'history',
|
||||||
|
quotation_uid: quotation_uid,
|
||||||
|
quotation_version: quotation_version
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/Api/addEditDelQuotation",
|
||||||
|
type: "post",
|
||||||
|
data: formData,
|
||||||
|
success: function (data, textStatus, jqXHR) {
|
||||||
|
if (data.ret == "yes") {
|
||||||
|
var obj = data.quotationDetail;
|
||||||
|
var objView = data.quotationView;
|
||||||
|
|
||||||
|
$('#modelItem_div').html('');
|
||||||
|
$('#payment_group').find('ol').html('');
|
||||||
|
$('#invoice_group').find('ol').html('');
|
||||||
|
|
||||||
|
$("#quotation_method").val('edit');
|
||||||
|
|
||||||
|
quotationEditModelFillData(obj, objView);
|
||||||
|
|
||||||
|
$('#quotationTitle_name').val('報價單內容 (檢視唯讀狀態)');
|
||||||
|
$('#modelQuotationDialogSaveBtn').hide();
|
||||||
|
|
||||||
|
$('#clientModelQuotationModal').modal('toggle');
|
||||||
|
} else {
|
||||||
|
alert(data.message);
|
||||||
|
|
||||||
|
if (data.err_code == "99999") {
|
||||||
|
location.href = "/Root/Login";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
function buttonClick(obj) {
|
function buttonClick(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');
|
||||||
|
|
@ -1511,6 +1579,44 @@ function buttonQuotationClick(obj, view) {
|
||||||
|
|
||||||
quotationRowPos = quotationTable.fnGetPosition($('#' + uid)[0]);
|
quotationRowPos = quotationTable.fnGetPosition($('#' + uid)[0]);
|
||||||
|
|
||||||
|
if (type == "history") {
|
||||||
|
var formData = {
|
||||||
|
method: 'get',
|
||||||
|
quotation_uid: uid,
|
||||||
|
version: version
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/Api/getHistoryList",
|
||||||
|
type: "post",
|
||||||
|
data: formData,
|
||||||
|
success: function (data, textStatus, jqXHR) {
|
||||||
|
if (data.ret == "yes") {
|
||||||
|
var obj = data.quotationViews;
|
||||||
|
|
||||||
|
$('#now_version').val(version);
|
||||||
|
|
||||||
|
$('#dt-responsive-history').dataTable().fnClearTable();
|
||||||
|
if (obj.length > 0) {
|
||||||
|
|
||||||
|
$('#dt-responsive-history').dataTable().fnAddData(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#clientHistoryListModal').modal('toggle');
|
||||||
|
} else {
|
||||||
|
alert(data.message);
|
||||||
|
|
||||||
|
if (data.err_code == "99999") {
|
||||||
|
location.href = "/Root/Login";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (type == "del") {
|
if (type == "del") {
|
||||||
if (confirm('確定要刪除此張報價單?')) {
|
if (confirm('確定要刪除此張報價單?')) {
|
||||||
var formData = {
|
var formData = {
|
||||||
|
|
@ -1579,6 +1685,7 @@ function buttonQuotationClick(obj, view) {
|
||||||
//$("#project_name").val(obj.project_name).trigger('change');
|
//$("#project_name").val(obj.project_name).trigger('change');
|
||||||
//$("#company_select").val(obj.company_uid);
|
//$("#company_select").val(obj.company_uid);
|
||||||
//$("#project_ps").val(obj.project_ps).trigger('change');
|
//$("#project_ps").val(obj.project_ps).trigger('change');
|
||||||
|
$('#modelQuotationDialogSaveBtn').show();
|
||||||
|
|
||||||
$('#clientModelQuotationModal').modal('toggle');
|
$('#clientModelQuotationModal').modal('toggle');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1595,6 +1702,156 @@ function buttonQuotationClick(obj, view) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//歷史清單
|
||||||
|
function loadHistoryTable() {
|
||||||
|
var dataTables = {
|
||||||
|
init: function init() {
|
||||||
|
|
||||||
|
this.bindUIActions();
|
||||||
|
},
|
||||||
|
bindUIActions: function bindUIActions() {
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
this.table = this.handleDataTables();
|
||||||
|
|
||||||
|
// add buttons
|
||||||
|
//this.table.buttons().container().appendTo('#dt-buttons').unwrap();
|
||||||
|
},
|
||||||
|
handleDataTables: function handleDataTables() {
|
||||||
|
//$('#myTable').append("<tfoot><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tfoot>");
|
||||||
|
return $('#dt-responsive-history').DataTable({
|
||||||
|
dom: '<\'text-muted\'Bif>\n <\'table-responsive\'trl>\n <\'mt-4\'p>',
|
||||||
|
lengthChange: true,
|
||||||
|
lengthMenu: [[25, 50, 100, -1], [25, 50, 100, "All"]],
|
||||||
|
pageLength: 25,
|
||||||
|
buttons: [
|
||||||
|
//{
|
||||||
|
// text: '休假設定',
|
||||||
|
// action: function (e, dt, node, config) {
|
||||||
|
// vacationBtnFun();
|
||||||
|
|
||||||
|
// }
|
||||||
|
//},
|
||||||
|
//'excelHtml5'
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
paginate: {
|
||||||
|
previous: '<i class="fa fa-lg fa-angle-left"></i>',
|
||||||
|
next: '<i class="fa fa-lg fa-angle-right"></i>'
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
copyTitle: 'Data copied',
|
||||||
|
copyKeys: 'Use your keyboard or menu to select the copy command'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
autoWidth: false,
|
||||||
|
rowId: function (row) {
|
||||||
|
return 'history_' + row.quotation_uid;
|
||||||
|
},
|
||||||
|
deferRender: true,
|
||||||
|
initComplete: function () {
|
||||||
|
historyTable = $('#dt-responsive-history').dataTable();
|
||||||
|
historyDataTable = $('#dt-responsive-history').DataTable();
|
||||||
|
$('#dt-responsive-history').on('click', 'a', function () {
|
||||||
|
buttonHistoryClick(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#dt-responsive-history').on('click', 'button', function () {
|
||||||
|
buttonHistoryClick(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
order: [[3, 'desc']],
|
||||||
|
info: true,
|
||||||
|
search: "搜尋:",
|
||||||
|
searching: true,
|
||||||
|
columns: [
|
||||||
|
{ data: 'quotation_uid', className: 'align-top text-center', orderable: false, searchable: false },
|
||||||
|
{ data: 'quotation_modifydate', className: 'align-top text-left', orderable: true, searchable: false },
|
||||||
|
{ data: 'quotation_name', className: 'align-top text-left', orderable: true, searchable: true },
|
||||||
|
{ data: 'quotation_version', className: 'align-top text-left', orderable: true, searchable: true }
|
||||||
|
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
|
||||||
|
{
|
||||||
|
targets: 0,
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
render: function render(data, type, row, meta) {
|
||||||
|
var ret = '';
|
||||||
|
var drowdownHtml = '';
|
||||||
|
drowdownHtml += '<div class="dropdown d-inline-block">\n';
|
||||||
|
drowdownHtml += ' <button data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="saveas" class="btn btn-icon btn-secondary" data-toggle="dropdown"><i class="fa fa-fw fa-ellipsis-h"></i></button>';
|
||||||
|
drowdownHtml += ' <div class="dropdown-menu dropdown-menu-left" style="">';
|
||||||
|
drowdownHtml += ' <div class="dropdown-arrow"></div>';
|
||||||
|
drowdownHtml += ' <button data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="save_in_same" type="button" class="dropdown-item">另存到此專案</button>';
|
||||||
|
drowdownHtml += ' <button data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="saveas_to_other" type="button" class="dropdown-item">另存到其他專案</button>';
|
||||||
|
drowdownHtml += ' <button data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="saveas_new_proj" type="button" class="dropdown-item">另存為新專案</button>';
|
||||||
|
drowdownHtml += ' </div>';
|
||||||
|
drowdownHtml += '</div> ';
|
||||||
|
ret += drowdownHtml;
|
||||||
|
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="view" class="btn btn-icon btn-secondary" ><i class="fa fa-eye fa-fw"></i> <span class="sr-only">View</span></button>';
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
targets: 1,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
render: function render(data, type, row, meta) {
|
||||||
|
return (new Date(row.quotation_modifydate)).format("yyyy/MM/dd hh:mm:ss");
|
||||||
|
}
|
||||||
|
} ,
|
||||||
|
{
|
||||||
|
targets: 3,
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
render: function render(data, type, row, meta) {
|
||||||
|
var ret = row.quotation_version;
|
||||||
|
|
||||||
|
if (ret == $('#now_version').val()) {
|
||||||
|
ret = ret + ' (目前版本)';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
responsive: {
|
||||||
|
details: {
|
||||||
|
display: $.fn.dataTable.Responsive.display.childRowImmediate,
|
||||||
|
type: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSearchRecords: function handleSearchRecords() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
$('#table-search, #filterBy').on('keyup change focus', function (e) {
|
||||||
|
var filterBy = $('#filterBy').val();
|
||||||
|
var hasFilter = filterBy !== '';
|
||||||
|
var value = $('#table-search').val();
|
||||||
|
|
||||||
|
self.table.search('').columns().search('').draw();
|
||||||
|
|
||||||
|
if (hasFilter) {
|
||||||
|
self.table.columns(filterBy).search(value).draw();
|
||||||
|
} else {
|
||||||
|
self.table.search(value).draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataTables.init();
|
||||||
|
}
|
||||||
|
|
||||||
function loadQuotationTable() {
|
function loadQuotationTable() {
|
||||||
var dataTables = {
|
var dataTables = {
|
||||||
init: function init() {
|
init: function init() {
|
||||||
|
|
@ -1680,7 +1937,7 @@ function loadQuotationTable() {
|
||||||
searchable: false,
|
searchable: false,
|
||||||
render: function render(data, type, row, meta) {
|
render: function render(data, type, row, meta) {
|
||||||
var ret = '';
|
var ret = '';
|
||||||
|
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="history" class="btn btn-sm btn-icon btn-secondary" ><i class="oi oi-list"></i> <span class="sr-only">History</span></button>';
|
||||||
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="edit" class="btn btn-sm btn-icon btn-secondary" ><i class="fa fa-pencil-alt"></i> <span class="sr-only">Edit</span></button>';
|
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="edit" class="btn btn-sm btn-icon btn-secondary" ><i class="fa fa-pencil-alt"></i> <span class="sr-only">Edit</span></button>';
|
||||||
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="del" class="btn btn-sm btn-icon btn-secondary"><i class="far fa-trash-alt"></i> <span class="sr-only">Remove</span></button>';
|
ret += '<button type="button" data-uid="' + row.quotation_uid + '" data-version="' + row.quotation_version + '" data-method="del" class="btn btn-sm btn-icon btn-secondary"><i class="far fa-trash-alt"></i> <span class="sr-only">Remove</span></button>';
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue