updates
parent
b513287430
commit
5f4530f9ad
|
|
@ -63,7 +63,7 @@ namespace QuotationMaker.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
usersJsonObj = JsonConvert.DeserializeObject(users_json_str);
|
usersJsonObj = JsonConvert.DeserializeObject(users_json_str);
|
||||||
conn.Insert(newGroup);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +75,7 @@ namespace QuotationMaker.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
string nowrite_msg = "";
|
string nowrite_msg = "";
|
||||||
|
int userCount = 0;
|
||||||
foreach (dynamic item in usersJsonObj) {
|
foreach (dynamic item in usersJsonObj) {
|
||||||
string user_uid = item.user_uid;
|
string user_uid = item.user_uid;
|
||||||
string user_name = item.user_name;
|
string user_name = item.user_name;
|
||||||
|
|
@ -89,15 +89,25 @@ namespace QuotationMaker.Controllers
|
||||||
newGU.groupUser_uid = GlobalClass.CreateRandomCode(16);
|
newGU.groupUser_uid = GlobalClass.CreateRandomCode(16);
|
||||||
newGU.dept_uid = dept_uid;
|
newGU.dept_uid = dept_uid;
|
||||||
conn.Insert<groupUser>(newGU);
|
conn.Insert<groupUser>(newGU);
|
||||||
|
userCount++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nowrite_msg += user_name + " 此用戶已經是其他群組的成員,故此員取消加入!\n";
|
nowrite_msg += user_name + " 此用戶已經是其他群組的成員,故此員取消加入!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userCount == 0) {
|
||||||
|
nowrite_msg += "成員數量不得為0,故取消建立群組!";
|
||||||
|
ret.ret = "no";
|
||||||
|
ret.err_code = "0007";
|
||||||
|
ret.message = nowrite_msg;
|
||||||
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
}
|
||||||
|
conn.Insert(newGroup);
|
||||||
ret.groups.Add(new groupDetail(newGroup));
|
ret.groups.Add(new groupDetail(newGroup));
|
||||||
|
|
||||||
ret.message = nowrite_msg;
|
ret.message = nowrite_msg;
|
||||||
|
ret.ret = "yes";
|
||||||
|
|
||||||
|
|
||||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
<!-- .card -->
|
<!-- .card -->
|
||||||
<div class="card card-fluid">
|
<div class="card card-fluid">
|
||||||
<div class="card-header border-bottom-0"> 成員 </div><!-- .nestable -->
|
<div class="card-header border-bottom-0"> 成員 </div><!-- .nestable -->
|
||||||
<div id="nestableMember" class="dd" data-toggle="sortable" data-group-uid="ccc" data-max-depth="1">
|
<div id="nestableMember" class="dd" data-toggle="sortable" data-group-uid="ccc" data-type="" data-max-depth="1">
|
||||||
<!-- .dd-list -->
|
<!-- .dd-list -->
|
||||||
<ol class="dd-list">
|
<ol class="dd-list">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,20 @@ $(document).ready(function () {
|
||||||
success: function (data, textStatus, jqXHR) {
|
success: function (data, textStatus, jqXHR) {
|
||||||
if (data.ret == "yes") {
|
if (data.ret == "yes") {
|
||||||
|
|
||||||
|
var obj = data.groups;
|
||||||
|
|
||||||
|
$.each(obj, function (index, item) {
|
||||||
|
$('#group_div').append(cardHtml(item));
|
||||||
|
$('#' + item.group_uid).nestable();
|
||||||
|
|
||||||
|
//$('#' + item.optionItem_uid).on('change', function () {
|
||||||
|
// nestableChange(this);
|
||||||
|
//});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.message != '') {
|
||||||
|
alert(data.message);
|
||||||
|
}
|
||||||
|
|
||||||
$('#groupModal').modal('toggle');
|
$('#groupModal').modal('toggle');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -208,7 +222,7 @@ function deptList() {
|
||||||
|
|
||||||
function optionItemHtml(item) {
|
function optionItemHtml(item) {
|
||||||
var html = '';
|
var html = '';
|
||||||
html += '<li class="dd-item dd-nodrag" data-id="1" data-user-uid="'+ item.user_uid +'">';
|
html += '<li class="dd-item dd-nodrag" data-name="user_item" data-id="1" data-user-uid="'+ item.user_uid +'">';
|
||||||
html += ' <div class="dd-handle">';
|
html += ' <div class="dd-handle">';
|
||||||
html += ' <span class="dd-nodrag drag-indicator"></span>';
|
html += ' <span class="dd-nodrag drag-indicator"></span>';
|
||||||
html += ' <div data-name="option_name"> ' + item.user_name + ' </div>';
|
html += ' <div data-name="option_name"> ' + item.user_name + ' </div>';
|
||||||
|
|
@ -225,10 +239,42 @@ function delMemberBtnClick(obj) {
|
||||||
tmpNestableItem = $(obj).parent().parent().find("[data-name='option_name']");
|
tmpNestableItem = $(obj).parent().parent().find("[data-name='option_name']");
|
||||||
var optionItem_name = $(obj).parent().parent().find("[data-name='option_name']").text();
|
var optionItem_name = $(obj).parent().parent().find("[data-name='option_name']").text();
|
||||||
var user_uid = $(obj).parent().parent().parent().attr("data-user-uid");
|
var user_uid = $(obj).parent().parent().parent().attr("data-user-uid");
|
||||||
|
var group_uid = $(obj).parent().parent().parent().parent().parent().attr("data-type");
|
||||||
|
delItem = $(obj).parent().parent().parent();
|
||||||
|
|
||||||
|
if (group_uid == '') {
|
||||||
|
delItem.remove();
|
||||||
|
} else {
|
||||||
|
|
||||||
if ($('#client_method').val() == 'add') {
|
|
||||||
tmpNestableItem.parent().parent().remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cardHtml(groupOption) {
|
||||||
|
var html = "";
|
||||||
|
html += "<!-- grid column -->";
|
||||||
|
html += "<div class=\"col-lg-6\">";
|
||||||
|
html += " <!-- .card -->";
|
||||||
|
html += " <div class=\"card card-fluid\">";
|
||||||
|
html += " <div class=\"card-header border-bottom-0 btn-group\"> " + groupOption.group_name + " <div class=\"dd-nodrag btn-group ml-auto\"><button class=\"btn btn-sm btn-secondary\" type=\"button\" onclick=\"editGroupClick(this);\">Edit</button> <button class=\"btn btn-sm btn-secondary\" type=\"button\" onclick=\"delGroupClick(this);\"><i class=\"far fa-trash-alt\"></i></button></div></div><!-- .nestable -->";
|
||||||
|
html += " <div id=\"" + groupOption.group_uid + "\" class=\"dd\" data-toggle=\"sortable\" data-max-depth=\"1\" data-type=\"" + groupOption.group_uid + "\">";
|
||||||
|
html += " <!-- .dd-list -->";
|
||||||
|
html += " <ol class=\"dd-list\">";
|
||||||
|
html += " <li></li>";
|
||||||
|
|
||||||
|
$.each(groupOption.users, function (index, item) {
|
||||||
|
html += optionItemHtml(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
html += " </ol><!-- /.dd-list -->";
|
||||||
|
html += " </div><!-- /.nestable -->";
|
||||||
|
html += " <!-- .card-footer -->";
|
||||||
|
html += " <div class=\"card-footer\">";
|
||||||
|
html += " <a href=\"javascript: void(0);\" onclick=\"addItem(this)\" data-type=\"" + groupOption.group_uid + "\" class=\"card-footer-item justify-content-start\"><span><i class=\"fa fa-plus-circle mr-1\"></i> 新增成員 </span></a>";
|
||||||
|
html += " </div><!-- /.card-footer -->";
|
||||||
|
html += " </div><!-- /.card -->";
|
||||||
|
html += "</div><!-- /grid column -->";
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue