var around_grlty_office_pg_i = 1;
var around_grlty_office_end_of_pg = 0;
// =============================================================== ajax json main
function GET_JSON_DATA( fcate, sub_fcate, form_nm, pg_num, target_v )
{
if( document.getElementById("rp_progress_indicator") )
document.getElementById("rp_progress_indicator").style.display = "block";
// ============================================ ¼±Ã³¸®
var bf_prcs_rst = BF_AJX_IED_SCRIPT(fcate);
if( bf_prcs_rst == false )
{
if( document.getElementById("rp_progress_indicator") )
document.getElementById("rp_progress_indicator").style.display = "none";
return false;
}
// ============================================ post ·Î º¸³¾ data »ý¼º
var formdata_JSON = JSON_FORMDATA( fcate, sub_fcate, form_nm, pg_num );
// ============================================ ajax model url
var Json_Url = SELECT_FCATE_URL(fcate, sub_fcate);
//console.log(formdata_JSON);
if( !Json_Url ) return false;
// ============================================ ajax
$.post(Json_Url,
{
formdata_JSON:formdata_JSON
},
function(data,status){
if( data != 'error' )
{
AFT_JSON_PRCS( data, fcate, sub_fcate, form_nm, pg_num, target_v );
}
});
}
// =============================================================== ajax json ÈÄó¸®
function AFT_JSON_PRCS( data, fcate, sub_fcate, form_nm, pg_num, target_v )
{
//console.log(data);
// ============================================ ½Ç°Å·¡ ±×·¡ÇÁ data ó¸®
if( fcate == 'dangi_detail_view' )
{
document.getElementById(fcate+"_div").innerHTML = data;
}
else if( fcate == 'rp_that_graph' || fcate == 'rp_local_graph' )
{
var JSON_DATA = JSON.parse(data);
if( JSON_DATA.TOTAL_CNT == null || JSON_DATA.TOTAL_CNT == 0 )
{
if( document.getElementById("area_b")
&& document.getElementById("area_b").value == ''
)
{
if( fcate == 'rp_that_graph' )
{
check_result_in_dview(fcate, 'no_data');
}
}
else if( fcate == 'rp_that_graph' || fcate == 'rp_local_graph' )
{
check_result_in_dview(fcate, 'no_data');
}
document.getElementById(fcate+"_div").innerHTML =
"
½Ç°Å·¡ Á¤º¸°¡ ¾ø½À´Ï´Ù.";
if( document.getElementById("rp_progress_indicator") )
document.getElementById("rp_progress_indicator").style.display = "none";
return false;
}
var Graph_Data = JSON_DATA.DATA;
if( fcate == 'rp_that_graph' )
{
var RP_THAT_AREA = JSON_DATA.GRAPH_AREA;
rp_that_graph_area_btn_view_script(RP_THAT_AREA);
}
drawChart_local(fcate, Graph_Data);
return false;
}
// ============================================ ÀÚµ¿¿Ï¼º
else if( fcate == 'auto_c_search_txt' )
{
// console.log(data);
//var JSON_DATA = JSON.parse(data);
var JSON_DATA = data;
if( JSON_DATA.DATA == null ) { }
else
AUTO_C_LIST_DATA = JSON_DATA;
Smart_Auto_Complete_List(AUTO_C_LIST_DATA);
}
// ============================================ ¸ñ·Ï view »ý¼º
else
{
if( fcate == 'around_rlty' || fcate == 'around_dangi' )
{
output_list_html = data;
if( document.getElementById(fcate+"_container") )
document.getElementById(fcate+"_container").innerHTML = output_list_html;
}
else
{
var JSON_DATA = JSON.parse(data);
var loop_cnt = JSON_DATA.DATA.length;
var output_list_html = "";
if( JSON_DATA.TOTAL_CNT == null || JSON_DATA.TOTAL_CNT == 0 )
{
if( document.getElementById(fcate+"_container") )
document.getElementById(fcate+"_container").innerHTML = "
°Ë»öµÈ Á¤º¸°¡ ¾ø½À´Ï´Ù.";
if( document.getElementById(fcate+"_pagelist") )
{
if( fcate == 'around_grlty_office' && pg_num > 0 ){ }
else
document.getElementById(fcate+"_pagelist").innerHTML = "";
}
if( document.getElementById("rp_progress_indicator") )
document.getElementById("rp_progress_indicator").style.display = "none";
if( fcate == 'rp_data_that_table' )
check_result_in_dview(fcate, 'no_data');
return false;
}
else
{
if( fcate == 'rp_data_local_table' ||
fcate == 'rp_data_that_table' ) output_list_html = rp_data_table_view_script(JSON_DATA.DATA, fcate);
else if( fcate == 'ac_dangi_info' ) {output_list_html = ac_dangi_info_view_script(JSON_DATA.DATA, fcate);}
else if( fcate == 'around_grlty_office' ) output_list_html = expert_list_view_script(JSON_DATA.DATA, fcate);
}
if( document.getElementById(fcate+"_container") )
document.getElementById(fcate+"_container").innerHTML = output_list_html;
// ============================================ ÆäÀÌÁö ¸®½ºÆ®
if( pg_num == '' || pg_num == null )
pg_num = 1;
else
pg_num = Number(pg_num);
total_page = Number(JSON_DATA.TOTAL_PAGE);
if( fcate == 'around_grlty_office' && JSON_DATA.TOTAL_CNT < 15 )
around_grlty_office_end_of_pg = 1;
else
around_grlty_office_end_of_pg = 0;
output_pg_html = JS_PAGE_LIST( fcate, sub_fcate, form_nm, pg_num, total_page );
if( document.getElementById(fcate+"_pagelist") )
document.getElementById(fcate+"_pagelist").innerHTML = "
" + output_pg_html + "
";
if( fcate == 'ac_dangi_info' )
document.getElementById("ac_dangi_info_container").style.display = "";
}
}
if( document.getElementById("rp_progress_indicator") )
document.getElementById("rp_progress_indicator").style.display = "none";
}
// =============================================================== ¼±Ã³¸®
function BF_AJX_IED_SCRIPT( fcate )
{
// ½Ç°Å·¡ ±×·¡ÇÁ
if( fcate == 'rp_that_graph' || fcate == 'rp_local_graph' || fcate == 'rp_data_that_table' )
{
bf_prcs_rst = rp_srch_condition_view_script( fcate );
return bf_prcs_rst;
}
else if( fcate == 'auto_c_search_txt' )
{
$("#auto_c_search_txt #srch_txt").val($("#s_srch_frm #search_txt").val());
}
else if( fcate == 'ac_dangi_info' )
{
var rlty_cate_sise = $("input[type='radio'][name='rlty_cate_sise']:checked").val();
if( rlty_cate_sise == 'rlty_cate_sise_sole_tp' || rlty_cate_sise == 'sole' ||
rlty_cate_sise == 'rlty_cate_sise_land_tp' || rlty_cate_sise == 'land' ) return false;
if( document.getElementById("sido").value == '' )
{
alert('Áö¿ªÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.');
document.getElementById("sido").focus();
return false;
}
else if( document.getElementById("gugun").value == '' )
{
alert('½Ã±º±¸¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.');
document.getElementById("gugun").focus();
return false;
}
else if( document.getElementById("dong").value == '' )
{
alert('À¾¸éµ¿À» ¼±ÅÃÇØÁÖ¼¼¿ä.');
document.getElementById("dong").focus();
return false;
}
}
return true;
}
// =============================================================== ajax model url ¼±ÅÃ
function SELECT_FCATE_URL( fcate, sub_fcate )
{
if( fcate == null || fcate == '' ) return false;
if( fcate == 'rp_data_local_table' ||
fcate == 'rp_data_that_table' ) ajx_url = "/workdir/upcate/sise/model/rp_md/rp_data_table_common_inc.php"; // ´ÜÁö/ÁÖº¯Áö¿ª ½Ç°Å·¡°¡
else if( fcate == 'rp_that_graph' ) ajx_url = "/workdir/upcate/sise/model/rp_md/rp_graph_that_inc.php"; // ´ÜÁö ±×·¡ÇÁ
else if( fcate == 'rp_local_graph' ) ajx_url = "/workdir/upcate/sise/model/rp_md/rp_graph_local_inc.php"; // ÁÖº¯Áö¿ª ±×·¡ÇÁ
else if( fcate == 'ac_dangi_info' ) ajx_url = "/workdir/process/ajax/ajax_inc/md_ajx_autocomplete_data.php"; // ´ÜÁöÁ¤º¸ get
else if( fcate == 'auto_c_search_txt' ) ajx_url = "/workdir/ied_search/ied_smart/ied_auto_complete.php"; // ÀÚµ¿¿Ï¼º
else if( fcate == 'dangi_detail_view' ) ajx_url = "/workdir/process/ajax/ajax_inc/md_ajx_dangi_dview_prcs.php"; // ´ÜÁöÁ¤º¸ »ó¼¼ÆäÀÌÁö
else if( fcate == 'around_rlty' ||
fcate == 'around_dangi' ||
fcate == 'around_grlty_office' ) ajx_url = "/workdir/process/ajax/ajax_inc/md_ajx_ied_srch.php"; //
return ajx_url;
}
// =============================================================== formdata »ý¼º
function JSON_FORMDATA( fcate, sub_fcate, frm_nm, pg_num )
{
var data_obj = [];
var data_obj_nm_A = [];
if( frm_nm )
{
data_obj = $("#"+frm_nm).serialize();
data_obj += "&fcate="+fcate;
}
// ---------------------------------------------------------- ´ÜÁö¸í °¡Á®¿À±â / ´ÜÁö, ÁÖº¯Áö¿ª ±×·¡ÇÁ
else if( fcate == 'ac_dangi_info' || fcate == 'rp_that_graph' || fcate == 'rp_local_graph' )
{
if( fcate == 'ac_dangi_info' )
data_obj_nm_A = ["fcate","sido","gugun","dong","rlty_cate_sise","rlty_cate_sise"
,"bon","bu"];
else if( fcate == 'rp_that_graph' || fcate == 'rp_local_graph' )
data_obj_nm_A = ["fcate","auto_comp_keyword","sido","gugun","dong","rlty_cate_sise","bon","bu","dangi_nm"];
for( i = 0; i < data_obj_nm_A.length; i++ )
{
elm_nm = data_obj_nm_A[i];
if( elm_nm == undefined || elm_nm == null )
return;
if( elm_nm == 'fcate' ) elm_val = fcate;
else if( elm_nm == 'rlty_cate_sise' )
{
elm_val = $("input[type='radio'][name='rlty_cate_sise']:checked").val();
}
else if( elm_nm == 'trade_tp' )
{
elm_val = $("input[type='radio'][name='trade_tp']:checked").val();
}
else
elm_val = encodeURIComponent($("#"+elm_nm).val());
data_obj += "&"+elm_nm+"="+elm_val;
}
}
// ---------------------------------------------------------- ÁÖº¯Áö¿ª ¸Å¹°/´ÜÁöÁ¤º¸
else if( fcate == 'around_rlty' || fcate == 'around_dangi' || fcate == 'dangi_detail_view' )
{
MAIN_CATE = encodeURIComponent($("#MAIN_CATE").val());
SUB_CATE = '';
if( MAIN_CATE == '' ) MAIN_CATE = "web";
if( SUB_CATE == '' ) SUB_CATE = "mobile_web";
sido = encodeURIComponent($("#sido").val());
gugun = encodeURIComponent($("#gugun").val());
dong = encodeURIComponent($("#dong").val());
bon = encodeURIComponent($("#bon").val());
bu = encodeURIComponent($("#bu").val());
auto_comp_dg_cd = encodeURIComponent($("#auto_comp_dg_cd").val());
auto_comp_lat = encodeURIComponent($("#auto_comp_lat").val());
auto_comp_lng = encodeURIComponent($("#auto_comp_lng").val());
app_software_version = encodeURIComponent($("#APP_SOFTWARE_VERSION").val());;
trade_tp = $("input[type='radio'][name='trade_tp']:checked").val();
if( trade_tp == null || trade_tp == 'undefined' )
trade_tp = $("#trade_tp").val();
rlty_cate_sise = $("input[type='radio'][name='rlty_cate_sise']:checked").val();
if( rlty_cate_sise == null || rlty_cate_sise == 'undefined' )
rlty_cate_sise = $("#rlty_cate_sise").val();
if( rlty_cate_sise == 'rlty_cate_sise_apt_tp' || rlty_cate_sise == 'apt' ) bldg_cate = "apt";
else if( rlty_cate_sise == 'rlty_cate_sise_billa_tp' || rlty_cate_sise == 'billa') bldg_cate = "billa";
else if( rlty_cate_sise == 'rlty_cate_sise_sole_tp' || rlty_cate_sise == 'sole' ) bldg_cate = "";
else if( rlty_cate_sise == 'rlty_cate_sise_otel_tp' || rlty_cate_sise == 'otel' ) bldg_cate = "otel";
else if( rlty_cate_sise == 'rlty_cate_sise_brgt_tp' || rlty_cate_sise == 'brgt' ) bldg_cate = "brgt";
else if( rlty_cate_sise == 'rlty_cate_sise_land_tp' || rlty_cate_sise == 'land' ) bldg_cate = "";
if( fcate == 'around_rlty' )
{
data_obj = {
"MAIN_CATE":MAIN_CATE ,
"SUB_CATE" : SUB_CATE ,
"sido":sido ,
"gugun":gugun ,
"dong":dong ,
"SW_KYUNG_ING":"1",
"SW_PRE":"1",
"SW_GONG":"1",
"SW_BUN":"1",
"from_where":"m_w_d_search_list",
"APP_SOFTWARE_VERSION":app_software_version,
"around_dg_lat":auto_comp_lat ,
"around_dg_lng":auto_comp_lng
};
if( trade_tp == 'trade_tp_sale_junse' ) $.extend(data_obj, {sw_gen :"1"});
else if( trade_tp == 'trade_tp_sale' ) $.extend(data_obj, {sw_sale:"1"});
else if( trade_tp == 'trade_tp_junse' ) $.extend(data_obj, {sw_jun :"1"});
else if( trade_tp == 'trade_tp_wolse' ) $.extend(data_obj, {sw_wol :"1"});
}
else if( fcate == 'around_dangi' )
{
data_obj = { "MAIN_CATE":MAIN_CATE ,
"SUB_CATE" : SUB_CATE ,
"sido":sido ,
"gugun":gugun ,
"dong":dong ,
"bon":bon ,
"bu":bu ,
"SW_SISE":"1",
"Dview_Type":"dangi",
"bldg_cate":bldg_cate,
"from_where":"m_w_d_search_list",
"APP_SOFTWARE_VERSION":app_software_version,
"SIZE_LIMIT":"6",
"around_dg_lat":auto_comp_lat ,
"around_dg_lng":auto_comp_lng
};
}
else if( fcate == 'dangi_detail_view' )
{
data_obj = { "MAIN_CATE":MAIN_CATE ,
"SUB_CATE" : SUB_CATE ,
"SIDO":sido ,
"GUGUN":gugun ,
"DONG":dong ,
"BONBUN":bon ,
"BUBUN":bu ,
"Bldg_Cate":bldg_cate ,
"Dangi_Code":auto_comp_dg_cd ,
"Lat":auto_comp_lat ,
"Lng":auto_comp_lng
};
}
data_obj = $.param(data_obj);
}
// ----------------------------------------------------------
// ----------------------------------------------------------
if( pg_num == null || pg_num == 'undefined' ) pg_num = 1;
around_grlty_office_pg_i = pg_num;
data_obj += "&pg="+pg_num;
// ----------------------------------------------------------
var json_data = data_obj;
return json_data;
}
// =============================================================== ÆäÀÌÁö ¸®½ºÆ®
function JS_PAGE_LIST( fcate, sub_fcate, form_nm, pg_num, total_page )
{
var output_html = "";
start_page = ( ( parseInt( (pg_num - 1 ) / 10 ) ) * 10 ) + 1;
end_page = start_page + 9;
if( fcate == 'around_grlty_office' )
{
around_grlty_office_pg_i = parseInt(around_grlty_office_pg_i);
prev_pg = around_grlty_office_pg_i-1;
if( prev_pg == 0 ) prev_pg = 1;
if( around_grlty_office_end_of_pg ) next_pg = around_grlty_office_pg_i;
else next_pg = around_grlty_office_pg_i+1;
output_html += "";
output_html += "" + around_grlty_office_pg_i + "";
output_html += "";
}
else
{
if( pg_num > 1 && total_page > 10 )
{
output_html += "óÀ½";
if( pg_num > 10 ) output_html += "ÀÌÀü";
}
if(end_page >= total_page) end_page = total_page;
if(total_page > 1)
for ( k = start_page; k <= end_page; k++ )
{
if(pg_num != k) output_html += "" + k + "";
else output_html += ""+k+"";
}
if(pg_num < total_page && total_page > 10 )
{
if( ( end_page + 1 ) > total_page ) next_pg_no = total_page;
else next_pg_no = ( end_page + 1 );
output_html += "´ÙÀ½";
output_html += "¸Ç³¡";
}
output_html += "";
}
return output_html;
}