inc_ViewContract.php 26 KB

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