Add JS files
This commit is contained in:
57
modules/Accounts/js/SalesChart.js
Normal file
57
modules/Accounts/js/SalesChart.js
Normal file
@@ -0,0 +1,57 @@
|
||||
google.load("visualization", "1", {packages:["corechart"]});
|
||||
google.setOnLoadCallback(drawChart);
|
||||
|
||||
function drawChart() {
|
||||
var a = new Array();
|
||||
var html = "";
|
||||
var table = document.getElementById("ChartData");
|
||||
for (var i = 0, row; row = table.rows[i]; i++) {
|
||||
a[i] = new Array();
|
||||
for (var j = 0, col; col = row.cells[j]; j++) {
|
||||
a[i][j]=row.cells[j].textContent;
|
||||
if(j>0 && i > 0){
|
||||
a[i][j] = a[i][j].replace(".", "").replace(".", "");
|
||||
a[i][j] = parseFloat(a[i][j].replace(",", "."));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Calculate the width and height of the Array
|
||||
var w = a.length ? a.length : 0,
|
||||
h = a[0] instanceof Array ? a[0].length : 0;
|
||||
|
||||
// In case it is a zero matrix, no transpose routine needed.
|
||||
if(h === 0 || w === 0) { t=[]; }
|
||||
|
||||
/**
|
||||
* @var {Number} i Counter
|
||||
* @var {Number} j Counter
|
||||
* @var {Array} t Transposed data is stored in this array.
|
||||
*/
|
||||
var i, j, t = [];
|
||||
// Loop through every item in the outer array (height)
|
||||
for(i=0; i<h-1; i++) {
|
||||
// Insert a new row (array)
|
||||
t[i] = [];
|
||||
// Loop through every item per item in outer array (width)
|
||||
for(j=0; j<w-1; j++) {
|
||||
// Save transposed data.
|
||||
t[i][j] = a[j][i];
|
||||
}
|
||||
}
|
||||
|
||||
var data = google.visualization.arrayToDataTable(t);
|
||||
formatter = new google.visualization.NumberFormat({
|
||||
suffix: ' zł',
|
||||
fractionDigits: '2',
|
||||
decimalSymbol: ',',
|
||||
groupingSymbol: '.',
|
||||
});
|
||||
for (i = 1; i < data.getNumberOfColumns(); i++) {
|
||||
formatter.format(data, i);
|
||||
}
|
||||
var options = {
|
||||
};
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
|
||||
chart.draw(data, options);
|
||||
}
|
||||
29
modules/Accounts/js/States.js
Normal file
29
modules/Accounts/js/States.js
Normal file
@@ -0,0 +1,29 @@
|
||||
$(function() {
|
||||
var availableTags = [
|
||||
"zachodniopomorskie",
|
||||
"dolnośląskie",
|
||||
"kujawsko-pomorskie",
|
||||
"lubelskie",
|
||||
"lubuskie",
|
||||
"łódzkie",
|
||||
"małopolskie",
|
||||
"mazowieckie",
|
||||
"opolskie",
|
||||
"podkarpackie",
|
||||
"podlaskie",
|
||||
"pomorskie",
|
||||
"śląskie",
|
||||
"świętokrzyskie",
|
||||
"warmińsko-mazurskie",
|
||||
"wielkopolskie"
|
||||
|
||||
];
|
||||
var $searchBox = $( "input[name='register_address_state']");
|
||||
$searchBox.autocomplete({
|
||||
source: availableTags
|
||||
});
|
||||
var $searchBox2 = $( "input[name='billing_address_state']");
|
||||
$searchBox2.autocomplete({
|
||||
source: availableTags
|
||||
});
|
||||
});
|
||||
47
modules/Accounts/js/Telephones.js
Normal file
47
modules/Accounts/js/Telephones.js
Normal file
@@ -0,0 +1,47 @@
|
||||
$(document).ready(function() {
|
||||
console.log('ten plik');
|
||||
$('.loading_panel').hide();
|
||||
var MaxInputs = 10; //maximum input boxes allowed
|
||||
var InputsWrapper = $("#InputsWrapper2"); //Input boxes wrapper ID
|
||||
var AddButton = $("#AddMoreWWWBox2"); //Add button ID
|
||||
|
||||
var x = InputsWrapper.length; //initlal text box count
|
||||
var FieldCount=1; //to keep track of text box added
|
||||
|
||||
var weblists = $.parseJSON($("input[name='telephones_list']").val()); // get and decode json object
|
||||
|
||||
|
||||
$.each(weblists, function(idx, obj) { // add existing elements
|
||||
FieldCount++; //text box added increment
|
||||
//add input box
|
||||
if(idx == 0 ){ // to first element
|
||||
$( "div input[name='telephones[]']" ).first().val(obj.telephone);
|
||||
$( "div input[name='telephones_id[]']" ).first().val(obj.id);
|
||||
} else { // rest
|
||||
$(InputsWrapper).append('<tr><td><input type="hidden" value="'+obj.id+'" name="telephones_id[]"><input type="text" size="30" name="telephones[]" id="field_'+ FieldCount +'" value="'+obj.telephone +'"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&themeName=Sugar5&imageName=id-ff-remove.png"></a></td></tr>');
|
||||
}
|
||||
x++; //text box increment
|
||||
|
||||
});
|
||||
|
||||
$(AddButton).click(function (e) //on add input button click
|
||||
{
|
||||
if(x <= MaxInputs) //max input box allowed
|
||||
{
|
||||
FieldCount++; //text box added increment
|
||||
//add input box
|
||||
$(InputsWrapper).append('<tr><td><input type="hidden" value="" name="telephones_id[]"><input type="text" size="30" name="telephones[]" id="field_'+ FieldCount +'" value=""/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&themeName=Sugar5&imageName=id-ff-remove.png"></a></td>,/tr>');
|
||||
x++; //text box increment
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).closest('tr').remove();//remove text box
|
||||
x--; //decrement textbox
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
});
|
||||
47
modules/Accounts/js/Websites.js
Normal file
47
modules/Accounts/js/Websites.js
Normal file
@@ -0,0 +1,47 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.loading_panel').hide();
|
||||
var MaxInputs = 10; //maximum input boxes allowed
|
||||
var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID
|
||||
var AddButton = $("#AddMoreWWWBox"); //Add button ID
|
||||
|
||||
var x = InputsWrapper.length; //initlal text box count
|
||||
var FieldCount=1; //to keep track of text box added
|
||||
|
||||
var weblists = $.parseJSON($("input[name='websites_list']").val()); // get and decode json object
|
||||
|
||||
|
||||
$.each(weblists, function(idx, obj) { // add existing elements
|
||||
FieldCount++; //text box added increment
|
||||
//add input box
|
||||
if(idx == 0 ){ // to first element
|
||||
$( "div input[name='websites[]']" ).first().val(obj.www);
|
||||
$( "div input[name='websites_id[]']" ).first().val(obj.id);
|
||||
} else { // rest
|
||||
$(InputsWrapper).append('<tr><td><input type="hidden" value="'+obj.id+'" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="'+obj.www +'"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&themeName=Sugar5&imageName=id-ff-remove.png"></a></td></tr>');
|
||||
}
|
||||
x++; //text box increment
|
||||
|
||||
});
|
||||
|
||||
$(AddButton).click(function (e) //on add input button click
|
||||
{
|
||||
if(x <= MaxInputs) //max input box allowed
|
||||
{
|
||||
FieldCount++; //text box added increment
|
||||
//add input box
|
||||
$(InputsWrapper).append('<tr><td><input type="hidden" value="" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="http://"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&themeName=Sugar5&imageName=id-ff-remove.png"></a></td>,/tr>');
|
||||
x++; //text box increment
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).closest('tr').remove();//remove text box
|
||||
x--; //decrement textbox
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
});
|
||||
43
modules/Accounts/js/showMap.js
Normal file
43
modules/Accounts/js/showMap.js
Normal file
@@ -0,0 +1,43 @@
|
||||
$(document)
|
||||
.ready(
|
||||
function() {
|
||||
var mapProp = {
|
||||
center : new google.maps.LatLng(52.05, 19.45),
|
||||
zoom : 6,
|
||||
mapTypeId : google.maps.MapTypeId.ROADMAP
|
||||
};
|
||||
var map = new google.maps.Map(document
|
||||
.getElementById("googleMapContainer"), mapProp);
|
||||
|
||||
var markers = JSON.parse(b64_to_utf8($('#googleMapMarkers')
|
||||
.val()));
|
||||
$.each(markers, function(index, m) {
|
||||
var marker = new google.maps.Marker({
|
||||
position : new google.maps.LatLng(m.lat, m.lng),
|
||||
url : '/',
|
||||
animation : google.maps.Animation.DROP,
|
||||
customInfo : m.info,
|
||||
title : m.title,
|
||||
map : map
|
||||
});
|
||||
google.maps.event.addListener(marker, 'click',
|
||||
markerClickFunction);
|
||||
});
|
||||
|
||||
function markerClickFunction() {
|
||||
infowindow = new google.maps.InfoWindow({
|
||||
content : this.customInfo
|
||||
});
|
||||
infowindow.open(map, this);
|
||||
closeInfoWindow(infowindow);
|
||||
}
|
||||
function closeInfoWindow(infoWindow) {
|
||||
setTimeout(function() {
|
||||
infoWindow.close();
|
||||
}, 8000);
|
||||
}
|
||||
});
|
||||
|
||||
function b64_to_utf8(str) {
|
||||
return decodeURIComponent(escape(window.atob(str)));
|
||||
}
|
||||
Reference in New Issue
Block a user