This commit is contained in:
2023-03-11 17:30:20 +00:00
commit b6c4e025bc
5124 changed files with 1153349 additions and 0 deletions
@@ -0,0 +1,510 @@
var Unibase;
(function (Unibase) {
let Platform;
(function (Platform) {
let Automation;
(function (Automation) {
let Components;
(function (Components) {
class Comments extends Unibase.Platform.Core.BaseComponent {
constructor() {
super();
this.commentcount = 0;
}
cssFiles() {
return [""];
}
jsFiles() {
return [""];
}
html(id, containerid) {
let html = `<div class="card card-default shadow-none border-0 mb-0" id="Form_Comments">
<div class="card-header card-header-action"><span id="WidgetTitle" class="biz-highlight-bg-color">Comments (<span class="comments_count">0</span>)</h4></div>
<div class="card-body"><div class="row"><div class="col-sm-12"><div class="divComments" id="divComments"></div></div></div></div>
</div>
<div class="divallcomments comment-list block" id="admincomments">
<div class="allcomment-block"></div>
<div class="row"><div class="form-group col-sm-12 ml-lg-10"><a href="/#/welcome" id="btnrefreshComments" class="btn btn-default hidden btn-sm"><i class="fa fa-plus icon-muted"></i> more</a></div></div>
</div>`;
$("." + containerid).html(html);
return "";
}
init(containerId) {
var instance = this;
instance.html("", containerId);
var id = "";
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
instance.InstalledAppId = InstalledAppId;
for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
if (obj.Key === "hf_" + InstalledAppId + "_recordid") {
id = obj.Value;
}
}
instance.load(id, containerId, null);
}
load(id, containerid, callback) {
var instance = this;
instance.currentuser = Unibase.Platform.Membership.Infos.Identity.currentUser;
instance.showComments();
}
showComments() {
var instance = this;
$('.allComments_').remove();
var commentshtml = '<div class="divComments panel-default mb-2" id="divComments_">' +
'<div class="allComments_ allcomment-block bg-light"></div> <div id="divComment_items" class="comment-item_ mr-35">' +
'<div class="input-group form-group"><input type="text" id="commentTextBox_0" class="form-control commentTextBox txtnewComment_ " placeholder="Type Comments here...." onchange="Unibase.Platform.Automation.Components.Comments.Instance().enableSendbtn(event,0)">' +
'<a href="javascript:(0)" id="commentPostButton_0" class="list-group-anchor btn btn-sm py-1 border-bottom rounded-0 input-group-addon" onclick="Unibase.Platform.Automation.Components.Comments.Instance().saveComment();"><span class="btn-icon-wrap"><button class="btn btn-white fa fa-paper-plane-o p-0 text-disabled "></button></span></a></span></a>' +
'</div></div></div>';
$("#divComments").html(commentshtml);
instance.loadComments();
instance.addComments();
}
loadComments() {
var instance = this;
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var refGuid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_versionguid").Value;
var jsfiles = ['platform/automation/managers/commentmanager.js', 'platform/automation/infos/comment.js', 'platform/automation/requests/comment.js', 'platform/automation/enums/commenttype.js'];
instance.fileCacheHelper.loadJsFiles(jsfiles, function () {
Unibase.Platform.Automation.Managers.CommentManager.Instance().getMyCommentsByGuid(refGuid).then(function (response) {
var CommentId = 0;
var ParentCommentCount = 0;
$('.commentsCount_').text(response.result.length);
$('.comments_count').text(response.result.length);
var html = "";
$(".comment-addItem").remove();
$(".comment-item_").remove();
var commentClosed = true;
let photoUrl = "";
if (instance.currentUser.photoUrl != "" && instance.currentUser.photoUrl != null) {
photoUrl = instance.currentUser.photoUrl;
let srcSplit = photoUrl.split('/');
if (srcSplit[srcSplit.length - 1] == 'unnamed.png') {
photoUrl = "tenants/themes/compact/imgs/avatar.jpg";
}
}
else {
photoUrl = "tenants/themes/compact/imgs/avatar.jpg";
}
html += `<form><div id="divComment_items" class="mb-2 d-flex comment-item_">
<div class="comment-right-wrapper m-0 d-flex align-items-center w-100 border-bottom border-light-50"><input type="text" id="commentTextBox_0" class="w-100 border-0 outline-0 commentTextBox txtnewComment_" placeholder="Type Comments here...." oninput="Unibase.Platform.Automation.Components.Comments.Instance().enableSendbtn(event,0)">
<div class="comment-btn-wrapper" id="add-comment-btn">
<a href="javascript:(0)" id="commentPostButton_0" class="list-group-anchor btn btn-icon btn-sm rounded" onclick="Unibase.Platform.Automation.Components.Comments.Instance().saveComment();"><span class="btn-icon-wrap"><button class="btn btn-white fa fa-paper-plane-o mt-5 p-0 text-disabled commentSendBtn"></button></span></a>
</div></div></div></form>`;
for (var i = 0; i < response.result.length; i++) {
var model = response.result[i];
var deletehtml = '';
if (model.CreatedBy == instance.currentuser.userId) {
deletehtml = '<div class="d-flex align-items-center"><span class="mr-10"><a href="javascript:(0)" onclick="Unibase.Platform.Automation.Components.Comments.Instance().deleteComment(' + model.CommentId + ', 0, 0, 0);"><span class="btn-icon-wrap"><i class="fa fa-trash-o text-danger font-16"> </i></span> </a>' +
'</span></div>';
}
var CreatedByImage = " ";
if (model.FromUserPhotoUrl == null || model.FromUserPhotoUrl == "") {
if (model.ImageUrl == null) {
let avatarTxt = "";
let headingTxt = model.FromUserName;
let matches = headingTxt.match(/\b(\w)/g);
if (matches.length == 1) {
avatarTxt = $.trim(headingTxt).substr(0, 2);
}
else {
avatarTxt = matches.join('').slice(0, 2);
}
CreatedByImage = `<h5 class="biz-primary-text-color font-12">${avatarTxt}</h5>`;
}
else {
CreatedByImage = `<img src="${model.ImageUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="avatar-img img-fluid rounded-circle font-11" alt="img">`;
}
}
else {
CreatedByImage = model.FromUserPhotoUrl;
let srcSplit = CreatedByImage.split('/');
if (srcSplit[srcSplit.length - 1] == 'unnamed.png' || CreatedByImage == null || CreatedByImage == "") {
let avatarTxt = "";
let headingTxt = model.FromUserName;
let matches = headingTxt.match(/\b(\w)/g);
if (matches.length == 1) {
avatarTxt = $.trim(headingTxt).substr(0, 2);
}
else {
avatarTxt = matches.join('').slice(0, 2);
}
CreatedByImage = `<h5 class="biz-primary-text-color font-12">${avatarTxt}</h5>`;
}
else {
CreatedByImage = `<img src="${model.FromUserPhotoUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="avatar-img img-fluid rounded-circle font-11" alt="img">`;
}
}
var attachImage = "";
if (model.ImageUrl == null || model.ImageUrl == "")
attachImage = '';
else {
attachImage = "<img src='" + model.ImageUrl + "' class='w-100 h-100'>";
}
var commentIcon = "";
var commentName = "";
var IsEvent = "";
var bgcolor = "";
var parentCount = `<span class="pr-1 toGetReplyCountByParentId${model.CommentId}">Replies</span>`;
parentCount += `<span id="Reply_${model.CommentId}"> (${model.ParentCommentCount}) </span>`;
if (model.ParentCommentCount == 0) {
parentCount = `<span class="pr-1 toGetReplyCountByParentId${model.CommentId}">Reply</span>`;
parentCount += `<span id="Reply_${model.CommentId}"></span>`;
}
if (model.CommentType == Unibase.Platform.Automation.Enums.CommentType.Comment) {
}
else if (model.CommentType == Unibase.Platform.Automation.Enums.CommentType.Call) {
commentIcon = "fa fa-phone text-info";
commentName = "Call";
}
else if (model.CommentType == Unibase.Platform.Automation.Enums.CommentType.Mail) {
commentIcon = "fa fa-envelope-o text-info";
commentName = "Mail";
}
else if (model.CommentType == Unibase.Platform.Automation.Enums.CommentType.Meeting) {
commentIcon = "fa fa-users text-info ";
commentName = "Meeting";
}
else if (model.CommentType == Unibase.Platform.Automation.Enums.CommentType.Follow) {
commentIcon = "fa fa-flash text-info";
commentName = "Event";
IsEvent = "hidden";
}
if ($("#hfCommentids").val() != model.CommentId) {
if ($("#hfCommentids").val() != "0")
html += '</section></article></div>';
$("#hfCommentids").val(model.CommentId);
if (model.ParentCommentCount > 0) {
html += '<div class="block allComments_ allcomment-block comment-addItem pt-1 d-none"><article id="comment-' + model.CommentId + '" class="comment-item clear">' +
'<input type="hidden" id="hfAssignedFollowers_' + model.CommentId + '" value="' + model.AssignedFollowers + '" />' +
'<section class="comment-body"><div class="comment-body-wrapper d-flex justify-content-between">' +
'<div class="comment-user-img"><div class="avatar biz-detail-avatar biz-highlight-color" style="width: 25px !important;height: 25px !important;">' + CreatedByImage + '</div>' +
'</span></div>' +
'<div class="comment-details-wrapper ml-1" style="flex-grow:2"><div class="comment-user-details d-flex align-items-center justify-content-between flex-wrap w-100"><div class="comment-username d-flex align-items-center"><h6 class="font-14 biz-highlight-bg-color mr-5 commentusername_' + CommentId + '"> ' + model.FromUserName + '</h6></div><input type="hidden" id="hf_ParentCmtVersionGuid_' + model.CommentId + '" value="' + model.VersionGuid + '"/>';
}
else {
html += '<div class="block allComments_ allcomment-block comment-addItem pt-1 d-none"><article id="comment-' + model.CommentId + '" class="comment-item clear">' +
'<input type="hidden" id="hfAssignedFollowers_' + model.CommentId + '" value="' + model.AssignedFollowers + '" />' +
'<section class="comment-body"><div class="comment-body-wrapper d-flex justify-content-between">' +
'<div class="comment-user-img"><div class="avatar biz-detail-avatar biz-highlight-color" style="width: 25px !important;height: 25px !important;">' + CreatedByImage + '</div>' +
'</span></div>' +
'<div class="comment-details-wrapper ml-1" style="flex-grow:2"><div class="comment-user-details d-flex align-items-center justify-content-between flex-wrap w-100"><div class="comment-username d-flex align-items-center"><h6 class="font-14 biz-highlight-bg-color mr-5 commentusername_' + CommentId + '"> ' + model.FromUserName + '</h6></div><input type="hidden" id="hf_ParentCmtVersionGuid_' + model.CommentId + '" value="' + model.VersionGuid + '"/>';
}
if (model.IsSystemGenerated != true) {
if (window.innerWidth <= 1198) {
html += deletehtml + '</div>' +
'<div class="comment-text mt-1 w-sm-95 mb-5 text-dark font-11 word-break"><span>' + model.CommentSubject + ' </span></div>';
}
else {
html += deletehtml + '</div>' +
'<div class="comment-text mt-1 w-sm-95 mb-5 text-dark font-14 word-break"><span>' + model.CommentSubject + ' </span></div>';
}
}
}
html += '<div class="stats_container d-flex align-items-center mb-2 justify-content-between"><div class="comment-reply-wrapper"><span><a href="/#/welcome" class="list-group-anchor" onclick="Unibase.Platform.Automation.Components.Comments.Instance().details(' + model.CommentId + ');"><i class="' + commentIcon + '"></i> ' + commentName + '</a></span>';
if (model.IsSystemGenerated != true) {
if (window.innerWidth <= 1198) {
html += '<span class="panel-default"><a href="/#/welcome" data-parent="divcomment 4" class="list-group-anchor text-dark d-flex mr-3 font-11 list-item-main-title" onclick="Unibase.Platform.Automation.Components.Comments.Instance().childComments(' + model.CommentId + ');"> ' + parentCount + '</a>' +
'</span></div> <span class="comment-time font-11 text-dark">' + Unibase.Platform.Helpers.DateTimeHelper.Instance().commentsdateformat(model.CreatedDate) + '</span></div>' +
' <div class="bg-white hidden" id = "comments-' + model.CommentId + '" > ' +
'<div id="childcomment-list_' + model.CommentId + '" class="childcomment-list_' + model.CommentId + '"></div>' +
'</div></div></div></section></article></div>';
}
else {
html += '<span class="panel-default"><a href="/#/welcome" data-parent="divcomment 4" class="list-group-anchor text-dark d-flex mr-3 font-12 list-item-main-title" onclick="Unibase.Platform.Automation.Components.Comments.Instance().childComments(' + model.CommentId + ');"> ' + parentCount + '</a>' +
'</span></div> <span class="comment-time font-12 text-dark">' + Unibase.Platform.Helpers.DateTimeHelper.Instance().commentsdateformat(model.CreatedDate) + '</span></div>' +
' <div class="bg-white hidden" id = "comments-' + model.CommentId + '" > ' +
'<div id="childcomment-list_' + model.CommentId + '" class="childcomment-list_' + model.CommentId + '"></div>' +
'</div></div></div></section></article></div>';
}
}
CommentId = model.CommentId;
ParentCommentCount = model.ParentCommentCount;
}
$('.allComments_').after(html);
let size_li = $("#divComments_ .comment-addItem").length;
if (size_li >= 5) {
$('#loadMore-Comments').removeClass("d-none");
}
else {
$('#loadMore-Comments').addClass("d-none");
}
instance.commentcount = 5;
$('#divComments_ .comment-addItem:lt(' + instance.commentcount + ')').removeClass("d-none");
$('#loadMore-Comments').click(function () {
instance.commentcount = (instance.commentcount + 5 <= size_li) ? instance.commentcount + 5 : size_li;
$('#divComments_ .comment-addItem:lt(' + instance.commentcount + ')').removeClass("d-none");
debugger;
if (instance.commentcount == size_li) {
$('#loadMore-Comments').addClass("d-none");
instance.commentcount = 0;
}
});
instance.toGetReplyCountByParentId(CommentId, ParentCommentCount);
}, function (response) {
});
});
}
addComments() {
var html = "";
$('#divComments_').append(html);
$('#divComments_').append(`<div class="d-flex align-items-center justify-content-center click-more-btn"><div id="loadMore-Comments" class="btn btn-sm btn-success d-none">More</div></div>`);
}
toGetReplyCountByParentId(Id, Count) {
var ParentId = Id;
var ParentCommentCount = Count;
if (ParentId != 0) {
Unibase.Platform.Automation.Managers.CommentManager.Instance().getCommentsByParentId(ParentId).then(function (response) {
for (var i = 0; i < response.result.length; i++) {
ParentCommentCount = ParentCommentCount + response.result[i].ParentCommentCount;
if (ParentCommentCount != 0) {
$('.toGetReplyCountByParentId' + ParentId).text('Replies');
$('#Reply_' + ParentId).text(`(${ParentCommentCount})`);
}
else {
$('.toGetReplyCountByParentId' + ParentId).text('Reply');
$('#Reply_' + ParentId).text(``);
}
}
});
}
}
saveComment() {
var instance = this;
let size_li = $("#divComments_ .comment-addItem").length;
if (size_li >= 5) {
$('#loadMore-Comments').removeClass("d-none");
}
if ($('.txtnewComment_').val().toString().trim() == null || $('.txtnewComment_').val().toString().trim() == "") {
MessageHelper.Instance().showError("Please Enter Something...", "div_message");
return false;
}
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var refGuid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_versionguid").Value;
var postData = {
CommentId: 0,
RefGuid: refGuid,
CommentSubject: $(".txtnewComment_").val().toString().trim(),
CommentType: Unibase.Platform.Automation.Enums.CommentType.Comment,
Followers: null,
InstallPageId: Unibase.Themes.Providers.DetailHelper.installedAppId,
ParentId: 0
};
Unibase.Platform.Automation.Managers.CommentManager.Instance().saveComment(postData).then(function (response) {
var CommentId = response.result.CommentId;
$(".txtnewComment_").val(" ");
$("#Notifications_txtActivities").val(' ');
$("#childcomment-list_" + CommentId).html(' ');
instance.loadComments();
instance.childComments(CommentId, undefined, true);
});
}
childComments(commentId, parentid, fromsendbtn) {
Unibase.Platform.Automation.Managers.CommentManager.Instance().getCommentsByParentId(commentId).then(function (response) {
if (parentid == undefined) {
var html = '<div class="wrapper-sm childcomment-item_' + commentId + '">' +
'<form><div class="d-flex border-bottom border-light-50 bg-white w-85 ">' +
'<input type="text" id="commentTextBox_' + commentId + '" class="w-100 border-0 outline-0 commentTextBox txtnewComment_' + commentId + '" placeholder="Type Comments here...." oninput="Unibase.Platform.Automation.Components.Comments.Instance().enableSendbtn(event,' + commentId + ')">' +
'<div class="comment-btn-wrapper mb-1">' +
'<a href="/#/welcome" id="commentPostButton_' + commentId + '"class="list-group-anchor btn btn-icon btn-xs rounded" onclick="Unibase.Platform.Automation.Components.Comments.Instance().addChildCommentsforChildComments(' + commentId + ',' + commentId + ',true);"><span class="btn-icon-wrap"><button class="btn btn-white fa fa-paper-plane-o mt-5 p-0 text-disabled commentSendBtn"></button></span></a></span></div>' +
'</div></form>' +
'</div>';
}
else {
if (!fromsendbtn || fromsendbtn && $('.childcomment-item_' + commentId + '').hasClass('ml-35')) {
var html = '<div class="ml-35 childcomment-item wrapper-sm childcomment-item_' + commentId + '">';
}
else if (fromsendbtn && !$('.childcomment-item_' + commentId + '').hasClass('ml-35')) {
var html = '<div class="childcomment-item wrapper-sm childcomment-item_' + commentId + '">';
}
html += '<form><div class="d-flex border-bottom border-light-50 bg-white w-85 ml-35">' +
'<input type="text" id="commentTextBox_' + commentId + '" class="w-100 border-0 outline-0 commentTextBox txtnewComment_' + commentId + '" placeholder="Type Comments here...." oninput="Unibase.Platform.Automation.Components.Comments.Instance().enableSendbtn(event,' + commentId + ')">' +
'<div class="comment-btn-wrapper mb-1">' +
'<a href="/#/welcome" id="commentPostButton_' + commentId + '"class="btn btn-icon btn-xs rounded" onclick=" Unibase.Platform.Automation.Components.Comments.Instance().addChildCommentsforChildComments(' + commentId + ',' + parentid + ',true);"><span class="btn-icon-wrap"><button class="btn btn-white fa fa-paper-plane-o mt-5 p-0 text-disabled commentSendBtn"></button></span></a></span></div>' +
'</div></form>' +
'</div>';
}
if (response.result != null)
for (var i = response.result.length - 1; i >= 0; i--) {
var model = response.result[i];
var parentCount = `<span class="pr-1 toGetReplyCountByParentId${model.CommentId}">Replies</span>`;
parentCount += `<span id="Reply_${model.CommentId}"> (${model.ParentCommentCount}) </span>`;
if (model.ParentCommentCount == 0) {
parentCount = `<span class="pr-1 toGetReplyCountByParentId${model.CommentId}">Reply</span>`;
parentCount += `<span id="Reply_${model.CommentId}"></span>`;
}
var commentIcon = "";
var bgcolor = "";
var CommImage = "";
if (model.FromUserPhotoUrl == null || model.FromUserPhotoUrl == "") {
let avatarTxt = "";
let headingTxt = model.FromUserName;
let matches = headingTxt.match(/\b(\w)/g);
if (matches.length == 1) {
avatarTxt = $.trim(headingTxt).substr(0, 2);
}
else {
avatarTxt = matches.join('').slice(0, 2);
}
CommImage = `<h5 class="biz-primary-text-color font-12">${avatarTxt}</h5>`;
}
else {
let imgsrc = model.FromUserPhotoUrl;
let srcSplit = imgsrc.split('/');
if (srcSplit[srcSplit.length - 1] == 'unnamed.png') {
let avatarTxt = "";
let headingTxt = model.FromUserName;
let matches = headingTxt.match(/\b(\w)/g);
if (matches.length == 1) {
avatarTxt = $.trim(headingTxt).substr(0, 2);
}
else {
avatarTxt = matches.join('').slice(0, 2);
}
CommImage = `<h5 class="biz-primary-text-color font-12">${avatarTxt}</h5>`;
}
else {
CommImage = `<img src="${model.FromUserPhotoUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="avatar-img img-fluid rounded-circle font-11" alt="img">`;
}
}
var deletehtml = '';
if (model.CreatedBy == Unibase.Platform.Automation.Components.Comments.Instance().currentuser.userId) {
deletehtml = '<div class="d-flex align-items-center"> <span class="mr-10"><a href="/#/welcome" onclick="Unibase.Platform.Automation.Components.Comments.Instance().deleteComment(' + model.CommentId + ',' + commentId + ',' + parentid + ',1);"> <span class="btn-icon-wrap"> <i class="fa fa-trash-o text-danger font-16"> </i></span> </a>' +
'</span></div>';
}
bgcolor = "text-warning";
$("#hfAssignedFollowers").val(model.AssignedFollowers);
if (window.innerWidth <= 1198) {
var innerhtml = '<div class="wrapper-sm mt-10 childcomment-item_' + commentId + '">' +
'<section class="comment-body"><div class="comment-body-wrapper d-flex justify-content-between">' +
'<div class="comment-user-img"><div class="avatar biz-detail-avatar biz-highlight-color" style="width: 25px !important;height: 25px !important;">' + CommImage + '</div></div>' +
'<div class="comment-details-wrapper ml-1" style="flex-grow:2"><div class="comment-user-details"><div class="comment-username"><div class="d-flex align-items-center justify-content-between"><h6 class="font-12 biz-highlight-bg-color mr-5 commentusername_' + commentId + '">' + model.FromUserName + '</h6>' + deletehtml + '</div><div class="comment-text mt-1 w-sm-80 mb-5 text-dark font-11"><span>' + model.CommentSubject + '</span></div><div class="commentChild-statsContainer d-flex align-items-center text-dark justify-content-end flex-row-reverse"> ' +
'<div class="comment-extra-details">' +
'<span class="comment-time font-11 1"> ' + Unibase.Platform.Helpers.DateTimeHelper.Instance().commentsdateformat(model.CreatedDate) + '</span>' +
'</div>';
}
else {
var innerhtml = '<div class="wrapper-sm mt-10 childcomment-item_' + commentId + '">' +
'<section class="comment-body"><div class="comment-body-wrapper d-flex justify-content-between">' +
'<div class="comment-user-img"><div class="avatar biz-detail-avatar biz-highlight-color" style="width: 25px !important;height: 25px !important;">' + CommImage + '</div></div>' +
'<div class="comment-details-wrapper ml-1" style="flex-grow:2"><div class="comment-user-details"><div class="comment-username"><div class="d-flex align-items-center justify-content-between"><h6 class="font-14 biz-highlight-bg-color mr-5 commentusername_' + commentId + '">' + model.FromUserName + '</h6>' + deletehtml + '</div><div class="comment-text mt-1 w-sm-80 mb-5 text-dark font-14"><span>' + model.CommentSubject + '</span></div><div class="commentChild-statsContainer d-flex align-items-center text-dark justify-content-end flex-row-reverse"> ' +
'<div class="comment-extra-details">' +
'<span class="comment-time font-12 1"> ' + Unibase.Platform.Helpers.DateTimeHelper.Instance().commentsdateformat(model.CreatedDate) + '</span>' +
'</div>';
}
if (parentid == undefined) {
innerhtml += '<div class="comment-reply-wrapper mr-3"><span class="panel-default"><a href="/#/welcome" data-parent="divcomment" class="list-group-anchor text-dark d-flex p-0 font-12 list-item-main-title repli_data" onclick=" Unibase.Platform.Automation.Components.Comments.Instance().childComments(' + model.CommentId + ',' + commentId + ');"> ' + parentCount + '</a>' +
'</span></div>' +
'</div> </div></section><div class="bg-white hidden" id = "comments-' + model.CommentId + '" > ' +
'<div id="childcomment-list_' + model.CommentId + '" class="childcomment-list_' + model.CommentId + '"></div>' +
'</div></</div>';
}
else {
innerhtml += '<div class="comment-reply-wrapper mr-3"><span class="panel-default"><a href="/#/welcome" data-parent="divcomment" class="p-0 list-group-anchor text-dark d-flex pl-0 font-12 list-item-main-title repli_data" onclick=" Unibase.Platform.Automation.Components.Comments.Instance().childComments(' + model.CommentId + ',' + parentid + ')"> ' + parentCount + '</a>' +
'</span></div>' +
'</div> </div></section><div class="bg-white hidden" id = "comments-' + model.CommentId + '" > ' +
'<div id="childcomment-list_' + model.CommentId + '" class="childcomment-list_' + model.CommentId + '"></div>' +
'</div></</div>';
}
html = html + innerhtml;
}
if (fromsendbtn != true) {
if ($('#comments-' + commentId).hasClass('hidden')) {
$('#comments-' + commentId).removeClass('hidden').addClass('show');
}
else {
$('#comments-' + commentId).removeClass('show').addClass('hidden');
}
}
$("#childcomment-list_" + commentId).html(html);
let userName;
if ($('.toGetReplyCountByParentId' + commentId).parents('.stats_container').length > 0) {
userName = $('.toGetReplyCountByParentId' + commentId).parents('.stats_container').siblings('.comment-user-details').find('.comment-username h6').text().trim();
}
else if ($('.toGetReplyCountByParentId' + commentId).parents('.comment-username').length > 0) {
userName = $('.toGetReplyCountByParentId' + commentId).parents('.comment-username').find('h6').text().trim();
}
$('.txtnewComment_' + commentId).val('@' + userName + ' ');
});
}
addChildCommentsforChildComments(commentId, parentid, fromsendbtn) {
var instance = this;
if ($('.txtnewComment_' + commentId).val() == null || $('.txtnewComment_' + commentId).val() == "") {
MessageHelper.Instance().showError("Please Enter Something...", "bizgaze_SpiltErrorMessages");
return false;
}
var assgflwrs = null;
if ($('#hfAssignedFollowers_' + commentId).val() != null) {
assgflwrs = $('#hfAssignedFollowers_' + commentId).val();
}
var postData = {
CommentId: 0,
RefGuid: $('#hf_ParentCmtVersionGuid_' + parentid).val().toString(),
CommentSubject: $(".txtnewComment_" + commentId).val().toString(),
CommentType: Unibase.Platform.Automation.Enums.CommentType.Comment,
Followers: assgflwrs,
InstallPageId: $("#hfBizgaze_InstalledPageId").val(),
ParentId: commentId,
};
Unibase.Platform.Automation.Managers.CommentManager.Instance().saveComment(postData).then(function (response) {
$(".txtnewComment_" + commentId).val(" ");
instance.childComments(commentId, parentid, fromsendbtn);
instance.toGetReplyCount(commentId, parentid);
});
}
deleteComment(commentId, parentCommentId, SuperParentCmtId, IsChild) {
var instance = this;
bootbox.confirm("Are you sure want to delete?", function (result) {
if (result) {
Unibase.Platform.Automation.Managers.CommentManager.Instance().deleteComment(commentId).then(function (response) {
MessageHelper.Instance().showSuccess(response.message, '');
if (IsChild == 0) {
instance.loadComments();
}
else {
instance.childComments(parentCommentId, SuperParentCmtId, true);
}
instance.toGetReplyCount(parentCommentId);
});
}
});
}
toGetReplyCount(Id, parentId) {
var CommentId = Id;
var ParentCommentCount = 0;
if (CommentId != 0) {
Unibase.Platform.Automation.Managers.CommentManager.Instance().getCommentByCommentId(CommentId).then(function (response) {
ParentCommentCount = ParentCommentCount + response.result.ParentCommentCount;
if (ParentCommentCount != 0) {
$('.toGetReplyCountByParentId' + CommentId).text('Replies');
$('#Reply_' + CommentId).text(`(${ParentCommentCount})`);
}
else {
$('.toGetReplyCountByParentId' + CommentId).text('Reply');
$('#Reply_' + CommentId).text(``);
}
CommentId = response.result.ParentId;
});
}
}
enableSendbtn(e, id) {
let input = $('#commentTextBox_' + id);
let btn = $('#commentPostButton_' + id).find('.commentSendBtn');
if (input.val().length > 0) {
btn.removeClass('text-disabled').addClass('text-primary');
}
else {
btn.removeClass('text-primary').addClass('text-disabled');
}
}
static Instance() {
if (this.instance == undefined) {
this.instance = new Comments();
}
return this.instance;
}
}
Components.Comments = Comments;
})(Components = Automation.Components || (Automation.Components = {}));
})(Automation = Platform.Automation || (Platform.Automation = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long