/home/mjc1/public_html/j3demo/shopm/1n1.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
include_once("./_common.php");
include_once(
$j3_shopm_path."/shop_header.php");

if(
$id_ccode=='' || $id_ccode=='0'){
    
alert("1:1문의는 회원만 가능합니다. 회원가입이나 로그인하시기 바랍니다."); exit;
}

if(
$stx!=''){
    
$where2 .= " and {$sti} like '%{$stx}%' ";
}

$list_num $config['page_line'];
if(
$_COOKIE['page_line']!=''){ $list_num $_COOKIE['page_line']; }
if (
$page 1) { $page 1; } // 페이지가 없으면 첫 페이지 (1 페이지)

$list_array qa_list_get($id_ccode$where2$page$list_num);

$total_page $list_array[0]['total_page'];
$list_num $list_array[0]['list_num'];
$total_count $list_array[0]['total_count'];

$qstr $_SERVER['QUERY_STRING'];

if(
$idx!=''){
    
$cinfo qa_info_get($idx);
}

?>
<div id="wrap">
    <div id="container" class="" style='<?php if($_COOKIE['hd_height']!='' && $header_fixed=='1'){ echo "margin-top:{$_COOKIE['hd_height']}px !important;"; }?>'>

<?php
    skin_module_show
("qa",$sample_idx); // 1:1문의 스킨을 불러온다.
?>
    </div><!-- #container -->
</div><!-- #wrap -->

<script>
$(function(){
    $(".check_all_class").click(function(){ // 전체선택 전체선택 해제
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $(".show_qa_class").click(function(){ // 1:1문의 보기
        $tr_obj = $(this).closest("tr");
        $idx = $tr_obj.find("input[name='codes[]']").val();
        document.location.href="?page=<?php echo $page;?>&idx="+$idx;
    });

    $(".qa_list_class").click(function(){ // 1:1목록으로
        document.location.href="?page=<?php echo $page;?>";
    });

    $(".1n1_new_class").click(function(){ // 1:1문의 신규작성
        $.get("1n1_new.inc.php",function(rtn){
            $("#modal_member_box").html(rtn).dialog({
                resizable: true, height:600, width:"100%", modal: true, title:"1:1문의 [작성]",
                buttons: {
                    문의하기: function() {
                        qa_save();
                    },
                    닫기: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });
    });

    $(".1n1_delete_class").click(function(){ // 1:1문의 삭제
        var ck_cnt = 0;
        var v = $("input[name='code_idx[]']").each(function(){
            if($(this).is(":checked")){ ck_cnt++; }
        });
        if(ck_cnt==0){ alert('삭제하실 문의를 선택하세요.'); return; }

        if(confirm('정말로 '+ck_cnt+'개의 문의를 삭제하시겠습니까?')){
            $("input[name='sel_del']").val("Y");
            var form_data = $("form[name='qa_list_form']").serialize();

            $.ajax({type:"post", url:"<?php echo $j3_shopp_url;?>/ajax.qa_process.php?", data:form_data, async:false, dataType : "xml", 
                success:function(xml){    
                    var v_mode = $(xml).find("mode").text();
                    var v_mode_ok = $(xml).find("mode_ok").text();
                    var v_msg = $(xml).find("msg").text();
                    var v_qa_cnt = $(xml).find("qa_cnt").text();
                    if(v_mode_ok=='Y'){
                        document.location.reload();
                    } else {
                        alert(v_msg);
                    }
                },
                error:function(rtn,status,error){    alert(error);        }
            });
        }
    });

    $(".total_cnt_class").html("<?php echo $total_count;?>");
});

function qa_save(){ // 1:1문의 저장
    $form_obj = $("#1n1_reg_form");

    if($form_obj.find("input[name='qa_subject']").val()==''){
        alert('문의제목을 입력하세요.'); return;
    }
    if($("#qa_content").val()==''){
        alert('문의내용을 입력하시기 바랍니다.'); return;
    }
    if(confirm('1:1문의를 작성하시겠습니까?')){
        form_data = $form_obj.serialize();
        $.ajax({type:"post", url:"<?php echo $j3_shopp_url;?>/ajax.qa_process.php", data:form_data, async:false, dataType : "xml", 
            success:function(xml){    
                var v_mode = $(xml).find("mode").text();
                var v_mode_ok = $(xml).find("mode_ok").text();
                var v_msg = $(xml).find("msg").text();
                if(v_mode_ok!='Y'){
                    alert(v_msg);
                } else {
                    document.location.reload();
                }
            },
            error:function(rtn,status,error){    alert(error);        }
        });
    }
}
</script>

<?php
include_once($j3_shopm_path."/shop_footer.php");
?>
<div id="modal_member_box" title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>