updates
parent
b3e41484c3
commit
ee7984a6c1
|
|
@ -25,6 +25,171 @@ namespace QuotationMaker.Controllers
|
|||
|
||||
}
|
||||
|
||||
[Route("addEditDelGetContactPerson")]
|
||||
public ActionResult AddEditDelContactPerson(IFormCollection obj)
|
||||
{
|
||||
contactPersonListResult ret = new contactPersonListResult();
|
||||
|
||||
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 company_uid = obj["company_uid"].ToString();
|
||||
string contactPerson_uid = obj["contactPerson_uid"].ToString();
|
||||
string contactPerson_name = obj["contactPerson_name"].ToString();
|
||||
string contactPerson_email = obj["contactPerson_email"].ToString();
|
||||
string contactPerson_tel = obj["contactPerson_tel"].ToString();
|
||||
|
||||
string method = obj["method"].ToString();
|
||||
|
||||
|
||||
|
||||
|
||||
if (method == "")
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "0001";
|
||||
ret.message = "沒有method!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (method == "add")
|
||||
{
|
||||
if (contactPerson_name.Trim() == "")
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "0003";
|
||||
ret.message = "沒有contactPerson_name!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
contactPerson_uid = GlobalClass.CreateRandomCode(24);
|
||||
contactPerson newItem = new contactPerson();
|
||||
newItem.contactPerson_name = contactPerson_name;
|
||||
newItem.contactPerson_uid = contactPerson_uid;
|
||||
newItem.company_uid = company_uid;
|
||||
|
||||
newItem.contactPerson_tel = contactPerson_tel;
|
||||
newItem.contactPerson_email = contactPerson_email;
|
||||
|
||||
newItem.contactPerson_lastmodify_uid = token.user_uid;
|
||||
newItem.contactPerson_createdate = DateTime.Now;
|
||||
newItem.contactPerson_modifydate = DateTime.Now;
|
||||
|
||||
conn.Insert(newItem);
|
||||
ret.contactPersons.Add(newItem);
|
||||
ret.ret = "yes";
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
if (contactPerson_uid.Trim() == "")
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "0002";
|
||||
ret.message = "沒有contactPerson_uid!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
|
||||
|
||||
contactPerson editItem = conn.QueryFirstOrDefault<contactPerson>("select * from contactPerson where contactPerson_isdel = 'N' and contactPerson_uid = @contactPerson_uid ", new { contactPerson_uid = contactPerson_uid });
|
||||
|
||||
if (editItem == null)
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "0004";
|
||||
ret.message = "沒有contactPerson_uid此筆資料!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
if (method == "edit")
|
||||
{
|
||||
|
||||
|
||||
if (contactPerson_name.Trim() == "")
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "0002";
|
||||
ret.message = "沒有contactPerson_name!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
editItem.contactPerson_name = contactPerson_name;
|
||||
|
||||
|
||||
editItem.contactPerson_tel = contactPerson_tel;
|
||||
editItem.contactPerson_email = contactPerson_email;
|
||||
|
||||
editItem.contactPerson_lastmodify_uid = token.user_uid;
|
||||
editItem.contactPerson_modifydate = DateTime.Now;
|
||||
|
||||
conn.Update(editItem);
|
||||
ret.contactPersons.Add(editItem);
|
||||
ret.ret = "yes";
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
if (method == "get")
|
||||
{
|
||||
ret.contactPersons.Add(editItem);
|
||||
ret.ret = "yes";
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
if (method == "del")
|
||||
{
|
||||
editItem.contactPerson_isdel = "Y";
|
||||
editItem.contactPerson_lastmodify_uid = token.user_uid;
|
||||
editItem.contactPerson_modifydate = DateTime.Now;
|
||||
|
||||
conn.Execute("update contactPerson set contactPerson_isdel = 'Y' where contactPerson_uid = @contactPerson_uid ", new { contactPerson_uid = contactPerson_uid });
|
||||
|
||||
conn.Update(editItem);
|
||||
ret.ret = "yes";
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
[Route("contactPersonList")]
|
||||
public ActionResult ContactPersonList(IFormCollection obj)
|
||||
{
|
||||
contactPersonListResult ret = new contactPersonListResult();
|
||||
|
||||
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 company_uid = obj["company_uid"].ToString();
|
||||
|
||||
ret.contactPersons = conn.Query<contactPerson>("select * from contactPerson where contactPerson_isdel = 'N' and company_uid = @company_uid ", new { company_uid = company_uid }).ToList();
|
||||
ret.ret = "yes";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
[Route("addEditDelGetCompany")]
|
||||
public ActionResult AddEditDelSubItem(IFormCollection obj)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,3 +114,107 @@
|
|||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</form><!-- /.modal -->
|
||||
<!-- .modal -->
|
||||
<form id="clientSubItemListForm" name="clientSubItemListForm">
|
||||
<div class="modal fade" id="clientSubItemListModal" tabindex="-1" role="dialog" aria-labelledby="clientSubItemListModalLabel" 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="mainItemTitle" 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="subItemList_method" />
|
||||
<input type="hidden" id="subItemList_contactPerson_uid" />
|
||||
<input type="hidden" id="subItemList_company_uid" />
|
||||
<!-- .page-section -->
|
||||
<div class="page-section">
|
||||
<button type="button" id="subItemListNewBtn" class="btn btn-primary btn-floated position-absolute" title="Add new client"><i class="fa fa-plus"></i></button>
|
||||
<!-- .card -->
|
||||
<div class="card card-fluid">
|
||||
<!-- .card-body -->
|
||||
<div class="card-body">
|
||||
<!-- .table -->
|
||||
<table id="dt-responsive-subItem" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> 姓名 </th>
|
||||
<th> Email </th>
|
||||
<th> 電話 </th>
|
||||
<th style="width: 25px;"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table><!-- /.table -->
|
||||
</div><!-- /.card-body -->
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.page-section -->
|
||||
</div><!-- /.modal-body -->
|
||||
<!-- .modal-footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="kolSaveBtn" style="visibility:hidden;" 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 -->
|
||||
|
||||
<!-- .modal -->
|
||||
<form id="clientSubItemModalForm" name="clientSubItemModalForm">
|
||||
<div class="modal fade" id="clientSubItemModal" tabindex="-1" role="dialog" aria-labelledby="clientSubItemModalLabel" 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="clientSubItemModalLabel" class="modal-title inline-editable">
|
||||
<span class="sr-only">Client name</span> <input id="clientSubItemModalTitle" 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="clientSubItem_method" />
|
||||
<input type="hidden" id="clientSubItem_contactPerson_uid" />
|
||||
<input type="hidden" id="clientSubItem_company_uid" />
|
||||
<!-- .form-group -->
|
||||
<div class="form-group">
|
||||
<div class="form-label-group">
|
||||
<input type="text" id="modal_contactPerson_name" class="form-control" value="" placeholder="姓名" maxlength="16" required=""> <label for="modal_contactPerson_name">姓名</label>
|
||||
</div>
|
||||
</div><!-- /.form-group -->
|
||||
<!-- .form-group -->
|
||||
<div class="form-group">
|
||||
<div class="form-label-group">
|
||||
<input type="text" id="modal_contactPerson_email" class="form-control" value="" placeholder="Email" maxlength="30" required=""> <label for="modal_contactPerson_name">Email</label>
|
||||
</div>
|
||||
</div><!-- /.form-group -->
|
||||
<!-- .form-group -->
|
||||
<div class="form-group">
|
||||
<div class="form-label-group">
|
||||
<input type="text" id="modal_contactPerson_tel" class="form-control" value="" placeholder="電話" maxlength="20" required=""> <label for="modal_contactPerson_tel">電話</label>
|
||||
</div>
|
||||
</div><!-- /.form-group -->
|
||||
|
||||
</div><!-- /.modal-body -->
|
||||
<!-- .modal-footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="clientSubItemSaveBtn" 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 -->
|
||||
|
|
@ -8,6 +8,12 @@ var subItemRowPos;
|
|||
|
||||
$(document).ready(function () {
|
||||
loadDataTable();
|
||||
loadSubItemDataTable();
|
||||
|
||||
$('#subItemListNewBtn').on('click', function () {
|
||||
$("#clientSubItem_method").val('add');
|
||||
$('#clientSubItemModal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#maintItemNewModal').on('click', function () {
|
||||
$("#company_method").val('add');
|
||||
|
|
@ -70,8 +76,157 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#clientSubItemSaveBtn').on('click', function () {
|
||||
var contactPerson_uid = $('#clientSubItem_contactPerson_uid').val();
|
||||
var company_uid = $('#clientSubItem_company_uid').val();
|
||||
var method = $('#clientSubItem_method').val();
|
||||
var contactPerson_name = $('#modal_contactPerson_name').val();
|
||||
var contactPerson_email = $('#modal_contactPerson_email').val();
|
||||
var contactPerson_tel = $('#modal_contactPerson_tel').val();
|
||||
|
||||
var msg = '';
|
||||
|
||||
if (contactPerson_name == '') {
|
||||
msg += '請輸入窗口姓名!\n';
|
||||
}
|
||||
|
||||
if (contactPerson_tel == '') {
|
||||
msg += '請輸入窗口電話!\n';
|
||||
}
|
||||
|
||||
if (msg != '') {
|
||||
alert(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
company_uid: company_uid,
|
||||
contactPerson_uid: contactPerson_uid,
|
||||
method: method,
|
||||
contactPerson_name: contactPerson_name,
|
||||
contactPerson_email: contactPerson_email,
|
||||
contactPerson_tel: contactPerson_tel
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/addEditDelGetContactPerson",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.contactPersons[0];
|
||||
|
||||
if (method == "add") {
|
||||
subItemTable.fnAddData(obj);
|
||||
}
|
||||
|
||||
if (method == "edit") {
|
||||
subItemTable.fnUpdate(obj, subItemRowPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#clientSubItemModal').modal('toggle');
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
||||
if (data.err_code == "99999") {
|
||||
location.href = "/Root/Login";
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function buttonSubItemClick(obj) {
|
||||
var type = obj.getAttribute('data-method');
|
||||
var uid = obj.getAttribute('data-uid');
|
||||
var company_uid = $('#clientSubItem_company_uid').val();
|
||||
|
||||
subItemRowID = $('#' + uid);
|
||||
|
||||
subItemRowPos = subItemTable.fnGetPosition($('#' + uid)[0]);
|
||||
|
||||
if (type == "edit") {
|
||||
var formData = {
|
||||
method: 'get',
|
||||
company_uid: company_uid,
|
||||
contactPerson_uid: uid
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/addEditDelGetContactPerson",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.contactPersons[0];
|
||||
|
||||
$("#clientSubItem_method").val('edit');
|
||||
$("#clientSubItem_contactPerson_uid").val(obj.contactPerson_uid);
|
||||
$("#modal_contactPerson_name").val(obj.contactPerson_name).trigger('change');
|
||||
|
||||
$("#modal_contactPerson_email").val(obj.contactPerson_email).trigger('change');
|
||||
$("#modal_contactPerson_tel").val(obj.contactPerson_tel).trigger('change');
|
||||
|
||||
$('#clientSubItemModal').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 (confirm('確定刪除此筆子項目資料? ')) {
|
||||
|
||||
var formData = {
|
||||
method: 'del',
|
||||
company_uid: company_uid,
|
||||
contactPerson_uid: uid
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/addEditDelGetContactPerson",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var row = subItemTable.api().row(subItemRowID).remove().draw(false);
|
||||
alert('刪除成功');
|
||||
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
||||
if (data.err_code == "99999") {
|
||||
location.href = "/Root/Login";
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buttonClick(obj) {
|
||||
|
||||
var type = obj.getAttribute('data-method');
|
||||
|
|
@ -84,26 +239,27 @@ function buttonClick(obj) {
|
|||
if (type == "preview") {
|
||||
var mainItem_name = obj.innerText.trim();
|
||||
var formData = {
|
||||
dept_uid: dept_uid,
|
||||
mainItem_uid: uid
|
||||
company_uid: uid
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/AuthApi/authSubItemList",
|
||||
url: "/Api/contactPersonList",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.subItems;
|
||||
var obj = data.contactPersons;
|
||||
|
||||
|
||||
$('#dt-responsive-subItem').dataTable().fnClearTable();
|
||||
if (obj.length > 0) {
|
||||
|
||||
$('#dt-responsive-subItem').dataTable().fnAddData(obj);
|
||||
}
|
||||
$('#mainItemTitle').val(mainItem_name + ' 的子項目列表').trigger('change');
|
||||
$('#mainItemTitle').val(mainItem_name + ' 的窗口列表').trigger('change');
|
||||
|
||||
$('#subItemList_mainItem_uid').val(uid);
|
||||
$('#clientSubItem_company_uid').val(uid);
|
||||
$('#subItemList_company_uid').val(uid);
|
||||
$('#clientSubItemListModal').modal('toggle');
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
|
@ -327,3 +483,128 @@ function loadDataTable() {
|
|||
|
||||
dataTables.init();
|
||||
}
|
||||
|
||||
function loadSubItemDataTable() {
|
||||
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-subItem').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: 'contactPerson_uid',
|
||||
deferRender: true,
|
||||
initComplete: function () {
|
||||
subItemTable = $('#dt-responsive-subItem').dataTable();
|
||||
$('#dt-responsive-subItem').on('click', 'a', function () {
|
||||
buttonSubItemClick(this);
|
||||
});
|
||||
|
||||
$('#dt-responsive-subItem').on('click', 'button', function () {
|
||||
buttonSubItemClick(this);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
order: [[0, 'desc']],
|
||||
info: true,
|
||||
search: "搜尋:",
|
||||
searching: true,
|
||||
columns: [
|
||||
{ data: 'contactPerson_name', className: 'align-top text-left', orderable: true, searchable: true },
|
||||
{ data: 'contactPerson_email', className: 'align-top text-right', orderable: true, searchable: true },
|
||||
{ data: 'contactPerson_tel', className: 'align-top text-right', orderable: true, searchable: true },
|
||||
{ data: 'contactPerson_uid', className: 'align-top text-center', orderable: false, searchable: false }
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
className: 'align-middle text-left',
|
||||
orderable: false,
|
||||
searchable: true,
|
||||
render: function render(data, type, row, meta) {
|
||||
|
||||
return row.contactPerson_name;
|
||||
//return '<a href="javascript: void(0);" data-uid="' + row.subItem_uid + '" data-method="preview" >' + row.subItem_name + '</a>';
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
targets: 3,
|
||||
className: 'align-middle text-center',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
render: function render(data, type, row, meta) {
|
||||
var ret = '';
|
||||
|
||||
ret += '<button type="button" data-uid="' + row.contactPerson_uid + '" 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.contactPerson_uid + '" 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;
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
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();
|
||||
}
|
||||
Loading…
Reference in New Issue