Created
October 16, 2015 06:40
-
-
Save anishmenon/084398d06b456d9901ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<link href="font/fonts.css" rel="stylesheet" type="text/css"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<title>Ammras- Mobile App</title> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> | |
<link rel="stylesheet" type="text/css" href="css/jquery-sliding-menu.css"> | |
<!-- calendar--> | |
<link href='cal/fullcalendar.css' rel='stylesheet' /> | |
<link href='cal/fullcalendar.print.css' rel='stylesheet' media='print' /> | |
<!-- calendar ends --> | |
<!-- SECOND VERSION --> | |
<!-- New product lsiting --> | |
<style> | |
.usr-img{padding-left:23px;} | |
#VS code, #VS pre, #VS tt { | |
font-family: Monaco, Consolas, "Lucida Console", monospace; | |
font-size: 12px; | |
line-height: 18px; | |
color: #444; | |
background: none; | |
} | |
#VS code { | |
margin-left: 8px; | |
padding: 0 0 0 12px; | |
font-weight: normal; | |
} | |
#VS pre { | |
font-size: 12px; | |
padding: 2px 0 2px 0; | |
border-left: 6px solid #829C37; | |
margin: 12px 0; | |
} | |
#search_query { | |
margin: 18px 0; | |
opacity: 0; | |
} | |
#search_query .raquo { | |
font-size: 18px; | |
line-height: 12px; | |
font-weight: bold; | |
margin-right: 4px; | |
} | |
#search_query2 { | |
margin: 18px 0; | |
opacity: 0; | |
} | |
#search_query2 .raquo { | |
font-size: 18px; | |
line-height: 12px; | |
font-weight: bold; | |
margin-right: 4px; | |
} | |
.center{margin: 0px auto; display: block;} | |
</style> | |
<link rel="stylesheet" href="Newjqproduct/lib/css/custom.css" /> | |
<link rel="stylesheet" href="Newjqproduct/lib/css/reset.css" type="text/css" media="screen" charset="utf-8"> | |
<link rel="stylesheet" href="Newjqproduct/lib/css/icons.css" type="text/css" media="screen" charset="utf-8"> | |
<link rel="stylesheet" href="Newjqproduct/lib/css/workspace.css" type="text/css" media="screen" charset="utf-8"> | |
<script src="Newjqproduct/vendor/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script> | |
<!-- <script src="vendor/backported/jquery-1.4.4.js" type="text/javascript" charset="utf-8"></script> --> | |
<script src="Newjqproduct/vendor/jquery.ui.core.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/jquery.ui.position.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/jquery.ui.menu.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/jquery.ui.autocomplete.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/underscore-1.5.2.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/vendor/backbone-1.1.0.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/visualsearch.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/views/search_box.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/views/search_facet.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/views/search_input.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/models/search_facets.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/models/search_query.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/utils/backbone_extensions.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/utils/hotkeys.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/utils/jquery_extensions.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/utils/search_parser.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/utils/inflector.js" type="text/javascript" charset="utf-8"></script> | |
<script src="Newjqproduct/lib/js/templates/templates.js" type="text/javascript" charset="utf-8"></script> | |
<link rel="stylesheet" href="css/token-input.css" type="text/css" /> | |
<link rel="stylesheet" href="css/token-input-facebook.css" type="text/css" /> | |
<link rel="stylesheet" type="text/css" href="css/default.css" /> | |
<link rel="stylesheet" type="text/css" href="css/component.css" /> | |
<script type="text/javascript" src="js/jquery.min.js"></script> | |
<!-- popup changes--> | |
<link href="css/bootstrap.css" rel="stylesheet" /> | |
<link href="css/prettify.css" rel="stylesheet" /> | |
<link href="css/bootstrap-responsive.css" rel="stylesheet" /> | |
<link href="css/bootstrap-modal.css" rel="stylesheet" /> | |
<script type="text/javascript" src="js/prettify.js"></script> | |
<script src="js/bootstrap.js"></script> | |
<script src="js/bootstrap-modalmanager.js"></script> | |
<script src="js/bootstrap-modal.js"></script> | |
<script>var jquery164 = jQuery.noConflict(true);</script> | |
<!-- <script src="js/jquery.tokeninput.js"></script>--> | |
<!-- calendar--> | |
<script src='cal/moment.min.js'></script> | |
<script src='cal/jquery.min.js'></script> | |
<script src='cal/fullcalendar.min.js'></script> | |
<!-- calendar --> | |
<!-- SMART CART--> | |
<link href="sales/styles/smart_cart.css" rel="stylesheet" type="text/css"> | |
<link href="sales/styles/responsive.css" rel="stylesheet" type="text/css" /> | |
<!-- | |
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> --> | |
<script type="text/javascript" src="sales/js/jquery.smartCart-2.0.js"></script> | |
<!-- SMART CART ENDS--> | |
<script type="text/javascript" src="cordova.js"></script> | |
<script type="text/javascript" src="js/turn.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<link rel="stylesheet" type="text/css" href="css/demo.css" /> | |
<link rel="stylesheet" type="text/css" href="css/component.css" /> | |
<link rel="stylesheet" type="text/css" href="css/component1.css" /> | |
<style> | |
.tab1:hover #content1{display:block;} | |
</style> | |
<!-- tab end--> | |
<script type="text/javascript"> | |
var lead_lan_long=""; | |
var rr=1; | |
var loopnoform=0; | |
var writedata={}; | |
var writedata_datily={}; | |
var db; | |
var onedata={}; | |
var writedataTP={}; | |
var kk=0; | |
var tpdata={}; | |
var offlinerouteinfo={}; | |
function init(){ | |
document.addEventListener("deviceready", onDeviceReady, false); | |
} | |
//http://127.0.0.1:8000/ | |
//http://ammras-ammras.rhcloud.com/ | |
//ammras-ammras.rhcloud.com | |
//ammras-ammras.rhcloud.com | |
//Get details abt lead: name address phone + reports details- from server | |
//REPORTS VIEW | |
function lead_details(obj) | |
{ | |
var element = $(obj).attr('id'); | |
//alert(element) | |
var array = element.split('**'); | |
// tab= ""; | |
tabinn="" | |
kk=0; | |
//Basic report from Offline Mode | |
//(1)BASIC DATA FROM OF LINE | |
//alert(JSON.stringify(offlinerouteinfo['user_area'][array[0]])) | |
// for (var i=0; i < offlinerouteinfo['user_area'][array[0]].length; i++) { | |
// var uifg= JSON.stringify(offlinerouteinfo['user_area'][array[0]][i].unique_key_lead);//remove double quotes | |
// uifg = uifg.replace(/"/g, ""); | |
// if(uifg==array[1]) | |
// { | |
tabinn += '<input type="hidden" value = '+array[0] +' id="Place" /> '; | |
// var dsf= JSON.stringify(offlinerouteinfo['user_area'][array[0]][i].name);//remove double quotes | |
// dsf = dsf.replace(/"/g, ""); | |
//load basic info and report hestrory | |
//tab+='<a href="#map-page45"><button class="md-trigger md-setperspective plus_but" data-toggle="modal" href="#responsive23"></button></a>' | |
//tab+='<div data-role="content"><div class="ui-grid-a" id="restau_infos"><div class="ui-block-a"><p><img src="~/../images/defaultuser.png" alt="jeannette photo"/><h4> '+dsf+'</h4> </p><p>'+" " +'</p></div></div></div><div id=detailsbind></div>'; | |
//alert(array[0]+ " " +array[1]) | |
//$('#menu').menu(); | |
//bind form data ie report popup | |
// tabinn+='<div data-role="content"><div class="ui-grid-a" id="restau_infos"><div class="center"><p><img src="~/../images/defaultuser.png" class="center" alt="jeannette photo"/><h4> '+array[1]+'</h4> </p><p> '+" " +'</p></div></div></div><div id=detailsbind></div>' | |
tabinn+='<div class="center"><p><img src="~/../images/defaultuser.png" class="center" alt="jeannette photo"/><h4> '+array[1]+'</h4> </p><p> '+" " +'</p></div><div id=detailsbind></div>' | |
tabinn += '<input type="hidden" value = '+ array[1] +' id="Uid" /> '; | |
// alert( JSON.stringify(offlinerouteinfo['formloaddynamic'])) | |
for(var i=0, len=offlinerouteinfo['formloaddynamic'].length; i < len; i++){ | |
//alert( JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)) | |
tabinn +='<label style="margin-top:10px;">'+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)+' : </label> '; | |
tabinn += '<input type="hidden" value = '+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)+' id="labelhead-'+ kk +'" /> '; | |
tabinn += '<input type="text" class="form-control" name = "'+ kk +'" id="dataenterdy-'+ kk +'" placeholder='+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label) +' required aria-required="true"/> '; | |
kk++; | |
} | |
// } | |
// } | |
//$('#leaddetails').html(tab); | |
$('#loadformand_person_info').html(tabinn); | |
// } | |
} | |
//can be removed below | |
// $.each( valueP, function( keyP, valueP ) | |
// { | |
// var name = JSON.stringify(valueP.name).replace(/"/g, ''); | |
// var company = JSON.stringify(valueP.company).replace(/"/g, ''); | |
// var phone = JSON.stringify(valueP.phone).replace(/"/g, ''); | |
// tab+='<div data-role="content"><div class="ui-grid-a" id="restau_infos"><div class="ui-block-a"><p><img src="~/../images/defaultuser.png" alt="jeannette photo"/><h4> '+name+'</h4> </p><p> '+company +'</p><p> Phone:'+phone +' </p></div></div></div><div id=detailsbind></div>'; | |
// head=1; | |
// }) | |
//can be removed above | |
//(2)ALLOW REPORT NOW OPTION | |
// detailed reports from online -- ie previous visit details | |
//(1) cHECK CONNECTION- iF EXIST WAIT TO BIND | |
//(2)ELSE BIND IT FAST | |
// $.ajax({ | |
// url : "http://ammras-ammras.rhcloud.com/report/lead_info_mobile/", | |
// type : 'POST', | |
// cache : false, | |
// async: false, | |
// crossDomain: true, | |
// dataType : 'json', | |
// data : { | |
// leadnameuid: array[1] , username: window.localStorage.getItem("username") | |
// } | |
// }).done(function(data) | |
// { | |
// var head=0; | |
// $.each( data, function( keyP, valueP ) | |
// { | |
// if((keyP=="lead_info")&&(head==0)) | |
// { | |
// } | |
// if(keyP=="reports") | |
// { | |
// $.each( valueP, function( keyP, valueP ) | |
// { | |
// tabinn+='<li>'; | |
// var daterep = JSON.stringify(valueP[1].Dateofreportentering).replace(/\{|\}/gi,''); | |
// daterep=daterep.replace(/"/g, ''); | |
// var st = JSON.stringify(valueP[0]).replace(/\{|\}/gi,''); | |
// st=st.replace(/"/g, ''); | |
// //st=st.replace(/,/g, , ); | |
// st=st.replace(/ *, */g, ' | '); | |
// tabinn+='<a href="#"><span style="font-size:18px; font-weight:400; padding:10px 0px 10px 0px;"> <br>'+daterep+'</span><br>'; | |
// tabinn+='<span style="font-size:12px; color: rgba(105, 110, 109, 0.98); font-weight:100; padding:10px 0px 10px 0px;">'+st+'</span>'; | |
// tabinn+='</li>'; | |
// $('#leaddetails').html(tab); | |
// $('#detailsbind').html(tabinn); | |
// }) | |
// } | |
// }) | |
// }) | |
//REPORTS get day vise reports- From server and load | |
function call() | |
{ | |
// AREA WHERE TASKS ARE LOADED | |
var tablereport=""; | |
var table=""; | |
var table1=""; | |
var formtotabel= new Array(); | |
sometokentoexit=0; | |
//window.localStorage.setItem("username", "[email protected]"); | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/reports/getreports_view_mobile/", | |
type : 'POST', | |
cache : false, | |
async: false, | |
crossDomain: true, | |
dataType : 'json', | |
data : { | |
username: window.localStorage.getItem("username") | |
} | |
}).done(function(data) { | |
$.each( data, function( keyP, valueP ) { | |
$.each( valueP, function( keyP, valueP ) { | |
// alert(JSON.stringify(valueP[0])) | |
// alert(JSON.stringify(valueP[0][1].Dateofreportentering)) | |
// $.each( valueP, function( keyP, valueP ) { | |
// alert( JSON.stringify(valueP[1])) | |
// alert(JSON.stringify(valueP)) | |
//loop data in between | |
nameoflead=JSON.stringify(valueP[0].leadid).replace(/"/g, ''); | |
// alert(nameoflead) | |
// {"0":[{"Product promoted":"dsfs","Gift given":"Books","leadid":"Jagan,Nath,,534543","Next Followup reminders":"sdfdssdfds"},{"territory":"Ernamkulam-Kunathunadu","Dateofreportentering":"2015-07-21 10:38:27"}], | |
// "1":[{"Product promoted":"sd","leadid":"Soman,,,","Next Followup reminders":"sdsfsf"},{"territory":"Ernamkulam-Kunathunadu","Dateofreportentering":"2015-07-21 10:39:36"}]} | |
var maindata = JSON.stringify(valueP[1]).replace(/\{|\}/gi,''); | |
maindata=maindata.replace(/"/g, ''); | |
//st=st.replace(/,/g, , ); | |
maindata=maindata.replace(/ *, */g, ' | '); | |
var subdata = JSON.stringify(valueP[0]).replace(/\{|\}/gi,''); | |
subdata=subdata.replace(/"/g, ''); | |
//st=st.replace(/,/g, , ); | |
subdata=subdata.replace(/ *, */g, ' | '); | |
tablereport+='<li>'; | |
tablereport+='<a href="#"><span style="font-size:18px; font-weight:400; padding:10px 0px 10px 0px;">'+nameoflead+'</span><span style="padding: 10px 16px;width: 100px;float: right;margin-top: -33px;margin-right: -80px;font-size:14px"></span><br>'; | |
tablereport+='<span style="font-size:12px; font-weight:100; padding:10px 0px 10px 0px;">'+ subdata+'</span>'; | |
tablereport+='<span style="color: #ACACAC;width: 100%;float: left;padding: 5px;margin-left: -5px;font-size:14px">'; | |
tablereport+=maindata+'</span></a>'; | |
tablereport+='</li>'; | |
tablereport+='</li>'; | |
$('#reportsload').html(tablereport); | |
// }) | |
}) | |
}) | |
// alert(tablereport) | |
// $('#menu').menu(); | |
}) | |
} | |
//List pending synch items | |
$(document).ready(function() | |
{ | |
$('#myaccount').click(function(e) | |
{ | |
call_synch_pending() | |
$('#mynewlist').listview('refresh') | |
}); | |
}); | |
function call_synch_pending(obj) | |
{ | |
db.transaction(queryDB, errorCB); | |
// $('#dataView').listview(); | |
} | |
//SAVE REPORTS FROM MOBILE To SERVER | |
// TRANS DATA | |
function divclick(obj) | |
{ | |
var element = $(obj).attr('id'); | |
var array = element.split('-'); | |
// var product_promoted=$("#product_promoted-"+array[1]).val(); | |
//var anticipating_order=$("#anticipating_order-"+array[1]).val(); | |
// var product_remarks=$("#product_remarks-"+array[1]).val(); | |
// var next_visit_details=$("#next_visit_details-"+array[1]).val(); | |
var leadid=$("#Uid-"+array[1]).val();//lead id | |
var MyDiv1 = document.getElementById('search_query'); | |
var Uid=window.localStorage.getItem("username"); | |
var territory=$("#territory-"+array[1]).val(); | |
var datatobepass="{"; | |
for (i = 0; i < rr; i++) { | |
var kk="label-"+i+","+array[1] | |
var labelval= document.getElementById(kk).value//$("#label-1,0").val();//$("#label-"+i+","+array[1]).text() | |
// alert(labelval) | |
var jjj=parseInt(array[1])+1 | |
datatobepass += "'" + labelval+ "':'" | |
var ss= ""+ i + ","+array[1]; | |
datatobepass += document.getElementById(ss).value; | |
//alert(ss) | |
//alert(jjj+ ":"+ ss + ":: " +document.getElementById(ss).value) | |
datatobepass +="',"; | |
} | |
datatobepass +="'Otherdata' :'{"; | |
datatobepass +=MyDiv1.innerHTML; | |
datatobepass +="}',"; | |
datatobepass +="'Uid' :'"; | |
datatobepass += Uid; | |
datatobepass +="',"; | |
datatobepass +="'leadid' :'"; | |
datatobepass += leadid; | |
datatobepass +="',"; | |
datatobepass +="'territory_reported' :'"; | |
datatobepass += territory; | |
datatobepass +="'}"; | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
//url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : datatobepass, | |
// data : {product_promoted : product_promoted ,anticipating_order : anticipating_order, product_remarks : product_remarks, next_visit_details : next_visit_details,user_info : user_info,territory : territory,Uid : Uid } | |
}).done(function(data) { | |
$('input[type="text"],textarea').val(''); | |
}).fail(function(a, b, c, d) { | |
// $('#loadingmessage').hide(); | |
// $('#main').show(); | |
//$('input[type="text"],textarea').val(''); | |
// | |
var submitButton = $(this, "input[type='button']"); | |
$(submitButton).attr("disabled", "true"); | |
$("#sendwrapper").prepend('<span>Data saved.... </span>') | |
}); | |
} | |
//SAVE TO JSON OFFLINE MODE STARTS | |
function onLoad() { | |
document.addEventListener("deviceready", onDeviceReady, false); | |
} | |
//CHECK BASIC DATA IN LOCAL IS UPTODATE GET data in --writedata--variable | |
function checkisupdate() | |
{ | |
// window.localStorage.setItem("username", "[email protected]"); | |
var user_info=window.localStorage.getItem("username"); | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/usersettings/check_if_update_or_data_mob/", | |
type : 'POST', | |
cache : false, | |
async: false, | |
crossDomain: true, | |
dataType : 'json', | |
data : {user_info : user_info } | |
}).done(function(data) { | |
writedata=data; | |
//alert(JSON.stringify(writedata)) | |
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);//write full data-- out in to | |
// window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); | |
}).fail(function(a, b, c, d) { | |
}); | |
} | |
//Write data to.json -- file | |
function gotFS(fileSystem) { | |
fileSystem.root.getFile("to.json", {create: true, exclusive: false}, gotFileEntry, fail); | |
} | |
//WRITER TP | |
function gotFileEntry(fileEntry) { | |
fileEntry.createWriter(gotFileWriter, fail); | |
} | |
function gotFileWriter(writer) { | |
if(JSON.stringify(writedata) !== '{}') { | |
writer.onwriteend = function(evt) { | |
// console.log("contents of file now 'some sample text'"); | |
writer.truncate(11); | |
writer.onwriteend = function(evt) { | |
// console.log("contents of file now 'some sample'"); | |
writer.seek(4); | |
// alert("writedataTP") | |
// alert(writedataTP) | |
//alert("Write ***** \n" + JSON.stringify(writedata)) | |
// alert(JSON.stringify(writedata)) | |
writer.write(writedata); | |
// alert("Write") | |
writer.onwriteend = function(evt){ | |
// console.log("contents of file now 'some different text'"); | |
} | |
}; | |
}; | |
writer.write(writedata); | |
} | |
} | |
function fail(error) { | |
console.log(error.code); | |
} | |
// Read data saved in report | |
function gotFSReadReport(fileSystem) { | |
fileSystem.root.getFile("DailyReport.json", {create: true, exclusive: false}, gotFileEntryReadReport, fail); | |
} | |
function gotFileEntryReadReport(fileEntry) { | |
fileEntry.file(gotFileReport, fail); | |
} | |
function gotFileReport(file){ | |
// readDataUrl(file); | |
readAsTextReport(file); | |
} | |
function readAsTextReport(file) { | |
// alert("dfgfd") | |
var reader = new FileReader(); | |
reader.onloadend = function(evt) { | |
// alert("sucess read2") | |
// console.log("Read as text"); | |
// console.log(evt.target.result); | |
//alert(evt.target.result); | |
}; | |
reader.readAsText(file); | |
} | |
function fail(evt) { | |
console.log(evt.target.error.code); | |
} | |
//Read data saved in report end | |
//TP SESSION ENDS | |
//SAVE TO JSON OFFLINE MODE ENDS | |
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods | |
function onDeviceReady() { | |
//removed now-- testing | |
navigator.geolocation.getCurrentPosition(onSuccess, onError);//location track | |
//window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSReadReport, fail); | |
db = window.openDatabase("Database", "1.0", "Ammras", 200000); | |
} | |
setInterval(function() { | |
//read report saved | |
//window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSReadReport, fail); | |
//removed now --testing | |
navigator.geolocation.getCurrentPosition(onSuccess, onError); | |
}, 1000 * 60 * 1); //10 min | |
//location track | |
var lead_add_more=""; | |
// ONE FUNCTION TO SAVE ALL GPS LOCATION IN REG INTERVAL SAVE | |
function onSuccess(position) | |
{ | |
//var element = document.getElementById('geolocation'); | |
// alert(position.coords.latitude + ":" + position.coords.longitude) | |
lead_lan_long="("+position.coords.latitude + "," + position.coords.longitude + ")"; | |
//element.innerHTML = 'Latitude: ' + position.coords.latitude + | |
// ' Longitude: ' + position.coords.longitude ; | |
//code tot get date and time local | |
var DateTime = new Date(); | |
var strYear= DateTime.getFullYear(); | |
var strMonth= DateTime.getMonth() +1; | |
var strDay = DateTime.getDate(); | |
var strHours = DateTime.getHours(); | |
var strMinutes = DateTime.getMinutes(); | |
var strSeconds = DateTime.getSeconds(); | |
var datetimeret = strDay + "/" + strMonth + "/" + strYear + " " + strHours + ":" + strMinutes + ":" + strSeconds; | |
// var dateget= strMonth + "-" + strDay + "-" + strYear; | |
// var timeget= strHours + ":" + strMinutes + ":" + strSeconds; | |
alert(dateget + " ..." + timeget ); | |
//code to get date and time loacl ends | |
//Code to get loaction info | |
var geocoder = new google.maps.Geocoder; | |
var input = lead_lan_long; | |
var newString = input.substr(1, input.length-2); | |
var latlngStr = newString.split(',', 2); | |
var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])}; | |
geocoder.geocode({'location': latlng}, function(results, status) { | |
if (status === google.maps.GeocoderStatus.OK) { | |
if (results[1]) { | |
lead_add_more = results[1].formatted_address;// place name | |
var lat=parseFloat(latlngStr[0]); | |
var longi=parseFloat(latlngStr[1]); | |
// alert("latitude is: "+ lat+ " longitude is: "+ longi); | |
//lead add map | |
mapCenter = new google.maps.LatLng(lat, longi), | |
myOptions = { | |
zoom:10, | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
center: mapCenter, | |
}, | |
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions), | |
marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(lat, longi), | |
map: map, | |
title:"Current Location!" | |
}) | |
//report section map | |
mapCenterreport = new google.maps.LatLng(lat, longi), | |
myOptions = { | |
zoom:10, | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
center: mapCenterreport, | |
}, | |
mapreport = new google.maps.Map(document.getElementById("map_canvas_report"), myOptions), | |
marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(lat, longi), | |
map: mapreport, | |
title:"Current Location!" | |
}) | |
//CHECK NET connection | |
var aaa=checkConnection(); | |
if(aaa!="No network connection") | |
{ | |
//call the save method when the fuction returns and net present | |
var user_info=window.localStorage.getItem("username"); | |
$.ajax({ | |
//url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
url : "http://ammras-ammras.rhcloud.com/report/gps_save_auto/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : {Latitude : position.coords.latitude ,Longitude : position.coords.longitude,user_info : user_info,name_of_location:lead_add_more,localdatetime:datetimeret } | |
}).done(function(data) { | |
}).fail(function(a, b, c, d) { | |
}); | |
//save method ends here | |
} | |
else | |
{ | |
locationdata="{" | |
locationdata += "'Latitude':'" | |
locationdata += position.coords.latitude; | |
locationdata +="',"; | |
locationdata += "'Longitude':'" | |
locationdata += position.coords.longitude; | |
locationdata +="',"; | |
locationdata += "'user_info':'" | |
locationdata += user_info; | |
locationdata +="',"; | |
locationdata += "'name_of_location':'" | |
locationdata += lead_add_more; | |
locationdata +="',"; | |
locationdata += "'localdatetime':'" | |
locationdata += datetimeret; | |
locationdata +="''}"; | |
//alert(locationdata) | |
//no net connection | |
//WRITE DATA TO FILE | |
//window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSLocation, fail); | |
//no net connection | |
} | |
} else { | |
window.alert('No results found'); | |
} | |
} else { | |
window.alert('Geocoder failed due to: ' + status); | |
} | |
}); | |
//Code to get loaction info ends | |
} | |
// onError Callback receives a PositionError object | |
// | |
function onError(error) { | |
alert('code: ' + error.code + '\n' + | |
'message: ' + error.message + '\n'); | |
} | |
//read section | |
var states = {}; | |
function checkConnection() { | |
var networkState = navigator.connection.type; | |
states[Connection.UNKNOWN] = 'Unknown connection'; | |
states[Connection.ETHERNET] = 'Ethernet connection'; | |
states[Connection.WIFI] = 'WiFi connection'; | |
states[Connection.CELL_2G] = 'Cell 2G connection'; | |
states[Connection.CELL_3G] = 'Cell 3G connection'; | |
states[Connection.CELL_4G] = 'Cell 4G connection'; | |
states[Connection.CELL] = 'Cell generic connection'; | |
states[Connection.NONE] = 'No network connection'; | |
// alert('Connection type: ' + states[networkState]); | |
return states[networkState]; | |
} | |
</script> | |
<script type="text/javascript" src="js/jquery-sliding-menu.js" ></script> | |
<script type="text/javascript"> | |
//$.noConflict(); | |
$(document).ready(function() | |
{ | |
maincall(); | |
//end document ready | |
}); | |
//test 2 end | |
// // call the category ends | |
// callback([ | |
// 'Product promoted', | |
// 'Samples given', | |
// 'Order taken', | |
// 'Gift', | |
// 'Quantity', | |
// // { label: 'city', category: 'location' }, | |
// // { label: 'address', category: 'location' }, | |
// // { label: 'country', category: 'location' }, | |
// // { label: 'U.S. State', category: 'location' }, | |
// ]); | |
/* | |
$(window).ready(function() { | |
$('#magazine').turn({ | |
display: 'single', | |
acceleration: true, | |
gradients: !$.isTouch, | |
elevation:50, | |
when: { | |
turned: function(e, page) { | |
} | |
} | |
}); | |
}); | |
$(window).bind('keydown', function(e){ | |
if (e.keyCode==37) | |
$('#magazine').turn('previous'); | |
else if (e.keyCode==39) | |
$('#magazine').turn('next'); | |
}); | |
*/ | |
function maincall() | |
{ | |
//$('#menu').menu(); | |
$('#main').hide(); | |
$('#loadingmessage').show(); | |
window.localStorage.setItem("username", "[email protected]"); | |
var aaa=checkConnection(); | |
//alert(aaa) | |
if(aaa!="No network connection") | |
{ | |
// alert("gdfgdfg") | |
checkisupdate() | |
//checkif_tp_update() | |
} | |
//alert("dgdfgd") | |
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSRead, fail); | |
//window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotTPFSRead, fail); | |
function gotFSRead(fileSystem) { | |
fileSystem.root.getFile("to.json", {create: true, exclusive: false}, gotFileEntryRead, fail); | |
} | |
function gotFileEntryRead(fileEntry) { | |
fileEntry.file(gotFileRead, fail); | |
} | |
function fail(evt) { | |
console.log(evt.target.error.code); | |
} | |
var iter=0; | |
var setinn=0; | |
var setval_pro_fetch=0; | |
var table=""; | |
var table1=""; | |
var $placebind = $("#placebind"); | |
var $placebindfirst = $("#placebindfirst"); | |
var formtotabel= new Array(); | |
sometokentoexit=0; | |
var tabinn=""; | |
function gotFileRead(file){ | |
var reader = new FileReader(); | |
reader.onloadend = function(evt) { | |
var aa= evt.target.result; | |
//alert(JSON.stringify(aa)) | |
aa=(evt.target.result).substr(4)//remove first 4 as it has some junk | |
var obj = eval ("(" + aa + ")"); | |
//alert(obj.user_area[0].name) | |
offlinerouteinfo=obj; | |
// alert(JSON.stringify(offlinerouteinfo)) | |
//loading info is moved to here | |
if(JSON.stringify(offlinerouteinfo) !== '{}') { | |
//alert(JSON.stringify(offlinerouteinfo["user_tp"])) | |
/* | |
table += " <li><a >"; | |
table += key; | |
table += "</a>"; | |
table += "<ul >"; | |
for (var i in offlinerouteinfo['user_tp'][0]['planned_work_info']) { | |
title = JSON.stringify(offlinerouteinfo['user_tp'][0]['planned_work_info'][i].route_of_work).replace(/\\/g, ''); | |
uid = JSON.stringify(offlinerouteinfo['user_tp'][0]['planned_work_info'][i].leadinfo).replace(/\\/g, ''); | |
table +="<li><a href='#'>"; | |
table +=uid//JSON.stringify(value1.name) | |
table +="</a>"; | |
table +="<ul><li>"; | |
table +=" <a href='#'>" | |
table +=" Territory : " | |
table += '<label >'+ title + '</label>' ; | |
table += '<input type="hidden" id="territory-'+ iter +'" value= '+ title + '>' ; | |
table += '<input type="hidden" id="Uid-'+ iter +'" value= '+ uid + '>' ; | |
table +=" | Meeting person : " | |
table +=uid//JSON.stringify(value1.name) | |
table +="</a>" | |
table +="</li><li>"; | |
table +='<div id="formload-' + loopnoform +'"></div>' | |
kk=0; | |
loopnoform++; | |
table +='<div onClick="divclick(this)" id="book-'+ iter +'">'; | |
table +='<button type="button" class="off" id="confirm-'+ iter +'">Report</button>'; | |
table +='</div>'; | |
table +=' <div id="sendwrapper"><p></p>' | |
table +=' </div>' ; | |
table +="</li></ul></li>"; | |
iter++; | |
} | |
table += "</ul></li>" | |
*/ | |
} | |
table1 += ''; | |
//TERRITORY & LEADS | |
for (var key in offlinerouteinfo['user_area']) { | |
//alert(JSON.stringify(key)) | |
table1 +='<li>'; | |
table1 +='<a href="#">'+ JSON.stringify(key) + '</a><ul>'; | |
$placebind.append("<option>" + JSON.stringify(key) + "</option>"); | |
$placebindfirst.append("<option>" + JSON.stringify(key) + "</option>"); | |
//alert(JSON.stringify(offlinerouteinfo['user_area'][key] )) | |
//alert(JSON.stringify(offlinerouteinfo.user_area[0].area[i].lead_info[0].unique_key)) | |
//$.each( value, function( key1, value1 ) { | |
//for (var ii=0; ii < offlinerouteinfo.user_area[0].area[i].lead_info.length; ii++) { | |
for (var i=0; i < offlinerouteinfo['user_area'][key].length; i++) { | |
//for (var key in offlinerouteinfo['user_area']) { | |
//alert(JSON.stringify(offlinerouteinfo.user_area[0].area[i].lead_info[ii].unique_key)) | |
var dsf= JSON.stringify(offlinerouteinfo['user_area'][key][i].name);//remove double quotes | |
dsf = dsf.replace(/"/g, ""); | |
var uifg= JSON.stringify(offlinerouteinfo['user_area'][key][i].unique_key_lead);//remove double quotes | |
uifg = uifg.replace(/"/g, ""); | |
var territory= JSON.stringify(key);//remove double quotes | |
territory = territory.replace(/"/g, ""); | |
territory=territory.replace(/\s+/g, '-').toLowerCase(); | |
var valuepass=territory +'**'+ uifg; | |
//'+territory+'**'+uifg+' | |
//table1 +='<button class="md-trigger md-setperspective rightarr_but" data-toggle="modal" href="#responsive23"></button>' | |
//ammu | |
table1 +='<li><a href="#" onClick="lead_details(this)" id='+valuepass+' >'+ dsf + '</a>' | |
//table1 +='<ul><div id=leaddetails></div></ul></li>';change is happend here | |
table1 +='<ul><a href="#map-page45"></a><div data-role="content"><div class="ui-grid-a" id="restau_infos"><div class="ui-block-a"><p class="usr-img"><img src="~/../images/defaultuser.png" alt="jeannette photo"/><h4 style="padding-left:23px;"> '+dsf+'</h4> </p><p>'+" " +'</p></div></div></div><div id=detailsbind></div>'; | |
//table1 +='</ul><ul>'; | |
//table1 +='<li>Rata</li>'; | |
table1 +='<li><a href="#" onClick="lead_details(this)" id='+valuepass+'>Report Now</a><ul><li>' | |
//table1 +='<div id="loadformand_person_info"></div>'; | |
//table1 +='<div><div id="loadformand_person_info"></div></div>'; | |
//REPORT NOW SECTION | |
table1+='<div class="center"><p><img src="~/../images/defaultuser.png" class="center" alt="jeannette photo"/><h4> '+dsf+'</h4> </p><p> '+" " +'</p></div><div id=detailsbind></div>' | |
table1 += '<input type="hidden" value = '+ dsf +' id="Uid" /> '; | |
//REPORT NOW DYNAMIV FROM | |
for(var i=0, len=offlinerouteinfo['formloaddynamic'].length; i < len; i++){ | |
//alert( JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)) | |
table1 +='<label style="margin-top:10px;">'+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)+' : </label> '; | |
table1 += '<input type="hidden" value = '+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label)+' id="labelhead-'+ kk +'" /> '; | |
table1 += '<input type="text" class="form-control" name = "'+ kk +'" id="dataenterdy-'+ kk +'" placeholder='+ JSON.stringify(offlinerouteinfo['formloaddynamic'][i].label) +' required aria-required="true"/> '; | |
kk++; | |
} | |
table1 += '<button type="button" data-dismiss="modal" class="btn">Close</button>'; | |
table1 += '<button type="button" onclick="savereportsvtp()" class="btn btn-primary">Save changes</button>'; | |
table1 +='</li></ul></li>' | |
table1 +='<li><a href="#">Location</a><ul><li>' | |
//LOCATION SECTION | |
table1 +='<button class="md-trigger md-setperspective rightarr_but" data-toggle="modal" href="#responsive23"></button>' | |
table1 +='<div class="ui-bar-c ui-corner-all ui-shadow" data-role="content" style="padding: 1em;">' | |
table1 +='<div id="map_canvas_report" style="height: 400px;"></div></div>' | |
table1 +='<p><div class="container"> <div class="select-wrapper"> <select class="selectnew" id="weekdaysworking"><option>All Week days</option><option>Mondays</option><option>Tuesday</option><option>Wednesday</option><option>Thursday</option><option>Friday</option><option>Saturdays</option></select><span class="select-icon entypo-arrow-combo"></span></div></div></p>' | |
table1 +='<p><input type="text" id="lead_timing" placeholder="Timing" name="lead_timing" class="span12" /></p>' | |
//LOCATION SECTION ENDS | |
table1 +='</li></ul></li>'; | |
table1 +='<li><a href="#">History</a><ul><li><a href="#">History</a></li></ul></li>'; | |
table1 +='<li><a href="#">Product presentation</a><ul><li><a href="#">Product presentation</a></li></ul></li>'; | |
table1 +='<li><a href="#">Survey Info</a><ul><li><a href="#">Survey Info</a></li></ul></li>'; | |
table1 +='<li><a href="#">Outlet Info</a><ul><li><a href="#">Outlet Info</a></li></ul></li>'; | |
table1 +='<li><a href="#">Stock Position</a><ul><li><a href="#">Stock Position</a></li></ul></li>'; | |
table1 +='<li><a href="#">Order taking</a><ul><li><a href="#">Order taking</a></li></ul></li>'; | |
table1 +='</ul></li>'; | |
// tabinn+='<div data-role="content"><div class="ui-grid-a" id="restau_infos"><div class="ui-block-a"><p><img src="~/../images/defaultuser.png" alt="jeannette photo"/><h4> '+dsf+'</h4> </p><p> '+" " +'</p></div></div></div><div id=detailsbind></div>' | |
// $('#loadformand_person_info').html(tabinn); | |
//till here | |
} | |
//}); | |
table1 +='</ul></li>'; | |
//alert(JSON.stringify(offlinerouteinfo)) | |
//}); | |
} | |
//for(var ii=0; ii<loopnoform; ii++) | |
//{ | |
//$('#formload-'+ ii).html(formtotabel[ii]); | |
//}; | |
$('#testdata1').html(table1); | |
$('#loadingmessage').hide(); | |
$('#main').show(); | |
$('#menu').menu(); | |
//LEADS SECTION -ends | |
//$('#place').html(tableterritorylead); | |
//alert(tableterritorylead) | |
//sales cart | |
$('#SmartCart').smartCart(); | |
aa=[] | |
if(JSON.stringify(tpdata) !== '{}') { | |
// alert(JSON.stringify(tpdata)) | |
for (var i in tpdata['user_tp'][0]['planned_work_info']) { | |
title = JSON.stringify(tpdata['user_tp'][0]['planned_work_info'][i].route_of_work).replace(/\\/g, ''); | |
//title= title.replace (/"/g,'') | |
title +="\n" | |
title += JSON.stringify(tpdata['user_tp'][0]['planned_work_info'][i].leadinfo).replace(/\\/g, ''); | |
//title= title.replace (/"/g,'') | |
//alert(title) | |
aa.push({title:title,start:JSON.stringify(tpdata['user_tp'][0]['planned_work_info'][i].date_of_worK)}); | |
} | |
} | |
$('#calendar').fullCalendar({ | |
events: | |
aa, | |
dayClick: function(date, jsEvent, view) { | |
document.getElementById("Date").setAttribute('value',date.format()); | |
//alert('Clicked on: ' + date.format()); | |
// alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); | |
// alert('Current view: ' + view.name); | |
// my_function(); | |
// .fullCalendar( 'gotoDate', date ) | |
// change the day's background color just for fun | |
//$(this).css('background-color', 'red'); | |
$('#calendar').fullCalendar('changeView', 'agendaDay'); | |
// $('#calendar').fullCalendar('gotoDate', date); | |
} | |
}); | |
//loading info end here | |
}; | |
reader.readAsText(file); | |
} | |
//read data local | |
//GET DATA | |
//Inside task add, when place pic, bind the leads in that territory | |
$("#placebindfirst").change(function() { | |
var value = $('#placebindfirst').val(); | |
var $leadbind = $("#leadbind"); | |
for (var key in offlinerouteinfo['user_area']) { | |
actkey=key | |
key='"'+ key+ '"' | |
if(key == value) | |
{ | |
for (var i=0; i < offlinerouteinfo['user_area'][actkey].length; i++) { | |
$leadbind.append("<option>" + JSON.stringify(offlinerouteinfo['user_area'][actkey][i].name) + "</option>"); | |
} | |
} | |
} | |
}); | |
//BIND DATA TO VIEW | |
// var currentDate = new Date() | |
// var day = currentDate.getDate() | |
// var month = currentDate.getMonth() + 1 | |
// var year = currentDate.getFullYear() | |
// var currentDate= month + "/" + day + "/" + year | |
//TP SECTION -starts | |
// $.each( value, function( key1, value1 ) { | |
// if(typeof JSON.stringify(value1[1]) != 'undefined'){ | |
// for(var ii=0; ii<iter+1; ii++) | |
// { | |
// kk=0; | |
// formtotabel[ii] =""; | |
// formtotabel[ii] +="<label style='margin-top:10px;margin-bottom: 10px;'>Enter task done : </label> "; | |
// formtotabel[ii] +=' <div id="search_box_container'+ii+'"></div>'; | |
// formtotabel[ii] +=' <div style="visibility:hidden;height: 0px" id="search_query"></div>'; | |
// $.each(value1, function(index, formdata) | |
// { | |
// formtotabel[ii] +="<label style='margin-top:10px;'>"+ JSON.stringify(formdata.label)+" : </label> "; | |
// formtotabel[ii] += '<input type="hidden" value = '+ JSON.stringify(formdata.label)+' id="label-'+ kk +"," + ii +'" /> '; | |
// formtotabel[ii] += '<input type="text" class="form-control" name = "'+ kk +"," + ii +'" id="'+ kk +"," + ii +'" placeholder='+ JSON.stringify(formdata.alias) +' " required aria-required="true"/> '; | |
// kk++; | |
// }) | |
// rr=kk; | |
// }; | |
// } | |
//TP SECTION -ends | |
//LEADS SECTION -starts | |
//WHOLE LEADS | |
//category ends | |
// $('#main').show(); | |
//$('#testdata').html(table); | |
//sales cart end | |
//popup | |
jquery164(function(){ | |
jquery164.fn.modalmanager.defaults.resize = true; | |
$('[data-source]').each(function(){ | |
var $this = $(this), | |
$source = $($this.data('source')); | |
var text = []; | |
$source.each(function(){ | |
var $s = $(this); | |
if ($s.attr('type') == 'text/javascript'){ | |
text.push($s.html().replace(/(\n)*/, '')); | |
} else { | |
text.push($s.clone().wrap('<div>').parent().html()); | |
} | |
}); | |
$this.text(text.join('\n\n').replace(/\t/g, ' ')); | |
}); | |
prettyPrint(); | |
}); | |
//poup | |
//var out=[]; | |
//CALENDAR--STARTS | |
$('#today-button').click(function() { | |
// alert("test") | |
// $('#calendar').fullCalendar('today'); | |
$('#calendar').fullCalendar('changeView', 'month'); | |
}); | |
//alert(JSON.stringify(tpdata['user_tp'][0]['planned_work_info'])) | |
//alert(JSON.stringify(tpdata)) | |
//calendar endS | |
var pro=[]; | |
var gift=[]; | |
//test 2 | |
//for loop for number of leads and bind products, gift ,samples | |
for (var gg=0;gg<=iter; gg++) | |
{ | |
window.visualSearch = VS.init({ | |
container : $('#search_box_container'+gg), | |
query : '', | |
showFacets : true, | |
readOnly : false, | |
unquotable : [ | |
'text', | |
'account', | |
'filter', | |
'access' | |
], | |
callbacks : { | |
search : function(query, searchCollection) { | |
//alert("ha3") | |
var $query = $('#search_query'); | |
$query.stop().animate({opacity : 1}, {duration: 300, queue: false}); | |
$query.html('' + searchCollection.serialize() + ''); | |
// clearTimeout(window.queryHideDelay); | |
// window.queryHideDelay = setTimeout(function() { | |
// $query.animate({ | |
// opacity : 0 | |
// }, { | |
// duration: 1000, | |
// queue: false | |
// }); | |
// }, 2000); | |
}, | |
valueMatches : function(category, searchTerm, callback) { | |
//alert("ha2") | |
switch (category) { | |
case 'Product promoted': | |
// callback([ | |
// { value: '1-DOMESTIC SYSTEMS', label: 'DOMESTIC SYSTEMS ' }, | |
// { value: '2-COMMERCIAL SYSTEMS ', label: 'COMMERCIAL SYSTEMS ' }, | |
// { value: '3-AIR BLOWERS ', label: 'AIR BLOWERS ' }, | |
// { value: '4-jeremy', label: 'Jeremy' }, | |
// { value: '5-samuel', label: 'Samuel' }, | |
// { value: '6-scott', label: 'Scott' } | |
// ]); | |
//product bind | |
callback(pro) | |
//product bind end | |
break; | |
case 'Sample given': | |
callback(pro) | |
//callback(['Jeremy', 'Azerbaijan', 'Alabama']); | |
break; | |
case 'Orders': | |
callback(['1', '2', '3','4','5','6','7']); | |
break; | |
case 'Order taken': | |
callback(pro) | |
//callback(['Angeles', 'Arkansas', 'Alabama']); | |
break; | |
case 'Gift given': | |
callback(gift) | |
// callback([ | |
// 'Gift coupon', | |
// 'Discount coupon', | |
// 'Service coupon', | |
// 'Books' | |
// ]); | |
break; | |
} | |
}, | |
facetMatches : function(callback) { | |
// if(setval_pro_fetch==0){ | |
//call the category | |
$.ajax({ | |
//url : "http://ammras-ammras.rhcloud.com/report/route_get_mob_call/", | |
url : "http://ammras-ammras.rhcloud.com/usersettings/formsettings_addons_mob/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : { | |
username: window.localStorage.getItem("username"), | |
north:10, | |
south: 10, | |
east:10, | |
west:10} | |
}).done(function(data) | |
{ | |
//alert(JSON.stringify(data)) | |
out=[] | |
pro=[] | |
gift=[] | |
//category | |
for (var key in data["lead_info"][0]) { | |
if(key!="companyauthemail") | |
{ | |
var out1 = JSON.stringify(data["lead_info"][0][key]).replace(/"/g, ''); | |
out.push(out1); | |
} | |
} | |
//category ends | |
//products | |
// alert(JSON.stringify(data["companyproducts"])) | |
for (var key in data["companyproducts"]) { | |
//if(key!="companyauthemail") | |
// { | |
var out1 = JSON.stringify(data["companyproducts"][key]).replace(/"/g, ''); | |
out1 = out1.replace(/\{|\}/gi,''); | |
out1 = out1.replace("productname:", ''); | |
//maindata=maindata.replace(/ *, */g, ' | '); | |
pro.push(out1); | |
// } | |
// alert(pro) | |
} | |
//products ends | |
//gifts | |
for (var key in data["companygift"][0]) { | |
//if(key!="companyauthemail") | |
// { | |
var out1 = JSON.stringify(data["companygift"][0][key]).replace(/"/g, ''); | |
gift.push(out1); | |
// } | |
} | |
//gifts ends | |
callback(out); | |
}) | |
//category bind end | |
// } | |
} | |
} | |
}); | |
} | |
} | |
//Daily data read local file -- Daily Data----------------------------- | |
function gotFSReadReportDailyData(fileSystem) { | |
fileSystem.root.getFile("dailydata.json", {create: true, exclusive: false}, gotFileEntryReadReportDailyData, fail); | |
} | |
function gotFileEntryReadReportDailyData(fileEntry) { | |
fileEntry.file(gotFileReportDailyData, fail); | |
} | |
function gotFileReportDailyData(file){ | |
// readDataUrl(file); | |
readAsTextReportDailyData(file); | |
} | |
function readAsTextReportDailyData(file) { | |
var reader = new FileReader(); | |
reader.onloadend = function(evt) { | |
// alert("sucess read2") | |
// console.log("Read as text"); | |
// console.log(evt.target.result); | |
alert(evt.target.result); | |
writedata_datily=evt.target.result; | |
}; | |
reader.readAsText(file); | |
} | |
function fail(evt) { | |
console.log(evt.target.error.code); | |
} | |
//Daily data save to file******** DAILY DATA ******************** | |
//Write data to.json -- file | |
function gotFSDailyData(fileSystem) { | |
fileSystem.root.getFile("dailydata.json", {create: true, exclusive: false}, gotFileEntryDailyData, fail); | |
} | |
//WRITER TP | |
function gotFileEntryDailyData(fileEntry) { | |
fileEntry.createWriter(gotFileWriterDailyData, fail); | |
} | |
function gotFileWriterDailyData(writer) { | |
if(JSON.stringify(writedata_datily) !== '{}') { | |
writer.onwriteend = function(evt) { | |
// console.log("contents of file now 'some sample text'"); | |
writer.truncate(11); | |
writer.onwriteend = function(evt) { | |
// console.log("contents of file now 'some sample'"); | |
writer.seek(4); | |
// alert("writedataTP") | |
// alert(writedataTP) | |
//alert("Write ***** \n" + JSON.stringify(writedata)) | |
// alert(JSON.stringify(writedata)) | |
writer.write(writedata_datily); | |
alert("Write") | |
writer.onwriteend = function(evt){ | |
// console.log("contents of file now 'some different text'"); | |
} | |
}; | |
}; | |
writer.write(writedata_datily); | |
} | |
} | |
function fail(error) { | |
console.log(error.code); | |
} | |
// lead save to db | |
function populateDB(tx) { | |
var rr=escape(JSON.stringify(onedata)); | |
//var rr = [hash, JSON.stringify(d.data, null, ""); | |
//var jsonString = escape(JSON.stringify(d.data)); | |
//rr="First,Second,third,fourth"; | |
// alert(rr); | |
// tx.executeSql('DROP TABLE IF EXISTS LeadInfo'); | |
tx.executeSql('CREATE TABLE IF NOT EXISTS LeadInfo (data)'); | |
tx.executeSql('INSERT INTO LeadInfo (data) VALUES ("'+ rr +'")'); | |
// tx.executeSql('INSERT INTO LeadInfo (id, data) VALUES (2, "Second row")'); | |
alert("Insert") | |
// alert("Insert"); | |
} | |
// Transaction error callback | |
// | |
function errorCB(tx, err) { | |
//alert("Error processing SQL Insert: "+err); | |
} | |
// Transaction success callback | |
// | |
function successCB() { | |
// alert("success!"); | |
} | |
// lead retrive from db | |
function queryDB(tx) { | |
// alert("enter") | |
tx.executeSql('SELECT * FROM LeadInfo', [], querySuccess, errorCB); | |
} | |
function querySuccess(tx, results) { | |
// alert("read") | |
// this will be empty since no rows were inserted. | |
//alert("Insert ID = " + results.insertId); | |
// this will be 0 since it is a select statement | |
// alert("Rows Affected = " + results.rowAffected); | |
// the number of rows returned by the select statement | |
// alert("Insert ID = " + results.rows.length); | |
var tablereport=""; | |
if (results != null && results.rows != null) { | |
for (var i = 0; i < results.rows.length; i++) { | |
// alert("In") | |
var row =unescape(results.rows.item(i).data); | |
var obj = JSON.parse(row); | |
// alert(JSON.stringify(obj)); | |
// alert(unescape(row)) | |
//$('#lbUsers').append('<br>' + row.UserId + '. ' + | |
//row.FirstName+ ' ' + row.LastName); | |
// tablereport+='<li>'; | |
// tablereport+='<a href="#"><span style="font-size:18px; font-weight:400; padding:10px 0px 10px 0px;">'+row+'</span><span style="padding: 10px 16px;width: 100px;float: right;margin-top: -33px;margin-right: -80px;font-size:14px"></span><br>'; | |
// tablereport+='<span style="font-size:12px; font-weight:100; padding:10px 0px 10px 0px;">'+ subdata+'</span>'; | |
// tablereport+='<span style="color: #ACACAC;width: 100%;float: left;padding: 5px;margin-left: -5px;font-size:14px">'; | |
// tablereport+=row+'</span></a>'; | |
// tablereport+='</li>'; | |
// tablereport+='</li>'; | |
//alert(row); | |
tablereport+='<li>'; | |
tablereport+='<a href="#"><span style="font-size:18px; font-weight:400; padding:10px 0px 10px 0px;">'+JSON.stringify(obj.lead_name)+'</span><span style="padding: 10px 16px;width: 100px;float: right;margin-top: -33px;margin-right: -80px;font-size:14px"></span><br>'; | |
tablereport+='<span style="font-size:12px; font-weight:100; padding:10px 0px 10px 0px;">'+ JSON.stringify(obj.lead_name)+'</span>'; | |
tablereport+='<span style="color: #ACACAC;width: 100%;float: left;padding: 5px;margin-left: -5px;font-size:14px">'; | |
tablereport+=JSON.stringify(obj.lead_name)+'</span></a>'; | |
tablereport+='</li>'; | |
// tablereport+=JSON.stringify(obj.lead_name); | |
tablereport+='</li>'; | |
// console.log(tablereport); | |
} | |
} | |
//$('#pendingsynch').append(tablereport) | |
// $('#pendingsynch').append(tablereport).listview('refresh'); | |
$('#pendingsynch').html("hello world"); | |
$('#mynewlist').listview("refresh"); | |
// alert( $('#dataView').val()) | |
//$('#dataView').listview(); | |
// $('#pendingsynch').listview(); | |
// $('#pendingsynch').empty(); | |
// $('#pendingsynch').append(tablereport).trigger('create'); | |
// $( '#dataView' ).listview( 'refresh' ); | |
// $('#dataView').listview('refresh'); | |
// $("#dataView").listview('refresh'); | |
// $(".dataView").listview("refresh"); | |
// $("ul:jqmData(role='dataView')").listview(); | |
// $("#dataView").listview("refresh"); | |
// $('#dataView ul').listview('refresh'); | |
//setInterval(function(){$('#pendingsynch').html(tablereport)},5000); | |
// $('#pendingsynch').update(tablereport); | |
//$("#preloader").css('display','inline') | |
//setTimeout($('#pendingsynch').html(tablereport), 1000); | |
//$("#preloader").hide() | |
/* | |
var len = results.rows.length; | |
// alert("DEMO table: " + len + " rows found."); | |
for (var i=0; i<len; i++){ | |
alert("Row = " + i + " ID = " + results.rows.item(i).id + " Data = " + results.rows.item(i).data); | |
} | |
*/ | |
} | |
function errorCB(err) { | |
alert("Error processing SQL Retrive: "+err.code); | |
} | |
//var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000); | |
//Daily data save to file | |
//SAVE A NEW LEAD TO A TERRITORY | |
function savenewlead() | |
{ | |
//$('#loadingmessage').show(); | |
var lead_name=$("#lead_name").val(); | |
var lead_address=$("#lead_address").val(); | |
var lead_Phone=$("#lead_Phone").val(); | |
var place=$("#placebind").val(); | |
var lead_location_days=$("#location_timing_days").val(); | |
var lead_location_days_timing=$("#location_timing_days_timing").val(); | |
var lead_marketing_timing=$("#lead_market_findings").val(); | |
var lead_market_product_priotity=$("#lead_market_product_priority").val(); | |
var lead_market_competetor_info=$("#lead_market_competetor_product").val(); | |
var lead_market_competetor_product_volume=$("#lead_market_competetor_volume").val(); | |
var lead_purchse_habit=$("#lead_market_purchase_habit").val(); | |
var lead_rating=$("#lead_market_rate_lead").val(); | |
var lead_main_out_name=$("#lead_Main_store_name").val(); | |
var lead_inst_out=$("#lead_inst_or_out").val(); | |
var lead_out_grade=$("#lead_grade").val(); | |
var lead_out_dist_km=$("#lead_dist").val(); | |
var lead_out_supply_from=$("#lead_Main_supp_from").val(); | |
var lead_out_contact_per=$("#lead_cont_person").val(); | |
var lead_out_contact_number=$("#lead_cnt_number").val(); | |
place=place.replace(/^"|"$/g, ''); | |
//window.alert(place); | |
var lead_location=lead_lan_long; | |
var DateTime = new Date(); | |
var strYear= DateTime.getYear(); | |
var strMonth= DateTime.getMonth() +1; | |
var strDay = DateTime.getDate(); | |
var strHours = DateTime.getHours(); | |
var strMinutes = DateTime.getMinutes(); | |
var strSeconds = DateTime.getSeconds(); | |
var datetimeret = strDay + "/" + strMonth + "/" + strYear + " " + strHours + ":" + strMinutes + ":" + strSeconds; | |
//window.alert(lead_lan_long); | |
//Code to get loaction info | |
var geocoder = new google.maps.Geocoder; | |
var input = lead_lan_long; | |
var newString = input.substr(1, input.length-2); | |
var latlngStr = newString.split(',', 2); | |
window.alert(parseFloat(latlngStr[0])+ " " + parseFloat(latlngStr[1]) ); | |
var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])}; | |
geocoder.geocode({'location': latlng}, function(results, status) { | |
if (status === google.maps.GeocoderStatus.OK) { | |
if (results[1]) { | |
lead_add_more = results[1].formatted_address;// place name | |
// window.alert(lead_add_more); | |
//Save data to local file space | |
onedata['lead_name']= lead_name; | |
onedata['lead_address']= lead_address; | |
onedata['lead_Phone']= lead_Phone; | |
onedata['lead_location']= lead_location; | |
onedata['user_info']= user_info; | |
onedata['place']= place; | |
onedata['dateofadding']= datetimeret; | |
onedata['location_name_readable']= lead_add_more; | |
onedata['lead_location_days']= lead_location_days; | |
onedata['lead_location_days_timing']= lead_location_days_timing; | |
onedata['lead_marketing_timing']= lead_marketing_timing; | |
onedata['lead_market_product_priotity']= lead_market_product_priotity; | |
onedata['lead_market_competetor_info']= lead_market_competetor_info; | |
onedata['lead_market_competetor_product_volume']= lead_market_competetor_product_volume; | |
onedata['lead_purchse_habit']= lead_purchse_habit; | |
onedata['lead_rating']= lead_rating; | |
onedata['lead_main_out_name']= lead_main_out_name; | |
onedata['lead_inst_out']= lead_inst_out; | |
onedata['lead_out_grade']= lead_out_grade; | |
onedata['lead_out_dist_km']= lead_out_dist_km; | |
onedata['lead_out_supply_from']= lead_out_supply_from; | |
onedata['lead_out_contact_per']= lead_out_contact_per; | |
onedata['lead_out_contact_number']= lead_out_contact_number; | |
db.transaction(populateDB, errorCB, successCB); | |
// db.transaction(queryDB, errorCB); | |
// alert(JSON.stringify(writedata_datily)); | |
// window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSReadReportDailyData, fail); | |
// writedata_datily['Newlead']=onedata; | |
// alert("towrite********" + JSON.stringify(writedata_datily)); | |
// window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSDailyData, fail); | |
//Save data to local file space | |
//var dataoflead="{" | |
//CHECK NET connection | |
var aaa=checkConnection(); | |
//temp | |
aaa="No network connection"; | |
if(aaa!="No network connection") | |
{ | |
var user_info=window.localStorage.getItem("username"); | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/report/lead_save_mobile_new/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : {lead_name : lead_name ,lead_address : lead_address,lead_Phone : lead_Phone,lead_location:lead_location,user_info:user_info,place:place,dateofadding:datetimeret,location_name_readable:lead_add_more} | |
}).done(function(data) { | |
// $('#loadingmessage').hide(); | |
$('input[type="text"],textarea').val(''); | |
}).fail(function(a, b, c, d) { | |
$('input[type="text"],textarea').val(''); | |
}); | |
//maincall(); | |
} | |
window.alert("Saved..") | |
} | |
} | |
}) | |
} | |
</script> | |
<style> | |
.heading | |
{ | |
background-color:#ddd; | |
width:100%; | |
padding:15px 20px 15px 20px; | |
text-align:center; | |
font-weight:800; | |
} | |
#map_canvas { width: 100%; height: 100%; padding: 0; } | |
span | |
{ | |
padding:10px; | |
} | |
input[type="text"] { | |
width: 100%; | |
display: block; | |
margin-bottom: 10px; | |
height: 40px; | |
border-radius: 2px; | |
outline: medium none; | |
border: 1px solid #DDD; | |
font-family: font; | |
padding-left: 10px; | |
margin-top: 10px; | |
margin-bottom: 10px; | |
} | |
input[type="text"]:hover{ | |
-webkit-transition: all 0.3s ease-in; /*Safari & Chrome*/ | |
transition: all 0.3s ease-in; | |
-moz-transition: all 0.3s ease-in; /* Firefox 4 */ | |
-o-transition: all 0.3s ease-in; /* Opera */ | |
text-decoration:none; | |
} | |
input[type="button"] { | |
padding:12px 20px; | |
text-align:center; | |
width:100px; | |
background-color:#0378fa; | |
color:#fff; | |
border-radius:6px; | |
border: solid 1px #fff; | |
} | |
label | |
{ | |
color:#000; | |
} | |
.selectone { | |
border: solid 1px #ddd; | |
outline: none; | |
width: 100%; | |
height: 30px; | |
} | |
label { | |
display: block; | |
margin: 30px 0 0 0; | |
} | |
select { | |
width: 200px; | |
} | |
.overflow { | |
height: 200px; | |
} | |
input#bigbutton { | |
width:100%; | |
background: #0D0D0E; /*the colour of the button*/ | |
padding: 8px 14px 10px; /*apply some padding inside the button*/ | |
border:1px solid #070F12; /*required or the default border for the browser will appear*/ | |
cursor:pointer; /*forces the cursor to change to a hand when the button is hovered*/ | |
/*style the text*/ | |
/*font-size:1.5em;*/ | |
font-family:Oswald, sans-serif; /*Oswald is available from http://www.google.com/webfonts/specimen/Oswald*/ | |
letter-spacing:.1em; | |
text-shadow: 0 -1px 0px rgba(0, 0, 0, 0.3); /*give the text a shadow - doesn't appear in Opera 12.02 or earlier*/ | |
color: #fff; | |
/*use box-shadow to give the button some depth - see cssdemos.tupence.co.uk/box-shadow.htm#demo7 for more info on this technique*/ | |
-webkit-box-shadow: inset 0px 1px 0px #A5B4BA, 0px 5px 0px 0px #5D6669, 0px 10px 5px #999; | |
-moz-box-shadow: inset 0px 1px 0px #A5B4BA, 0px 5px 0px 0px #5D6669, 0px 10px 5px #999; | |
box-shadow: inset 0px 1px 0px #A5B4BA, 0px 5px 0px 0px #5D6669, 0px 10px 5px #999; | |
/*give the corners a small curve*/ | |
-moz-border-radius: 10px; | |
-webkit-border-radius: 10px; | |
/*border-radius: 10px;*/ | |
} | |
/***SET THE BUTTON'S HOVER AND FOCUS STATES***/ | |
input#bigbutton:hover, input#bigbutton:focus { | |
color:#dfe7ea; | |
/*reduce the size of the shadow to give a pushed effect*/ | |
-webkit-box-shadow: inset 0px 1px 0px #647278, 0px 2px 0px 0px #A5B4BA, 0px 2px 5px #999; | |
-moz-box-shadow: inset 0px 1px 0px #647278, 0px 2px 0px 0px #A5B4BA, 0px 2px 5px #999; | |
box-shadow: inset 0px 1px 0px #647278, 0px 2px 0px 0px #A5B4BA, 0px 2px 5px #999; | |
} | |
#calendar { | |
max-width: 900px; | |
margin: 0 auto; | |
margin-left: 20px; | |
} | |
#magazine{ | |
width:576px; | |
height:752px; | |
} | |
#magazine .turn-page{ | |
background-color:#ccc; | |
background-size:100% 100%; | |
} | |
.ui-controlgroup .ui-controlgroup-controls, .ui-controlgroup .ui-radio, .ui-controlgroup .ui-checkbox, .ui-controlgroup .ui-select, .ui-controlgroup li { | |
border-radius: inherit; | |
} | |
.ui-body-c, .ui-body-c input, .ui-body-c select, .ui-body-c textarea, .ui-body-c button { | |
font-family: Helvetica,Arial,sans-serif; | |
} | |
.ui-body-c, .ui-overlay-c { | |
color: #333; | |
text-shadow: 0px 1px 0px #FFF; | |
} | |
.ui-page-theme-a .ui-btn:hover, html .ui-bar-a .ui-btn:hover, html .ui-body-a .ui-btn:hover, html body .ui-group-theme-a .ui-btn:hover, html head + body .ui-btn.ui-btn-a:hover { | |
background: none repeat scroll 0% 0% #EDEDED; | |
border-color: #DDD; | |
color: #333; | |
text-shadow: 0px 1px 0px #F3F3F3; | |
} | |
.ui-page-theme-a .ui-btn, html .ui-bar-a .ui-btn, html .ui-body-a .ui-btn, html body .ui-group-theme-a .ui-btn, html head + body .ui-btn.ui-btn-a, .ui-page-theme-a .ui-btn:visited, html .ui-bar-a .ui-btn:visited, html .ui-body-a .ui-btn:visited, html body .ui-group-theme-a .ui-btn:visited, html head + body .ui-btn.ui-btn-a:visited { | |
background: none repeat scroll 0% 0% #F6F6F6; | |
border-color: #DDD; | |
color: #333; | |
text-shadow: 0px 1px 0px #F3F3F3; | |
} | |
button.ui-btn-inline { | |
width: auto; | |
} | |
button.ui-btn, .ui-controlgroup-controls button.ui-btn-icon-notext { | |
box-sizing: border-box; | |
-moz-appearance: none; | |
/* width: 15%;*/ | |
} | |
.ui-btn-inline { | |
display: inline-block; | |
vertical-align: middle; | |
margin-right: 0.625em; | |
} | |
.ui-btn { | |
font-size: 16px; | |
margin: 0.5em 0px; | |
padding: 0.7em 1em; | |
display: block; | |
position: relative; | |
text-align: center; | |
text-overflow: ellipsis; | |
overflow: hidden; | |
white-space: nowrap; | |
cursor: pointer; | |
-moz-user-select: none; | |
margin-left: 20px; | |
} | |
.ui-btn, label.ui-btn { | |
font-weight: 700; | |
border-width: 1px; | |
border-style: solid; | |
} | |
/* css dropdown */ | |
.container { | |
margin: 1em auto 0; | |
width: 100%; | |
} | |
.select-wrapper { | |
background-color: #eee; | |
border: 1px solid #aaa; | |
color: #aaa; | |
cursor: pointer; | |
float: left; | |
overflow: hidden; | |
padding-right: 3em; | |
position: relative; | |
width: 100%; | |
} | |
.selectnew { | |
-webkit-appearance: none; | |
background-color: #eee; | |
border-width: 0; | |
box-sizing: border-box; | |
cursor: pointer; | |
float: left; | |
font-size: 1em; | |
line-height: 1em; | |
padding: 1em 1em; | |
width: 100%; | |
width: calc(100% + 2em); | |
&:focus { | |
outline: none; | |
} | |
} | |
.select-icon { | |
position: absolute; | |
top: .8em; | |
right: 1em; | |
} | |
/* css dropdown */ | |
</style> | |
</head> | |
<!-- <li> | |
<div data-role="content"> | |
<div class="ui-grid-a" id="restau_infos"> | |
<div class="ui-block-a"> | |
<p><img src="~/../images/defaultuser.png" alt="jeannette photo"/></p> | |
</div> | |
<div class="ui-block-b"> | |
<h1> Le Mouffetard</h1> | |
<p><strong> Restaurant bar in the center of Strasbourg</strong></p> | |
<p> On the menu: </p> | |
<ul><li> Milkshake with chocolat</li><li> Planchettes </li><li> Leek pie </li></ul> | |
</div> | |
</div> | |
</div><hr/></li> --> | |
<body style="width:100%;" onload="onDeviceReady();"> | |
<div id="responsive" class="modal hide fade" tabindex="-1" data-width="760"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
<h3>Lead add</h3> | |
</div> | |
<div class="modal-body"> | |
<div class="container"> | |
<div id="tabs" class="tabs"> | |
<nav> | |
<ul> | |
<li><a href="#section-1">Main</a></li> | |
<li><a href="#section-2">Location</a></li> | |
<li><a href="#section-3">Survey</a></li> | |
<li><a href="#section-4">Stockist</a></li> | |
</ul> | |
</nav> | |
<div class="content"> | |
<section id="section-1"> | |
<div class="row-fluid"> | |
<div class="span6"> | |
<p><input type="text" id="lead_name" placeholder="Name" name="lead_name" class="span12" /></p> | |
<p><input type="text" id="lead_address" placeholder="Address" name="lead_address" class="span12" /></p> | |
<p><input type="text" id="lead_Phone" placeholder="PhoneNo" name="lead_Phone" class="span12" /></p> | |
<p> | |
<div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="placebind"> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div> | |
</p> | |
</div> | |
</div> | |
</section> | |
<section id="section-2"> | |
<div class="ui-bar-c ui-corner-all ui-shadow" data-role="content" style="padding: 1em;"> | |
<div id="map_canvas" style="height: 400px;"></div> | |
</div> | |
<p> | |
<div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="location_timing_days" name="location_timing_days"> | |
<option>All Week days</option> | |
<option>Mondays</option> | |
<option>Tuesday</option> | |
<option>Wednesday</option> | |
<option>Thursday</option> | |
<option>Friday</option> | |
<option>Saturdays</option> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div> | |
</p> | |
<p><input type="text" id="location_timing_days_timing" placeholder="Timing" name="location_timing_days_timing" class="span12" /></p> | |
</section> | |
<section id="section-3"> | |
<div class="row-fluid"> | |
<div class="span6"> | |
<p><input type="text" id="lead_market_findings" placeholder="Market Findings" name="lead_market_findings" class="span12" /></p> | |
<p><input type="text" id="lead_market_product_priority" placeholder="Product Priority" name="lead_market_product_priority" class="span12" /></p> | |
<p><input type="text" id="lead_market_competetor_product" placeholder="Competitor Info/Product" name="lead_market_competetor_product" class="span12" /></p> | |
<p><input type="text" id="lead_market_competetor_volume" placeholder="Competitor Volume" name="lead_market_competetor_volume" class="span12" /></p> | |
<p><input type="text" id="lead_market_purchase_habit" placeholder="Puchase Habit" name="lead_market_purchase_habit" class="span12" /></p> | |
<p><input type="text" id="lead_market_rate_lead" placeholder="Rate/Grade" name="lead_market_rate_lead" class="span12" /></p> | |
<!-- <p> <div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="placebind"> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div></p> --> | |
</div> | |
</div> | |
</section> | |
<section id="section-3"> | |
<div class="row-fluid"> | |
<div class="span6"> | |
<p><input type="text" id="lead_Main_store_name" placeholder="Main Store Name" name="lead_Main_store_name" class="span12" /></p> | |
<p><input type="text" id="lead_inst_or_out" placeholder="Institute/Outlet" name="lead_inst_or_out" class="span12" /></p> | |
<p><input type="text" id="lead_grade" placeholder="Grade" name="lead_grade" class="span12" /></p> | |
<p><input type="text" id="lead_dist" placeholder="Distance" name="lead_dist" class="span12" /></p> | |
<p><input type="text" id="lead_Main_supp_from" placeholder="Main Supply from" name="lead_Main_supp_from" class="span12" /></p> | |
<p><input type="text" id="lead_cont_person" placeholder="Contact Person" name="lead_cont_person" class="span12" /></p> | |
<p><input type="text" id="lead_cnt_number" placeholder="Contact Number" name="lead_cnt_number" class="span12" /></p> | |
<!-- <p> <div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="placebind"> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div></p> --> | |
</div> | |
</div> | |
</section> | |
</div> | |
<!-- /content --> | |
</div> | |
<!-- /tabs --> | |
</div> | |
<script src="js/cbpFWTabs.js"></script> | |
<script> | |
new CBPFWTabs( document.getElementById( 'tabs' ) ); | |
</script> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" data-dismiss="modal" class="btn">Close</button> | |
<button type="button" onclick="savenewlead()" value="Save" class="btn btn-primary">Save changes</button> | |
</div> | |
</div> | |
<!--popup Task add to clendar--> | |
<script type="text/javascript"> | |
//SAVE NEW TASK CALENDAR | |
function savenewtask(){ | |
var territory=$("#placebindfirst").val(); | |
var uid=$("#leadbind").val();//lead id is not taken correctly now it is name | |
var starts=$("#starts").val(); | |
var ends=$("#ends").val(); | |
var travel_time=$("#travel_time").val(); | |
var alert=$("#alert").val(); | |
var invitee=$("#invitee").val(); | |
var user_info=window.localStorage.getItem("username");//staff name or uid | |
var eventdate=$("#Date").val(); | |
var user_info=window.localStorage.getItem("username"); | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/plantask/save_plan_mobile/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : {territory : territory ,uid : uid,starts : starts,ends:ends,travel_time:travel_time,alert:alert,invitee:invitee,user_info:user_info,eventdate:eventdate} | |
}).done(function(data) { | |
// $('#loadingmessage').hide(); | |
}).fail(function(a, b, c, d) { | |
}); | |
} | |
var data_vio_report=""; | |
function savereportsvtp(obj){ | |
data_vio_report="{"; | |
//alert("save start ") | |
//var data_vio_report="{"; | |
var territory=$("#Place").val(); | |
var leadid=$("#Uid").val(); | |
var Uid=window.localStorage.getItem("username"); | |
for (i = 0; i < kk; i++) { | |
var headval="labelhead-"+i | |
var dataval="dataenterdy-"+i | |
// window.alert(headval) | |
// window.alert(dataval) | |
var head= document.getElementById(headval).value//$("#label-1,0"). | |
var data= document.getElementById(dataval).value//$("#label-1,0"). | |
data_vio_report += "'" + head+ "':'" | |
data_vio_report += data; | |
data_vio_report +="',"; | |
} | |
//window.alert(territory + " " + leadid + " " + Uid ); | |
//window.alert(data_vio_report); | |
//datatobepass = datatobepass.substring(0, str.length - 1); | |
// data_vio_report +="'Otherdata' :'{"; | |
// data_vio_report +=""; | |
// data_vio_report +="}',"; | |
data_vio_report +="'Uid' :'"; | |
data_vio_report += Uid; | |
data_vio_report +="',"; | |
data_vio_report +="'leadid' :'"; | |
data_vio_report += leadid; | |
data_vio_report +="',"; | |
data_vio_report +="'territory_reported' :'"; | |
data_vio_report += territory; | |
data_vio_report +="'}"; | |
//window.alert(data_vio_report); | |
//window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSReport, fail); | |
//check if network avail | |
var aaa=checkConnection(); | |
if(aaa!="No network connection") | |
{ | |
$.ajax({ | |
url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
//url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : data_vio_report, | |
// data : {product_promoted : product_promoted ,anticipating_order : anticipating_order, product_remarks : product_remarks, next_visit_details : next_visit_details,user_info : user_info,territory : territory,Uid : Uid } | |
}).done(function(data) { | |
$('input[type="text"],textarea').val(''); | |
}).fail(function(a, b, c, d) { | |
// $('#loadingmessage').hide(); | |
// $('#main').show(); | |
//$('input[type="text"],textarea').val(''); | |
// | |
var submitButton = $(this, "input[type='button']"); | |
$(submitButton).attr("disabled", "true"); | |
$("#sendwrapper").prepend('<span>Data saved.... </span>') | |
}); | |
//save same to staff location track | |
//lead_lan_long="("+position.coords.latitude + "," + position.coords.longitude + ")"; | |
//element.innerHTML = 'Latitude: ' + position.coords.latitude + | |
// ' Longitude: ' + position.coords.longitude ; | |
//code tot get date and time local | |
var DateTime = new Date(); | |
var strYear= DateTime.getYear(); | |
var strMonth= DateTime.getMonth() +1; | |
var strDay = DateTime.getDate(); | |
var strHours = DateTime.getHours(); | |
var strMinutes = DateTime.getMinutes(); | |
var strSeconds = DateTime.getSeconds(); | |
var datetimeret = strDay + "/" + strMonth + "/" + strYear + " " + strHours + ":" + strMinutes + ":" + strSeconds; | |
// alert(datetimeret); | |
//code to get date and time loacl ends | |
//Code to get loaction info | |
var geocoder = new google.maps.Geocoder; | |
var input = lead_lan_long; | |
var newString = input.substr(1, input.length-2); | |
var latlngStr = newString.split(',', 2); | |
var lat=parseFloat(latlngStr[0]); | |
var longt=parseFloat(latlngStr[1]); | |
var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])}; | |
geocoder.geocode({'location': latlng}, function(results, status) { | |
if (status === google.maps.GeocoderStatus.OK) { | |
if (results[1]) { | |
lead_add_more = results[1].formatted_address;// place name | |
var user_info=window.localStorage.getItem("username"); | |
$.ajax({ | |
//url : "http://ammras-ammras.rhcloud.com/report/save_works_mobile/", | |
url : "http://ammras-ammras.rhcloud.com/report/gps_save_auto/", | |
type : 'POST', | |
cache : false, | |
crossDomain: true, | |
dataType : 'json', | |
data : {Latitude : lat ,Longitude : longt,user_info : user_info,name_of_location:lead_add_more,localdatetime:datetimeret,reporteddata:data_vio_report } | |
}).done(function(data) { | |
}).fail(function(a, b, c, d) { | |
}); | |
//window.alert("save 2") | |
} else { | |
window.alert('No results found'); | |
} | |
} else { | |
window.alert('Geocoder failed due to: ' + status); | |
} | |
}); | |
//save end | |
} | |
window.alert("Report Saved..") | |
} | |
function gotFSReport(fileSystem) { | |
fileSystem.root.getFile("DailyReport.json", {create: true, exclusive: false}, gotFileEntryReport, fail); | |
} | |
//WRITER TP | |
function gotFileEntryReport(fileEntry) { | |
fileEntry.createWriter(gotFileWriterReport, fail); | |
} | |
function gotFileWriterReport(writer) { | |
writer.onwriteend = function(evt) { | |
console.log("contents of file now 'some sample text'"); | |
writer.truncate(11); | |
writer.onwriteend = function(evt) { | |
console.log("contents of file now 'some sample'"); | |
writer.seek(4); | |
writer.write(data_vio_report); | |
// alert("Write") | |
writer.onwriteend = function(evt){ | |
console.log("contents of file now 'some different text'"); | |
} | |
}; | |
}; | |
writer.write(data_vio_report); | |
} | |
function fail(error) { | |
window.alert(error.code) | |
console.log(error.code); | |
} | |
</script> | |
<div id="responsive2" class="modal hide fade" tabindex="-1" data-width="760"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
<h3>New Event</h3> | |
</div> | |
<div class="modal-body"> | |
<div class="row-fluid"> | |
<div class="span6"> | |
<!-- <h4>Some Input</h4> --> | |
<p><input id="Date" type="text" placeholder="Date" class="span12" disabled /></p> | |
<div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="placebindfirst"> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div> | |
<div class="container"> | |
<div class="select-wrapper"> | |
<select class="selectnew" id="leadbind"> | |
</select> | |
<span class="select-icon entypo-arrow-combo"></span> | |
</div> | |
</div> | |
<p><input id="starts" type="text" class="span12" placeholder="Starts "/></p> | |
<p><input id="ends" type="text" class="span12" placeholder="Ends" /></p> | |
<p><input id="travel_time" type="text" class="span12" placeholder="Travel Time" /></p> | |
<p><input id="alert" type="text" class="span12" placeholder="Alert" /></p> | |
<p><input id="invitee" type="text" placeholder="Invitee" class="span12" /></p> | |
</div> | |
</div> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" data-dismiss="modal" class="btn">Close</button> | |
<button type="button" onclick="savenewtask()" class="btn btn-primary">Save</button> | |
</div> | |
</div> | |
<div id='loadingmessage' style='display:none'> | |
<img src='../www/font/images/loading.gif'/> | |
</div> | |
<!-- TABS LOAD To LOAD TASK REPORTING OPTIONS--> | |
<div id="responsive23" class="modal hide fade" tabindex="-1" data-width="760"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
<h3>Report tasks now</h3> | |
</div> | |
<div class="modal-body"> | |
<div class="container"> | |
<div id="tabs" class="tabs"> | |
<nav> | |
<ul> | |
<li><a href="#section-11">Main</a></li> | |
<li><a href="#section-22">Location</a></li> | |
<li><a href="#section-23">Survey</a></li> | |
<li><a href="#section-24">Stockist</a></li> | |
<!-- <li><a href="#section-3" >link1</a></li> | |
<li><a href="#section-4" >link1</a></li> | |
<li><a href="#section-5">link1</a></li> --> | |
</ul> | |
</nav> | |
<div class="content"> | |
<section id="section-11"> | |
<div id="loadformand_person_info"></div> | |
<!-- <div class="mediabox"> | |
<p>Sushi gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin onion chickpea gram corn pea.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea prairie turnip leek lentil turnip greens parsnip.</p> | |
</div> --> | |
</section> | |
<section id="section-22"> | |
<!-- <div class="mediabox"> | |
<p>Chickweed okra pea winter purslane coriander yarrow sweet pepper radish garlic brussels sprout groundnut summer purslane earthnut pea tomato spring onion azuki bean gourd. </p> | |
</div> | |
<div class="mediabox"> | |
<p>Salsify taro catsear garlic gram celery bitterleaf wattle seed collard greens nori. Grape wattle seed kombu beetroot horseradish carrot squash brussels sprout chard.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Celery quandong swiss chard chicory earthnut pea potato. Salsify taro catsear garlic gram celery bitterleaf wattle seed collard greens nori. </p> | |
</div> --> | |
</section> | |
<!-- <section id="section-3"> | |
<div class="mediabox"> | |
<p>Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin onion chickpea gram corn pea.Sushi gumbo beet greens corn soko endive gumbo gourd.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Sushi gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Pea horseradish azuki bean lettuce avocado asparagus okra. Kohlrabi radish okra azuki bean corn fava bean mustard tigernut wasabi tofu broccoli mixture soup.</p> | |
</div> | |
</section> | |
<section id="section-4"> | |
<div class="mediabox"> | |
<p>Chickweed okra pea winter purslane coriander yarrow sweet pepper radish garlic brussels sprout groundnut summer purslane earthnut pea tomato spring onion azuki bean gourd. </p> | |
</div> | |
<div class="mediabox"> | |
<p>Salsify taro catsear garlic gram celery bitterleaf wattle seed collard greens nori. Grape wattle seed kombu beetroot horseradish carrot squash brussels sprout chard.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Celery quandong swiss chard chicory earthnut pea potato. Salsify taro catsear garlic gram celery bitterleaf wattle seed collard greens nori. </p> | |
</div> | |
</section> | |
<section id="section-5"> | |
<div class="mediabox"> | |
<p>Catsear cauliflower garbanzo yarrow salsify chicory garlic bell pepper napa cabbage lettuce tomato kale arugula melon sierra leone bologi rutabaga tigernut.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Sea lettuce gumbo grape kale kombu cauliflower salsify kohlrabi okra sea lettuce broccoli celery lotus root carrot winter purslane turnip greens garlic.</p> | |
</div> | |
<div class="mediabox"> | |
<p>Green horseradish azuki bean lettuce avocado asparagus okra. Kohlrabi radish okra azuki bean corn fava bean mustard tigernut wasabi tofu broccoli mixture soup.</p> | |
</div> | |
</section> --> | |
</div> | |
<!-- /content --> | |
</div> | |
<!-- /tabs --> | |
</div> | |
<script src="js/cbpFWTabs.js"></script> | |
<script> | |
new CBPFWTabs( document.getElementById( 'tabs' ) ); | |
</script> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" data-dismiss="modal" class="btn">Close</button> | |
<button type="button" onclick="savereportsvtp()" class="btn btn-primary">Save changes</button> | |
</div> | |
</div> | |
<!-- TABS LOAD ENDS --> | |
<div id='main'> | |
<div class="heading" style="color:black">AMMRAS TOOL </div> | |
<div id="menu" style="width:100%;"> | |
<ul style="width:100%;" id="dataView" data-role="listview"> | |
<li> | |
<a href="#">Tasks</a> | |
<ul > | |
<div id="testdata"></div> | |
</ul> | |
</li> | |
<li> | |
<a href="#">Plan</a> | |
<ul> | |
<a href="#map-page"> | |
<button class="md-trigger md-setperspective plus_but" data-toggle="modal" href="#responsive2"></button> | |
<!-- <button class="md-trigger md-setperspective plus_but" data-modal="modal-18"></button> --> | |
</a> | |
<button class="ui-btn ui-btn-inline" id="today-button">Month view</button> | |
<!-- <li> | |
<a href="#">Get Your Wings</a> | |
<ul> --> | |
<div id='calendar'></div> | |
<!-- <li> | |
<a href="#">Train Kept A-Rollin'</a> | |
</li> | |
<li> | |
<a href="#">Same Old Song and Dance</a> | |
</li> --> | |
<!-- </ul> | |
</li> --> | |
</ul> | |
</li> | |
<li> | |
<a id="rep_but" onclick="call()" href="#">Reports</a> | |
<ul> | |
<div id="reportsload"></div> | |
<!-- <li> | |
<a href="#">Eagles</a> | |
<ul> | |
<li> | |
<a href="#">Hotel California</a> | |
<ul> | |
<li> | |
<a href="#">Hotel California</a> | |
</li> | |
<li> | |
<a href="#">Pretty Maids All in a Row</a> | |
</li> | |
</ul> | |
</li> | |
</ul> | |
</li> | |
<li> | |
<a href="#">Led Zeppelin</a> | |
<ul> | |
<li> | |
<a href="#">Physical Graffiti</a> | |
<ul> | |
<li> | |
<a href="#">In My Time of Dying</a> | |
</li> | |
<li> | |
<a href="#">Houses of the Holy</a> | |
</li> | |
</ul> | |
</li> | |
</ul> | |
</li> --> | |
</ul> | |
</li> | |
<!-- <li> | |
<a href="#">My Region</a> | |
<ul> | |
<li> | |
<a href="#myPopup" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">Show Popup Form</a> | |
<a href="#">Rock</a> | |
<ul> | |
<li> | |
</li> | |
</ul> | |
</li> | |
<li> | |
<a href="#">Hard rock</a> | |
<ul> | |
<li> | |
<a href="#">In My Time of Dying</a> | |
</li> | |
<li> | |
<a href="#">Houses of the Holy</a> | |
</li> | |
</ul> | |
</li> | |
</ul> | |
</li> --> | |
<li> | |
<a href="#">Leads</a> | |
<ul > | |
<!-- <a href="#map-page"><button class="md-trigger md-setperspective plus_but" data-modal="modal-17"></button></a> --> | |
<a href="#map-page"><button class="md-trigger md-setperspective plus_but" data-toggle="modal" | |
href="#responsive"></button></a> | |
<div id="testdata1"></div> | |
</ul> | |
</li> | |
<li> | |
<a href="#">Promotional Materials</a> | |
<ul> | |
<li> | |
<div id="magazine"> | |
<div style="background-image:url(pages/01.jpg);"></div> | |
<div style="background-image:url(pages/02.jpg);"></div> | |
<div style="background-image:url(pages/03.jpg);"></div> | |
<div style="background-image:url(pages/04.jpg);"></div> | |
<div style="background-image:url(pages/05.jpg);"></div> | |
<div style="background-image:url(pages/06.jpg);"></div> | |
</div> | |
</li> | |
<!-- <li> | |
<a href="#">Player</a> | |
<ul> | |
<li> | |
<a href="#">Volume</a> | |
</li> | |
<li> | |
<a href="#">Equalizer</a> | |
</li> | |
</ul> | |
</li> --> | |
</ul> | |
</li> | |
<li> | |
<a id="myaccount" href="#">My Account Sync</a> | |
<ul id="mynewlist" data-role="listview"> | |
<li> | |
<div id="pendingsynch" class=""> | |
</div> | |
<!-- onclick="call_synch_pending()" --> | |
</li> | |
</ul> | |
</li> | |
<li> | |
<a href="#">Help and Support</a> | |
<ul> | |
<li> | |
<a href="#">Ammras Verion 1.0</a> | |
</li> | |
</ul> | |
</li> | |
<div class="row"> | |
<div class="span10"> | |
<div class="responsive2"> | |
<div class="text-center"> | |
</div> | |
</div> | |
<br /> | |
</div> | |
</div> | |
</li> | |
<!-- <a href="#">Volume</a> --> | |
<!-- </li> | |
<li> | |
<a href="#">Equalizer</a> | |
</li> --> | |
</ul> | |
</li> | |
</ul> | |
</li> | |
<!-- <li> | |
<a href="#">Ammras Cloud</a> | |
<ul> | |
<li> | |
<a href="#">Profile</a> | |
</li> | |
<li> | |
<a href="#">Player</a> | |
<ul> | |
<li> | |
<a href="#">Volume</a> | |
</li> | |
<li> | |
<a href="#">Equalizer</a> | |
</li> | |
</ul> | |
</li> | |
</ul> | |
</li> --> | |
</ul> | |
</div> | |
</div> | |
<div class="md-overlay"></div> | |
<!-- the overlay element --> | |
<script src="js/classie.js"></script> | |
<script src="js/modalEffects.js"></script> | |
<script> | |
var polyfilter_scriptpath = '/js/'; | |
</script> | |
<script src="js/cssParser.js"></script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that is brilliant