Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imageId="";
- canvasId="";
- phpUrl="";
- var mapid_glo="";
- var editFaid="";
- var deleteFAid="";
- arrphp = new Array();
- arrbtn =new Array();
- var arr= new Array();
- var yes="yes";
- var decIDlot="";
- function getSelinHome(){
- $("#theme").empty();
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{"code":"getSelinHome"},
- dataType:"json",
- cache:false,
- success:function(data){
- var arr=data;
- var sel=$("#theme");
- for(var i=0;i<arr.length;i++){
- var option=$("<option>"+arr[i]+"</option>");
- sel.append(option);
- }
- sel.append("<option>new</option>");
- }
- });
- }
- function readyDec(td){
- $("#declotspub").empty();
- var id=$(td).attr("id");
- var option=$("<option title='newDec'>deceased</option>");
- $("#declotspub").append(option);
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"readyDec",id:id},
- dataType:"json",
- cache:false,
- success:function(data){
- for(var i=0;i<data.length;i++){
- var option=$("<option title='"+data[i][0]+"'>"+data[i][1]+"</option>");
- $("#declotspub").append(option);
- }
- }
- });
- }
- function removePX(position){
- var temp="";
- for(var i=0;i<position.length;i++){
- if(!isNaN(position.charAt(i))){
- temp=temp+""+position.charAt(i);
- }
- }
- return parseInt(temp);
- }
- function findDec(){
- $("#conmap").animate({
- scrollTop:0,
- scrollLeft:0,
- },'slow');
- $("#slider").slider('value',7);
- $("#maptest").animate({zoom:"0.0"},1);
- $(".selectelement").removeClass("selectelement");
- var option=document.getElementById("resultdec").selectedIndex;
- var id=$("#resultdec option:eq("+option+")").attr("title");
- alert(id);
- var position = $("#"+id).position();
- var mapwidth=removePX($("#maptest").css("width"));
- var mapheight=removePX($("#maptest").css("height"));
- var top=0;
- var left=0;
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getTopLeft",id:id},
- success:function(data){
- var arr=data.split("+");
- top=parseInt(arr[0])-300;
- left=parseInt(arr[1])-(removePX($("#conmap").css("width"))/2);
- //top=Math.round((top/mapheight)*100);
- //left=Math.round((left/mapwidth)*100);
- if(top <= 0){
- top=0;
- }
- if(left <= 0){
- left=0;
- }
- var div=document.getElementById("conmap");
- $("#"+id).find("img").addClass("selectelement");
- $("#conmap").animate({
- scrollTop:top+"%",
- scrollLeft:left+"%",
- },'slow');
- }
- });
- var div=document.getElementById("conmap");
- //alert(top+" "+left+" "+$("#conmap").css("width"));
- $("#"+id).find("img").addClass("selectelement");
- $("#conmap").animate({
- scrollTop:top+"px",
- scrollLeft:left+"px",
- },'slow');
- }
- function findOwner(){
- $("#conmap").animate({
- scrollTop:0,
- scrollLeft:0,
- },'slow');
- $("#slider").slider('value',7);
- $("#maptest").animate({zoom:"0.0"},1);
- $(".selectelement").removeClass("selectelement");
- var option=document.getElementById("resultOwner").selectedIndex;
- var id=$("#resultOwner option:eq("+option+")").attr("title");
- var position = $("#"+id).position();
- var mapwidth=removePX($("#maptest").css("width"));
- var mapheight=removePX($("#maptest").css("height"));
- var top=0;
- var left=0;
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getTopLeft",id:id},
- success:function(data){
- var arr=data.split("+");
- top=parseInt(arr[0])-300;
- left=parseInt(arr[1])- (removePX($("#conmap").css("width"))/2);
- //top=Math.round((top/mapheight)*100);
- //left=Math.round((left/mapwidth)*100);
- if(top <= 0){
- top=0;
- }
- if(left <= 0){
- left=0;
- }
- var div=document.getElementById("conmap");
- $("#"+id).find("img").addClass("selectelement");
- $("#conmap").animate({
- scrollTop:top+"%",
- scrollLeft:left+"%",
- },'slow');
- }
- });
- }
- function loadFA(){
- $("#txtfa").val("");
- $("#listFA li").remove();
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getAllFA"},
- dataType:"json",
- cache:false,
- success:function(data){
- var arr="";
- arr=data;
- for(var i=0;i<arr.length;i++){
- var li=$("<li class='list-group-item'>"+arr[i][1]+"<div class='pull-right'><button class='btn btn-success' onClick='editFA("+arr[i][0]+")'><span class='glyphicon glyphicon-edit' style='color:white;'></span></button> <button class='btn btn-danger' onClick='deleteFA("+arr[i][0]+")'><span class='glyphicon glyphicon-trash' style='color:white;'></span></button></div></li>");
- $("#listFA").append(li);
- }
- }
- });
- }
- function deleteFA(id){
- $("#loaddeleteFA").click();
- deleteFAid=id;
- }
- function editFA(id){
- editFaid=id;
- $("#faText").removeClass("error");
- $("#loadFA").click();
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getFA",id:id},
- success:function(data){
- $("#faText").val(data);
- }
- });
- }
- function Lot_Information(td){
- //var ownerid="false";
- //var decid="false";
- readyDec(td);
- lot_typeID=$(td).attr("id");
- decIDlot=td;
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getLotInfo",id:$(td).attr("id")},
- success:function(data){
- if(data[0] == 0){
- // $("#imgowner").attr("src","img/700x450.gif");
- // $("#btnimgowner").val("NO RECORD");
- // $("#txtfname").val("NO RECORD");
- // $("#txtlname").val("NO RECORD");
- // $("#txtmname").val("NO RECORD");
- // $("#txtaddress").val("NO RECORD");
- // $("#txtemail").val("NO RECORD");
- // $("#txtnumber").val("NO RECORD");
- $("#ownerimg").attr("src","img/placeholder.png");
- $("#ownername").html("NO RECORD");
- $("#owneradd").html("NO RECORD");
- $("#ownercon").html("NO RECORD");
- $("#owneremail").html("NO RECORD");
- }else{
- var arr=data.split("+");
- // $("#imgowner").attr("src",arr[7]);
- // $("#btnimgowner").val("");
- // $("#txtfname").val(arr[1]);
- // $("#txtlname").val(arr[2]);
- // $("#txtmname").val(arr[3]);
- // $("#txtaddress").val(arr[5]);
- // $("#txtemail").val(arr[4]);
- // $("#txtnumber").val(arr[6]);
- $("#ownerimg").attr("src",arr[7]);
- $("#ownername").html(arr[1]+" "+arr[3]+" "+arr[2]);
- $("#owneradd").html(arr[5]);
- $("#ownercon").html(arr[6]);
- $("#owneremail").html(arr[4]);
- ownerid=arr[0];
- }
- }
- });
- // $.ajax({
- // url:"include/function.php",
- // type:"POST",
- // data:{code:"getLotInfoDec",id:$(td).attr("id")},
- // success:function(data){
- // if(data[0] == 0){
- // // $("#imgdeceased").attr("src","img/700x450.gif");
- // // $("#btnimgdeceased").val("");
- // // $("#fnamedec").val("");
- // // $("#lnamedec").val("");
- // // $("#mnamedec").val("");
- // // $("#birthdec").val("");
- // // $("#deathdec").val("");
- // // $("#burialdec").val("");
- $("#decimg").attr("src","placeholder.png");
- $("#decname").html("NO RECORD");
- $("#decbirth").html("NO RECORD");
- $("#decdeath").html("NO RECORD");
- $("#decburial").html("NO RECORD");
- // }else{
- // var arr=data.split("+");
- // // $("#imgdeceased").attr("src",arr[7]);
- // // $("#btnimgdeceased").val("");
- // // $("#fnamedec").val(arr[1]);
- // // $("#lnamedec").val(arr[2]);
- // // $("#mnamedec").val(arr[3]);
- // // $("#deathdec").val(arr[5]);
- // // $("#birthdec").val(arr[4]);
- // // $("#burialdec").val(arr[6]);
- // $("#decimg").attr("src",arr[7]);
- // $("#decname").html(arr[1]+" "+arr[3]+" "+arr[2]);
- // $("#decbirth").html(arr[4]);
- // $("#decdeath").html(arr[5]);
- // $("#decburial").html(arr[6]);
- // decid=arr[0];
- // }
- // }
- // });
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- width:800,
- modal: true,
- });
- }
- function clickLot(id){
- $(".divselect").removeClass("divselect");
- $(".tblblocksel").removeClass("tblblocksel");
- $("#"+id).find("table").addClass("tblblocksel");
- $("#"+id).addClass("divselect");
- //tdid=$(td).attr("id");
- //$("#"+tdid+":parent").zoomTarget();
- //$(td).zoomTo({targetsize:0.75, duration:600});
- //evt.stopPropagation();
- }
- function loadGrid(mapw,maph,table){
- //var w=$("#maptest").width();
- //var h=$("#maptest").height();
- var l=parseInt(maph)/900;
- var w=parseInt(mapw)/900;
- if(l == 0){l=1;}
- if(w == 0){w=1;}
- lmap=l;
- wmap=w;
- //alert(l+w);
- $("#maptest").empty();
- //var table=$("<table id='tblmap' border='1' style='position:absolute;'></table>");
- //w=w+mapw;
- //h=h+maph;
- //$("#maptest").css({"width":mapw+"px","height":maph+"px"});
- //var w=Math.round($("#maptest").width()/30);
- //var h=Math.round($("#maptest").height()/30);
- //alert($("#maptest").height());
- /*for(var i=0;i<30*w;i++){
- var tr=$("<tr></tr>");
- for(var x=0;x<30*l;x++){
- var td=$("<td onmouseover='tdover(this)' onClick='tool(this)' onmouseout='tdout(this)' style='width:30px;height:30px;' id='tr"+i+"td"+x+"'></td>");
- tr.append(td);
- }
- table.append(tr);
- }
- $("#maptest").append(table);*/
- }
- function loadElement(top,left,width,height,img,classes,title,id){
- if(classes == "elementtext"){
- var div=$("<div id='"+id+"'></div>");
- div.css({"top":top+"px","left":left+"px","position":"absolute","width":width+"px","height":height+"px"});
- div.addClass(classes);
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getText",id:id},
- success:function(data){
- div.append("<p style='color:#fff;'>"+data+"</p>");
- }
- })
- $("#maptest").append(div);
- }else if(title != "block"){
- var div=$("<div id='"+id+"'></div>");
- div.css({"top":top+"px","left":left+"px","position":"absolute","width":width+"px","height":height+"px"});
- //div.draggable({ containment: "#maptest", scroll: false,snap:true,grid:[30,30],cursor:"none"});
- div.addClass(classes);
- if(title != "other" && title != "block" && title !="walknon" && title !="waynon"){
- //div.resizable({grid: 30,containment: "#maptest"});
- }
- div.append("<img src='img/mapimg/"+img+".png' style='width:100%;height:100%;' />");
- $("#maptest").append(div);
- }else{
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getElementLot",id:id},
- dataType:"json",
- cache:false,
- success:function(data){
- var arr=data;
- var div=$("<div id='"+id+"'></div>");
- div.css({"top":top+"px","left":left+"px","position":"absolute","width":(width)+"px","height":(height)+"px"});
- //div.draggable({ containment: "#maptest", scroll: false,snap:true,grid:[30,30]});
- div.addClass("elementblock");
- var arrtemp=arr.length-1;
- var row=parseInt(arr[arrtemp][1]);
- var col=parseInt(arr[arrtemp][2])/row;
- var index=0;
- var tbl=$("<table style='position:absolute;' class='tblblock' onClick='clickLot("+id+")'></table>");
- for(var i=0;i<row;i++){
- var tr=$("<tr></tr>");
- for(var x=0;x<col;x++){
- if(arr[index][0] != "remove lot"){
- var td=$("<td id='"+arr[index][3]+"' ondblClick='Lot_Information(this)'></td>");
- td.append("<img src='img/mapimg/"+arr[index][0]+".png' style='width:30px;height:30px;'/>");
- }else{
- var td=$("<td></td>");
- }
- tr.append(td);
- index++;
- }
- tbl.append(tr);
- }
- //div.draggable({ containment: "#maptest", scroll: false,snap:true,grid:[30,30],cursor:"none"});
- div.append(tbl);
- $("#maptest").append(div);
- }
- });
- }
- }
- function updateStaff(id){
- $("#btnimgstaff").val("");
- $("#txtfnamestaff").val("");
- $("#txtlaststaff").val("");
- $("#txtmiddlestaff").val("");
- $("#txtbranchstaff").val("");
- $("#txtpositionstaff").val("");
- $("#imgstaff").attr("src","img/700x450.gif");
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getStaffbyID",id:id},
- dataType:"json",
- cache:false,
- success:function(data){
- var arr=data;
- $("#txtfnamestaff").val(arr[1]);
- $("#txtlaststaff").val(arr[0]);
- $("#txtmiddlestaff").val(arr[2]);
- $("#txtpositionstaff").val(arr[3]);
- $("#txtbranchstaff").val(arr[5]);
- $("#imgstaff").attr("src",arr[4]);
- }
- });
- $( "#dialog-updatestaff" ).dialog({
- resizable: true,
- height:500,
- width:700,
- modal: true,
- buttons: {
- Update: function() {
- var fname=$("#txtfnamestaff").val();
- var lname=$("#txtlaststaff").val();
- var branch=$("#txtbranchstaff").val();
- var mname=$("#txtmiddlestaff").val();
- var position=$("#txtpositionstaff").val();
- if(fname != "" && lname != "" && mname != "" && position != "" && branch != ""){
- var form=new FormData(document.getElementById('updatestaff'));
- form.append("code","updateStaff");
- form.append("id",id);
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false, // To send DOMDocument or non processed data file it is set to false
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data+"");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:266,
- width:759,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- getStaff();
- }
- });
- $("#btnimgstaff").val("");
- $("#txtfnamestaff").val("");
- $("#txtlaststaff").val("");
- $("#txtmiddlestaff").val("");
- $("#txtpositionstaff").val("");
- $("#txtbranchstaff").val("");
- $("#imgstaff").attr("src","img/700x450.gif");
- //getStaff();
- $( this ).dialog( "close" );
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error! You need to Fillup all of the information.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- },
- Close:function(){
- $( this ).dialog( "close" );
- }
- }
- });
- }
- function getStaff(){
- //var indx=$("#divaddstaff > div").length;
- $("#divaddstaff > div:gt(0)").remove();
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getStaff"},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr= data;
- //alert(arr.length);
- for(var i=0;i<arr.length;i++){
- $("#divaddstaff").append($("<div class='col-md-4' style='height:430px;' id='divstaff"+arr[i][0]+"'><button class='btn btn-danger pull-right' onClick='deleteStaff("+arr[i][0]+")'>X</button><div class='thumbnail text-center btn' onClick='updateStaff("+arr[i][0]+")'><img src='"+arr[i][5]+"' style='height:300px; width:350px;' class='img-responsive img-rounded'><div class='caption'><h3>"+arr[i][1]+","+arr[i][2]+" "+arr[i][3]+".<br /><small>"+arr[i][6]+"</small><br /><small>"+arr[i][4]+"</small></h3></div></div></div>"));
- }
- $("#divaddstaff").append("<div class='col-md-4' ><div class='thumbnail text-center'><button class='btn btn-primary ' onClick='addStaff()' style='height:345px;width:100%;'><span style='font-size:250px;'>+</span></button></div></div>");
- }
- });
- }
- function addStaff(){
- $("#btnimgstaffadd").val("");
- $("#txtfnamestaffadd").val("");
- $("#txtlaststaffadd").val("");
- $("#txtmiddlestaffadd").val("");
- $("#txtbranchstaffadd").val("");
- $("#txtpositionstaffadd").val("");
- $("#imgstaffadd").attr("src","img/700x450.gif");
- $( "#dialog-addstaff" ).dialog({
- resizable: true,
- height:500,
- width:700,
- modal: true,
- buttons: {
- Add: function() {
- var fname=$("#txtfnamestaffadd").val();
- var lname=$("#txtlaststaffadd").val();
- var mname=$("#txtmiddlestaffadd").val();
- var branch=$("#txtbranchstaffadd").val();
- var position=$("#txtpositionstaffadd").val();
- //var desc=$("#txtdescstaff").val();
- var img=$("#btnimgstaffadd").val();
- if(fname != "" && lname != "" && mname != "" && position != "" && img != "" && branch != ""){
- var form=new FormData(document.getElementById('addstaff'));
- form.append("code","addStaff");
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false, // To send DOMDocument or non processed data file it is set to false
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data+"");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:266,
- width:759,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- getStaff();
- }
- });
- //phpUrl="imgstaff.php";
- //imageId="btnimgstaff";
- //uploadFile();
- $("#btnimgstaffadd").val("");
- $("#txtfnamestaffadd").val("");
- $("#txtlaststaffadd").val("");
- $("#txtmiddlestaffadd").val("");
- $("#txtpositionstaffadd").val("");
- $("#imgstaffadd").attr("src","img/700x450.gif");
- $( this ).dialog( "close" );
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error! You need to Fillup all of the information.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- },
- Close:function(){
- $( this ).dialog( "close" );
- }
- }
- });
- }
- function deleteStaff(id){
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"deleteStaff",id:id},
- });
- $("#divstaff"+id).remove();
- }
- function getString(data){
- var temp=data;
- var val="";
- var index=0;
- arr= new Array();
- for(var i=0;i<temp.length;i++){
- if(temp.charAt(i) == '+'){
- arr[index]=val;
- val="";
- index++;
- }else{
- val=val+temp.charAt(i);
- }
- }
- return arr;
- }
- function getCategory(){
- indx=document.getElementById("cat1").selectedIndex;
- $("#spinloaditem").show();
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getCategoryID"},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr= new Array();
- arr=data;
- var id=arr[indx];
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getCategoryItem",id:id},
- dataType: "json",
- cache: false,
- success:function(data){
- /*var temp=data;
- var val="";
- var index=0;
- var index1=0;
- arr= new Array();
- //arr=data;
- for(var i=0;i<temp.length;i++){
- if(temp.charAt(i) == '+'){
- arr[index1-1][index]=val;
- val="";
- index++;
- }else if(temp.charAt(i) == '-'){
- arr[index1]=new Array();
- index1++;
- index=0;
- }else{
- val=val+temp.charAt(i);
- }
- }*/
- arr= new Array();
- arr=data;
- $("#tblcat tr:gt(0)").remove();
- for(var i=0;i<arr.length;i++){
- var tr=$("<tr></tr>");
- for(var x=0;x<arr[i].length;x++){
- if(x == 0){
- tr.append($("<td>"+(i+1)+".</td>"));
- }else{
- tr.append($("<td>"+arr[i][x]+"</td>"));
- }
- }
- tr.append($("<td><button class='btn btn-primary' onClick='UpdateItem("+arr[i][0]+")'>View</button></td>"));
- $("#tbody").append(tr);
- }
- $("#spinloaditem").hide();
- }
- });
- }
- });
- }
- function getcatName(){
- $("#cat1").empty();
- $("#cat2").empty();
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getCategory"},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr=data;
- for(var i=0;i<arr.length;i++){
- $("#cat1").append($("<option>"+arr[i]+"</option>"));
- $("#cat2").append($("<option>"+arr[i]+"</option>"));
- }
- getCategory();
- }
- });
- }
- function UpdateItem(id){
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getItem",id:id},
- dataType: "json",
- cache: false,
- success:function(data){
- //dito tayo
- var arr= new Array();
- arr=data;
- $("#item_img").attr("src",arr[0]);
- $("#item_img2").attr("src",arr[3]);
- $("#item_img3").attr("src",arr[4]);
- $("#item_name").val(arr[1]);
- $("#item_desc").val(arr[2]);
- }
- });
- var name=$("#item_name").val();
- var desc=$("#item_desc").val();
- $("#dialog-messagesss").dialog({
- modal: true,
- width:900,
- height:631,
- buttons: {
- Update: function() {
- var name=$("#item_name").val();
- var desc=$("#item_desc").val();
- if(name != "" && desc != ""){
- var form=new FormData(_("updateItem"));
- form.append("code","updateItem");
- form.append("id",id);
- //alert(name+""+desc+""+id+""+img);
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- $("#dialog-messagesss").dialog( "close" );
- }
- }
- });
- }
- });
- //if($("#itemfile").val() != ""){
- //phpUrl="saveItem.php";
- //imageId="itemfile";
- //uploadFile();
- //}
- getCategory();
- //alert("Item successfully Updated!");
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Fillup all of the information.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }
- },
- Delete:function(){
- var con=confirm("are you sure you want to delete this item ?");
- if(con){
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"deleteItem",id:id},
- });
- //alert("Item successfully Deleted!");
- getCategory();
- $("#dialog-messagesss").dialog( "close" );
- }
- }
- }
- });
- }
- function _(elementID){
- return document.getElementById(elementID);
- }
- function uploadFile(){
- var formdata = new FormData();
- var file = _(imageId).files[0];
- formdata.append(imageId, file);
- var ajax = new XMLHttpRequest();
- ajax.open("POST", phpUrl);
- ajax.send(formdata);
- }
- function showImage(){
- var input=_(imageId);
- var fReader = new FileReader();
- var imageObj = new Image();
- fReader.readAsDataURL(input.files[0]);
- fReader.onloadend = function(event){
- $("#"+canvasId).attr("src",event.target.result);
- }
- }
- function addAdmin(username,password,retype){
- if(username == "" || password == "" || retype == ""){
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>Input all the fields first.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- else if(password != retype){
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>Password does not match.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- else{
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"addAdmin",username:username,password:password},
- success:function(data){
- if(data == "True"){
- var modal = $("#dialog");
- modal.dialog("open");
- $("#txtAdminUsername").val("");
- $("#txtAdminPass").val("");
- $("#txtRetype").val("");
- }
- else{
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>The username is already exist! Please try another one.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- }
- });//end of ajax.
- }
- }
- function updateAdmin(username,password,retype,id){
- if(username == "" || password == "" || retype == ""){
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>Input all the fields first.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- else if(password != retype){
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>Password does not match.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- else{
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"updateAdmin",username:username,password:password,id:id},
- success:function(data){
- if(data == "True"){
- var modal = $("#dialog");
- var pTag = $("<p>Account is successfully updated.</p>");
- $("#dialog > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- $("#adminUsername").val("");
- $("#adminPass").val("");
- $("#adminRe").val("");
- }
- else{
- var modal = $("#dialog-message")
- var pTag = $("<p style='color:red;'>The username is already exist! Please try another one.</p>");
- $("#dialog-message > p").remove();
- modal.append(pTag);
- modal.dialog("open");
- }
- }
- });//end of ajax.
- }
- }
- function setId(id){
- this.id = id;
- }
- function getId(){
- var id_admin = id;
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"adminDelete",id:id_admin},
- success:function(data){
- if(data == "True"){
- window.location.href="adminManage.php";
- }
- }
- });
- }
- $(document).ready(function(){
- //$(".text-editor").summernote();
- //$("#searchdec").hide();
- $("#dialog-messagesss").hide();
- $("#alertsuc").hide();
- $("#alertdan").hide();
- $("#btnsearchdec").click(function(){
- $("#alertinfo").hide();
- $("#alertsuc").hide();
- $("#alertdan").hide();
- var search=$("#txtsearchdec").val();
- $(".selectelement").removeClass("selectelement");
- if(search == ""){
- alert("input name of the deceased first!");
- }else if(mapid_glo == ""){
- alert("Select Branch first!");
- }else{
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"searchDec",dec:search,id:mapid_glo},
- dataType: "json",
- cache: false,
- success:function(data){
- if(data == "no match found!"){
- $("#alertinfo").hide();
- $("#alertsuc").hide();
- $("#alertdan").show();
- }else{
- $("#resultdec").empty();
- $("#resultOwner").empty();
- $("#alertinfo").hide();
- $("#alertsuc").show();
- $("#alertdan").hide();
- $("#renum").html(data.length);
- $("#sertxt").html(search);
- $("#resultdec").append($("<option></option>"));
- $("#resultOwner").append($("<option id='first'>result</option>"));
- var countd=0;
- var counto=0;
- for(var i=0;i<data.length;i++){
- var option=$("<option title='"+data[i][0]+"'>"+data[i][1]+"</option>");
- // if(data[i][2] == 'dec'){
- // $("#resultdec").append(option);
- // countd++;
- // }else{
- $("#resultOwner").append(option);
- // counto++;
- // }
- }
- $("#countO").html("("+counto+")");
- $("#countD").html("("+countd+")");
- //$("#resultdec option:last").remove();
- //$("#resultOwner").empty();
- }
- }
- });
- }
- });
- $("#btnsearchowner").click(function(){
- var search=$("#txtsearchowner").val();
- $(".selectelement").removeClass("selectelement");
- if(search == ""){
- alert("input name of the deceased first!");
- }else{
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"searchOwner",owner:search},
- dataType: "json",
- cache: false,
- success:function(data){
- if(data == "no match found!"){
- alert(data);
- }else{
- for(var i=0;i<data.length;i++){
- $("#"+data[i]).find("img").addClass("selectelement");
- }
- }
- }
- });
- }
- });
- $("#searchowner").hide();
- $("#searchblock").hide();
- $("#searchby").change(function(){
- var search=document.getElementById("searchby").selectedIndex;
- if(search == 0){
- $("#searchdec").show();
- $("#searchowner").hide();
- $("#searchblock").hide();
- }
- if(search == 1){
- $("#searchdec").hide();
- $("#searchowner").show();
- $("#searchblock").hide();
- }
- if(search == 2){
- $("#searchdec").hide();
- $("#searchowner").hide();
- $("#searchblock").show();
- }
- });
- $("#maptest").draggable({ scroll: true,cursor:"move"});
- $("#dialog-confirm").hide();
- $("#dialog-message").hide();
- /*$("#dialog-messageEdit").dialog({
- modal: true,
- width:73+"%"});*/
- $("#dialog-messageEdit").hide();
- $("#spinloaditem").hide();
- $(".spin").hide();
- $("#spinsavecat").hide();
- $("#spinsaveitem").hide();
- $("#dialog-addstaff").hide();
- $("#dialog-updatestaff").hide();
- $("#tdiv").hide();
- // choose theme
- $("#theme").change(function(){
- $(".spin").show();
- //$("#img1").hide();
- var indx=document.getElementById("theme").selectedIndex;
- var id=0;
- $("#img1title").val("");
- $("#img2title").val("");
- $("#img3title").val("");
- $("#img4title").val("");
- $("#img1desc").val("");
- $("#img2desc").val("");
- $("#img3desc").val("");
- $("#img4desc").val("");
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getThemeID",id:id},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr=data;
- id=arr[indx];
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getTheme",id:id},
- success:function(data){
- var arr=getString(data);
- $("#themename").val(arr[0]);
- $("#img1").attr("src",arr[1]);
- $("#img2").attr("src",arr[2]);
- $("#img3").attr("src",arr[3]);
- $("#img4").attr("src",arr[4]);
- $("#staffimg").attr("src",arr[5]);
- $("#img1title").val(arr[6]);
- $("#img2title").val(arr[7]);
- $("#img3title").val(arr[8]);
- $("#img4title").val(arr[9]);
- $("#img1desc").val(arr[10]);
- $("#img2desc").val(arr[11]);
- $("#img3desc").val(arr[12]);
- $("#img4desc").val(arr[13]);
- $(".spin").hide();
- },
- });
- }
- });
- //$("#img1").show();
- });
- // end choose theme
- //change pic
- $("#file1").on("change",function(){
- imageId="file1";
- canvasId="img1";
- // phpUrl="imageUpdate.php";
- showImage();
- //uploadFile();
- });
- $("#file2").on("change",function(){
- imageId="file2";
- canvasId="img2";
- showImage();
- //uploadFile();
- });
- $("#file3").on("change",function(){
- imageId="file3";
- canvasId="img3";
- // phpUrl="imageUpdate.php";
- showImage();
- //uploadFile();
- });
- $("#file4").on("change",function(){
- imageId="file4";
- canvasId="img4";
- // phpUrl="imageUpdate.php";
- showImage();
- //uploadFile();
- });
- $("#stafffile").on("change",function(){
- imageId="stafffile";
- canvasId="staffimg";
- phpUrl="imageUpdate.php";
- showImage();
- //uploadFile();
- });
- //end change pic
- //save home
- $("#btnsavehome").click(function(){
- var indx=document.getElementById("theme").selectedIndex;
- var id=0;
- arrbtn[0]="file1";
- arrbtn[1]="file2";
- arrbtn[2]="file3";
- arrbtn[3]="file4";
- arrbtn[4]="stafffile";
- var theme=$("#themename").val();
- //var features=$("#txtf").val();
- //var faq=$("#txtfaq").val();
- //var management=$("#txtm").val();
- var title1="";
- var title2="";
- var title3="";
- var title4="";
- var descript1="";
- var descript2="";
- var descript3="";
- var descript4="";
- arrphp[0]="image1.php";
- arrphp[1]="image2.php";
- arrphp[2]="image3.php";
- arrphp[3]="image4.php";
- arrphp[4]="image5.php";
- if($("#theme").val() == "new"){
- if($("#file1").val() != "" && $("#file2").val() != "" && $("#file3").val() != "" && $("#file4").val() != "" && $("#themename").val() != ""){
- $("#code").attr("value","saveTheme");
- var form=new FormData(document.getElementById('adminHome'));
- //form.append("code","saveTheme");
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- getSelinHome();
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $("#file1").val("");
- $("#file2").val("");
- $("#file3").val("");
- $("#file4").val("");
- $("#stafffile").val("");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error in Craeting the theme. Complete the theme before saving.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- $("#code").attr("value","updateTheme");
- }else{
- //if($("#themename").val() != "" && title1 != "" && title2 != "" && title3 != "" && title4 != "" && descript1 != "" && descript2 != "" && descript3 != "" && descript4 != ""){
- if($("#themename").val() != ""){
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getThemeID",id:id},
- dataType:"json",
- cache:false,
- success:function(data){
- var arr=data;
- id=arr[indx];
- var form=new FormData(_('adminHome'));
- //form.append("code","updateTheme");
- form.append("id",id);
- form.append("img1title","");
- form.append("img2title","");
- form.append("img3title","");
- form.append("img4title","");
- form.append("img1desc","");
- form.append("img2desc","");
- form.append("img3desc","");
- form.append("img4desc","");
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- getSelinHome();
- $("#file1").val("");
- $("#file2").val("");
- $("#file3").val("");
- $("#file4").val("");
- $("#stafffile").val("");
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- //document.getElementById("dialog-confirm").setAttribute("title","Success");
- }
- });
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error in updating the theme. Complete the theme before saving.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }
- }
- });
- //end save home
- //add category
- $("#categoryfile").on("change",function(){
- imageId="categoryfile";
- canvasId="catimg";
- showImage();
- });
- $("#btnaddcat").click(function(){
- var name=$("#txtcat").val();
- var descript=$("#txtdesc").val();
- if(name != "" && $("#categoryfile").val() != "" && descript != ""){
- $("#spinsavecat").show();
- var form=new FormData(_("addCategory"));
- form.append("code","saveCategory");
- form.append("name",name);
- form.append("descript",descript);
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- $("#spinsavecat").hide();
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- getcatName();
- }
- });
- //phpUrl="saveCategory.php";
- //imageId="categoryfile";
- //uploadFile();
- $("#txtcat").val("");
- $("#txtdesc").val("");
- $("#categoryfile").val("");
- $("#catimg").attr("src","img/1000x300-700x300.gif");
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Failed! You need to Input the image and the title of the new Category.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }
- });
- //end add category
- //search and delete category
- $("#cat1").change(function(){
- getCategory();
- });
- $("#txtsearch").keyup(function(){
- var item=$("#txtsearch").val();
- //if(evt.which == 8){
- if(item == ""){
- getCategory();
- //alert("Wwasak");
- }
- });
- $("#txtsearch").keypress(function(evt){
- //}
- if(evt.which == 13){
- indx=document.getElementById("cat1").selectedIndex;
- var item=$("#txtsearch").val();
- if(item == ""){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Input first!");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }else{
- $("#spinloaditem").show();
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getCategoryID"},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr= new Array();
- arr=data;
- var id=arr[indx];
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"searchItem",item:item,id:id},
- dataType: "json",
- cache: false,
- success:function(data){
- arr= new Array();
- arr=data;
- //var temp=data;
- if(arr.length != 0){
- var val="";
- var index=0;
- var index1=0;
- $("#tblcat tr:gt(0)").remove();
- for(var i=0;i<arr.length;i++){
- var tr=$("<tr></tr>");
- for(var x=0;x<arr[i].length;x++){
- if(x == 0){
- tr.append($("<td>"+(i+1)+".</td>"));
- }else{
- tr.append($("<td>"+arr[i][x]+"</td>"));
- }
- }
- tr.append($("<td><button class='btn btn-primary' onClick='UpdateItem("+arr[i][0]+")'>View</button></td>"));
- $("#tbody").append(tr);
- }
- $("#spinloaditem").hide();
- }else{
- $("#spinloaditem").hide();
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> No Result Found!");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }
- }
- });
- }
- });
- }
- }
- });
- $( "#tabs" ).tabs();
- $("#dialog-confirm").hide();
- $("#btnsearch").click(function(){
- indx=document.getElementById("cat1").selectedIndex;
- var item=$("#txtsearch").val();
- if(item == ""){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Input first!");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }else{
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"getCategoryID"},
- dataType: "json",
- cache: false,
- success:function(data){
- var arr= new Array();
- arr=data;
- var id=arr[indx];
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"searchItem",item:item,id:id},
- dataType: "json",
- cache: false,
- success:function(data){
- //var temp=data;
- arr= new Array();
- arr=data;
- if(arr.length != 0){
- var val="";
- var index=0;
- var index1=0;
- $("#tblcat tr:gt(0)").remove();
- for(var i=0;i<arr.length;i++){
- var tr=$("<tr></tr>");
- for(var x=0;x<arr[i].length;x++){
- if(x == 0){
- tr.append($("<td>"+(i+1)+".</td>"));
- }else{
- tr.append($("<td>"+arr[i][x]+"</td>"));
- }
- }
- tr.append($("<td><button class='btn btn-primary' onClick='UpdateItem("+arr[i][0]+")'>View</button></td>"));
- $("#tbody").append(tr);
- }
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> No Result Found!");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:200,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- $( this ).dialog( "destroy" );
- }
- }
- });
- }
- }
- });
- }
- });
- }
- });
- //end search and delete category
- //update Item
- $("#itemfile").change(function(){
- imageId="itemfile";
- canvasId="item_img";
- showImage();
- });
- $("#itemfile2").change(function(){
- imageId="itemfile2";
- canvasId="item_img2";
- showImage();
- });
- $("#itemfile3").change(function(){
- imageId="itemfile3";
- canvasId="item_img3";
- showImage();
- });
- //end update Item
- //add category item
- $("#addItemfile").change(function(){
- imageId="addItemfile";
- canvasId="imgaddItem";
- showImage();
- });
- $("#addItemfile2").change(function(){
- imageId="addItemfile2";
- canvasId="imgaddItem2";
- showImage();
- });
- $("#addItemfile3").change(function(){
- imageId="addItemfile3";
- canvasId="imgaddItem3";
- showImage();
- });
- $("#editcatfile").change(function(){
- imageId="editcatfile";
- canvasId="editcat_img";
- showImage();
- });
- $("#btnaddItem").click(function(){
- var title=$("#cat_title").val();
- var item_img=$("#addItemfile").val();
- var item_img2=$("#addItemfile2").val();
- var item_img3=$("#addItemfile3").val();
- var desc=$("#desc_item").val();
- if(title != "" && item_img != "" && desc != "" && item_img2 != "" && item_img3 != "" ){
- $("#spinsaveitem").show();
- var indx=document.getElementById("cat2").selectedIndex;
- var form=new FormData(_("addItem"));
- form.append("code","addItem");
- form.append("id",indx);
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- getCategory();
- $("#spinsaveitem").hide();
- }
- });
- //phpUrl="addItem.php";
- //imageId="addItemfile";
- //uploadFile();
- $("#cat_title").val("");
- $("#desc_item").val("");
- $("#addItemfile").val("");
- $("#addItemfile2").val("");
- $("#addItemfile3").val("");
- $("#imgaddItem").attr("src","img/700x450.gif");
- $("#imgaddItem2").attr("src","img/700x450.gif");
- $("#imgaddItem3").attr("src","img/700x450.gif");
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error! You need to Fillup all of the information.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- //end add category item
- //delete category
- $("#btndeletecat").click(function(){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Deleting the category may also delete the category item.<br/> are you sure you want to delete this category?");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:250,
- width:300,
- modal: true,
- buttons: {
- Yes: function() {
- var indx=document.getElementById("cat1").selectedIndex;
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"deleteCategory",id:indx},
- success:function(data){
- //alert(data);
- getcatName();
- }
- });
- $( this ).dialog( "close" );
- },
- No: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- });
- //end of delete category
- //about page
- $("#btnimgstaff").change(function(){
- imageId="btnimgstaff";
- canvasId="imgstaff";
- showImage();
- });
- $("#btnimgstaffadd").change(function(){
- imageId="btnimgstaffadd";
- canvasId="imgstaffadd";
- showImage();
- });
- $("#fileabout").change(function(){
- imageId="fileabout";
- canvasId="about_img";
- showImage();
- });
- $("#btnsaveabout").click(function(){
- var btnimg=$("#fileabout").val();
- var desc=$("#txtareaAbout").val();
- if( desc != ""){
- var form=new FormData(_("saveAbout"));
- form.append("code","saveAbout");
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data: form,
- contentType:false,
- cache:false,
- processData:false,
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error! you must insert the image and the description.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- //end about page
- //contact page
- $("#filecontact").change(function(){
- imageId="filecontact";
- canvasId="imgcontact";
- showImage();
- });
- $("#btnsavecontact").click(function(){
- var phone=$("#contactphone").val();
- var hours=$("#contacthours").val();
- var email=$("#contactemail").val();
- var details=$("#contactdetails").val();
- if(phone != "" && hours != "" && email != "" && details != ""){
- var form=new FormData(_("updateContact"));
- form.append("code","updateContact")
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data: form,
- contentType:false,
- cache:false,
- processData:false,
- success:function(data){
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> "+data);
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- }else{
- $("#txtp").html("<span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span> Error! you must complete the details for contact page.");
- $( "#dialog-confirm" ).dialog({
- resizable: true,
- height:180,
- width:300,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- //end contact page
- //login and logout
- /*$("#btnlogin").click(function(){
- var username=$("#txtusername").val();
- var pass=$("#txtpassword").val();
- if(username != "" && pass != ""){
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"login",username:username,pass:pass},
- success:function(data){
- var arr=getString(data);
- if(arr[0] == "true"){
- document.location.href="adminHome.php";
- }else{
- alert("incorrect password or username.!");
- }
- }
- });
- }else{
- alert("fill-up first!");
- }
- });*/
- $("#txtpassword").keyup(function(event){
- if(event.keyCode == 13)
- {
- // alert("successfully login");
- $("#btnlogin").click();
- }
- });
- $("#btnlogin").click(function(){
- var username=$("#txtusername").val();
- var pass=$("#txtpassword").val();
- if(username != "" && pass != ""){
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"login",username:username,pass:pass},
- success:function(data){
- var arr=getString(data);
- if(arr[0] == "true"){
- document.location.href="adminHome.php";
- }else{
- alert("incorrect password or username.!");
- }
- }
- });
- }else{
- alert("fill-up first!");
- }
- });
- $("#btnlogout").click(function(){
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"logout"},
- success:function(data){
- document.location.href="index.php";
- }
- });
- });
- //end of login and logout
- //select map
- $("#selectMap").change(function(){
- var indx=document.getElementById("selectMap").selectedIndex;
- var id=$(this).find("option:eq("+indx+")").attr("id");
- mapid_glo=id;
- if(id == "defult"){
- }else{
- $("#maptest").empty();
- $("#maptest").draggable({ containment: "#maptest", scroll: false,snap:true,grid:[30,30],cursor:"none"});
- $("#maptest").animate({zoom:"0.5"},1);
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"loadMap",id:id},
- success:function(data){
- var arr=getString(data);
- //loadGrid(parseInt(arr[0]),parseInt(arr[1]));
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"loadElement",id:arr[2]},
- success:function(data){
- var index=0;
- var arr=getString(data);
- var num=parseInt(arr[0]);
- for(var i=0;i<num;i++){
- loadElement(arr[index+1],arr[index+2],arr[index+3],arr[index+4],arr[index+5],arr[index+6],arr[index+7],arr[index+8]);
- index=index+8;
- }
- }
- });
- }
- });
- }
- });
- //end of select map
- //add features and amenities
- $("#btnfa").click(function(){
- var txt=$("#txtfa").val();
- if(txt != ""){
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"addFA",txt:txt},
- success:function(data){
- }
- });
- loadFA();
- }else{
- alert("input first!");
- }
- });
- // end add features and amenities
- //edit cat
- $("#btneditcat").click(function(){
- $("#editcat_img").attr("src","img/700x450.gif");
- $("#editcat_name").val("");
- $("#editcat_desc").val("");
- var indx=document.getElementById("cat1").selectedIndex;
- //alert(indx);
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:{code:"editCategory",id:indx},
- success:function(data){
- var arr=getString(data);
- $("#editcat_img").attr("src",arr[2]);
- $("#editcat_name").val(arr[0]);
- $("#editcat_desc").val(arr[1]);
- $("#dialog-messageEdit").dialog({
- modal: true,
- width:73+"%",
- buttons: {
- Update: function() {
- var name=$("#editcat_name").val();
- var desc=$("#editcat_desc").val();
- if(name != "" && desc != ""){
- var indx=document.getElementById("cat1").selectedIndex;
- var form=new FormData(_("editCat"));
- form.append("id",indx);
- form.append("code","updateCategory");
- $.ajax({
- type:"POST",
- url:"include/function.php",
- data:form,
- contentType: false, // The content type used when sending data to the server.
- cache: false, // To unable request pages to be cached
- processData:false,
- success:function(data){
- alert(data);
- $("#dialog-messageEdit").dialog( "close" );
- }
- });
- //$( this ).dialog( "close" );
- }else{
- alert("complete the form first!");
- }
- }
- }
- });
- //getcatName();
- },
- });
- });
- // end edit cat
- $( "#dialog-message" ).dialog({
- autoOpen: false,
- modal: true,
- buttons: {
- Ok: function() {
- $(this).dialog( "close" );
- }
- }
- });
- $( "#dialog" ).dialog({
- autoOpen: false,
- modal: true,
- buttons: {
- Ok: function() {
- $(this).dialog( "close" );
- }
- }
- });
- $( "#dialog3" ).dialog({
- autoOpen: false,
- modal: true,
- buttons: {
- Ok: function(data) {
- getId();
- },
- Cancel: function(data){
- $(this).dialog("close");
- }
- }
- });
- $( "#accordion" ).accordion({
- collapsible: true
- });
- $("#btnAddAdmin").click(function(){
- var username = $("#txtAdminUsername").val();
- var password = $("#txtAdminPass").val();
- var retype = $("#txtRetype").val();
- addAdmin(username,password,retype);
- });
- $("#btnUpdateAdmin").click(function(){
- // var username = $("#adminUsername").val();
- var password = $("#adminPass").val();
- // var retype = $("#adminRe").val();
- var admin_id = $("#id").val();
- updateAdmin(password,admin_id);
- });
- $(".btnAdminDel").click(function(){
- var admin_id =$(this).closest('tr').children('td:first').text();
- setId(admin_id);
- $("#dialog3").dialog("open");
- });
- var temps=4;
- $( "#slider" ).slider({
- value:0,
- max: 13,
- step: 1,
- slide: function( event, ui ) {
- var s=ui.value;
- //alert(s+" "+temps);
- if(temps <= s){
- $("#maptest").animate({zoom:"+=0.1"},1);
- temps=s;
- }else{
- $("#maptest").animate({zoom:"-=0.1"},1);
- temps=s;
- }
- // if(s >= 4 && s<= 7){
- // $("#maptest").animate({zoom:"+=0.1"},400);
- // }
- // //$("#maptest").animate({zoom:ui.value*0.1},400);
- //$( "#amount" ).val( "$" + ui.value );
- }
- });
- $("#declotspub").change(function(){
- var declots=document.getElementById("declotspub").selectedIndex;
- declots=$("#declotspub option:eq("+declots+")").attr("title");
- if(declots == "newDec"){
- $("#decimg").attr("src","img/placeholder.png");
- $("#decname").html("NO RECORD");
- $("#decbirth").html("NO RECORD");
- $("#decdeath").html("NO RECORD");
- $("#decburial").html("NO RECORD");
- }else{
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"getLotInfoDec",decID:declots,id:$(decIDlot).attr("id")},
- success:function(data){
- var arr=data.split("+");
- $("#decimg").attr("src",arr[7]);
- $("#decname").html(arr[1]+" "+arr[3]+" "+arr[2]);
- $("#decbirth").html(arr[4]);
- $("#decdeath").html(arr[5]);
- $("#decburial").html(arr[6]);
- decid=arr[0];
- }
- });
- }
- });
- $("#btnokedit").click(function(){
- $("#faText").removeClass("error");
- var txt=$("#faText").val();
- if(txt != ""){
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"setFA",id:editFaid,txt:txt},
- success:function(data){
- $("#btncloseedit").click();
- }
- });
- loadFA();
- }else{
- $("#faText").addClass("error");
- }
- });
- $("#btnokdelete").click(function(){
- $.ajax({
- url:"include/function.php",
- type:"POST",
- data:{code:"deleteFA",id:deleteFAid},
- success:function(data){
- $("#loadFAtemp").click();
- $("#btnclosedelete").click();
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement