initial commit 2

This commit is contained in:
equippedcoding-master
2025-09-17 15:19:57 -05:00
parent e2c98790b2
commit 1c59875b8a
55391 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,372 @@
function func_login(app,view){
_func_login();
}
function func_dashboardDefaultViewListener(){
_func_dashboardDefaultViewListener();
}
function func_dashboardListener(){
views_dashboardContentView();
$('#dashboard-content').append(app_views['dashboard_main'].getHtml());
}
function func_emailListener(){
$("#email-back").click(function(){
app_views['dashboard_main'].render('default');
});
}
function func_webbuilderListener(){
_func_webbuilderListener();
}
function func_communicationListener(){
$("#communication-back").click(function(){
app_views['dashboard_main'].render('default');
});
}
function func_emailListener(){
_func_emailListener();
}
function func_emailManageListener(callback){
var data = {get_all_email_accounts:true};
$.post("core/request.php",data,function(resp){
resp = JSON.parse(resp);
//console.log(resp)
var verifiedArray = [];
var unverifiedArray = [];
var publicArray = [];
var privateArray = [];
for(var i=0; i < resp.length; i++){
if(resp[i].verified.verified==1){
verifiedArray.push(resp[i].verified);
}
if(resp[i].unverified!=undefined && resp[i].unverified.verified==0){
unverifiedArray.push(resp[i].unverified);
}
}
for(var i=0; i < verifiedArray.length; i++){
if(verifiedArray[i].category==0){
privateArray.push(verifiedArray[i]);
}else
if(verifiedArray[i].category==1){
publicArray.push(verifiedArray[i]);
}
}
var publicList = app.factory.list({
list: publicArray,
item: function(item,index){
this.label = item.username;
this.listener = function(item){
console.log(item);
openDialog(item);
}
return this;
}
});
var privateList = app.factory.list({
list: privateArray,
item: function(item,index){
this.label = item.username;
this.listener = function(item){
//console.log(item);
openDialog(item);
}
return this;
}
});
var nav = app.factory.nav({
//top[default], top-center, top-left, right, left
//position: "top-right"
});
nav.add({
init: true,
label: 'Public',
body: app.factory.container({
body:'<div id="list-emails-verified" class="manage-emails-container-list"></div>',
listener: function(){
$("#list-emails-verified").append(publicList.getHtml());
}
})
});
nav.add({
init: false,
label: 'Private',
body: app.factory.container({
body: '<div id="grap-emails-that-i-like-now"><h3>Empty</h3></div>',
listener: function(){
$("#grap-emails-that-i-like-now").append(privateList.getHtml());
}
})
});
nav.build();
$("#manage-verified-emails-list").append(nav.getHtml());
nav.initializeListeners();
var unverifiedList = app.factory.list({
list: unverifiedArray,
item: function(item,index){
//console.log(item);
this.label = ((item.userid==null||item.userid==undefined || item.userid=="") ? "[Name not chosen yet]" : item.userid) +" - "+ item.token;
this.listener = function(item){
console.log(item);
}
return this;
}
});
// ssss
$("#manage-unverified-emails-list").append(unverifiedList.getHtml());
if(callback!=undefined){
callback();
}
});
}
function openDialog(item){
// https://www2.cradle2careertx.xyz/portal/mailclient/1/
// <form action="${app_config.auto_login_url}" method="post" name="autologin">
var container1 = app.factory.container({
body: `
<form action="https://www2.cradle2careertx.xyz/portal/mailclient/1/" method="post" name="autologin">
<div style="display:none">
UserID <input name="rc_user" type="text" id="rc_user">
Passwort <input name="rc_pass" type="password" id="rc_pass">
</div>
<input type="submit" style="width:100%;margin-bottom:20px;" name="Submit" value="View Email">
</form>
`,
listener: function(){
$("#rc_user").val(item.userid);
$("#rc_pass").val(item.password);
}
});
var form = app.factory.form();
form.addCheckbox({
tag: "password",
label: "Update Password",
type: "text",
defaultValue: item.level
});
form.addInput({
tag: "forward",
label: "Forward Email",
type: "text",
defaultValue: item.level
});
form.addInput({
tag: "password",
label: "Update Password",
type: "text",
defaultValue: item.level
});
form.addRadioButtonGroup({
tag: 'category',
label: "Select Category",
inline: true,
defaultValue: item.category,
buttons: [
{
label:"Private",
value: 0,
id:"getg",
tag: "category_tag",
//checked: item.category==0 ? true : false
},
{
label:"Public",
value: 1,
tag: "category_tag",
id:"getgrt",
//checked: item.category==1 ? true : false
}
],
listener: function(obj){
//console.log(item)
}
});
form.addInput({
tag: "level",
label: "Level",
type: "number",
defaultValue: item.level
});
form.addInput({
tag: "firstname",
label: "First name",
type: "text",
defaultValue: (item.firstname=="_none_") ? "" : item.firstname,
});
form.addInput({
tag: "lastname",
label: "Last name",
type: "text",
defaultValue: (item.lastname=="_none_") ? "" : item.lastname,
});
form.onSubmit({
//id: "",
label: "Submit",
style: "width: 100%;",
className: "",// "btn btn-success",
overlay: true,
},function(obj){
//obj.values.category = parseInt(obj.values.category);
//console.log(item);
obj.values.username = item.username;
//console.log(obj.values);
var data2 = {
update_user_email_data: true,
data: JSON.stringify(obj.values)
};
$.post("core/request.php",data2,function(resp){
$("#manage-verified-emails-list").empty();
$("#manage-unverified-emails-list").empty();
func_emailManageListener(function(){
app.overlay(false);
AppDialog.toggle();
});
});
});
form.build();
var header = app.brick().stack().h5(item.userid + "@" + item.domain).build();
var layout = app.layout.newLayout()
.row()
.col({md:6}, header)
.row()
.col({md:6}, container1)
.row()
.col({md:6,offset_md:3}, form)
.build();
var comp1 = app.factory.container({body:layout})
AppDialog.setContent({
title: "Email",
body: comp1
});
AppDialog.toggle();
}
function func_emailCreateListener(){
$("#new-address-form").css({display:"block"});
$("#new-address-form-success").css({display:"none"});
$.post("./core/request.php",{get_all_email_accounts:true},function(resp1){
app_config["accounts"] = JSON.parse(resp1);
var form = comp_createEmailAddressForm();
$('#new-address-form').append(form.getHtml());
});
}
function func_emailSuccessListener(){
if(app_creationData==null || app_creationData==undefined){ return; }
$("#new-address-form").css({display:"none"});
$("#new-address-form-success").css({display:"block"});
$("#new-address-form-success-header").html("Invitation sent for "+ app_creationData.username + "@" + app_creationData.domain);
$("#new-address-form-success-button").click(function(e){
app_creationData = undefined;
$("#new-address-form-success-header").html("");
app_views['dashboard_email'].render("manage");
});
}
function func_createNewAdminEmailAddress(){
_func_createNewAdminEmailAddress();
}
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
function _func_webbuilderListener(){
$('#open-webbuilder-project').click(function(e){
e.preventDefault();
window.location.href = "webbuilder/";
});
$("#webbuilder-back").click(function(){
app_views['dashboard_main'].render('default');
});
}
function _func_createNewAdminEmailAddress(username,password,category,email,callback){
var data = {
'create_new_email_address':true,
username: username,
password: password,
category: category,
email: email
};
$.post("core/request.php",data,function(resp){
callback(resp);
});
}
function _func_emailListener(){
$("#email-container").append(app_views['dashboard_email'].getHtml());
$('#email-back').click(function(){
app_views['dashboard_main'].render('default');
});
$('#email-create-new-address').click(function(){
app_views['dashboard_email'].render('create');
});
$('#email-manage-address').click(function(){
app_views['dashboard_email'].render('manage');
});
}
function _func_dashboardDefaultViewListener(){
$(".default_view-btn-email").click(function(){
app_views['dashboard_main'].render('email');
});
$(".default_view-btn-webbuilder").click(function(){
app_views['dashboard_main'].render('webbuilder');
});
$(".default_view-btn-communication").click(function(){
app_views['dashboard_main'].render('communication');
});
$("#logout").click(function(e){
var data = { admin_logout:true };
$.post("core/request.php",data,function(resp){
console.log(resp);
});
app_views['main'].render('login');
});
}
function _func_login(){
// overflow: hidden;
// overflow: hidden;
$('body').css({"overflow":"hidden"});
//$('body').css({"overflow":"visible"});
$('#login-submit').click(function(e){
var username = $('#login-username').val();
var password = $('#login-password').val();
var data = {
"admin_login": true,
"username":username,
"password":password
};
$.post("core/request.php",data,function(data){
data = JSON.parse(data)
console.log(data);
if(data.status){
$("#login-status-text").html("Logging in...");
setTimeout(function(){
app_views['main'].render('dashboard');
},2000);
}else{
$("#login-status-text").html(data.message);
}
});
});
}

View File

@@ -0,0 +1,28 @@
$(document).ready(function(){
// window.app = new ApplicationContextManager({});
// window.app_views = {};
// window.app_config = {};
// var data = {'initialize_dashboard':true};
// $.post("./core/request.php",data,function(resp){
// //console.log(resp);
// app_config = JSON.parse(resp);
// console.log(app_config)
// views_createMainView();
// document.body.appendChild(app_views['main'].getHtml());
// $.post("./core/request.php",{get_all_email_accounts:true},function(resp1){
// app_config["accounts"] = JSON.parse(resp1);
// });
// setTimeout(function(){
// if(app_session=="no"){
// app_views['main'].render('login');
// }else{
// app_views['main'].render('dashboard');
// }
// },1000);
// });
});

View File

@@ -0,0 +1,181 @@
var loginTemplate = `
<form>
<!-- Email input -->
<div class="form-outline mb-4">
<input type="email" id="form2Example1" class="form-control" />
<label class="form-label" for="form2Example1">Email address</label>
</div>
<!-- Password input -->
<div class="form-outline mb-4">
<input type="password" id="form2Example2" class="form-control" />
<label class="form-label" for="form2Example2">Password</label>
</div>
<!-- 2 column grid layout for inline styling -->
<div class="row mb-4">
<div class="col d-flex justify-content-center">
<!-- Checkbox -->
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="form2Example31" checked />
<label class="form-check-label" for="form2Example31"> Remember me </label>
</div>
</div>
<div class="col">
<!-- Simple link -->
<a href="#!">Forgot password?</a>
</div>
</div>
<!-- Submit button -->
<button type="button" class="btn btn-primary btn-block mb-4">Sign in</button>
<!-- Register buttons -->
<div class="text-center">
<p>Not a member? <a href="#!">Register</a></p>
<p>or sign up with:</p>
<button type="button" class="btn btn-link btn-floating mx-1">
<i class="fab fa-facebook-f"></i>
</button>
<button type="button" class="btn btn-link btn-floating mx-1">
<i class="fab fa-google"></i>
</button>
<button type="button" class="btn btn-link btn-floating mx-1">
<i class="fab fa-twitter"></i>
</button>
<button type="button" class="btn btn-link btn-floating mx-1">
<i class="fab fa-github"></i>
</button>
</div>
</form>
`;
var loginTemplate2 = `
<div clas="container">
<div clas="row">
<div clas="col">
<section class="h-100 gradient-form" style="background-color: #eee;">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-xl-10">
<div class="card rounded-3 text-black">
<div class="row g-0">
<div class="col-lg-6">
<div class="card-body p-md-5 mx-md-4">
<div class="text-center">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/lotus.webp"
style="width: 185px;" alt="logo">
<h4 class="mt-1 mb-5 pb-1">We are The Lotus Team</h4>
</div>
<form>
<p>Please login to your account</p>
<div class="form-outline mb-4">
<input type="email" id="form2Example11" class="form-control"
placeholder="Phone number or email address" />
<label class="form-label" for="form2Example11">Username</label>
</div>
<div class="form-outline mb-4">
<input type="password" id="form2Example22" class="form-control" />
<label class="form-label" for="form2Example22">Password</label>
</div>
<div class="text-center pt-1 mb-5 pb-1">
<button class="btn btn-primary btn-block fa-lg gradient-custom-2 mb-3" type="button">Log
in</button>
<a class="text-muted" href="#!">Forgot password?</a>
</div>
<div class="d-flex align-items-center justify-content-center pb-4">
<p class="mb-0 me-2">Don't have an account?</p>
<button type="button" class="btn btn-outline-danger">Create new</button>
</div>
</form>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center gradient-custom-2">
<div class="text-white px-3 py-4 p-md-5 mx-md-4">
<h4 class="mb-4">We are more than just a company</h4>
<p class="small mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
`;
var loginTemplate3 = `
<div class="bg-secondary login-template-3">
<section class=" gradient-custom">
<div class="container">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-12 col-md-8 col-lg-6 col-xl-5">
<div class=" bg-secondary text-white" style="border-radius: 1rem;">
<div class=" p-4 text-center">
<div class="mb-md-5 mt-md-4 pb-5">
<h2 class="fw-bold mb-2 text-uppercase">Login To Administrator Dashboard</h2>
<p class="text-white-50 mb-5" id="login-status-text">Please enter your login and password!</p>
<div class="form-outline form-white mb-4">
<input type="text" id="login-username" class="form-control form-control-lg" />
<label class="form-label" for="login-username">Username</label>
</div>
<div class="form-outline form-white mb-4">
<input type="password" id="login-password" class="form-control form-control-lg" />
<label class="form-label" for="login-password">Password</label>
</div>
<!-- <p class="small mb-5 pb-lg-2"><a class="text-white-50" href="#!">Forgot password?</a></p> -->
<button class="btn btn-outline-light btn-lg px-5" id="login-submit" type="submit">Login</button>
<div class="d-flex justify-content-center text-center mt-4 pt-1">
<a href="#!" class="text-white"><i class="fab fa-facebook-f fa-lg"></i></a>
<a href="#!" class="text-white"><i class="fab fa-twitter fa-lg mx-4 px-2"></i></a>
<a href="#!" class="text-white"><i class="fab fa-google fa-lg"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
`;
var emailTemplate = ``;

View File

@@ -0,0 +1,134 @@
// Main View
function views_createMainView(){
var view = app.factory.view();
app_views['main'] = view;
view.newSubView({
id: "default",
init: true,
body: app.factory.container({
body: "<div></div>",
listener: function(){}
})
});
view.newSubView({
id: "login",
init: false,
body: app.factory.container({
body: loginTemplate3,
listener: function(){ func_login(app,view); }
})
});
view.newSubView({
id: "dashboard",
init: false,
body: app.factory.container({
body: TemplateDashboard,
listener: function(){
func_dashboardListener();
}
})
});
}
// main - event-attached:func_dashboardListener()
function views_dashboardContentView(){
var view = app.factory.view();
app_views['dashboard_main'] = view;
view.newSubView({
id: "default",
init: true,
body: app.factory.container({
body: TemplateDashboardDefault,
listener: function(){ func_dashboardDefaultViewListener(); }
})
});
view.newSubView({
id: "email",
init: false,
body: views_emailView()
});
view.newSubView({
id: "webbuilder",
init: false,
body: views_webbuilderView()
});
view.newSubView({
id: "communication",
init: false,
body: views_communicationView()
});
return view;
}
// email
function views_emailView(){
var view = app.factory.view();
app_views['dashboard_email'] = view;
view.newSubView({
id: "create",
init: true,
body: app.factory.container({
body: TemplateEmailCreateNewEmail,
listener: function(){ func_emailCreateListener(); }
})
});
view.newSubView({
id: "create-success",
init: false,
body: app.factory.container({
body: TemplateEmailCreateNewEmail,
listener: function(){ func_emailSuccessListener(); }
})
});
view.newSubView({
id: "manage",
init: false,
body: app.factory.container({
body: TemplateEmailManageEmail,
listener: function(){ func_emailManageListener(); }
})
});
var container = app.factory.container({
body: TemplateEmail,
listener: function(){ func_emailListener(); }
});
return container;
}
// web builder
function views_webbuilderView(){
var view = app.factory.view();
app_views['dashboard_webbuilder'] = view;
view.newSubView({
id: "default",
init: true,
body: app.factory.container({
body: TemplateWebBuilder,
listener: function(){ func_webbuilderListener(); }
})
});
return view;
}
// communication
function views_communicationView(){
var view = app.factory.view();
app_views['dashboard_communication'] = view;
view.newSubView({
id: "default",
init: true,
body: app.factory.container({
body: TemplateCommunication,
listener: function(){ func_communicationListener(); }
})
});
return view;
}

View File

@@ -0,0 +1,707 @@
function updateMessage(msg){
//document.getElementById("form_submit_status_1").innerHTML = "<span>"+msg+"</span>";
const collection = document.getElementsByClassName("form_submit_status_1");
for (let i = 0; i < collection.length; i++) {
collection[i].innerHTML = "<span>"+msg+"</span>";
}
}
// called in functions.js
function comp_createEmailAddressForm(){
//console.log(app_config);
var form = app.factory.form();
var visualGraph = {
"section_one": { // Category Selection
"section_two": null, // Public Category
"section_three": { // State Selection
"section_four": null, // Public Category
"section_five": { // Type Selection
"section_seven": null, // Admin Defined | Create Email Invitation
"section_eight": null // User Defined
}
}
}
};
app.static.buildFormGraph(visualGraph,form_data,form);
form.onSubmit({
//id: "",
label: "Submit",
style: "width: 100%;",
className: "",// "btn btn-success",
},function(obj){
console.log(obj);
app.overlay(true,9000);
var values = getValues(obj);
console.log(values);
//console.log(form.getSection());
//return; // mmmm
form.disableOnSubmit(true);
setTimeout(function(){ form.disableOnSubmit(false); }, 8000);
if(form.getSection()=="section_two"){
values['state'] = 1;
values['verified'] = 1; // means an actual email account will be created
if(values.username==null){
updateMessage("Username is Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
if(values.password==null){
updateMessage("Password is Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
}else if(form.getSection()=="section_seven"){
values['state'] = 0;
values['verified'] = 0; // means an invitation is being sent and the actual email account has NOT been created yet.
if(values.username==null){
updateMessage("Username is Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
if(values.sender==""){
updateMessage("Sender Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
if(values.backupEmail==""){
updateMessage("Recipient email is required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
}else if(form.getSection()=="section_eight"){
// ssss
values['state'] = 0;
values['verified'] = 0; // means an invitation is being sent and the actual email account has NOT been created yet.
if(values.backupEmail==""){
updateMessage("Recipient email is required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
if(values.sender==""){
updateMessage("Sender Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
}else{
values['state'] = 1;
values['verified'] = 1; // means an actual email account will be created
if(values.username==null || values.password==null){
updateMessage("Username and Password Required!");
form.disableOnSubmit(false);
app.overlay(false);
return;
}
}
var checkData = { check_username: true, username: values.username };
$.post("./core/request.php",checkData,function(resp){
//console.log(resp)
resp = JSON.parse(resp);
if(resp['available'] == true){
//document.getElementById("").innerHTML = "";
updateMessage("");
form.disableOnSubmit(false);
// TODO: make sure required format is being followed to create an email
values['token'] = "";
values['userid'] = values['username'];
values['server'] = app_config['server'];
var data = {
"create_email_account": true,
"state": values["state"],
data: JSON.stringify(values)
}
$.post("./core/request.php", data, function(resp1){
console.log(resp1)
//resp1 = JSON.parse(resp1);// "{\"status\":\"success\"}"
app.overlay(false);
window.app_creationData = values;
app_views["dashboard_email"].render("create-success");
});
}else{
app.overlay(false);
//document.getElementById("").innerHTML = "<span>Username already taken!</span>";
updateMessage("Username already taken!");
}
});
});
form.build();
var layout = app.layout.newLayout()
.row()
.col({md:6,offset_md:3},form)
.build();
return layout;
}
function getValues(obj){
// pppp
// # $1 username
// # $2 password
// # $3 domain
// # $4 level
// # $5 type
// # $6 category
// # $7 backupEmail
// # $8 firstname
// # $9 lastname
// # $10 expiry
// # $11 state
// # $12 sender
var username = dosomemore("username",obj);
var password = dosomemore("password",obj);
var domain = dosomemore("domain",obj);
var level = dosomemore("level",obj);
var type = dosomemore("type",obj);
var category = dosomemore("category",obj);
var backupEmail = dosomemore("backupEmail",obj);
var firstname = dosomemore("firstname",obj);
var lastname = dosomemore("lastname",obj);
var expiry = dosomemore("expiry",obj);
var sender = dosomemore("sender",obj);
var state = obj.state;
if(domain==null || domain==undefined){ domain = app_config.domain; }
if(level==null || level==undefined){ level = 0; }
if(type==null || type==undefined){ type = 0; }
if(category==null || category==undefined){ category = 0; }
if(backupEmail==null || backupEmail==undefined){ backupEmail = "_none_"; }
if(firstname==null || firstname==undefined){ firstname = "_none_"; }
if(lastname==null || lastname==undefined){ lastname = "_none_"; }
if(expiry==null || expiry==undefined){ expiry = "72"; }
return {username,password,domain,level,type,category,backupEmail,firstname,lastname,expiry,state,sender};
}
function dosomemore(param,obj){
var n = null;
for(prop in obj.values){
// ssss
if(prop.includes(param) && (obj.values[prop]!="_none_" && obj.values[prop]!=null && obj.values[prop]!="")){
n = obj.values[prop];
break;
}
}
return n;
}
var form_data = {
section_zero: {
addElements: function(form){},
addEndSection: function(formSection,form){}
},
section_one: {
addConnections: {
"back":{
label: "Back"
},
"section_two": {
label: 'Private Category',
className: "section_one_btn btn btn-dark",
// hhhh
listener: function(e){
form.setElementValue("category", 0);
formSection.goTo("section_three");
}
},
"section_three": {
label: 'Public Category ',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("category", 1);
form.setElementValue("state", 1);
formSection.goTo("section_two");
}
}
},
addElements: function(form){
form.addCustom({
tag:"category",
body: "<p>Select an email category</p>"
+ "<ul><li>Public: A general purpose email.</li>"
+ "<li>Private: A user specific email.</li></ul>"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.setButtons([
// nnnn
formSection.button({
label: 'Private Category',
className: "section_one_btn btn btn-dark",
// hhhh
listener: function(e){
form.setElementValue("category", 0);
formSection.goTo("section_three");
}
}),
formSection.button({
label: 'Public Category ',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("category", 1);
form.setElementValue("state", 1);
formSection.goTo("section_two");
}
})
]);
//formSection.backBtn = true;
//formSection.nextBtn = true;
return formSection;
},
},
section_two: { // Public Category
addElements: function(form){
form.addCustom({
//tag:"section_two_234809",
body: "<h3>Create an Administrator email</h3>"
+ "<p>These emails are typically meant for general purpose use by admins.</p>"
});
form.addInput({
label: 'Email Username',
tag: "username_04534546",
type: "text",
span: {label:"@" + app_config.domain}
});
form.addInput({
label: 'Password',
tag: "password_80934563",
type: "text"
});
// form.addInput({
// label: 'First name',
// tag: "firstname_2930842",
// type: "text"
// });
// form.addInput({
// label: 'Last name',
// tag: "lastname_8009244",
// type: "text"
// });
// form.addInput({
// label: 'Backup Email',
// tag: "backupEmail_9080982",
// type: "text"
// });
// form.addInput({
// label: 'Level - To further categorize email accounts, default is 0.',
// tag: "level_908234",
// type: "number"
// });
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.submit = true;
formSection.setButtons([
formSection.button({
label: 'Back To Category Selection',
listener: function(e){
formSection.goTo("section_one");
}
}),
]);
return formSection;
}
},
section_three: { // State Selection
addElements: function(form){
form.addCustom({
tag:"create_type",
body: "<p>How do you want to create email account?</p>"
+ "<ul>"
+ "<li>Self Setup: Create email account yourself.</li>"
+ "<li>Invitation: Send an invite for user to setup email account.</li>"
+ "</ul>"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.setButtons([
formSection.button({
label: 'Self Setup',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("create_type", 0);
form.setElementValue("state", 1);
formSection.goTo("section_four");
}
}),
formSection.button({
label: 'Invitation',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("create_type", 1);
formSection.goTo("section_five");
}
}),
formSection.button({
label: 'Back',
className: "section_one_btn btn btn-dark",
listener: function(e){
formSection.goTo("section_one");
}
})
]);
return formSection;
}
},
section_four: { // Private Category - Self Setup
addElements: function(form){
form.addCustom({
//tag:"admin_create_fields",
body: "<p>Fill out form fields</p>"
+ "<div class=\"form_submit_status_1\"></div>"
});
form.addInput({
label: 'Email Username*',
tag: "username_092423",
type: "text",
span: {label:"@" + app_config.domain}
});
form.addInput({
label: 'Password*',
tag: "password_8092384",
type: "text"
});
form.addInput({
label: 'First name',
tag: "firstname_2930842",
type: "text"
});
form.addInput({
label: 'Last name',
tag: "lastname_8009244",
type: "text"
});
form.addInput({
label: 'Backup Email',
tag: "backupEmail_9080982",
type: "text"
});
form.addInput({
label: 'Level - To further categorize email accounts, default is 0.',
tag: "level_908234",
type: "number"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.submit = {"_id":2,"label":"Create Email Account"};
formSection.setButtons([
formSection.button({
label: 'Back',
listener: function(e){
formSection.goTo("section_three");
}
}),
]);
return formSection;
}
},
section_five: {// Type Selection
addElements: function(form){
form.addCustom({
//tag:"admin_create",
body: "<p>Choose how the email will be created.</p>"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.setButtons([
formSection.button({
label: 'Admin Defined Email',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("type_8409238", 0);
form.setElementValue("state", 0);
formSection.goTo("section_seven");
}
}),
formSection.button({
label: 'User Defined Email',
className: "section_one_btn btn btn-dark",
listener: function(e){
form.setElementValue("type_8409238", 1);
form.setElementValue("state", 0);
formSection.goTo("section_eight");
}
}),
formSection.button({
label: 'Back',
className: "section_one_btn btn btn-dark",
style: "margin-bottom:10px",
listener: function(e){
formSection.goTo("section_three");
}
})
]);
return formSection;
}
},
section_six: {
addElements: function(form){
form.addCustom({
//tag:"creation_type323",
body: "<p>Choose which type of user email</p>"
});
// mmmm
form.addInput({
label: 'Username',
tag: "username_3289892"
});
form.addInput({
label: 'Email',
tag: "email_2834908"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.setButtons([
formSection.button({
label: 'Back',
listener: function(e){
formSection.goTo("section_one");
}
})
]);
return formSection;
}
},
section_seven: { // Admin Defined
addElements: function(form){
var list = [];
list.push("");
for(var i=0; i < app_config.accounts.length; i++){
var category = app_config.accounts[i]['verified']['category'];
if(category==1){
list.push(app_config.accounts[i]['verified']['username']);
}
}
form.addCustom({
//tag:"admin_create_fields",
body: "<h4>Create Email Invitation</h4>"
+ "<div class=\"form_submit_status_1\"></div>"
});
form.addInput({
label: 'Email Username*',
tag: "username_093456",
type: "text",
span: {label:"@" + app_config.domain}
});
form.addInput({
label: 'Recipient Email*',
tag: "backupEmail_019543854",
type: "text"
});
// ssss
form.addSelection({
tag: 'sender_08230948',
label: "Select Sender*",
//id:"",
//classes: "",
defaultSelection: "",
//paramName: "sender_08230948",//String name of the param for value on submit other wise the id of this element
list: list,
// mmmm
// Fire method every time element changes.
changeListener: function(seletedItem, event){
//console.log(seletedItem);
}
});
form.addInput({
label: 'First name',
tag: "firstname_3980934",
type: "text"
});
form.addInput({
label: 'Last name',
tag: "lastname_553453",
type: "text"
});
form.addInput({
label: 'Level - To further categorize email accounts, default is 0.',
tag: "level_4380194423",
type: "number"
});
form.addInput({
label: 'Expiry - When this invite is no longer valid. Default is 72 hours.',
tag: "expiry_03498589",
type: "number"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.submit = {label:"Send Invitation"};
formSection.setButtons([
formSection.button({
label: 'Back',
listener: function(e){
formSection.goTo("section_five");
}
})
]);
return formSection;
}
},
section_eight: {
addElements: function(form){
form.addCustom({
tag:"type_8409238",
body: "<h4>User Defined - Create Email Invitation</h4>"
+ "<div class=\"form_submit_status_1\"></div>"
});
// form.addInput({
// label: 'Email*',
// tag: "username_093456",
// type: "text",
// span: {label:"@" + app_config.domain}
// });
form.addInput({
label: 'Recipient Email*',
tag: "backupEmail_01954345456",
type: "text"
});
var list = [];
list.push("");
for(var i=0; i < app_config.accounts.length; i++){
var category = app_config.accounts[i]['verified']['category'];
if(category==1){
list.push(app_config.accounts[i]['verified']['username']);
}
}
form.addSelection({
tag: 'sender_0833456403845',
label: "Select Sender *",
//id:"",
//classes: "",
defaultSelection: "",
//paramName: "sender_08230948",//String name of the param for value on submit other wise the id of this element
list: list,
// mmmm
// Fire method every time element changes.
changeListener: function(seletedItem, event){
//console.log(seletedItem);
}
});
form.addInput({
label: 'Level - To further categorize email accounts, default is 0.',
tag: "level_4380194234",
type: "number"
});
form.addInput({
label: 'Expiry - When this invite is no longer valid. Default is 72 hours.',
tag: "expiry_0349345",
type: "number"
});
return form;
},
addEndSection: function(formSection,form){
formSection.type = 'page';
formSection.submit = {"label":"Send Invitation"};
formSection.setButtons([
formSection.button({
label: 'Back',
listener: function(e){
formSection.goTo("section_five");
}
})
]);
return formSection;
}
},
};
function comp_CreateNewEmail(){
var form = app.factory.form('form_one');
// Input
form.addInput({
//all: "myinput",
tag: "myinput",
selector: '#myinput',
paramName: 'myinput',
// layout the form elements in bootstrap4
// specifing row starts a new row
layout: {
row: true,
col: {md:12}
},
});
form.onSubmit({
//id: "",
label: "Submit",
style: "width: 100%;",
className: "btn btn-success",
return: 'array'
},function(obj){
console.log(obj);
// type
// backup
// address
// password
// domain
});
form.build();
return form;
}

View File

@@ -0,0 +1,8 @@
define(['dashboard/js/dashboard'],function (dashboard_context) {
setTimeout(() => {
// console.log(dashboard_context);
},5000);
});// end of define