| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <?php
- include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
- include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
- $cd_grade = $_REQUEST['cd_grade'];
- $mp = "13"; //set top nav
- /*$ds_cate = $_REQUEST[ds_cate];
- if(!$ds_cate) $ds_cate='A0';
- */
- if($cd_grade!="" || $cd_grade!=null){
- $sql ="SELECT
- mst.*
- ,(select cd_category from car_model sub where sub.cd_model = (select cd_model from car_model_sub sub where sub.cd_model_sub = mst.cd_model_sub ) ) cd_category
- , (select cd_model from car_model_sub sub1 where sub1.cd_model_sub = mst.cd_model_sub ) cd_model
- , (select cd_brand from car_model sub where sub.cd_model = (select cd_model from car_model_sub sub where sub.cd_model_sub = mst.cd_model_sub ) ) cd_brand
- FROM car_grade mst
- WHERE cd_grade='$cd_grade' AND ds_delind='N'";
- $col=mysql_fetch_array(mysql_query($sql));
- if (!empty($col['cd_grade'])){
- $cd_category =$col["cd_category"];
- $cd_brand =$col["cd_brand"];
- $cd_grade =$col["cd_grade"];
- $cd_model_sub =$col["cd_model_sub"];
- $nm_grade =$col["nm_grade"];
- $ds_status =$col["ds_status"];
- $mode ="Update";
- }else{
- AlertBack("게시물을 가져오지 못하였습니다.");
- }
- $PageNo = $PageNo;
- }else{
- $mode="Add";
- }
- if ($mode=="Add"){
- $cd_userid = $_SESSION['admin_cd_userid'];
- }
- if($ds_open==""){$ds_open="Y";}
- ?>
- <? include("../inc/inc_top.php") ?>
- <? include("../inc/inc_header.php") ?>
- <section id="contents">
- <!-- 세부모델 -->
- <h2>세부모델</h2>
- <form id="frmForm" name="frmForm" method="post" action="grade_proc.php" enctype="multipart/form-data">
- <input type="hidden" name="mode" id="mode" value="<?=$mode?>"/>
- <input type="hidden" name="cd_userid" id="cd_userid" value="<?=$cd_userid?>"/>
- <input type="hidden" name="ds_status" id="ds_status" value="<?=$ds_status?>"/>
- <input type="hidden" name="cd_grade" id="cd_grade" value="<?=$cd_grade?>"/>
- <input type="hidden" name="ds_cate" id="ds_cate" value="<?=$ds_cate?>"/>
- <input type="hidden" name="PageNo" id="PageNo" value="<?=$PageNo?>"/>
- <div class="tbl_wrap">
- <table class="tbl_list2 ty2">
- <colgroup>
- <col width="20%">
- <col width="*">
- </colgroup>
- <tr>
- <th>구분</th>
- <td>
- <span class="select" style="width:200px;" id="sel_cd_category">
- <select name="cd_category" id="cd_category" onchange="cd_category_chg(this.value)">
- </span>
- </td>
- </tr>
- <tr>
- <th>제조사</th>
- <td>
- <span class="select" style="width:200px;" id="sel_cd_brand">
- <select id="cd_brand" name="cd_brand" onchange="cd_brand_chg(this.value)"></select>
- </span>
- </td>
- </tr>
- <tr>
- <th>모델</th>
- <td>
- <span class="select" style="width:200px;" id="sel_cd_model">
- <select id="cd_model" name="cd_model" onchange="cd_model_chg(this.value)"></select>
- </span>
- </td>
- </tr>
- <tr>
- <th>세부모델</th>
- <td>
- <span class="select" style="width:200px;" id="sel_cd_model_sub">
- <select id="cd_model_sub" name="cd_model_sub"></select>
- </span>
- </td>
- </tr>
- <tr>
- <th>등급</th>
- <td><input type="text" class="inp_txt" style="width:60%;" name="nm_grade" id="nm_grade" value="<?=$nm_grade?>"></td>
- </tr>
- </table>
- </div>
- </form>
- <div class="btn_right">
- <? if($mode=="Add"){?>
- <a href="#" class="rnd_btn ty2 black" id="btn_write">등록</a>
- <?}elseif($mode=="Update"){?>
- <a href="#" class="rnd_btn ty2 black" id="btn_write">수정</a>
- <a href="#" class="rnd_btn ty2 black" onclick="fnDelete('<?=$cd_grade?>');">삭제</a>
- <?}?>
- <a href="#" class="rnd_btn ty2 black" onclick="fnList();return false;">목록</a>
- </div>
- </section>
- <form id="delFrm" name="delFrm" method="post" action="./grade_proc.php">
- <input type="hidden" name="mode" id="mode" value="Delete"/>
- <input type="hidden" name="cd_grade" id="cd_grade_del"/>
- <input type="hidden" name="ds_cate" value="<?=$ds_cate?>"/>
- </form>
- <script language="javascript" type="text/javascript">
- var ds_mode ="<?=$mode?>";
- function fnList(grade, cate){
- location.replace("./grade.php?cd_grade="+grade+"&ds_cate="+cate);
- }
- function fnDelete(cd_grade){
- $("#cd_grade_del").val(cd_grade);
- var custom_opts = {
- title : '정말로 삭제 하시겠습니까?',
- btn_close_show : false,
- }
- custom_modal_confirm(custom_opts, function(confirm) {
- if(confirm) {
- $("#btn_delete").hide();
- var data = $("#delFrm").serialize();
- $.ajax({
- url : 'grade_proc.php',
- type: 'POST',
- dataType : 'json',
- data: data,
- success: function(res) {
- custom_modal_confirm_close();
- $("#btn_delete").show();
- //세션 종료시 로그인 페이지로 이동
- if(res.CODE != "0000") {
- custom_opts.title = res.MSG;
- if(res.CODE == "4444") {
- window.location.href = res.DATAS.URL;
- }
- custom_modal_alert(custom_opts);
- return false;
- }
- custom_opts.title = '삭제 되었습니다.';
- custom_opts.event_esc_key = false;
- custom_modal_alert(custom_opts, function() {
- link("<?=ADMIN_PATH?>/car/grade.php");
- });
- },
- error:function(request,status,error){
- $("#btn_delete").show();
- custom_modal_confirm_close();
- alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
- }
- });
- }else {
- $("#btn_delete").show();
- return false;
- }
- });
- }
- function cd_category_chg(val) {
- setCodeSelectJqTransForm("listBrandBycate","cd_brand","car_brand","cd_brand","",'선택하세요',val);
- }
- function cd_brand_chg(val) {
- setCodeSelectJqTransForm("listModelBybrand","cd_model","car_model","cd_model","",'선택하세요',val);
- }
- function cd_model_chg(val) {
- setCodeSelectJqTransForm("listModelSubByModel","cd_model_sub","car_model_sub","cd_model_sub","",'선택하세요',val);
- }
- $(document).ready(function() {
- setCodeSelectJqTransForm("listcategory","cd_category", "car_category","cd_category","<?=$cd_category?>","선택하세요","");
- setCodeSelectJqTransForm("listBrandBycate","cd_brand","car_brand","cd_brand",'<?=$cd_brand?>','선택하세요','<?=$cd_category?>');
- setCodeSelectJqTransForm("listModelBybrand","cd_model","car_model","cd_model",'<?=$cd_model?>','선택하세요','<?=$cd_brand?>');
- setCodeSelectJqTransForm("listModelSubByModel","cd_model_sub","car_model_sub","cd_model_sub",'<?=$cd_model_sub?>','선택하세요','<?=$cd_model?>');
- $("#btn_write").bind("click",function(){
- var fieldlist = [["cd_category", "구분"], ["cd_brand", "제조사"], ["cd_model","모델"], ["cd_model_sub","세부모델"],["nm_grade","등급"]]
- if (!fnCheckForm(fieldlist)){
- return false;
- }
- var custom_opts = {
- title : '',
- btn_close_show : false,
- }
- var mode = "<?=$mode?>";
- if(mode == "Update") {
- custom_opts.title = '정보를 수정하시겠습니까?';
- }else {
- custom_opts.title = '정보를 등록하시겠습니까?';
- }
- custom_modal_confirm(custom_opts, function(confirm) {
- if(confirm) {
- $("#btn_write").hide();
- var data = $("#frmForm").serialize();
- $.ajax({
- url : 'grade_proc.php',
- type: 'POST',
- dataType : 'json',
- data: data,
- success: function(res) {
- custom_modal_confirm_close();
- $("#btn_write").show();
- //세션 종료시 로그인 페이지로 이동
- if(res.CODE != "0000") {
- custom_opts.title = res.MSG;
- if(res.CODE == "4444") {
- window.location.href = res.DATAS.URL;
- }
- custom_modal_alert(custom_opts);
- return false;
- }
- if(mode == "Update") {
- custom_opts.title = '수정이 완료되었습니다.';
- }else {
- custom_opts.title = '등록이 완료되었습니다.';
- }
- custom_opts.event_esc_key = false;
- custom_modal_alert(custom_opts, function() {
- reload();
- });
- },
- error:function(request,status,error){
- $("#btn_write").show();
- custom_modal_confirm_close();
- alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
- }
- });
- }else {
- $("#btn_write").show();
- return false;
- }
- });
- });
- });
- </script>
- <? include("../inc/inc_footer.php") ?>
- <? include("../inc/inc_bottom.php") ?>
- <?
- mysql_close($connect);
- ?>
|