progress indicators, bug fixes, after a while
This commit is contained in:
267
public/assets/js/dashboard copy.js
vendored
Normal file
267
public/assets/js/dashboard copy.js
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
$(document).ready(function(){
|
||||
//init_flot_chart();
|
||||
init_sparklines()
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: base_url + '/dashboard/get_events',
|
||||
// data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
init_calendar(data);
|
||||
},
|
||||
error: function(error){
|
||||
var output = $.parseJSON(error.responseText);
|
||||
console.log(output.errors);
|
||||
$('#ipNotifyArea').removeClass('hidden');
|
||||
$('#ipNotifyArea').addClass('alert alert-danger');
|
||||
$.each(output.errors, function (key, value) {
|
||||
//console.log(value[0]);
|
||||
$('#ipNotifyArea').text(value[0]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#mybarChart').length ){
|
||||
|
||||
var ctx = document.getElementById("mybarChart");
|
||||
var mybarChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["January", "February", "March", "April", "May", "June", "July"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
backgroundColor: "#26B99A",
|
||||
data: [51, 30, 40, 28, 92, 50, 45]
|
||||
}]
|
||||
},
|
||||
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function init_calendar(theData) {
|
||||
//console.log(theData);
|
||||
$.each(theData, function (key, value) {
|
||||
//console.log(value);
|
||||
});
|
||||
if( typeof ($.fn.fullCalendar) === 'undefined'){ return; }
|
||||
// console.log('init_calendar');
|
||||
|
||||
var date = new Date(),
|
||||
d = date.getDate(),
|
||||
m = date.getMonth(),
|
||||
y = date.getFullYear(),
|
||||
started,
|
||||
categoryClass;
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay,listMonth'
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function(start, end, allDay) {
|
||||
$('#fc_create').click();
|
||||
|
||||
started = start;
|
||||
ended = end;
|
||||
|
||||
$(".antosubmit").on("click", function() {
|
||||
var title = $("#title").val();
|
||||
if (end) {
|
||||
ended = end;
|
||||
}
|
||||
|
||||
categoryClass = $("#event_type").val();
|
||||
|
||||
if (title) {
|
||||
calendar.fullCalendar('renderEvent', {
|
||||
title: title,
|
||||
start: started,
|
||||
end: end,
|
||||
allDay: allDay
|
||||
},
|
||||
true // make the event "stick"
|
||||
);
|
||||
}
|
||||
|
||||
$('#title').val('');
|
||||
|
||||
calendar.fullCalendar('unselect');
|
||||
|
||||
$('.antoclose').click();
|
||||
|
||||
return false;
|
||||
});
|
||||
},
|
||||
eventClick: function(calEvent, jsEvent, view) {
|
||||
$('#fc_edit').click();
|
||||
$('#title2').val(calEvent.title);
|
||||
|
||||
categoryClass = $("#event_type").val();
|
||||
|
||||
$(".antosubmit2").on("click", function() {
|
||||
calEvent.title = $("#title2").val();
|
||||
|
||||
calendar.fullCalendar('updateEvent', calEvent);
|
||||
$('.antoclose2').click();
|
||||
});
|
||||
|
||||
calendar.fullCalendar('unselect');
|
||||
},
|
||||
editable: true,
|
||||
events: [
|
||||
{
|
||||
title: 'All Day Event',
|
||||
start: new Date(y, m, 1)
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
function gd(year, month, day) {
|
||||
return new Date(year, month - 1, day).getTime();
|
||||
}
|
||||
|
||||
function init_flot_chart(){
|
||||
|
||||
if( typeof ($.plot) === 'undefined'){ return; }
|
||||
|
||||
console.log('init_flot_chart');
|
||||
|
||||
var arr_data2 = [
|
||||
[gd(2023, 10, 1), 82],
|
||||
[gd(2023, 10, 2), 23],
|
||||
[gd(2023, 10, 3), 66],
|
||||
[gd(2023, 10, 4), 9],
|
||||
[gd(2023, 10, 5), 119],
|
||||
[gd(2023, 10, 6), 6],
|
||||
[gd(2023, 10, 7), 9]
|
||||
];
|
||||
|
||||
var chart_plot_02_data = [];
|
||||
// console.log(chart_plot_02_data.reverse()[0]);
|
||||
|
||||
for (var i = 0; i < 30; i++) {
|
||||
//console.log([new Date(Date.today().add(i).days()).getTime(), randNum() + i + i + 10]);
|
||||
chart_plot_02_data.push([new Date(Date.today().add(i).days()).getTime(), randNum() + i + i + 10]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var chart_plot_02_settings = {
|
||||
grid: {
|
||||
show: true,
|
||||
aboveData: true,
|
||||
color: "#3f3f3f",
|
||||
labelMargin: 10,
|
||||
axisMargin: 0,
|
||||
borderWidth: 0,
|
||||
borderColor: null,
|
||||
minBorderMargin: 5,
|
||||
clickable: true,
|
||||
hoverable: true,
|
||||
autoHighlight: true,
|
||||
mouseActiveRadius: 100
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
show: true,
|
||||
fill: true,
|
||||
lineWidth: 2,
|
||||
steps: false
|
||||
},
|
||||
points: {
|
||||
show: true,
|
||||
radius: 4.5,
|
||||
symbol: "circle",
|
||||
lineWidth: 3.0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: "ne",
|
||||
margin: [0, -25],
|
||||
noColumns: 0,
|
||||
labelBoxBorderColor: null,
|
||||
labelFormatter: function(label, series) {
|
||||
return label + ' ';
|
||||
},
|
||||
width: 40,
|
||||
height: 1
|
||||
},
|
||||
colors: ['#96CA59', '#3F97EB', '#72c380', '#6f7a8a', '#f7cb38', '#5a8022', '#2c7282'],
|
||||
shadowSize: 0,
|
||||
tooltip: true,
|
||||
tooltipOpts: {
|
||||
content: "%s: %y.0",
|
||||
xDateFormat: "%d/%m",
|
||||
shifts: {
|
||||
x: -30,
|
||||
y: -50
|
||||
},
|
||||
defaultTheme: false
|
||||
},
|
||||
yaxis: {
|
||||
min: 0
|
||||
},
|
||||
xaxis: {
|
||||
mode: "time",
|
||||
minTickSize: [1, "day"],
|
||||
timeformat: "%d/%m/%y",
|
||||
min: chart_plot_02_data[0][0],
|
||||
//max: chart_plot_02_data.reverse()[0]
|
||||
max: chart_plot_02_data[20][0]
|
||||
}
|
||||
};
|
||||
|
||||
if ($("#chart_plot_02").length){
|
||||
console.log('Plot2');
|
||||
|
||||
$.plot( $("#chart_plot_02"),
|
||||
[{
|
||||
label: "Logins",
|
||||
data: chart_plot_02_data,
|
||||
lines: {
|
||||
fillColor: "rgba(150, 202, 89, 0.12)"
|
||||
},
|
||||
points: {
|
||||
fillColor: "#fff" }
|
||||
}], chart_plot_02_settings);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function init_sparklines() {
|
||||
|
||||
if(typeof (jQuery.fn.sparkline) === 'undefined'){ return; }
|
||||
console.log('init_sparklines');
|
||||
|
||||
|
||||
$(".sparkline_dash").sparkline([2, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 6, 4, 5, 6, 3, 5, 4, 5, 4, 5, 4, 3, 4, 5, 6, 7, 5, 4, 3, 5, 6], {
|
||||
type: 'bar',
|
||||
height: '125',
|
||||
barWidth: 13,
|
||||
colorMap: {
|
||||
'7': '#a1a1a1'
|
||||
},
|
||||
barSpacing: 2,
|
||||
barColor: '#26B99A'
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
132
public/assets/js/dashboard.js
vendored
132
public/assets/js/dashboard.js
vendored
@@ -1,113 +1,25 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
/*
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: base_url + '/dashboard/get_events',
|
||||
// data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
init_calendar(data);
|
||||
},
|
||||
error: function(error){
|
||||
var output = $.parseJSON(error.responseText);
|
||||
console.log(output.errors);
|
||||
$('#ipNotifyArea').removeClass('hidden');
|
||||
$('#ipNotifyArea').addClass('alert alert-danger');
|
||||
$.each(output.errors, function (key, value) {
|
||||
console.log(value[0]);
|
||||
$('#ipNotifyArea').text(value[0]);
|
||||
});
|
||||
}
|
||||
type: "get",
|
||||
url: base_url + '/dashboard/get_events',
|
||||
// data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
//init_calendar(data);
|
||||
},
|
||||
error: function(error){
|
||||
var output = $.parseJSON(error.responseText);
|
||||
console.log(output.errors);
|
||||
$('#ipNotifyArea').removeClass('hidden');
|
||||
$('#ipNotifyArea').addClass('alert alert-danger');
|
||||
$.each(output.errors, function (key, value) {
|
||||
//console.log(value[0]);
|
||||
$('#ipNotifyArea').text(value[0]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function init_calendar(theData) {
|
||||
console.log(theData);
|
||||
$.each(theData, function (key, value) {
|
||||
console.log(value);
|
||||
});
|
||||
if( typeof ($.fn.fullCalendar) === 'undefined'){ return; }
|
||||
// console.log('init_calendar');
|
||||
|
||||
var date = new Date(),
|
||||
d = date.getDate(),
|
||||
m = date.getMonth(),
|
||||
y = date.getFullYear(),
|
||||
started,
|
||||
categoryClass;
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay,listMonth'
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function(start, end, allDay) {
|
||||
$('#fc_create').click();
|
||||
|
||||
started = start;
|
||||
ended = end;
|
||||
|
||||
$(".antosubmit").on("click", function() {
|
||||
var title = $("#title").val();
|
||||
if (end) {
|
||||
ended = end;
|
||||
}
|
||||
|
||||
categoryClass = $("#event_type").val();
|
||||
|
||||
if (title) {
|
||||
calendar.fullCalendar('renderEvent', {
|
||||
title: title,
|
||||
start: started,
|
||||
end: end,
|
||||
allDay: allDay
|
||||
},
|
||||
true // make the event "stick"
|
||||
);
|
||||
}
|
||||
|
||||
$('#title').val('');
|
||||
|
||||
calendar.fullCalendar('unselect');
|
||||
|
||||
$('.antoclose').click();
|
||||
|
||||
return false;
|
||||
});
|
||||
},
|
||||
eventClick: function(calEvent, jsEvent, view) {
|
||||
$('#fc_edit').click();
|
||||
$('#title2').val(calEvent.title);
|
||||
|
||||
categoryClass = $("#event_type").val();
|
||||
|
||||
$(".antosubmit2").on("click", function() {
|
||||
calEvent.title = $("#title2").val();
|
||||
|
||||
calendar.fullCalendar('updateEvent', calEvent);
|
||||
$('.antoclose2').click();
|
||||
});
|
||||
|
||||
calendar.fullCalendar('unselect');
|
||||
},
|
||||
editable: true,
|
||||
events: [
|
||||
{
|
||||
title: 'All Day Event',
|
||||
start: new Date(y, m, 1)
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
*/
|
||||
});
|
||||
156
public/assets/js/mnos.js
vendored
156
public/assets/js/mnos.js
vendored
@@ -1,3 +1,18 @@
|
||||
$(document).ready(function(){
|
||||
var d = new Date();
|
||||
var month = d.getMonth()+1;
|
||||
var day = d.getDate();
|
||||
var currentDate = d.getFullYear() + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
|
||||
|
||||
//$('select').select2();
|
||||
$('#myDatepicker2').datetimepicker({
|
||||
format: 'YYYY-MM-DD',
|
||||
maxDate: currentDate
|
||||
});
|
||||
$('#launchDate').datetimepicker({
|
||||
format: 'YYYY-MM-DD'
|
||||
});
|
||||
|
||||
$('#addIpBtn').click(function(evt){
|
||||
evt.preventDefault();
|
||||
$('#newIpModal').modal('show');
|
||||
@@ -65,7 +80,7 @@ $('.notesEditBtn').click(function(tve){
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: base_url + '/clients/get_note/' + theIDD,
|
||||
url: base_url + '/mnos/get_note/' + theIDD,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
@@ -135,7 +150,7 @@ $('#newNotesFormForm').submit(function(evt){
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#editNotesForm').submit(function(evt){
|
||||
@@ -144,7 +159,7 @@ $('#editNotesForm').submit(function(evt){
|
||||
var formData = new FormData($(this)[0]);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: base_url + '/clients/notes_update',
|
||||
url: base_url + '/mnos/notes_update',
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
@@ -174,4 +189,137 @@ $('#editNotesForm').submit(function(evt){
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
$('#addPaymentBtn').click(function(evt){
|
||||
evt.preventDefault();
|
||||
$('#financePaymentsForm').modal('show');
|
||||
});
|
||||
$('.paymentEntryEditBtn').click(function(tve){
|
||||
tve.preventDefault();
|
||||
//var theIDD = $("input[name=payment_entry_id]").val();
|
||||
var theIDD = $(this).siblings('.paymentEntryRowId').val();
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: base_url + '/mnos/get_payment/' + theIDD,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
if (data.code === 1) {
|
||||
console.log(theIDD);
|
||||
$('#paymentIdEdit').val(theIDD);
|
||||
$('#financeServicesEdit').val(data.services_arr).change();
|
||||
$('#invoiceNumberEdit').val(data.result.invoice_number);
|
||||
$('#invoiceAmountEdit').val(data.result.invoice_amount);
|
||||
$('#invoiceDateEdit').val(data.result.invoice_date);
|
||||
$('#invoiceStatusEdit').val(data.result.invoice_status).change();
|
||||
$('#remarksEdit').val(data.result.remarks);
|
||||
$('#financePaymentsEditForm').modal('show');
|
||||
}
|
||||
else if (data.code > 1) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: data.msg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Your request could not be handled. Try again !',
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#financeForm').submit(function(evt){
|
||||
evt.preventDefault();
|
||||
var formData = new FormData($(this)[0]);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: base_url + '/mnos/finance_store',
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
if (data.code === 1) {
|
||||
$("#financeForm")[0].reset();
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Payment Details added successfully',
|
||||
});
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
}, 8000);
|
||||
}
|
||||
else if (data.code > 5) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: data.msg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Your request could not be handled. Try again !',
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function(error){
|
||||
//console.log(error);
|
||||
//console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
|
||||
var output = $.parseJSON(error.responseText);
|
||||
console.log(output.errors);
|
||||
$('#financeNotifyArea').removeClass('hidden');
|
||||
$('#financeNotifyArea').addClass('alert alert-danger');
|
||||
$.each(output.errors, function (key, value) {
|
||||
console.log(value[0]);
|
||||
$('#financeNotifyArea').text(value[0]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#financeEditForm').submit(function(evt){
|
||||
evt.preventDefault();
|
||||
var formData = new FormData($(this)[0]);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: base_url + '/mnos/finance_update',
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
if (data.code === 1) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Payment Details successfully updated',
|
||||
});
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
}, 8000);
|
||||
}
|
||||
else if (data.code > 1) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: data.msg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Your request could not be handled. Try again !',
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user