This commit is contained in:
Ashwin 2018-08-22 20:43:34 +05:30
parent a4aee4f06c
commit a87f747a83
4 changed files with 458 additions and 471 deletions

View file

@ -1,6 +1,6 @@
$("#comment_form").submit(function (e) {
e.preventDefault()
e.preventDefault();
var formData = new FormData($("#comment_form")[0]);
$.ajax({
url: "/cases/comment/add/",
@ -23,10 +23,10 @@ $("#comment_form").submit(function (e) {
"<li><a class='action' onclick='remove_comment(" + data.comment_id + ")''>Remove</a></li></ul></div></div>" +
"<div class='stream-post-container' id='comment_name"+data.comment_id+"'><pre>"+data.comment+"</pre></div>"+
"<div class='stream-container'><pre class='float-left'>"+data.commented_by+"</pre><pre class='float-right'>"+d.toGMTString()+"</pre></div>"
)
$("#id_comments").val("")
alert("Comment Submitted")
$("#CommentError").html('')
);
$("#id_comments").val("");
alert("Comment Submitted");
$("#CommentError").html('');
}
}
})
@ -35,13 +35,13 @@ $("#comment_form").submit(function (e) {
function edit_comment(x) {
$('#Comments_Cases_Modal').modal('show');
comment = $("#comment_name" + x).text()
$("#commentid").val(x)
$("#id_editcomment").val(comment)
comment = $("#comment_name" + x).text();
$("#commentid").val(x);
$("#id_editcomment").val(comment);
}
$("#comment_edit").click(function (e) {
e.preventDefault()
e.preventDefault();
var formData = new FormData($("#comment_edit_form")[0]);
$.ajax({
url: "/cases/comment/edit/",
@ -52,32 +52,32 @@ $("#comment_edit").click(function (e) {
processData: false,
success: function (data) {
if (data.error) {
$("#CommentEditError").html(data.error).show()
$("#CommentEditError").html(data.error).show();
} else {
$("#comment_name" + data.comment_id).html('<pre>' + data.comment + '</pre>')
$("#comment_name" + data.comment_id).html('<pre>' + data.comment + '</pre>');
$('#Comments_Cases_Modal').modal('hide');
$("#id_editcomment").val("")
$("#CommentEditError").html('')
$("#id_editcomment").val("");
$("#CommentEditError").html('');
}
}
})
})
});
});
function HideError(e) {
$("#CommentError").hide()
$("#CommentError").hide();
}
function remove_comment(x) {
var con = confirm("Do you want to Delete it for Sure!?")
var con = confirm("Do you want to Delete it for Sure!?");
if (con == true) {
$.post('/cases/comment/remove/', {
"comment_id": x
}, function (data) {
if (data.error) {
alert(data.error)
alert(data.error);
} else {
$("#comment" + data.cid).remove()
$("#comment" + data.cid).remove();
}
})
}

View file

@ -1,4 +1,4 @@
$('body').on('click', '#home', function (e) {
$("body").on("click", "#home", function (e) {
e.preventDefault();
window.location = '/';
});

View file

@ -1,427 +1,424 @@
$('body').on('click', '.setstatus', function (e) {
$("body").on("click", ".setstatus", function (e) {
e.preventDefault();
eventID = $(this).closest("tr")[0].id
event = eventID.match(/\d+/)[0]
status = $(this).text().replace('Set ', '')
eventID = $(this).closest("tr")[0].id;
event = eventID.match(/\d+/)[0];
status = $(this).text().replace("Set ", "");
$.post(
'/planner/event/set/status/',
"/planner/event/set/status/",
{id: event, status: status},
function (data, status, xhr) {
if (status == 'success') {
if (data['success'] == 'Event Updated') {
$('#' + eventID.match(/\D+/)[0] + data["id"] + 'status').fadeOut(function () {
if (status == "success") {
if (data["success"] == "Event Updated") {
$("#" + eventID.match(/\D+/)[0] + data["id"] + "status").fadeOut(function () {
$(this).text(data["status"]);
}).fadeIn();
}
else if (data['AUTH'] == 'NO') {
window.location = '/accounts/login/';
else if (data["AUTH"] == "NO") {
window.location = "/accounts/login/";
//login REDIRECT URL
}
else if (data['INVALID'] == 'METHOD') {
window.location = '/logout/'
else if (data["INVALID"] == "METHOD") {
window.location = "/logout/";
}
else if (data['METHOD'] == 'INVALID') {
window.location = '/logout/'
else if (data["METHOD"] == "INVALID") {
window.location = "/logout/";
}
else {
if (data['Event'] != 'DoesNotExist') {
window.location = '/logout/'
if (data["Event"] != "DoesNotExist") {
window.location = "/logout/";
}
}
}
else if (status == 'error') {
else if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
window.location = "/";
}
}
else {
console.log(status)
console.log(status);
}
});
});
$('body').on('click', '#selectparent', function (e) {
e.preventDefault()
$('#selectparentmodel').modal("show");
$('#selectparentmodel').find('.modal-title').text('Select ' + $('#parent_type').val())
if ($('#parent_type').val() == 'Account') {
gURL = '/accounts/get/list/'
$("body").on("click", "#selectparent", function (e) {
e.preventDefault();
$("#selectparentmodel").modal("show");
$("#selectparentmodel").find(".modal-title").text("Select " + $("#parent_type").val());
if ($("#parent_type").val() == "Account") {
gURL = "/accounts/get/list/";
}
if ($('#parent_type').val() == 'Contact') {
gURL = '/contacts/get/list/'
if ($("#parent_type").val() == "Contact") {
gURL = "/contacts/get/list/";
}
else if ($('#parent_type').val() == 'Lead') {
gURL = '/leads/get/list/'
else if ($("#parent_type").val() == "Lead") {
gURL = "/leads/get/list/";
}
else if ($('#parent_type').val() == 'Opportunity') {
gURL = '/opportunities/get/list/'
else if ($("#parent_type").val() == "Opportunity") {
gURL = "/opportunities/get/list/";
}
else if ($('#parent_type').val() == 'Case') {
gURL = '/cases/get/list/'
else if ($("#parent_type").val() == "Case") {
gURL = "/cases/get/list/";
}
$.get(
gURL,
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#selectcontact-modal-body").html(data)
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#selectcontact-modal-body").html(data);
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
$('body').on('click', '.parentname', function (e) {
e.preventDefault()
console.log($(this))
$("body").on("click", ".parentname", function (e) {
e.preventDefault();
console.log($(this));
$('.parent_id').val($(this).attr('id'))
$('.parent_name').val($(this).text().trim())
$('#selectparentmodel').modal("hide");
$(".parent_id").val($(this).attr("id"));
$(".parent_name").val($(this).text().trim());
$("#selectparentmodel").modal("hide");
});
$('body').on('click', '#closeselectparentmodel', function (e) {
e.preventDefault()
$('#selectparentmodel').modal("hide");
$('.parent_name').val('')
$('.parent_id').val('')
$("body").on("click", "#closeselectparentmodel", function (e) {
e.preventDefault();
$("#selectparentmodel").modal("hide");
$(".parent_name").val("");
$(".parent_id").val("");
});
$('body').on('click', '#clearparent', function (e) {
e.preventDefault()
console.log($(this))
$(this).parent().parent().id
$('.parent_name').val('')
$('.parent_id').val('')
$("body").on("click", "#clearparent", function (e) {
e.preventDefault();
console.log($(this));
$(this).parent().parent().id;
$(".parent_name").val("");
$(".parent_id").val("");
});
$("body").on("click", '.glyphicon-trash', function (e) {
$("body").on("click", ".glyphicon-trash", function (e) {
if ($($(this).siblings()[2]).prop("checked") == false) {
$($(this).siblings()[2]).prop('checked', true)
$(this).css({'color': 'red'})
$($(this).siblings()[0]).attr('disabled', '')
$($(this).siblings()[1]).attr('disabled', '')
$($(this).siblings()[2]).prop("checked", true);
$(this).css({"color": "red"});
$($(this).siblings()[0]).attr("disabled", "");
$($(this).siblings()[1]).attr("disabled", "");
}
else {
$($(this).siblings()[2]).prop('checked', false)
$($(this).siblings()[0]).removeAttr('disabled', '')
$($(this).siblings()[1]).removeAttr('disabled', '')
$(this).removeAttr('style')
$($(this).siblings()[2]).prop("checked", false);
$($(this).siblings()[0]).removeAttr("disabled", "");
$($(this).siblings()[1]).removeAttr("disabled", "");
$(this).removeAttr("style");
}
})
$('body').on('click', '.pagination li a', function (e) {
$("body").on("click", ".pagination li a", function (e) {
e.preventDefault();
URL = window.location.pathname + $(this).context.search
$('.for-pagination').animate({width: '20px'})
URL = window.location.pathname + $(this).context.search;
$(".for-pagination").animate({width: "20px"});
$.get(
URL,
function (data, status, xhr) {
if (status == 'success') {
$('.for-pagination').html(data).animate({width: '100%'})
if (status == "success") {
$(".for-pagination").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('.for-pagination').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$(".for-pagination").html("Something Went Wrong Try Again Later...");
}
});
});
/////////////////////SELECT ATTENDEE USERS//////////////////////////////////////////////////
$('body').on('click', '#selectusers', function (e) {
e.preventDefault()
$('#selectusersmodel').modal("show");
$("body").on("click", "#selectusers", function (e) {
e.preventDefault();
$("#selectusersmodel").modal("show");
$.get(
'/planner/get/users/',
"/planner/get/users/",
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#selectusers-modal-body").html(data)
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#selectusers-modal-body").html(data);
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
$('body').on('click', '#clearuser', function (e) {
e.preventDefault()
$('.attendees-users-user_name').val('')
$('.assigned_users').val('')
$("body").on("click", "#clearuser", function (e) {
e.preventDefault();
$(".attendees-users-user_name").val("");
$(".assigned_users").val("");
});
$('body').on('click', '#selectusers-modal-body .paginate-me-users', function (e) {
$("body").on("click", "#selectusers-modal-body .paginate-me-users", function (e) {
e.preventDefault();
$('#selectusers-modal-body').animate({width: '20px'})
$("#selectusers-modal-body").animate({width: "20px"});
$.get(
'/planner/get/users/' + $(this).context.search,
"/planner/get/users/" + $(this).context.search,
function (data, status, xhr) {
if (status == 'success') {
$('#selectusers-modal-body').html(data).animate({width: '100%'})
if (status == "success") {
$("#selectusers-modal-body").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('.for-pagination').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$(".for-pagination").html("Something Went Wrong Try Again Later...");
}
});
});
var $uids = {}
$('body').on('click', '#selectusers-modal-body .checkuser', function (e) {
$("body").on("click", "#selectusers-modal-body .checkuser", function (e) {
// console.log($(this).prop("checked") == true)
if ($(this).prop("checked") == true) {
if (!($(this).val() in $uids))
$uids[$(this).val()] = $(this).parent().next().text().trim()
$uids[$(this).val()] = $(this).parent().next().text().trim();
}
else {
delete $uids[$(this).val()]
delete $uids[$(this).val()];
}
// console.log($uids)
})
$('body').on('click', '#closeselectusersmodel', function (e) {
console.log($uids)
if ($('.selectedusers').length < 1) {
$('.attendees-users-user_name').parent().after('<div class="selectedusers"></div>')
$('.selectedusers').html('')
$("body").on("click", "#closeselectusersmodel", function (e) {
if ($(".selectedusers").length < 1) {
$(".attendees-users-user_name").parent().after("<div class="selectedusers"></div>");
$(".selectedusers").html("");
}
$('.selectedusers').html('')
// $('.attendees-users-user_name').parent().after('<div class="selectedusers"></div>')
$(".selectedusers").html("");
// $(".attendees-users-user_name").parent().after("<div class="selectedusers"></div>")
for (a in $uids) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_user" type="hidden" name="attendees_user" value="' + a + '"/>'
str = '<div class="input-group"><input placeholder="user" readonly value="' + $uids[a] + '" name="attendees_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthisuser"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selectedusers').append(str)
strr = '<input id="attendees_user" type="hidden" name="attendees_user" value="' + a + '"/>';
str = '<div class="input-group"><input placeholder="user" readonly value="' + $uids[a] + '" name="attendees_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthisuser"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selectedusers").append(str);
}
}
})
$('body').on('click', '.clearthisuser', function (e) {
e.preventDefault()
$(this).closest('.input-group').remove()
delete $uids[$(this).parent().next().val()]
$("body").on("click", ".clearthisuser", function (e) {
e.preventDefault();
$(this).closest(".input-group").remove();
delete $uids[$(this).parent().next().val()];
// console.log($uids)
})
//CONTACTS START //////////////////////////////////////////////////////////////
$('body').on('click', '#select-attendee-contacts', function (e) {
e.preventDefault()
$('#select-contacts-model').modal("show");
$("body").on("click", "#select-attendee-contacts", function (e) {
e.preventDefault();
$("#select-contacts-model").modal("show");
$.get(
'/planner/get/contacts/',
"/planner/get/contacts/",
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#select-contacts-modal-body").html(data)
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#select-contacts-modal-body").html(data);
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
// $('body').on('click', '.username', function (e) {
// $("body").on("click", ".username", function (e) {
// e.preventDefault()
// console.log($(this))
// $('#assigned_users').val($(this).attr('id'))
// $('#user_name').val($(this).text())
// $('#selectusersmodel').modal("hide");
// $("#assigned_users").val($(this).attr("id"))
// $("#user_name").val($(this).text())
// $("#selectusersmodel").modal("hide");
// });
// $('body').on('click', '#clearcontacts', function (e) {
// $("body").on("click", "#clearcontacts", function (e) {
// e.preventDefault()
// $('#attendees_contacts').val('')
// $("#attendees_contacts").val(")
// });
$('body').on('click', '.paginate-me-contacts', function (e) {
$("body").on("click", ".paginate-me-contacts", function (e) {
e.preventDefault();
$('#attendees_contacts-modal-body').animate({width: '20px'})
$("#attendees_contacts-modal-body").animate({width: "20px"});
$.get(
'/planner/get/contacts/' + $(this).context.search,
"/planner/get/contacts/" + $(this).context.search,
function (data, status, xhr) {
if (status == 'success') {
$('#attendees_contacts-modal-body').html(data).animate({width: '100%'})
if (status == "success") {
$("#attendees_contacts-modal-body").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('.for-pagination-contacts').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$(".for-pagination-contacts").html("Something Went Wrong Try Again Later...");
}
});
});
var $cids = {}
$('body').on('click', '.checkcontact', function (e) {
$("body").on("click", ".checkcontact", function (e) {
// console.log($(this).prop("checked") == true)
if ($(this).prop("checked") == true) {
if (!($(this).val() in $cids))
$cids[$(this).val()] = $(this).parent().next().text().trim()
if (!($(this).val() in $cids));
$cids[$(this).val()] = $(this).parent().next().text().trim();
}
else {
delete $cids[$(this).val()]
delete $cids[$(this).val()];
}
// console.log($cids)
})
$('body').on('click', '#close-attendees-contacts-model', function (e) {
$("body").on("click", "#close-attendees-contacts-model", function (e) {
// console.log($cids)
$('.selectedcontacts').html('')
$(".selectedcontacts").html("");
// $('#contact_name').parent().after('<div class="selectedcontacts"></div>')
for (a in $cids) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_contacts" type="hidden" name="attendees_contacts" value="' + a + '"/>'
str = '<div class="input-group"><input placeholder="Contacts" readonly value="' + $cids[a] + '" name="attendees_contactname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthiscontact"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selectedcontacts').append(str)
strr = '<input id="attendees_contacts" type="hidden" name="attendees_contacts" value="' + a + '"/>';
str = '<div class="input-group"><input placeholder="Contacts" readonly value="' + $cids[a] + '" name="attendees_contactname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthiscontact"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selectedcontacts").append(str);
}
}
})
$('body').on('click', '.clearthiscontact', function (e) {
e.preventDefault()
$(this).closest('.input-group').remove()
delete $cids[$(this).parent().next().val()]
$("body").on("click", ".clearthiscontact", function (e) {
e.preventDefault();
$(this).closest(".input-group").remove();
delete $cids[$(this).parent().next().val()];
// console.log($cids)
})
//LEADS START //////////////////////////////////////////////////////////////
$('body').on('click', '#select-attendee-leads', function (e) {
e.preventDefault()
$('#select-leads-model').modal("show");
$("body").on("click", "#select-attendee-leads", function (e) {
e.preventDefault();
$("#select-leads-model").modal("show");
$.get(
'/planner/get/leads/',
"/planner/get/leads/",
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#select-leads-modal-body").html(data)
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#select-leads-modal-body").html(data);
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
// $('body').on('click', '#assigned-user-modal-body .username', function (e) {
// $("body").on("click", "#assigned-user-modal-body .username", function (e) {
// e.preventDefault()
// console.log($(this))
// $('#assigned_users').val($(this).attr('id'))
// $('#user_name').val($(this).text())
// $('#select-assigned-user-model').modal("hide");
// $("#assigned_users").val($(this).attr("id"))
// $("#user_name").val($(this).text())
// $("#select-assigned-user-model").modal("hide");
// });
// $('body').on('click', '#clearcontacts', function (e) {
// $("body").on("click", "#clearcontacts", function (e) {
// e.preventDefault()
// $('#attendees_contacts').val('')
// $("#attendees_contacts").val(")
// });
$('body').on('click', '.paginate-me-leads', function (e) {
$("body").on("click", ".paginate-me-leads", function (e) {
e.preventDefault();
$('#attendees_leads-modal-body').animate({width: '20px'})
$("#attendees_leads-modal-body").animate({width: "20px"});
$.get(
'/planner/get/leads/' + $(this).context.search,
"/planner/get/leads/" + $(this).context.search,
function (data, status, xhr) {
if (status == 'success') {
$('#attendees_leads-modal-body').html(data).animate({width: '100%'})
if (status == "success") {
$("#attendees_leads-modal-body").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('.for-pagination-contacts').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$(".for-pagination-contacts").html("Something Went Wrong Try Again Later...");
}
});
});
var $lids = {}
$('body').on('click', '.checklead', function (e) {
var $lids = {};
$("body").on("click", ".checklead", function (e) {
// console.log($(this).prop("checked") == true)
if ($(this).prop("checked") == true) {
if (!($(this).val() in $lids))
$lids[$(this).val()] = $(this).parent().next().text().trim()
$lids[$(this).val()] = $(this).parent().next().text().trim();
}
else {
delete $lids[$(this).val()]
delete $lids[$(this).val()];
}
// console.log($lids)
})
$('body').on('click', '#close-attendees-leads-model', function (e) {
$("body").on("click", "#close-attendees-leads-model", function (e) {
// console.log($lids)
$('#selectedleads').html('')
$('#leads_name').parent().after('<div id="selectedleads"></div>')
$("#selectedleads").html("");
$("#leads_name").parent().after("<div id="selectedleads"></div>");
for (a in $lids) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_leads" type="hidden" name="attendees_leads" value="' + a + '"/>'
str = '<div class="input-group"><input placeholder="Leads" readonly value="' + $lids[a] + '" name="attendees_leadname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthislead"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('#selectedleads').append(str)
strr = '<input id="attendees_leads" type="hidden" name="attendees_leads" value="' + a + '"/>';
str = '<div class="input-group"><input placeholder="Leads" readonly value="' + $lids[a] + '" name="attendees_leadname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthislead"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$("#selectedleads").append(str);
}
}
})
$('body').on('click', '.clearthislead', function (e) {
e.preventDefault()
$(this).closest('.input-group').remove()
delete $lids[$(this).parent().next().val()]
$("body").on("click", ".clearthislead", function (e) {
e.preventDefault();
$(this).closest(".input-group").remove();
delete $lids[$(this).parent().next().val()];
// console.log($lids)
})
/////////////////////SELECT ASSIGNED USERS//////////////////////////////////////////////////
$('body').on('click', '#assign-user', function (e) {
e.preventDefault()
$('#select-assigned-user-model').modal("show");
$("body").on("click", "#assign-user", function (e) {
e.preventDefault();
$("#select-assigned-user-model").modal("show");
$.get(
'/planner/get/users/',
"/planner/get/users/",
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#assigned-user-modal-body").html(data)
$('#assigned-user-modal-body .checkuser').remove()
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#assigned-user-modal-body").html(data);
$("#assigned-user-modal-body .checkuser").remove();
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
}
}
else {
@ -430,217 +427,207 @@ $('body').on('click', '#assign-user', function (e) {
});
});
// $('body').on('click', '#clearassigneduser', function (e) {
// e.preventDefault()
// $('#assigned_users').val('')
// $('#selected-assigned-users').val('')
// });
$('body').on('click', '#select-assigned-user-model .cell .username', function (e) {
$("body").on("click", "#select-assigned-user-model .cell .username", function (e) {
e.preventDefault();
// console.log($(this))
// if($('#selected-assigned-users').length<1) {
// $('.assigned_users_error').before('<div id="selected-assigned-users"></div>')
$('.selected-assigned-users').html('')
// }
$('#select-assigned-user-model').modal("hide");
strr = '<input class="assigned_users" type="hidden" name="assigned_users" value="' + $(this).context.id + '"/>'
// $('#user_name').after(str)
str = '<div class="input-group"><input readonly value="' + $(this).text() + '" name="assigned_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selected-assigned-users').append(str)
$(".selected-assigned-users").html("");
$("#select-assigned-user-model").modal("hide");
strr = '<input class="assigned_users" type="hidden" name="assigned_users" value="' + $(this).context.id + '"/>';
str = '<div class="input-group"><input readonly value="' + $(this).text() + '" name="assigned_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selected-assigned-users").append(str);
})
$('body').on('click', '#close-assigned-user-model', function (e) {
$('.selected-assigned-users').html('')
$("body").on("click", "#close-assigned-user-model", function (e) {
$(".selected-assigned-users").html("");
});
$('body').on('click', '#modeldialogclosed', function (e) {
$('.selected-assigned-users').html('')
$('.selectedcontacts').html('')
$('.selectedusers').html('')
$('#selectedleads').html('')
$("body").on("click", "#modeldialogclosed", function (e) {
$(".selected-assigned-users").html("");
$(".selectedcontacts").html("");
$(".selectedusers").html("");
$("#selectedleads").html("");
});
$('body').on('click', '.clearthis-assigned-user', function (e) {
e.preventDefault()
$(this).closest('.input-group').remove()
delete $aids[$(this).parent().next().val()]
// console.log($aids)
$("body").on("click", ".clearthis-assigned-user", function (e) {
e.preventDefault();
$(this).closest(".input-group").remove();
delete $aids[$(this).parent().next().val()];
})
$('body').on('click', '#assigned-user-modal-body .paginate-me-users', function (e) {
$("body").on("click", "#assigned-user-modal-body .paginate-me-users", function (e) {
e.preventDefault();
$('#assigned-user-modal-body').animate({width: '20px'})
$("#assigned-user-modal-body").animate({width: "20px"});
$.get(
'/planner/get/users/' + $(this).context.search,
"/planner/get/users/" + $(this).context.search,
function (data, status, xhr) {
if (status == 'success') {
$('#assigned-user-modal-body').html(data).animate({width: '100%'})
if (status == "success") {
$("#assigned-user-modal-body").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('#assigned-user-modal-body .paginate-me-users').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$("#assigned-user-modal-body .paginate-me-users").html("Something Went Wrong Try Again Later...");
}
});
});
function getOtherFields(data) {
///////////////////ASSGNED USERS////////////////////////////////////////////
$('.selected-assigned-users').html('')
$('.assigned_users_error').before('<div class="selected-assigned-users"></div>')
for (a in data['assigned_users']) {
$(".selected-assigned-users").html("");
$(".assigned_users_error").before("<div class="selected-assigned-users"></div>");
for (a in data["assigned_users"]) {
if ($.isNumeric(a)) {
strr = '<input class="assigned_users" type="hidden" name="assigned_users" value="' + a + '"/>'
strr = '<input class="assigned_users" type="hidden" name="assigned_users" value="' + a + '"/>';
// $('#user_name').after(str)
str = '<div class="input-group"><input placeholder="Assign user" readonly value="' + data['assigned_users'][a] + '" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selected-assigned-users').append(str)
str = '<div class="input-group"><input placeholder="Assign user" readonly value="' + data['assigned_users'][a] + '" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selected-assigned-users").append(str);
}
}
///////////////////END ASSGNED USERS////////////////////////////////////////////
/////////////////// ATTENDEES LEADS////////////////////////////////////////////
$('#selectedleads').html('')
$('#leads_name').parent().after('<div id="selectedleads"></div>')
for (a in data['attendees_leads']) {
$("#selectedleads").html("");
$("#leads_name").parent().after("<div id="selectedleads"></div>");
for (a in data["attendees_leads"]) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_leads" type="hidden" name="attendees_leads" value="' + a + '"/>'
str = '<div class="input-group"><input placeholder="Leads" readonly value="' + data['attendees_leads'][a] + '" name="attendees_leadname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthislead"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('#selectedleads').append(str)
strr = '<input id="attendees_leads" type="hidden" name="attendees_leads" value="' + a + '"/>';
str = '<div class="input-group"><input placeholder="Leads" readonly value="' + data['attendees_leads'][a] + '" name="attendees_leadname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthislead"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$("#selectedleads").append(str);
}
}
///////////////////END ATTENDEES LEADS////////////////////////////////////////////
///////////////////ATTENDEES CONTACTA////////////////////////////////////////////
$('.selectedcontacts').html('')
// $('#contact_name').parent().after('<div class="selectedcontacts"></div>')
for (a in data['attendees_contacts']) {
$(".selectedcontacts").html("");
// $("#contact_name").parent().after("<div class="selectedcontacts"></div>")
for (a in data["attendees_contacts"]) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_contacts" type="hidden" name="attendees_contacts" value="' + a + '"/>'
str = '<div class="input-group"><input placeholder="Contacts" readonly value="' + data['attendees_contacts'][a] + '" name="attendees_contactname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthiscontact"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selectedcontacts').append(str)
strr = '<input id="attendees_contacts" type="hidden" name="attendees_contacts" value="' + a + '"/>';
str = '<div class="input-group"><input placeholder="Contacts" readonly value="' + data['attendees_contacts'][a] + '" name="attendees_contactname" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthiscontact"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selectedcontacts").append(str);
}
}
/////////////////// END ATTENDEES CONTACTA////////////////////////////////////////////
/////////////////// ATTENDEES USERS////////////////////////////////////////////
$('.selectedusers').html('')
$('.attendees-users-user_name').parent().after('<div class="selectedusers"></div>')
for (a in data['attendees_user']) {
$(".selectedusers").html("");
$(".attendees-users-user_name").parent().after("<div class="selectedusers"></div>");
for (a in data["attendees_user"]) {
if ($.isNumeric(a)) {
strr = '<input id="attendees_user" type="hidden" name="attendees_user" value="' + a + '"/>'
strr = '<input id="attendees_user" type="hidden" name="attendees_user" value="' + a + '"/>';
// $('#user_name').after(str)
str = '<div class="input-group"><input placeholder="user" readonly value="' + data['attendees_user'][a] + '" name="attendees_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthisuser"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selectedusers').append(str)
str = '<div class="input-group"><input placeholder="user" readonly value="' + data['attendees_user'][a] + '" name="attendees_username" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthisuser"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selectedusers").append(str);
}
}
/////////////////// END ATTENDEES USERS////////////////////////////////////////////
}
$('body').on('click', '.filterfield', function (e, afield) {
$("body").on("click", ".filterfield", function (e, afield) {
e.preventDefault();
$('.' + $($(this).children()[0]).context.classList[0]).toggle()
$("." + $($(this).children()[0]).context.classList[0]).toggle();
})
$('body').on('click', '.remove-this-filter', function (e) {
$("body").on("click", ".remove-this-filter", function (e) {
e.preventDefault();
// console.log($(this))
$addedFilterItem = $($(this).closest('div .input-group')[0])
$className = $addedFilterItem.context.classList[$addedFilterItem.context.classList.length - 1]
$('.' + $className).toggle()
$addedFilterItem = $($(this).closest("div .input-group")[0]);
$className = $addedFilterItem.context.classList[$addedFilterItem.context.classList.length - 1];
$("." + $className).toggle();
});
$('body').on('click', '.reset-filters', function (e) {
$("body").on("click", ".reset-filters", function (e) {
e.preventDefault();
$('.addedFilters').children().hide()
$(".addedFilters").children().hide();
$('.filter-list .filterfield a').show()
$(".filter-list .filterfield a").show();
})
$('body').on('click', '.searchmeetings', function (e) {
$("body").on("click", ".searchmeetings", function (e) {
e.preventDefault();
// console.log($('#filter-form').serialize())
// console.log($("#filter-form").serialize())
$.get(
'/planner/search/events/',
data = $('#filter-form').serialize(),
"/planner/search/events/",
data = $("#filter-form").serialize(),
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
if (data['Event'] == 'DoesNotExist') {
$('.for-pagination').html('<div class="heading text-center"> No Meetings Found </div>')
if (data["Event"] == "DoesNotExist") {
$(".for-pagination").html("<div class="heading text-center"> No Meetings Found </div>");
} else {
$('.for-pagination').html(data)
$(".for-pagination").html(data);
}
if (data['auth'] == 'NO') {
alert('Not Authenticated!!')
window.location = '/login/'
if (data["auth"] == "NO") {
alert("Not Authenticated!!");
window.location = "/login/";
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
//////////////////////////////////created user/////////////////////////////////////////////////////////////////////
$('body').on('click', '#created-user', function (e) {
e.preventDefault()
$('#select-created-user-model').modal("show");
$("body").on("click", "#created-user", function (e) {
e.preventDefault();
$("#select-created-user-model").modal("show");
$.get(
'/planner/get/users/',
"/planner/get/users/",
data = {},
function (data, status, xhr) {
if (status == 'success') {
if (status == "success") {
// console.log(data)
$("#created-user-modal-body").html(data)
$('#created-user-modal-body .checkuser').remove()
if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
$("#created-user-modal-body").html(data);
$("#created-user-modal-body .checkuser").remove();
if (data["auth"] == "NO") {
alert("Not Authanticated!!");
//login REDIRECT URL
}
}
if (status == 'error') {
if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
alert('We Regret, there is an issue!! Try again.')
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
alert("We Regret, there is an issue!! Try again.");
window.location = "/";
console.log("Something Went Wrong!!!");
}
}
else {
console.log(status)
console.log(status);
}
});
});
$('body').on('click', '#select-created-user-model .cell .username', function (e) {
$("body").on("click", "#select-created-user-model .cell .username", function (e) {
e.preventDefault();
$('.selected-created-user').html('')
$('#select-created-user-model').modal("hide");
strr = '<input class="created_user" type="hidden" name="created_user" value="' + $(this).context.id + '"/>'
str = '<div class="input-group"><input readonly value="' + $(this).text() + '" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-created-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('.selected-created-user').append(str)
$(".selected-created-user").html("");
$("#select-created-user-model").modal("hide");
strr = '<input class="created_user" type="hidden" name="created_user" value="' + $(this).context.id + '"/>';
str = '<div class="input-group"><input readonly value="' + $(this).text() + '" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-created-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>';
$(".selected-created-user").append(str);
})
$('body').on('click', '#close-created-user-model', function (e) {
$('.selected-created-user').html('')
$("body").on("click", "#close-created-user-model", function (e) {
$(".selected-created-user").html("");
});
$('body').on('click', '#modeldialogclosed', function (e) {
$('.selected-created-user').html('')
$("body").on("click", "#modeldialogclosed", function (e) {
$(".selected-created-user").html("");
});
$('body').on('click', '.clearthis-created-user', function (e) {
e.preventDefault()
$(this).closest('.input-group').remove()
delete $aids[$(this).parent().next().val()]
$("body").on("click", ".clearthis-created-user", function (e) {
e.preventDefault();
$(this).closest(".input-group").remove();
delete $aids[$(this).parent().next().val()];
})
$('body').on('click', '#created-user-modal-body .paginate-me-users', function (e) {
$("body").on("click", "#created-user-modal-body .paginate-me-users", function (e) {
e.preventDefault();
$('#created-user-modal-body').animate({width: '20px'})
$("#created-user-modal-body").animate({width: "20px"});
$.get(
'/planner/get/users/' + $(this).context.search,
"/planner/get/users/" + $(this).context.search,
function (data, status, xhr) {
if (status == 'success') {
$('#created-user-modal-body').html(data).animate({width: '100%'})
if (status == "success") {
$("#created-user-modal-body").html(data).animate({width: "100%"});
}
else if (status == 'error') {
$('#created-user-modal-body .paginate-me-users').html('Something Went Wrong Try Again Later...')
else if (status == "error") {
$("#created-user-modal-body .paginate-me-users").html("Something Went Wrong Try Again Later...");
}
});
});

View file

@ -1,14 +1,14 @@
$(document).ready(function () {
$('.addedFilters .input-group').toggle()
$(".addedFilters .input-group").toggle();
$(function () {
$('.startdatepicker').datetimepicker(
{
format: 'MM/DD/YYYY HH:MM:ss'
format: "MM/DD/YYYY HH:MM:ss"
}
);
$('.enddatepicker').datetimepicker({
useCurrent: false, //Important! See issue #1075
format: 'MM/DD/YYYY HH:MM:ss'
format: "MM/DD/YYYY HH:MM:ss"
});
$(".startdatepicker").on("dp.change", function (e) {
$('.enddatepicker').data("DateTimePicker").minDate(e.date);
@ -45,74 +45,74 @@ $('body').on('submit', '#model-form', function (e) {
'</div>' +
'</td>' +
'</tr>');
$('i[id$=_error]').text('')
$('#task-create-model').modal("hide");
$('#task-success-model').modal("show");
$('#model-form').find("input[type=text], textarea").val("");
$("i[id$=_error]").text("")
$("#task-create-model").modal("hide");
$("#task-success-model").modal("show");
$("#model-form").find("input[type=text], textarea").val("");
}
else if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
else if (data["auth"] == "NO") {
alert("Not Authanticated!!")
//login REDIRECT URL
}
else {
if (data['success'] != 'Task Created') {
if (data["success"] != "Task Created") {
for (a in data) {
$('#' + a + "_error").text(data[a]);
$('#' + a + "_error").css("color", "red");
$("#" + a + "_error").text(data[a]);
$("#" + a + "_error").css("color", "red");
}
}
}
}
else if (textStatus == 'error') {
else if (textStatus == "error") {
console.log(textStatus);
}
});
});
$('body').on('click', '#modeldialogclosed', function () {
$('i[id$=_error]').text('')
$('#task-create-model').modal("hide");
$('#update-form').attr({"id": "model-form"})
$('#model-form').find("input[type=text], textarea").val("");
$('#parent_name').val('')
$('#parent_id').val('')
$('#update').attr("id", "gocreatetask").text('Create');
$('#updatemodeldialogclosed').attr({"id": "modeldialogclosed"})
$("body").on("click", "#modeldialogclosed", function () {
$("i[id$=_error]").text("")
$("#task-create-model").modal("hide");
$("#update-form").attr({"id": "model-form"})
$("#model-form").find("input[type=text], textarea").val("");
$("#parent_name").val("")
$("#parent_id").val("")
$("#update").attr("id", "gocreatetask").text("Create");
$("#updatemodeldialogclosed").attr({"id": "modeldialogclosed"})
});
$('body').on('click', '#successmodeldialogclosed', function () {
$('#task-success-model').modal("hide");
$("body").on("click", "#successmodeldialogclosed", function () {
$("#task-success-model").modal("hide");
});
$("body").on("click", ".removethis", function (e) {
e.preventDefault()
taskID = $(this).closest("tr")[0].id
$.post(
'/planner/task/delete/',
"/planner/task/delete/",
{taskID: taskID.match(/\d+/)[0]},
function (data, status, xhr) {
if (status == 'success') {
if (data['success'] == 'Task Deleted') {
$('#' + taskID).css({
if (status == "success") {
if (data["success"] == "Task Deleted") {
$("#" + taskID).css({
"background": "#e6f9ff",
}).animate({opacity: '0'}, 2000, function () {
}).animate({opacity: "0"}, 2000, function () {
$(this).remove();
});
}
else if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
else if (data["auth"] == "NO") {
alert("Not Authanticated!!")
//login REDIRECT URL
}
else if (data['failed' == 'ERROR']) {
alert('ERROR OCCURED!!!\nTry Later.')
else if (data["failed" == "ERROR"]) {
alert("ERROR OCCURED!!!\nTry Later.")
}
}
else if (status == 'error') {
else if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
window.location = '/';
console.log('Something Went Wrong!!!')
if (data["error"] == "Something Went Wrong!!!") {
window.location = "/";
console.log("Something Went Wrong!!!")
}
else {
@ -125,50 +125,50 @@ $("body").on("click", ".viewthis", function (e) {
e.preventDefault()
taskID = $(this).closest("tr")[0].id
task = taskID.match(/\d+/)[0]
$('#model-form').append('<input type="hidden" name="taskID" value="' + task + '">');
$('#gocreatetask').attr("id", "edittask").text('Edit');
$("#model-form").append("<input type="hidden" name="taskID" value="" + task + "">");
$("#gocreatetask").attr("id", "edittask").text("Edit");
$.post(
'/planner/get/task/',
"/planner/get/task/",
{taskID: taskID.match(/\d+/)[0]},
function (data, status, xhr) {
// console.log(data)
if (status == 'success') {
if (data['task']['event_type'] == 'Task') {
$('#name').val(data['task']['name'])
$('#parent').val(data['task']['parent'])
$('#status').val(data['task']['status'])
$('#priority').val(data['task']['priority'])
$('#start_date').val(data['task']['start_date'])
$('#close_date').val(data['task']['close_date'])
$('#description').val(data['task']['description'])
$('#parent_name').val(data['parent_name'])
$('#parent_id').val(data['parent_id'])
$('#parent_type').val(data['parent_type'])
$('#teams').val(data['task']['teams'])
if (status == "success") {
if (data["task"]["event_type"] == "Task") {
$("#name").val(data["task"]["name"])
$("#parent").val(data["task"]["parent"])
$("#status").val(data["task"]["status"])
$("#priority").val(data["task"]["priority"])
$("#start_date").val(data["task"]["start_date"])
$("#close_date").val(data["task"]["close_date"])
$("#description").val(data["task"]["description"])
$("#parent_name").val(data["parent_name"])
$("#parent_id").val(data["parent_id"])
$("#parent_type").val(data["parent_type"])
$("#teams").val(data["task"]["teams"])
///////////////////ASSGNED USERS////////////////////////////////////////////
$('#selected-assignee-users').html('')
$('#assigned_user_error').before('<div id="selected-assignee-users"></div>')
for (a in data['assigned_users']) {
$("#selected-assignee-users").html("")
$("#assigned_user_error").before("<div id="selected-assignee-users"></div>")
for (a in data["assigned_users"]) {
if ($.isNumeric(a)) {
strr = '<input id="assigned_user" type="hidden" name="assigned_users" value="' + a + '"/>'
// $('#user_name').after(str)
str = '<div class="input-group"><input placeholder="Assign user" readonly value="' + data['assigned_users'][a] + '" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>' + strr + '</div>'
$('#selected-assignee-users').append(str)
strr = "<input id="assigned_user" type="hidden" name="assigned_users" value="" + a + ""/>"
// $("#user_name").after(str)
str = "<div class="input-group"><input placeholder="Assign user" readonly value="" + data["assigned_users"][a] + "" class="main-element form-control input-sm" type="text"><span class="input-group-btn"><button tabindex="-1" type="button" class="btn btn-default input-sm clearthis-assigned-user"><i class="glyphicon glyphicon-remove"></i></button></span>" + strr + "</div>"
$("#selected-assignee-users").append(str)
}
}
///////////////////END ASSGNED USERS////////////////////////////////////////////
}
else if (data['failed'] == 'ERROR') {
alert(data['failed'])
else if (data["failed"] == "ERROR") {
alert(data["failed"])
//login REDIRECT URL
}
else if (data['AUTH'] == 'NO') {
alert('Not Authanticated')
else if (data["AUTH"] == "NO") {
alert("Not Authanticated")
//login redirect
}
}
else if (status == 'error') {
else if (status == "error") {
console.log(jqXhr);
}
@ -176,81 +176,81 @@ $("body").on("click", ".viewthis", function (e) {
console.log(status)
}
});
$('#task-create-model').modal("show");
$('.modal-body :input').attr("disabled", true);
$("#task-create-model").modal("show");
$(".modal-body :input").attr("disabled", true);
});
$("body").on("click", "#edittask", function (e) {
e.preventDefault();
$('.modal-body :input').removeAttr('disabled')
$('#model-form').attr({"id": "update-form", "type": "submit"});
$('#edittask').attr({"id": "update", "type": "submit"}).text('Update');
$('#modeldialogclosed').attr({"id": "modeldialogclosed"});
$('#modelbody').append('<input type="hidden" value="' + taskID + '">')
$(".modal-body :input").removeAttr("disabled")
$("#model-form").attr({"id": "update-form", "type": "submit"});
$("#edittask").attr({"id": "update", "type": "submit"}).text("Update");
$("#modeldialogclosed").attr({"id": "modeldialogclosed"});
$("#modelbody").append("<input type="hidden" value="" + taskID + "">")
});
$("body").on("click", "#updatemodeldialogclosed", function (e) {
e.preventDefault();
$('i[id$=_error]').text('')
$('#task-create-model').modal("hide");
$('#update').attr({"id": "gocreatetask", "type": "submit"}).text('Create');
$('#update-form').attr({"id": "model-form"})
$('#model-form').find("input[type=text], textarea").val("");
$('#parent_name').val('')
$('#parent_id').val('')
$('#updatemodeldialogclosed').attr({"id": "modeldialogclosed"})
$("i[id$=_error]").text("")
$("#task-create-model").modal("hide");
$("#update").attr({"id": "gocreatetask", "type": "submit"}).text("Create");
$("#update-form").attr({"id": "model-form"})
$("#model-form").find("input[type=text], textarea").val("");
$("#parent_name").val("")
$("#parent_id").val("")
$("#updatemodeldialogclosed").attr({"id": "modeldialogclosed"})
});
$("body").on("click", "#createtask", function (e) {
$('.modal-body :input').removeAttr('disabled')
$('#gocreatetask').attr("id", "gocreatetask").text('Create');
$('#edittask').attr("id", "gocreatetask").text('Create');
$('#model-form').find("input[type=text], textarea").val("");
$('#parent_name').val('')
$('#parent_id').val('')
$('#selected-assignee-users').html('')
$(".modal-body :input").removeAttr("disabled")
$("#gocreatetask").attr("id", "gocreatetask").text("Create");
$("#edittask").attr("id", "gocreatetask").text("Create");
$("#model-form").find("input[type=text], textarea").val("");
$("#parent_name").val("")
$("#parent_id").val("")
$("#selected-assignee-users").html("")
});
$('body').on('submit', '#update-form', function (e) {
$("body").on("submit", "#update-form", function (e) {
e.preventDefault();
$.post(
'/planner/task/update/',
$('#update-form').serialize(),
"/planner/task/update/",
$("#update-form").serialize(),
function (data, status, xhr) {
if (status == 'success') {
if (data['success'] == 'Task Updated') {
$('#task' + data["id"] + 'name').text(data["name"]);
$('#task' + data["id"] + 'status').text(data["status"]);
$('#task' + data["id"] + 'priority').text(data["priority"]);
$('#task' + data["id"] + 'start_date').text(data["startdate"]);
$('i[id$=_error]').text('')
$('#task-create-model').modal("hide");
$('#update').attr({"id": "gocreatetask", "type": "submit"}).text('Create');
if (status == "success") {
if (data["success"] == "Task Updated") {
$("#task" + data["id"] + "name").text(data["name"]);
$("#task" + data["id"] + "status").text(data["status"]);
$("#task" + data["id"] + "priority").text(data["priority"]);
$("#task" + data["id"] + "start_date").text(data["startdate"]);
$("i[id$=_error]").text("")
$("#task-create-model").modal("hide");
$("#update").attr({"id": "gocreatetask", "type": "submit"}).text("Create");
$('#update-form').attr({"id": "model-form"})
$('#model-form').find("input[type=text], textarea").val("");
$('#updatemodeldialogclosed').attr({"id": "modeldialogclosed"})
$("#update-form").attr({"id": "model-form"})
$("#model-form").find("input[type=text], textarea").val("");
$("#updatemodeldialogclosed").attr({"id": "modeldialogclosed"})
}
else if (data['auth'] == 'NO') {
alert('Not Authanticated!!')
else if (data["auth"] == "NO") {
alert("Not Authanticated!!")
//login REDIRECT URL
}
else {
if (data['success'] != 'Task Updated') {
if (data["success"] != "Task Updated") {
for (a in data) {
$('#' + a + "_error").text(data[a]);
$('#' + a + "_error").css("color", "red");
$("#" + a + "_error").text(data[a]);
$("#" + a + "_error").css("color", "red");
}
}
}
}
else if (status == 'error') {
else if (status == "error") {
console.log(jqXhr);
if (data['error'] == 'Something Went Wrong!!!') {
if (data["error"] == "Something Went Wrong!!!") {
window.location = '/';
console.log('Something Went Wrong!!!')
window.location = "/";
console.log("Something Went Wrong!!!")
}
}
else {
@ -258,14 +258,14 @@ $('body').on('submit', '#update-form', function (e) {
}
});
});
$('body').on('click', '.editthis', function (e) {
$('.viewthis').click()
$('#edittask').click()
$("body").on("click", ".editthis", function (e) {
$(".viewthis").click()
$("#edittask").click()
});
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') {
if (settings.type == "POST" || settings.type == "PUT" || settings.type == "DELETE") {
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
}