inc_ViewContract.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. <style>
  2. .add--pic--sm--wrap.mtx > div:nth-of-type(3):after {
  3. content: '전고객 등록증';
  4. font-weight: 400;
  5. font-size: 12px;
  6. line-height: 100%;
  7. text-align: center;
  8. letter-spacing: -0.03em;
  9. color: #333333;
  10. white-space: nowrap;
  11. }
  12. </style>
  13. <?php
  14. $bid_vat_price = preg_replace("/[^0-9]*/s", "", $bid_vat_price);
  15. if(!empty($bid_vat_price)) {
  16. $bid_vat_price = number_format($bid_vat_price);
  17. }
  18. //lock 기능 적용
  19. //AAP 지정 부관리자 입찰 건 수
  20. $tender_lock_sql = "SELECT *
  21. FROM tender_master
  22. WHERE ds_delind ='N'
  23. AND cd_sale = '$cd_sale'
  24. AND cd_dealer = '{$_SESSION['s_cd_dealer']}' ";
  25. // echo $tender_sql;
  26. $tender_lock_col = mysql_fetch_array(mysql_query($tender_lock_sql));
  27. $tender_ds_lock_status = "Z0";
  28. if(!empty($tender_lock_col['ds_lock_status'])) {
  29. $tender_ds_lock_status = $tender_lock_col['ds_lock_status'];
  30. }
  31. ?>
  32. <section class="mt-5 pt30">
  33. <div class="trading--drop--down">
  34. <!-- <h2>내입찰 금액은 <span><?=number_format($bid_price)?>만원</span>입니다.<br/>수수료 적용금액은 <span><?=$bid_vat_price?>만원</span>입니다.</h2> -->
  35. <h2>내입찰 금액은 <span><?=number_format($bid_price)?>만원</span>입니다.<br/>수수료는 <span><?=$bid_commission?>만원 </span>VAT별도입니다.</h2>
  36. <div class="accordion" id="accordionExample">
  37. <div class="accordion-item">
  38. <h2 class="accordion-header" id="headingOne">
  39. <?php if($ds_status_contract_step1_sale == "Y"){ ?>
  40. <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
  41. <?php }else { ?>
  42. <button class="accordion-button collapsed" type="button">
  43. <?php } ?>
  44. 고객 통화 후 일정 잡기
  45. <?php if($ds_status_contract_step2_sale == "Y"){ ?>
  46. <span class="ms-3 on">확인</span>
  47. <?php }else { ?>
  48. <span class="ms-3">미확인</span>
  49. <?php } ?>
  50. </h2>
  51. <div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
  52. <div class="accordion-body">
  53. <div class="form--wraper">
  54. <form id="frmFormStep2" name="frmFormStep2" method="post" action="aap_proc.php" enctype="multipart/form-data">
  55. <input type="hidden" id="mode" name="mode" value="ContractStep2">
  56. <input type="hidden" id="cd_sale" name="cd_sale" value="<?=$cd_sale?>">
  57. <div class="user--info mt-3">
  58. <dl class="d-flex">
  59. <dt>고객명 : </dt>
  60. <dd><?=$nm_name_sale?></dd>
  61. </dl>
  62. <dl class="d-flex">
  63. <dt>연락처 : </dt>
  64. <dd><?=$nm_hp_sale?></dd>
  65. </dl>
  66. </div>
  67. <div class="align-items-center justify-content-between">
  68. <div class="date--wrap">
  69. <input type="date" id="date01" class="form-control" _id="nm_contract_date" name="nm_contract_date" value="<?=$nm_contract_date_sale?>" />
  70. </div>
  71. <div class="btn--wrapper mt-3">
  72. <?php if($ds_status_contract_step2_sale != "Y"){ ?>
  73. <?php
  74. //차량 락이 걸려 있지 않아야 버튼이 노출
  75. if($tender_ds_lock_status == 'Z0') {
  76. ?>
  77. <button type='button' class="btn btn-outline-primary" id="btn_contract_step2">확인</button>
  78. <?php } ?>
  79. <?php } ?>
  80. </div>
  81. </div>
  82. </form>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="accordion-item">
  88. <h2 class="accordion-header" id="headingTwo">
  89. <?php if($ds_status_contract_step2_sale == "Y"){ ?>
  90. <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  91. <?php }else { ?>
  92. <button class="accordion-button collapsed" type="button">
  93. <?php } ?>
  94. 검차 결과 및 계약 진행
  95. <?php if($ds_status_contract_step3_sale == "Y"){ ?>
  96. <span class="ms-3 on">확인</span>
  97. <?php }else { ?>
  98. <span class="ms-3">미확인</span>
  99. <?php } ?>
  100. </button>
  101. </h2>
  102. <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
  103. <div class="accordion-body">
  104. <form id="frmFormStep3" name="frmFormStep3" method="post" action="aap_proc.php" enctype="multipart/form-data">
  105. <input type="hidden" id="mode" name="mode" value="ContractStep3">
  106. <input type="hidden" id="cd_sale" name="cd_sale" value="<?=$cd_sale?>">
  107. <div class="mt-3 hide" id="layout_contact_final">
  108. <textarea class="form-control" rows="5" id="nm_contract_cont_final" name="nm_contract_cont_final" placeholder="ex) 앞 풴다교환 1개-20만원, 앞범퍼 1판-7만원 20만원으로 최종조율, 다음주 수요일 인수예정"><?=$nm_contract_cont_final_sale?></textarea>
  109. </div>
  110. <div class="mt-3 hide" id="layout_contact_fail">
  111. <textarea class="form-control" rows="5" id="nm_contract_fail_reason" name="nm_contract_fail_reason" placeholder="거래실패 or 거래 연기사유를 작성해 주세요"><?=$nm_contract_fail_reason_sale?></textarea>
  112. </div>
  113. <div class="align-items-center mt25">
  114. <div class="form--group">
  115. <input type="radio" id="ds_status_contract1" name="ds_status_contract" hidden value="Z0"<? if($ds_status_contract_sale == "Z0"){ ?> checked="checked"<? } ?>>
  116. <label for="ds_status_contract1">거래 완료</label>
  117. </div>
  118. <div class="form--group mt-2">
  119. <input type="radio" id="ds_status_contract2" name="ds_status_contract" hidden value="B0"<? if($ds_status_contract_sale == "B0"){ ?> checked="checked"<? } ?>>
  120. <label for="ds_status_contract2">거래 연기</label>
  121. </div>
  122. <div class="form--group mt-2">
  123. <input type="radio" id="ds_status_contract3" name="ds_status_contract" hidden value="C0"<? if($ds_status_contract_sale == "C0"){ ?> checked="checked"<? } ?>>
  124. <label for="ds_status_contract3">거래 실패</label>
  125. </div>
  126. <div class="d-flex align-items-center mt-2">
  127. <input type="text" placeholder="최종금액 입력" style="height:53px;" class="form-control" id="nm_price_final" name="nm_price_final" value="<?=$nm_price_final_sale?>" />
  128. <label for="" class="ml15">만원</label>
  129. </div>
  130. </div>
  131. <?php
  132. // UPLOAD_PATH;
  133. $contract_img_path = $_SERVER['DOCUMENT_ROOT'].UPLOAD_PATH."aap/contract_step/".$cd_sale."_detail/";
  134. $contract_img_web_path = UPLOAD_PATH."aap/contract_step/".$cd_sale."_detail/";
  135. $nm_file_chk1_class = "";
  136. $nm_file_chk1_style = "";
  137. $nm_file_chk1 = $car_no_img;
  138. if(file_exists($contract_img_path.$nm_file_chk1_sale)) {
  139. $nm_file_chk1 = $contract_img_web_path.$nm_file_chk1_sale;
  140. $nm_file_chk1_class = "upload--file";
  141. $nm_file_chk1_style = "style='background: url(".$nm_file_chk1.") no-repeat center; background-size:contain;'";
  142. }
  143. $nm_file_chk2_class = "";
  144. $nm_file_chk2_style = "";
  145. $nm_file_chk2 = $car_no_img;
  146. if(file_exists($contract_img_path.$nm_file_chk2_sale)) {
  147. $nm_file_chk2 = $contract_img_web_path.$nm_file_chk2_sale;
  148. $nm_file_chk2_class = "upload--file";
  149. $nm_file_chk2_style = "style='background: url(".$nm_file_chk2.") no-repeat center; background-size:contain;'";
  150. }
  151. $nm_file_chk3_class = "";
  152. $nm_file_chk3_style = "";
  153. $nm_file_chk3 = $car_no_img;
  154. if(file_exists($contract_img_path.$nm_file_chk3_sale)) {
  155. $nm_file_chk3 = $contract_img_web_path.$nm_file_chk3_sale;
  156. $nm_file_chk3_class = "upload--file";
  157. $nm_file_chk3_style = "style='background: url(".$nm_file_chk3.") no-repeat center; background-size:contain;'";
  158. }
  159. $nm_file_chk4_class = "";
  160. $nm_file_chk4_style = "";
  161. $nm_file_chk4 = $car_no_img;
  162. if(file_exists($contract_img_path.$nm_file_chk4_sale)) {
  163. $nm_file_chk4 = $contract_img_web_path.$nm_file_chk4_sale;
  164. $nm_file_chk4_class = "upload--file";
  165. $nm_file_chk4_style = "style='background: url(".$nm_file_chk4.") no-repeat center; background-size:contain;'";
  166. }
  167. $nm_file_chk5_class = "";
  168. $nm_file_chk5_style = "";
  169. $nm_file_chk5 = $car_no_img;
  170. if(file_exists($contract_img_path.$nm_file_chk5_sale)) {
  171. $nm_file_chk5_size = "cover";
  172. $nm_file_chk5 = $contract_img_web_path.$nm_file_chk5_sale;
  173. $nm_file_chk5_class = "upload--file";
  174. $nm_file_chk5_style = "style='background: url(".$nm_file_chk5.") no-repeat center; background-size:contain;'";
  175. }
  176. ?>
  177. <h2 class="title--small mt-5">검차 사진</h2>
  178. <div class="add--pic--sm--wrap" id="layout_contract_image">
  179. <div class="<?=$nm_file_chk1_class?>" <?=$nm_file_chk1_style?>>
  180. <input type="file" hidden id="nm_file_chk1" name="nm_file_chk1" onchange="viewContractThumb(0,this)">
  181. <label for="nm_file_chk1">사진<br />등록</label>
  182. </div>
  183. <div class="<?=$nm_file_chk2_class?>" <?=$nm_file_chk2_style?>>
  184. <input type="file" hidden id="nm_file_chk2" name="nm_file_chk2" onchange="viewContractThumb(1,this)">
  185. <label for="nm_file_chk2">사진<br />등록</label>
  186. </div>
  187. <div class="<?=$nm_file_chk3_class?>" <?=$nm_file_chk3_style?>>
  188. <input type="file" hidden id="nm_file_chk3" name="nm_file_chk3" onchange="viewContractThumb(2,this)">
  189. <label for="nm_file_chk3">사진<br />등록</label>
  190. </div>
  191. <div class="<?=$nm_file_chk4_class?>" <?=$nm_file_chk4_style?>>
  192. <input type="file" hidden id="nm_file_chk4" name="nm_file_chk4" onchange="viewContractThumb(3,this)">
  193. <label for="nm_file_chk4">사진<br />등록</label>
  194. </div>
  195. <div class="<?=$nm_file_chk5_class?>" <?=$nm_file_chk5_style?>>
  196. <input type="file" hidden id="nm_file_chk5" name="nm_file_chk5" onchange="viewContractThumb(4,this)">
  197. <label for="nm_file_chk5">사진<br />등록</label>
  198. </div>
  199. <?php if($ds_status_contract_step3_sale != "Y"){ ?>
  200. <?php
  201. //차량 락이 걸려 있지 않아야 버튼이 노출
  202. if($tender_ds_lock_status == 'Z0') {
  203. ?>
  204. <button type='button' class="btn btn-outline-primary" id="btn_contract_step3">확인</button>
  205. <?php } ?>
  206. <?php } ?>
  207. </div>
  208. </form>
  209. </div>
  210. </div>
  211. </div>
  212. <div class="accordion-item">
  213. <h2 class="accordion-header" id="headingThree">
  214. <?php if($ds_status_contract_step3_sale == "Y"){ ?>
  215. <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
  216. <?php }else { ?>
  217. <button class="accordion-button collapsed" type="button">
  218. <?php } ?>
  219. 거래 마무리
  220. <?php if($ds_status_contract_step4_sale == "Y"){ ?>
  221. <span class="ms-3 on">확인</span>
  222. <?php }else { ?>
  223. <span class="ms-3">미확인</span>
  224. <?php } ?>
  225. </button>
  226. </h2>
  227. <?php
  228. $contract_img_path = $_SERVER['DOCUMENT_ROOT'].UPLOAD_PATH."aap/contract_step/".$cd_sale."_detail/";
  229. $contract_img_web_path = UPLOAD_PATH."aap/contract_step/".$cd_sale."_detail/";
  230. // echo $contract_img_path.$nm_file_trading_sale;
  231. // exit;
  232. $nm_file_trading_class = "";
  233. $nm_file_trading_style = "";
  234. $nm_file_trading = $car_no_img;
  235. if(file_exists($contract_img_path.$nm_file_trading_sale)) {
  236. $nm_file_trading = $contract_img_web_path.$nm_file_trading_sale;
  237. $nm_file_trading_class = "upload--file";
  238. $nm_file_trading_style = "style='background: url(".$nm_file_trading.") no-repeat center; background-size:contain;'";
  239. }
  240. $nm_file_performance_class = "";
  241. $nm_file_performance_style = "";
  242. $nm_file_performance = $car_no_img;
  243. if(file_exists($contract_img_path.$nm_file_performance_sale)) {
  244. $nm_file_performance = $contract_img_web_path.$nm_file_performance_sale;
  245. $nm_file_performance_class = "upload--file";
  246. $nm_file_performance_style = "style='background: url(".$nm_file_performance.") no-repeat center; background-size:contain;'";
  247. }
  248. $nm_file_regist_class = "";
  249. $nm_file_regist_style = "";
  250. $nm_file_regist = $car_no_img;
  251. if(file_exists($contract_img_path.$nm_file_regist_sale)) {
  252. $nm_file_regist = $contract_img_web_path.$nm_file_regist_sale;
  253. $nm_file_regist_class = "upload--file";
  254. $nm_file_regist_style = "style='background: url(".$nm_file_regist.") no-repeat center; background-size:contain;'";
  255. }
  256. ?>
  257. <div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
  258. <div class="accordion-body">
  259. <form id="frmFormStep4" name="frmFormStep4" method="post" action="aap_proc.php" enctype="multipart/form-data">
  260. <input type="hidden" id="mode" name="mode" value="ContractStep4">
  261. <input type="hidden" id="cd_sale" name="cd_sale" value="<?=$cd_sale?>">
  262. <?php if($ds_status_contract_step4_sale != "Y"){ ?>
  263. <div class="add--pic--sm--wrap mtx" id="layout_contract_end_image">
  264. <div class="<?=$nm_file_trading_class?>" <?=$nm_file_trading_style?>>
  265. <input type="file" hidden name="nm_file_trading" id="nm_file_trading" onchange="viewContractEndThumb(0,this)">
  266. <label for="nm_file_trading">사진<br />등록</label>
  267. </div>
  268. <div class="<?=$nm_file_performance_class?>" <?=$nm_file_performance_style?>>
  269. <input type="file" hidden name="nm_file_performance" id="nm_file_performance" onchange="viewContractEndThumb(1,this)">
  270. <label for="nm_file_performance">사진<br />등록</label>
  271. </div>
  272. <div class="<?=$nm_file_regist_class?>" <?=$nm_file_regist_style?>>
  273. <input type="file" hidden name="nm_file_regist" id="nm_file_regist" onchange="viewContractEndThumb(2,this)">
  274. <label for="nm_file_regist">사진<br />등록</label>
  275. </div>
  276. <?php
  277. //차량 락이 걸려 있지 않아야 버튼이 노출
  278. if($tender_ds_lock_status == 'Z0') {
  279. ?>
  280. <button type='button' class="btn btn-outline-primary" id="btn_contract_step4">확인</button>
  281. <?php } ?>
  282. </div>
  283. <?php }else { ?>
  284. <div class="add--pic--sm--wrap mtx" id="layout_contract_end_image">
  285. <div class="<?=$nm_file_trading_class?>" <?=$nm_file_trading_style?>>
  286. <a href="<?=$nm_file_trading?>"></a>
  287. </div>
  288. <div class="<?=$nm_file_performance_class?>" <?=$nm_file_performance_style?>>
  289. <a href="<?=$nm_file_performance?>"></a>
  290. </div>
  291. <div class="<?=$nm_file_regist_class?>" <?=$nm_file_regist_style?>>
  292. <a href="<?=$nm_file_regist?>"></a>
  293. </div>
  294. </div>
  295. <?php } ?>
  296. </form>
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. </div>
  302. </section>
  303. <style>
  304. .add--pic--sm--wrap.mtx a{
  305. display:block;
  306. width:100%;
  307. height:100%;
  308. }
  309. </style>
  310. <script language="javascript" type="text/javascript">
  311. function viewContractThumb(seq, arg){
  312. if (arg.files && arg.files[0])
  313. {
  314. var reader = new FileReader();
  315. reader.onload = function (e) {
  316. //no-repeat center; background-size:contain;
  317. $("#layout_contract_image div:eq("+seq+")").css({"background-image":"url('"+e.target.result+"')","background-size":"contain","background-position":"center"})
  318. .addClass("upload--file");
  319. // $(".photo_regist .pc_type_pv:eq("+seq+")").css({"background-image":"url('"+e.target.result+"')","background-size":"cover","background-position":"center"});
  320. // $(".photo_regist .pc_type_pv:eq("+seq+") span").html("");
  321. }
  322. reader.readAsDataURL(arg.files[0]);
  323. }
  324. }
  325. function viewContractEndThumb(seq, arg){
  326. if (arg.files && arg.files[0])
  327. {
  328. var reader = new FileReader();
  329. reader.onload = function (e) {
  330. //no-repeat center; background-size:contain;
  331. $("#layout_contract_end_image div:eq("+seq+")").css({"background-image":"url('"+e.target.result+"')","background-size":"contain","background-position":"center"})
  332. .addClass("upload--file");
  333. // $(".photo_regist .pc_type_pv:eq("+seq+")").css({"background-image":"url('"+e.target.result+"')","background-size":"cover","background-position":"center"});
  334. // $(".photo_regist .pc_type_pv:eq("+seq+") span").html("");
  335. }
  336. reader.readAsDataURL(arg.files[0]);
  337. }
  338. }
  339. $(document).ready(function() {
  340. $("input[name='nm_accident_detail[]']").attr("disabled", "disabled");
  341. $("#btn_cal").bind("click",function(){
  342. $("#nm_contract_date").datepicker('show');
  343. });
  344. // $("#btn_contract_step1").bind("click",function(){
  345. // var fieldlist = [["ds_status_contract_step1","확인여부"]]
  346. // if (!fnCheckForm_ty2(fieldlist)){
  347. // return false;
  348. // }
  349. //
  350. // fnCheckForm_normal_date_confirm("정보를 등록하시겠습니까?","frmFormStep1");
  351. // // var c = confirm("정보를 등록하시겠습니까?");
  352. // // if(c){
  353. // // $("#frmFormStep1").submit();
  354. // // }else{
  355. // // return false;
  356. // // }
  357. // });
  358. $("input[name=ds_status_contract]").on("click", function() {
  359. var val = $(this).val();
  360. switch(val) {
  361. case 'Z0':
  362. $("#layout_contact_final").removeClass("hide");
  363. $("#layout_contact_fail").addClass("hide");
  364. break;
  365. case 'B0':
  366. case 'C0':
  367. $("#layout_contact_final").addClass("hide");
  368. $("#layout_contact_fail").removeClass("hide");
  369. break;
  370. }
  371. });
  372. <?php if(!empty($ds_status_contract_sale)) { ?>
  373. $("input[name=ds_status_contract][value=<?=$ds_status_contract_sale?>]").click();
  374. <?php } ?>
  375. $("#btn_contract_step2").bind("click",function(){
  376. var custom_opts = {
  377. title : '',
  378. btn_close_show : false,
  379. }
  380. var fieldlist = [["date01","일정 만남일"]]
  381. if (!fnCheckForm(fieldlist)){
  382. return false;
  383. }
  384. custom_opts.title = '정보를 등록하시겠습니까?';
  385. custom_modal_confirm(custom_opts, function(confirm) {
  386. if(confirm) {
  387. $("#btn_contract_step2").hide();
  388. var data = $("#frmFormStep2").serialize();
  389. $.ajax({
  390. url : 'aap_proc.php',
  391. type: 'POST',
  392. dataType : 'json',
  393. data: data,
  394. success: function(res) {
  395. custom_modal_confirm_close();
  396. $("#btn_contract_step2").show();
  397. //세션 종료시 로그인 페이지로 이동
  398. if(res.CODE != "0000") {
  399. custom_opts.title = res.MSG;
  400. if(res.CODE == "4444") {
  401. window.location.href = res.DATAS.URL;
  402. }
  403. custom_modal_alert(custom_opts);
  404. return false;
  405. }
  406. custom_opts.title = '등록되었습니다.';
  407. custom_opts.event_esc_key = false;
  408. custom_modal_alert(custom_opts, function() {
  409. reload();
  410. });
  411. },
  412. error:function(request,status,error){
  413. $("#btn_contract_step2").show();
  414. custom_modal_confirm_close();
  415. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  416. }
  417. });
  418. }else {
  419. $("#btn_contract_step2").show();
  420. return false;
  421. }
  422. });
  423. });
  424. $("#btn_contract_step3").bind("click",function(){
  425. var custom_opts = {
  426. title : '',
  427. btn_close_show : false,
  428. }
  429. ///
  430. // var fieldlist = [["ds_status_contract","계약 상황"]]
  431. // if (!fnCheckForm(fieldlist)){
  432. // return false;
  433. // }
  434. if($('input[name="ds_status_contract"]:checked').length < 1) {
  435. custom_opts.title = '계약 상황을 선택하세요.';
  436. custom_modal_alert(custom_opts);
  437. return false;
  438. }
  439. if ($('input[name="ds_status_contract"]:checked').val() == "Z0"){
  440. fieldlist = [["nm_price_final","최종가격"],["nm_file_chk1","검차사진"]]
  441. if (!fnCheckForm(fieldlist)){
  442. return false;
  443. }
  444. }
  445. if ($('input[name="ds_status_contract"]:checked').val() == "B0" || $('input[name="ds_status_contract"]:checked').val() == "C0"){
  446. fieldlist = [["nm_contract_fail_reason","거래연기 or 거래 실패 사유"]]
  447. if (!fnCheckForm(fieldlist)){
  448. return false;
  449. }
  450. }
  451. custom_opts.title = '정보를 등록하시겠습니까?';
  452. custom_modal_confirm(custom_opts, function(confirm) {
  453. if(confirm) {
  454. var formData = new FormData();
  455. $("#frmFormStep3 input, #frmFormStep3 select, #frmFormStep3 textarea").each(function() {
  456. var input_name = $(this).attr("name");
  457. var input_value = $(this).val();
  458. var input_type = $(this).attr("type");
  459. switch(input_type) {
  460. case 'radio':
  461. formData.append(input_name, $("input[name="+input_name+"]:checked").val());
  462. break;
  463. default:
  464. formData.append(input_name, input_value);
  465. break;
  466. }
  467. });
  468. $("#frmFormStep3 input[type=file]").each(function() {
  469. var input_name = $(this).attr("name");
  470. var input_value = $(this)[0].files[0];
  471. formData.append(input_name, input_value);
  472. });
  473. $("#btn_contract_step3").hide();
  474. // var data = $("#frmFormStep3").serialize();
  475. $.ajax({
  476. url : 'aap_proc.php',
  477. type: 'POST',
  478. dataType : 'json',
  479. data: formData,
  480. processData: false,
  481. contentType: false,
  482. success: function(res) {
  483. custom_modal_confirm_close();
  484. $("#btn_contract_step3").show();
  485. //세션 종료시 로그인 페이지로 이동
  486. if(res.CODE != "0000") {
  487. custom_opts.title = res.MSG;
  488. if(res.CODE == "4444") {
  489. window.location.href = res.DATAS.URL;
  490. }
  491. custom_modal_alert(custom_opts);
  492. return false;
  493. }
  494. custom_opts.title = '등록되었습니다.';
  495. custom_opts.event_esc_key = false;
  496. custom_modal_alert(custom_opts, function() {
  497. reload();
  498. });
  499. },
  500. error:function(request,status,error){
  501. $("#btn_contract_step3").show();
  502. custom_modal_confirm_close();
  503. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  504. }
  505. });
  506. }else {
  507. $("#btn_contract_step3").show();
  508. return false;
  509. }
  510. });
  511. // fnCheckForm_normal_date_confirm("정보를 등록하시겠습니까?","frmFormStep3");
  512. // var c = confirm("정보를 등록하시겠습니까?");
  513. // if(c){
  514. // $("#frmFormStep3").submit();
  515. // }else{
  516. // return false;
  517. // }
  518. });
  519. $("#btn_contract_step4").bind("click",function(){
  520. var custom_opts = {
  521. title : '',
  522. btn_close_show : false,
  523. }
  524. var fieldlist = [["nm_file_trading","상사이전등록증"],["nm_file_performance","성능지"],["nm_file_regist","전고객 등록증"]]
  525. if (!fnCheckForm(fieldlist)){
  526. return false;
  527. }
  528. custom_opts.title = '정보를 등록하시겠습니까?';
  529. custom_modal_confirm(custom_opts, function(confirm) {
  530. if(confirm) {
  531. var formData = new FormData();
  532. $("#frmFormStep4 input, #frmFormStep4 select, #frmFormStep4 textarea").each(function() {
  533. var input_name = $(this).attr("name");
  534. var input_value = $(this).val();
  535. var input_type = $(this).attr("type");
  536. switch(input_type) {
  537. case 'radio':
  538. formData.append(input_name, $("input[name="+input_name+"]:checked").val());
  539. break;
  540. default:
  541. formData.append(input_name, input_value);
  542. break;
  543. }
  544. });
  545. $("#frmFormStep4 input[type=file]").each(function() {
  546. var input_name = $(this).attr("name");
  547. var input_value = $(this)[0].files[0];
  548. formData.append(input_name, input_value);
  549. });
  550. $("#btn_contract_step4").hide();
  551. // var data = $("#frmFormStep3").serialize();
  552. $.ajax({
  553. url : 'aap_proc.php',
  554. type: 'POST',
  555. dataType : 'json',
  556. data: formData,
  557. processData: false,
  558. contentType: false,
  559. success: function(res) {
  560. custom_modal_confirm_close();
  561. $("#btn_contract_step4").show();
  562. //세션 종료시 로그인 페이지로 이동
  563. if(res.CODE != "0000") {
  564. custom_opts.title = res.MSG;
  565. if(res.CODE == "4444") {
  566. window.location.href = res.DATAS.URL;
  567. }
  568. custom_modal_alert(custom_opts);
  569. return false;
  570. }
  571. custom_opts.title = '등록되었습니다.';
  572. custom_opts.event_esc_key = false;
  573. custom_modal_alert(custom_opts, function() {
  574. reload();
  575. });
  576. },
  577. error:function(request,status,error){
  578. $("#btn_contract_step4").show();
  579. custom_modal_confirm_close();
  580. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  581. }
  582. });
  583. }else {
  584. $("#btn_contract_step4").show();
  585. return false;
  586. }
  587. });
  588. // fnCheckForm_normal_date_confirm("정보를 등록하시겠습니까?","frmFormStep4");
  589. // var c = confirm("정보를 등록하시겠습니까?");
  590. // if(c){
  591. // $("#frmFormStep4").submit();
  592. // }else{
  593. // return false;
  594. // }
  595. });
  596. $("#deal_step > li > div.step_tit").click(function(){
  597. ;
  598. // alert($(this).closest("li").attr("noauth"));
  599. if($(this).closest("li").attr("noauth") == undefined){
  600. if(!$(this).closest("li").hasClass("on")){
  601. $(this).closest("li").parents(".success_confirm").find("li > p").removeClass("on");
  602. $(this).closest("li").addClass("on");
  603. } else {
  604. $(this).closest("li").removeClass("on");
  605. }
  606. }else{
  607. fnCheckForm_ty4("먼저 이전 단계 확인바랍니다.");
  608. }
  609. });
  610. $("#nm_contract_date").datepicker({ dateFormat: 'yy-mm-dd' });
  611. <? if(!($ds_status_contract_step1_sale != "Y" && $ds_status_contract_step1_sale != "N")){ ?>
  612. $($("#deal_step > li > div.step_tit").get().reverse()).each(function(i) {
  613. if($(this).closest("li").attr("noauth") == undefined){
  614. $(this).click();
  615. return false;
  616. }
  617. })
  618. <? } ?>
  619. // var radioContent = $(".tab_cont");
  620. // $(".deal_check input[type='radio']").click(function(){
  621. // radioContent.hide();
  622. // radioContent.eq($("input[type='radio']").index(this)).show();
  623. // });
  624. });
  625. </script>