Iniit
This commit is contained in:
@@ -0,0 +1,237 @@
|
||||
*, ::after, ::before {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
transition: all .2s ease;
|
||||
}
|
||||
|
||||
.startSlideLine {
|
||||
bottom: 8% !important;
|
||||
}
|
||||
|
||||
.startmenuClass {
|
||||
bottom: 38% !important;
|
||||
}
|
||||
|
||||
.treeContainer {
|
||||
height: 88vh;
|
||||
width: 100vw;
|
||||
margin-left: 80px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.treebody, .rulewidget {
|
||||
width: 100%;
|
||||
height: 90vh;
|
||||
padding: 20px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.treebody ul li {
|
||||
display: inline-block;
|
||||
padding-top: 150px;
|
||||
}
|
||||
|
||||
.rulewidget ul li {
|
||||
display: inline-block;
|
||||
padding-top: 150px;
|
||||
}
|
||||
/* box */
|
||||
.rootbox {
|
||||
margin: 0 auto !important;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.box {
|
||||
position: relative;
|
||||
height: 70px;
|
||||
border-left: 15px solid white;
|
||||
border-right: 15px solid white;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.boxcontent {
|
||||
padding: 0 1rem;
|
||||
background-color: lightgreen;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 5rem;
|
||||
}
|
||||
|
||||
.boxcontent.parnet {
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.boxcontent.eventbox {
|
||||
background-color: #CDFFFF;
|
||||
}
|
||||
|
||||
.rootbox .boxcontent {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.firstplus {
|
||||
position: absolute;
|
||||
bottom: 55%;
|
||||
z-index: 1;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding-bottom: 5px;
|
||||
background-color: rgb(28, 118, 221);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.boxlinedown {
|
||||
position: absolute;
|
||||
bottom: -18%;
|
||||
left: 0;
|
||||
width: 50%;
|
||||
height: 90px;
|
||||
border-right: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
.sideline {
|
||||
position: absolute;
|
||||
bottom: -125%;
|
||||
left: 53%;
|
||||
width: 70%;
|
||||
height: 50%;
|
||||
border-top: 1px dashed #ccc;
|
||||
transition: all .2s ease;
|
||||
}
|
||||
|
||||
.sidemenu {
|
||||
position: absolute;
|
||||
border: 1px solid grey;
|
||||
bottom: -90%;
|
||||
left: 110%;
|
||||
z-index: 999;
|
||||
transition: all .2s ease;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.plusbtn {
|
||||
position: absolute;
|
||||
bottom: 25%;
|
||||
z-index: 1;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding-bottom: 5px;
|
||||
background-color: rgb(28, 118, 221);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btnStart {
|
||||
padding: 0.5rem 3rem;
|
||||
border: 1px solid darkgreen;
|
||||
border-radius: 20px;
|
||||
background-color: rgba(144, 238, 144, 0.377);
|
||||
}
|
||||
/* card */
|
||||
.cardTree {
|
||||
position: relative;
|
||||
width: 230px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
li {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.element::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 20%;
|
||||
border-top: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
.element::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
height: 110px;
|
||||
border-right: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
.element:only-child::after, .element:only-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.element:only-child {
|
||||
margin-top: -6.3rem;
|
||||
}
|
||||
|
||||
ul .element:first-child::after {
|
||||
right: 0;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
ul .element:last-child::after {
|
||||
left: 0;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.togglechildren {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.card_menu_wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card_menu_wrapper img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform: translateY(-80%);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.cardTree.diffcard .deleteicon i {
|
||||
color: red;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.cardTree_des {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.conditionbtn {
|
||||
color: red;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.cardTree.diffcard > div {
|
||||
flex-direction: row !important;
|
||||
}
|
||||
|
||||
.cardTree.diffcard img {
|
||||
position: relative;
|
||||
transform: translateX(0);
|
||||
width: 53px;
|
||||
height: 53px;
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
/// <reference path="../../platform/automation/managers/rulemanager.ts" />
|
||||
/// <reference path="../../platform/automation/enums/automationmode.ts" />
|
||||
/// <reference path="../../platform/core/helpers/messages/messagehelper.ts" />
|
||||
|
||||
var elements =
|
||||
{
|
||||
SMS:
|
||||
{
|
||||
icon: "libs/flowy/assets/sms.svg",
|
||||
name: "SMS",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#66636a"
|
||||
},
|
||||
TASK:
|
||||
{
|
||||
icon: "libs/flowy/assets/task.svg",
|
||||
name: "TASK",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#e7d93d"
|
||||
},
|
||||
NOTIFICATION:
|
||||
{
|
||||
icon: "libs/flowy/assets/bell.svg",
|
||||
name: "NOTIFICATION",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#f38d08"
|
||||
},
|
||||
EXECUTEQUERY:
|
||||
{
|
||||
icon: "libs/flowy/assets/database.svg",
|
||||
name: "EXECUTEQUERY",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#4da782"
|
||||
},
|
||||
MAIL:
|
||||
{
|
||||
icon: "libs/flowy/assets/email.svg",
|
||||
name: "MAIL",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#ff35a2"
|
||||
},
|
||||
APIINTEGRATOR:
|
||||
{
|
||||
icon: "libs/flowy/assets/database.svg",
|
||||
name: "APIINTEGRATOR",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#c96e3f"
|
||||
},
|
||||
STAGECHANGE:
|
||||
{
|
||||
icon: "libs/flowy/assets/stage.svg",
|
||||
name: "STAGECHANGE",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#60afb7"
|
||||
},
|
||||
SCHEDULAR:
|
||||
{
|
||||
icon: "libs/flowy/assets/time.svg",
|
||||
name: "SCHEDULAR",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#9a6aab"
|
||||
},
|
||||
EVENT:
|
||||
{
|
||||
icon: "libs/flowy/assets/icon.png",
|
||||
name: "EVENT",
|
||||
color: "#959595",
|
||||
iconcolor: ""
|
||||
},
|
||||
WHATSAPP:
|
||||
{
|
||||
icon: "libs/flowy/assets/whatsapp.svg",
|
||||
name: "WHATSAPP",
|
||||
color: "#eaeced",
|
||||
iconcolor: "#1fa581"
|
||||
},
|
||||
}
|
||||
var containerid;
|
||||
var actions = [];
|
||||
var Ruleproviderid = 0;
|
||||
var smsblock;
|
||||
var emailblock;
|
||||
var notificationblock;
|
||||
var taskblock;
|
||||
var stagechangeblock;
|
||||
var etemplateblock;
|
||||
var whatsappblock;
|
||||
var eventblock;
|
||||
var apiblock;
|
||||
var disabledClick;
|
||||
var removefunction;
|
||||
var execuetqueryblock;
|
||||
var RuleId = 0;
|
||||
var importdata = '';
|
||||
var ispopupopened = false;
|
||||
var datainfo = [];
|
||||
var isdelete = false;
|
||||
var isplusbtn = false;
|
||||
var installedappid = 0;
|
||||
var rpid = 0;
|
||||
var rulename = "";
|
||||
var containerid;
|
||||
var _IsChildAction = false;
|
||||
var bizgaze_automation_flow_main = {
|
||||
//group id
|
||||
saveruleblock: function (id, name, ruleproviderid) {
|
||||
RuleId = Number(id);
|
||||
$('.rule_dataul').attr("id", RuleId).attr("alt", name);
|
||||
ispopupopened = false;
|
||||
//after saving disable all input fields
|
||||
$('#installedapp_dropdown').attr("disabled", "true");
|
||||
$('#ddl_RuleProvider').attr("disabled", "true");
|
||||
$("#txt_Rule").attr("disabled", "true");
|
||||
},
|
||||
saveeventblock: function (id, name) {
|
||||
if (Number(eventblock.id) == 0) {
|
||||
eventblock.id = id;
|
||||
$(eventblock).children().children().children('.action_data').append('<center>' + name + '</center>');
|
||||
$(eventblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name)
|
||||
}
|
||||
if (!$(eventblock).children().children().children('.event_name').hasClass('event_name'))
|
||||
{
|
||||
$(eventblock).children().children('.card_menu_wrapper').append('<input type="hidden" class="event_name">')
|
||||
}
|
||||
ispopupopened = false;
|
||||
},
|
||||
saveeventname(eventname) {
|
||||
$('.event_name').val(eventname)
|
||||
},
|
||||
savesmsblock: function (id, name) {
|
||||
smsblock.id = id;
|
||||
$(smsblock).children().children().children().children('.action_data').append(name);
|
||||
$(smsblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(smsblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
ispopupopened = false;
|
||||
},
|
||||
savenotificationblock: function (id, name) {
|
||||
notificationblock.id = id;
|
||||
$(notificationblock).children().children().children().children('.action_data').append(name);
|
||||
$(notificationblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
ispopupopened = false;
|
||||
$(notificationblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
savewhatsappblock: function (id, name) {
|
||||
whatsappblock.id = id;
|
||||
$(whatsappblock).children().children().children().children('.action_data').append(name);
|
||||
$(whatsappblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
ispopupopened = false;
|
||||
$(whatsappblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
savetaskblock: function (id, name) {
|
||||
taskblock.id = id;
|
||||
ispopupopened = false;
|
||||
$(taskblock).children().children().children().children('.action_data').append(name);
|
||||
$(taskblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(taskblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
saveemailblock: function (id, name) {
|
||||
emailblock.id = id;
|
||||
ispopupopened = false;
|
||||
$(emailblock).children().children().children().children('.action_data').append(name);
|
||||
$(emailblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(emailblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
savestagechangeblock: function (id, name) {
|
||||
stagechangeblock.id = id;
|
||||
ispopupopened = false;
|
||||
$(stagechangeblock).children().children().children().children('.action_data').append(name);
|
||||
$(stagechangeblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(stagechangeblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
saveApiIntegratorblock: function (id, name) {
|
||||
apiblock.id = id;
|
||||
ispopupopened = false;
|
||||
$(apiblock).children().children().children().children('.action_data').append(name);
|
||||
$(apiblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(apiblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
|
||||
},
|
||||
saveExecuteQueryblock: function (id, name) {
|
||||
execuetqueryblock.id = id;
|
||||
ispopupopened = false;
|
||||
$(execuetqueryblock).children().children().children().children('.action_data').append(name);
|
||||
$(execuetqueryblock).children().children('.deleteicon').children('.deleteblock').addClass('d-none');
|
||||
$(execuetqueryblock).parent().closest('.box').parent().children('.parent-list').attr("id", id).attr("alt", name);
|
||||
},
|
||||
getruleid: function () {
|
||||
return RuleId;
|
||||
},
|
||||
import: function (data) {
|
||||
importdata = data.html;
|
||||
datainfo = data.data;
|
||||
|
||||
},
|
||||
output: function () {
|
||||
eval("closemenu()");
|
||||
var datainfo = [];
|
||||
$('.parent-list').each(function () {
|
||||
if (Number($(this).attr("id")) != 0) {
|
||||
var info = {
|
||||
Name: $(this).attr("alt"),
|
||||
Id: Number($(this).attr("id")),
|
||||
Action: $(this).attr("data-name")
|
||||
}
|
||||
datainfo.push(info);
|
||||
}
|
||||
});
|
||||
var output = {
|
||||
data: datainfo, html: $('.treebody').html()
|
||||
}
|
||||
return output;
|
||||
},
|
||||
getruleid: function () {
|
||||
return RuleId;
|
||||
},
|
||||
getruleproviderid: function () {
|
||||
return Ruleproviderid;
|
||||
},
|
||||
getpopupclosed: function () {
|
||||
ispopupopened = false;
|
||||
},
|
||||
appendruleid: function (id) {
|
||||
RuleId = Number(id);
|
||||
},
|
||||
getcloseadvmode: function () {
|
||||
importdata = '';
|
||||
datainfo = [];
|
||||
RuleId = 0;
|
||||
},
|
||||
appendruleproviderid: function (id) {
|
||||
Ruleproviderid = Number(id);
|
||||
},
|
||||
getcontainerid: function (containerdata) {
|
||||
containerid = containerdata;
|
||||
},
|
||||
IsChildAction() {
|
||||
return _IsChildAction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// actions
|
||||
function load() {
|
||||
Unibase.Platform.Automation.Managers.RuleManager.Instance().getActions().then(function (response) {
|
||||
for (var i = 0; i <= response.length - 1; i++) {
|
||||
actions.push(response[i]);
|
||||
}
|
||||
});
|
||||
//previous data
|
||||
if (datainfo.length > 0) {
|
||||
//rule
|
||||
var info = datainfo.find(x => x.Action == "RULE");
|
||||
$("#txt_Rule").val(info.Name);
|
||||
//rule provider
|
||||
Unibase.Platform.Automation.Managers.RuleManager.Instance().getRuleProvider(Ruleproviderid).then(function (response) {
|
||||
if (response != null) {
|
||||
$('#installedapp_dropdown').html('');
|
||||
$('#installedapp_dropdown').html('<option value=' + response.InstalledAppId + ' selected>' + response.AppTitle + '</option>');
|
||||
$('#ddl_RuleProvider').html('');
|
||||
$('#ddl_RuleProvider').html('<option value=' + response.RuleProviderId + ' selected>' + response.RuleProviderName + '</option>');
|
||||
Unibase.Platform.Automation.Components.Rule.Instance().RuleInstalledAppId = Number(response.InstalledAppId);
|
||||
}
|
||||
});
|
||||
//disable all input fields
|
||||
$('#installedapp_dropdown').attr("disabled", "true");
|
||||
$('#ddl_RuleProvider').attr("disabled", "true");
|
||||
$("#txt_Rule").attr("disabled", "true");
|
||||
}
|
||||
//import data
|
||||
var html = importdata;
|
||||
if (html == '') {
|
||||
html = `<ul class="active d-flex" id="firstblock">
|
||||
<li class="element" style="z-index:0">
|
||||
<div class="box rootbox d-flex justify-content-center align-items-end" id="rootbox">
|
||||
<div class="boxcontent">
|
||||
<button class="btnStart">Start</button>
|
||||
</div>
|
||||
<div class="firstplus" id="startplusbtn" onclick="openmenu(this)">+</div>
|
||||
<div class="boxlinedown"></div>
|
||||
<div class="sideline startSlideLine d-none"></div>
|
||||
<div class="sidemenu startmenuClass d-none" id="startmenu"></div></div>
|
||||
<ul data-name="RULE" class="active startedTree d-flex parent-list rule_dataul" id="0"></ul>
|
||||
</li>
|
||||
</ul>`;
|
||||
}
|
||||
$('.treebody').append(html);
|
||||
|
||||
}
|
||||
function deleteblock(type) {
|
||||
isdelete = true;
|
||||
$(type).parent().closest('.box').parent().remove();
|
||||
if (ispopupopened) {
|
||||
ispopupopened = false;
|
||||
$('#' + containerid).modal('hide');
|
||||
$('#' + containerid).remove();
|
||||
}
|
||||
}
|
||||
function parentid(type) {
|
||||
var parentname = $(type).parent().closest('.box').parent().children('.parent-list').parent().parent().attr('data-name');
|
||||
var parentid = 0;
|
||||
if (parentname != "EVENT") {
|
||||
parentid = Number($(type).parent().closest('.box').parent().children('.parent-list').parent().parent().attr("id"));
|
||||
}
|
||||
return parentid;
|
||||
}
|
||||
//side menu
|
||||
function openmenu(e) {
|
||||
$('input[name="startbtnmenu"]').prop("checked", false);
|
||||
rpid = Number($('#ddl_RuleProvider option:selected').val());
|
||||
rulename = $('#txt_Rule').val();
|
||||
var parentname = $(e).parent().closest('.box').parent().children('.parent-list').attr('data-name');
|
||||
var data = [];
|
||||
isplusbtn = true;
|
||||
if ($(e).parent().find('.sideline').hasClass('d-none') && $(e).parent().find('.sidemenu').hasClass('d-none')) {
|
||||
$('.sidemenu').each(function () {
|
||||
if (!$(this).hasClass('d-none')) {
|
||||
$(this).addClass('d-none');
|
||||
}
|
||||
});
|
||||
$('.sideline').each(function () {
|
||||
if (!$(this).hasClass('d-none')) {
|
||||
$(this).addClass('d-none');
|
||||
}
|
||||
});
|
||||
$(e).parent().find('.sideline').removeClass('d-none');
|
||||
$(e).parent().find('.sidemenu').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
$(e).parent().find('.sideline').addClass('d-none');
|
||||
$(e).parent().find('.sidemenu').addClass('d-none');
|
||||
}
|
||||
if (rulename == "" || rpid == 0) {
|
||||
$(e).parent().find('.sidemenu').html(Errorhtml("Rule Fields Are Missing"));
|
||||
|
||||
}
|
||||
else if (Number($(e).parent().parent().children('.parent-list').attr("id")) == 0 && parentname != "RULE") {
|
||||
$(e).parent().find('.sidemenu').html(Errorhtml("Please Save Parent"));
|
||||
}
|
||||
else if ($(e).parent().find('.sidemenu').hasClass('dataadded') != true) {
|
||||
$(e).parent().find('.sidemenu').addClass('dataadded');
|
||||
if (parentname != "RULE") {
|
||||
data = ["SMS", "NOTIFICATION", "MAIL", "EXECUTEQUERY", "STAGECHANGE", "APIINTEGRATOR", "TASK","WHATSAPP"];
|
||||
}
|
||||
else {
|
||||
data = ["EVENT"];
|
||||
}
|
||||
$(e).parent().find('.sidemenu').html(menubarfunction(data));
|
||||
}
|
||||
}
|
||||
function closemenu() {
|
||||
if (!isplusbtn) {
|
||||
$('.sidemenu').each(function () {
|
||||
if (!$(this).hasClass('d-none')) {
|
||||
$(this).addClass('d-none');
|
||||
}
|
||||
});
|
||||
$('.sideline').each(function () {
|
||||
if (!$(this).hasClass('d-none')) {
|
||||
$(this).addClass('d-none');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
isplusbtn = false;
|
||||
}
|
||||
}
|
||||
function Errorhtml(message) {
|
||||
var html =
|
||||
`<div class="d-flex flex-column error_menu" style="gap:0.3rem"><div class="option_Error w-100 px-2 d-flex justify-content-start align-items-center">
|
||||
<i class="fa fa-exclamation-circle" style="color:red;font-size:12px"></i>
|
||||
<label class="ml-1 mt-1 error_message" for="event_startbtnmenu">${message}</label>
|
||||
</div></div>`;
|
||||
return html;
|
||||
}
|
||||
function ruleproviders() {
|
||||
var installedappid = Number($('#installedapp_dropdown option:selected').val());
|
||||
Unibase.Platform.Automation.Components.Rule.Instance().RuleInstalledAppId = installedappid;
|
||||
Unibase.Platform.Automation.Managers.RuleManager.Instance().loadRuleProviders(installedappid).then(function (response) {
|
||||
var html = "";
|
||||
if (response.length > 0) {
|
||||
for (let i = 0; i < response.length; i++) {
|
||||
html += '<option value=' + response[i].RuleProviderId + '>' + response[i].RuleProviderName + '</option>';
|
||||
}
|
||||
$('#ddl_RuleProvider').append(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
function ruleprovideridinfo() {
|
||||
Ruleproviderid = Number($('#ddl_RuleProvider option:selected').val());
|
||||
}
|
||||
//card design
|
||||
function getcarddesign(event) {
|
||||
var html = "";
|
||||
if (event.name != "EVENT") {
|
||||
return `<div class="boxcontent parnet">
|
||||
<div class="cardTree diffcard" id="0" onclick="popup(this)">
|
||||
<input type="hidden" class="action_name" value="${event.name}">
|
||||
<div class="d-flex flex-column justify-content-between h-100" style="background-color:${elements[event.name].color}">
|
||||
<div class="align-items-center card_menu_wrapper d-flex justify-content-center justify-content-end p-3" style="background-color:${elements[event.name].iconcolor}" >
|
||||
<img src="${elements[event.name].icon}" style="color:white;font-size:20px;height:20px;width:20px;margin-top:2px"></i>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center flex-column w-60">
|
||||
<center><div style="color:${elements[event.name].iconcolor}"><center><b class="mr-10">${event.name}</b></center></div></center>
|
||||
<center><div class="action_data text-truncate w-50 mr-10"></div></center>
|
||||
</div>
|
||||
<div class="deleteicon p-2" data-delete="${event.name}">
|
||||
<i class="fa fa-trash deleteblock" onclick="deleteblock(this)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sideline d-none"></div>
|
||||
<div class="sidemenu d-none"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
else {
|
||||
return `<div class="boxcontent eventbox">
|
||||
<div class="cardTree" id="0" onclick="popup(this)">
|
||||
<input type="hidden" class="action_name" value="${event.name}">
|
||||
<div class="d-flex flex-column py-4 px-3 h-100 justify-content-between ">
|
||||
<div class=" d-flex justify-content-end card_menu_wrapper px-2 align-items-end">
|
||||
<img src="${elements[event.name].icon}" alt="${event.name}">
|
||||
<input type="hidden" class="event_name">
|
||||
</div>
|
||||
<div class="d-flex justify-content-center flex-column">
|
||||
<div><center><b>EVENT</b></center></div>
|
||||
<div class="action_data"></div>
|
||||
</div>
|
||||
<div class="deleteicon">
|
||||
<i class="fa fa-trash deleteblock_event d-none pull-right" onclick="deleteblock(this)" style="position:relative;top:-25px;left:15px;font-size:12px"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sideline d-none"></div>
|
||||
<div class="sidemenu d-none"></div></div></div>`;
|
||||
}
|
||||
}
|
||||
//popup image
|
||||
function popup(type) {
|
||||
var name = $(type).children('.action_name').val();
|
||||
if (!ispopupopened && !isdelete) {
|
||||
ispopupopened = true;
|
||||
if ($(type).parent().closest('.box').parent().hasClass('firstelement')) {
|
||||
$(type).parent().closest('.box').parent().removeClass('firstelement');
|
||||
}
|
||||
var _fileCacheHelper = Unibase.Platform.Helpers.FileCacheHelper.Instance();
|
||||
var id = 0;
|
||||
switch (name) {
|
||||
case "SMS":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.sms.js", function () {
|
||||
let smsid = Number($(type).attr("id"));
|
||||
smsblock = $(type).get(0)
|
||||
var sms = new Unibase.Platform.Automation.Components.SendSms();
|
||||
sms.RuleProviderId = Ruleproviderid
|
||||
sms.ActionId = actions.filter(X => X.ActionName == "Send Sms")[0].ActionId;
|
||||
sms.ParentActionId = parentid(type);
|
||||
_IsChildAction = sms.ParentActionId == 0 ? false : true;
|
||||
sms.RuleActionData = [];
|
||||
sms.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
sms.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(smsid, '', sms, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "NOTIFICATION":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.notification.js", function () {
|
||||
let notificationid = Number($(type).attr("id"));
|
||||
notificationblock = $(type).get(0);
|
||||
var notification = new Unibase.Platform.Automation.Components.SendNotification();
|
||||
notification.RuleProviderId = Ruleproviderid
|
||||
notification.ParentActionId = parentid(type);
|
||||
_IsChildAction = notification.ParentActionId == 0 ? false : true;
|
||||
notification.ActionId = actions.filter(X => X.ActionName == "Send Notification")[0].ActionId;
|
||||
notification.RuleActionData = [];
|
||||
notification.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
notification.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(notificationid, '', notification, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "EXECUTEQUERY":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.executequery.js", function () {
|
||||
let executequeryid = Number($(type).attr("id"));
|
||||
execuetqueryblock = $(type).get(0);
|
||||
var ExecuteQuery = new Unibase.Platform.Automation.Components.ExecuteQuery();
|
||||
ExecuteQuery.RuleProviderId = Ruleproviderid
|
||||
ExecuteQuery.ActionId = actions.filter(X => X.ActionName == "Execute Query")[0].ActionId;
|
||||
ExecuteQuery.ParentActionId = parentid(type);;
|
||||
_IsChildAction = ExecuteQuery.ParentActionId == 0 ? false : true;
|
||||
ExecuteQuery.RuleActionData = [];
|
||||
ExecuteQuery.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
ExecuteQuery.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(executequeryid, '', ExecuteQuery, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "MAIL":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.email.js", function () {
|
||||
let emailid = Number($(type).attr("id"));
|
||||
emailblock = $(type).get(0);
|
||||
var email = new Unibase.Platform.Automation.Components.SendEmail();
|
||||
email.RuleProviderId = Ruleproviderid
|
||||
email.ActionId = actions.filter(X => X.ActionName == "Send Email")[0].ActionId;
|
||||
email.ParentActionId = parentid(type);;
|
||||
_IsChildAction = email.ParentActionId == 0 ? false : true;
|
||||
email.RuleActionData = [];
|
||||
email.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
email.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(emailid, '', email, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "TASK":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.task.js", function () {
|
||||
let taskid = Number($(type).attr("id"));
|
||||
taskblock = $(type).get(0);
|
||||
var task = new Unibase.Platform.Automation.Components.SendTask();
|
||||
task.RuleProviderId = Ruleproviderid
|
||||
task.ActionId = actions.filter(X => X.ActionName == "Send Task")[0].ActionId;
|
||||
task.ParentActionId = parentid(type);;
|
||||
_IsChildAction = task.ParentActionId == 0 ? false : true;
|
||||
task.RuleActionData = [];
|
||||
task.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
task.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(taskid, '', task, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "WHATSAPP":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.whatsapp.js", function () {
|
||||
let whatsappid = Number($(type).attr("id"));
|
||||
whatsappblock = $(type).get(0);
|
||||
var whatsapp = new Unibase.Platform.Automation.Components.SendWhatsApp();
|
||||
whatsapp.RuleProviderId = Ruleproviderid
|
||||
whatsapp.ActionId = actions.filter(X => X.ActionName == "Send WhatsApp")[0].ActionId;
|
||||
whatsapp.ParentActionId = parentid(type);;
|
||||
_IsChildAction = whatsapp.ParentActionId == 0 ? false : true;
|
||||
whatsapp.RuleActionData = [];
|
||||
whatsapp.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
whatsapp.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(whatsappid, '', whatsapp, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "APIINTEGRATOR":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.apiintegrator.js", function () {
|
||||
let apiintegratorid = Number($(type).attr("id"));
|
||||
apiblock = $(type).get(0);
|
||||
var ApiIntegrator = new Unibase.Platform.Automation.Components.ApiIntegrator();
|
||||
ApiIntegrator.RuleProviderId = Ruleproviderid
|
||||
ApiIntegrator.ActionId = actions.filter(X => X.ActionName == "Api Integration")[0].ActionId;
|
||||
ApiIntegrator.ParentActionId = parentid(type);;
|
||||
_IsChildAction = ApiIntegrator.ParentActionId == 0 ? false : true;
|
||||
ApiIntegrator.RuleActionData = [];
|
||||
ApiIntegrator.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
ApiIntegrator.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(apiintegratorid, '', ApiIntegrator, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
|
||||
});
|
||||
break;
|
||||
case "STAGECHANGE":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/actions/actions.stagechange.js", function () {
|
||||
let stagechangeid = Number($(type).attr("id"));
|
||||
stagechangeblock = $(type).get(0);
|
||||
var stagechange = new Unibase.Platform.Automation.Components.StageChange();
|
||||
stagechange.RuleProviderId = Ruleproviderid
|
||||
stagechange.ActionId = actions.filter(X => X.ActionName == "Stage Change")[0].ActionId;
|
||||
stagechange.ParentActionId = parentid(type);;
|
||||
stagechange.RuleActionData = [];
|
||||
stagechange.AutomationMode = Unibase.Platform.Automation.Enums.AutomationMode.AdvancedMode;
|
||||
stagechange.IsAutomationMode = true;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(stagechangeid, '', stagechange, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "SCHEDULAR":
|
||||
//not assigning id after saving
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/templatenotes.js", function () {
|
||||
let etemplateid = Number($(type).attr("id"));
|
||||
etemplateblock = $(type).get(0);
|
||||
var eventtemplate = new Unibase.Platform.Automation.Components.EventTemplate();
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(etemplateid, '', eventtemplate, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
case "EVENT":
|
||||
_fileCacheHelper.loadJsFile("platform/automation/components/rulebuilder/rulebuilder.event.js", function () {
|
||||
let eventid = Number($(type).attr("id"));
|
||||
eventblock = $(type).get(0);
|
||||
var ruleevent = new Unibase.Platform.Automation.Components.RuleEvent();
|
||||
ruleevent.RuleProviderId = Ruleproviderid;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().popup(eventid, '', ruleevent, function () {
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
isdelete = false;
|
||||
}
|
||||
|
||||
}
|
||||
//line design
|
||||
function getlinedesign(data) {
|
||||
isdelete = false;
|
||||
$(data).parent().parent().parent().find('.sideline').addClass('d-none');
|
||||
$(data).parent().parent().parent().find('.sidemenu').addClass('d-none');
|
||||
var elementdata = elements[$(data).children('.block_action').val()];
|
||||
var carddesign = getcarddesign(elementdata);
|
||||
var html = `<li class="element firstelement">
|
||||
<div class="box d-flex justify-content-center align-items-end">
|
||||
${carddesign}
|
||||
<div class="plusbtn" onclick="openmenu(this)">+</div>
|
||||
<div class="boxlinedown"></div>
|
||||
</div>
|
||||
<ul class="d-flex ${elementdata.name} parent-list justify-content-center align-content-center" id="0" data-name="${elementdata.name}">
|
||||
</ul>
|
||||
</li>`;
|
||||
$(data).parent().closest('.box').parent().children('.parent-list').append(html);
|
||||
var type = $(data).parent().closest('.box').parent().children('.parent-list').children('.firstelement').children('.box').children('.boxcontent').children('.cardTree').get(0);
|
||||
popup(type);
|
||||
}
|
||||
//hidden menu
|
||||
function menubarfunction(data) {
|
||||
var innerhtml = '';
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
innerhtml += `
|
||||
<div class="option_${data[i]} w-100 px-2 d-flex justify-content-start align-items-center" onclick="getlinedesign(this)">
|
||||
<input class="mr-1 block_action" type ="radio" name="startbtnmenu" value=${data[i]}>
|
||||
<label class="m-0" for="event_startbtnmenu">${data[i]}</label>
|
||||
</div>`;
|
||||
}
|
||||
var html = '<div class="d-flex flex-column menu" style="gap:0.3rem">' + innerhtml + '</div>';
|
||||
return html;
|
||||
}
|
||||
Reference in New Issue
Block a user