RUSSEL86

Html form with repeater field and calculation

Apr 3rd, 2017
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.85 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Form Template
  4. */
  5. get_header();?>
  6. <section id="main" class="col-sm-12 col-md-12 full-width" role="main">
  7. <article class="post-101 page type-page status-publish hentry">
  8. <div class="entry-meta">
  9. <div class="clearfix"></div>
  10. </div>
  11. <div class="entry-summary">
  12.  
  13. <p style="color: #fff; font-size: 50px; background-color: #ee5772; text-align: center; padding: 5px 10px; line-height: 50px;">97% מהתרומה שלך עוברת ישירות לנזקקים!</p>
  14. <p style="color: #ee5772; font-size: 20px; text-align: center; padding: 5px 10px; line-height: 15px;">3% – לכיסוי הוצאות ניהול ותפעול</p>
  15. <p style="color: #fff; font-size: 30px; font-weight: bold; text-align: center; background-color: #404e59; padding: 5px 10px; line-height: 40px;">אלפי נזקקים מברכים אותך על עזרתך, 2 דקות וסיימנו <img draggable="false" class="emoji" alt="🙂" src="https://s.w.org/images/core/emoji/2.2.1/svg/1f642.svg"></p>
  16.  
  17. <button type="button" class="btn btn-lg btn-link btn-modal" data-toggle="modal" data-target="#taxModal"><i class="fa fa-external-link"></i> מידע על קבלות תרומה לצורך החזר מס</button>
  18.  
  19. <div class="donation-form">
  20. <form method="post" id="donation_form" name="donation_form" novalidate="novalidate" class="fv-form fv-form-bootstrap">
  21. <h3 class="pink-title col-sm-offset-1"><i class="fa fa-heart"></i> פרטי התרומה</h3>
  22. <div class="collapse in" id="donation-info">
  23. <div class="donation-list" id="donation-list">
  24. <div class="row donation repeatable">
  25. <div class="col-sm-1 col-xs-2 remove-wrapper">
  26. <button type="button" class="btn btn-link btn-block remove"><i class="fa fa-times"></i></button>
  27. </div>
  28. <div class="col-sm-3 col-xs-5">
  29. <div class="form-group projects">
  30. <label for="projectID">עבור פרויקט</label>
  31. <select class="form-control" id="projectID" name="project[]">
  32. <option value="">תרומה כללית</option>
  33. <option value="">אימוץ בר מצווה</option>
  34. <option value="">אימוץ הוצאות חתונה</option>
  35. <option value="">ארוחות חמות</option>
  36. <option value="">היחידה לסיוע לחולה</option>
  37. <option value="">חלוקת סלי מזון</option>
  38. <option value="">חסד וסיוע לאלמנות וליתומים</option>
  39. <option value="">מחזירים את הדרום לשיגרה</option>
  40. <option value="">מחלקת ריהוט – תרומת רהיטים</option>
  41. <option value="">מטרנה לתינוקות</option>
  42. <option value="">מרפאות שיניים לנזקקים</option>
  43. <option value="">משלוח מנות במייל</option>
  44. <option value="">מתנות לאביונים – פורים</option>
  45. <option value="">סל מורחב לחגים</option>
  46. <option value="">עודפי תוצרת חקלאית</option>
  47. <option value="">פדיון כפרות</option>
  48. <option value="">פרויקט חונכים</option>
  49. <option value="">ציוד חורף</option>
  50. <option value="">קידום הכשרה מקצועית</option>
  51. <option value="">קמחא דפסחא</option>
  52. <option value="">קרן חירום והוצאות רפואיות</option>
  53. <option value="">קרן קול לכלה – נדוניה</option>
  54. <option value="">קרן שיקום</option>
  55. <option value="">שילוב הוראה מתקנת</option>
  56. <option value="">תווי קניה</option>
  57. </select>
  58. </div>
  59. </div>
  60. <div class="col-sm-3 col-xs-5">
  61. <div class="form-group prices has-feedback">
  62. <label for="price1">סכום</label>
  63. <div class="combobox-container">
  64. <div class="input-group">
  65. <input type="text" autocomplete="off" placeholder="בחר או הקלד סכום" class="form-control combobox donation-amount" >
  66.  
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="col-sm-3 col-xs-12 new-donation" style="display: block;">
  72. <button type="button" class="btn btn-default btn-block add"><i class="fa fa-plus-circle"></i> הוסף תרומה נוספת</button>
  73. </div>
  74. <input type="hidden" name="project_amount_label[]" value="">
  75. </div>
  76. </div>
  77. <hr>
  78. <div class="row">
  79. <div class="col-sm-2 col-sm-offset-1 col-xs-4">
  80. <div class="form-group">
  81. <label for="donation_type">סוג תרומה</label>
  82. <select class="form-control" id="donation_type" name="donation_type">
  83. <option value="single" checked="checked">תרומה חד פעמית</option>
  84. <option value="cycles">הוראת קבע</option>
  85. </select>
  86. </div>
  87. </div>
  88. <div class="col-sm-2 col-xs-4">
  89. <div class="form-group payments">
  90. <label for="payments">תשלומים</label>
  91. <select class="form-control" id="payments" name="payments">
  92. <option value="1">1</option>
  93. <option value="2">2</option>
  94. <option value="3">3</option>
  95. <option value="4">4</option>
  96. <option value="5">5</option>
  97. <option value="6">6</option>
  98. <option value="7">7</option>
  99. <option value="8">8</option>
  100. <option value="9">9</option>
  101. <option value="10">10</option>
  102. <option value="11">11</option>
  103. <option value="12">12</option>
  104. <option value="13">13</option>
  105. <option value="14">14</option>
  106. <option value="15">15</option>
  107. </select>
  108. </div>
  109. </div>
  110. <div class="col-sm-2 col-xs-4">
  111. <div class="form-group">
  112. <label for="currency">מטבע</label>
  113. <select class="form-control" id="currency" name="currency">
  114. <option value="ILS">₪ - שקל</option>
  115. <option value="EUR">€ - יורו</option>
  116. <option value="USD">$ - דולר</option>
  117. </select>
  118. </div>
  119. </div>
  120. <div class="col-sm-3 col-xs-12">
  121. <div class="form-group total">
  122. <label for="total">סה"כ סכום התרומה</label>
  123. <div class="checkout-total-amount">
  124. <span id="total_amount">0.00</span><span id="total_currency"> ₪</span>
  125. </div>
  126.  
  127. </div>
  128. </div>
  129. </div>
  130. <hr>
  131. <h3 class="blue-title col-sm-offset-1"><i class="fa fa-user"></i> פרטים אישיים</h3>
  132. <div class="row">
  133. <div class="col-sm-3 col-sm-offset-1 col-xs-6">
  134. <div class="form-group has-feedback">
  135. <label for="firstname">שם פרטי</label>
  136. <input type="text" name="first_name" class="form-control" id="firstname" data-fv-field="first_name">
  137. </div>
  138. </div>
  139. <div class="col-sm-3 col-xs-6">
  140. <div class="form-group has-feedback">
  141. <label for="lastname">שם משפחה</label>
  142. <input type="text" name="last_name" class="form-control" id="lastname" data-fv-field="last_name">
  143. </div>
  144. </div>
  145. <div class="col-sm-3 col-xs-6">
  146. <div class="form-group has-feedback">
  147. <label for="phone">טלפון</label>
  148. <input type="text" name="phone" class="form-control" id="phone" data-fv-field="phone">
  149. </div>
  150. </div>
  151. <div class="col-sm-3 col-sm-offset-1 col-xs-6">
  152. <div class="form-group has-feedback">
  153. <label for="email">דוא"ל</label>
  154. <input type="email" name="email" class="form-control" id="email" data-fv-field="email">
  155. </div>
  156. </div>
  157. <div class="col-sm-6 col-xs-12">
  158. <div class="form-group">
  159. <label for="address">כתובת</label>
  160. <input type="text" name="address" class="form-control" id="address" placeholder="כתובת מלאה למשלוח קבלה">
  161. </div>
  162. </div>
  163. </div>
  164. <hr>
  165. <a class="col-sm-offset-1 receipt-info" data-toggle="collapse" href="#receipt-info" ><i class="fa fa-caret-down"></i> אפשרויות קבלה לצרכי מס</a>
  166.  
  167. <div class="collapse" id="receipt-info">
  168. <div class="row">
  169. <div class="col-sm-11 col-sm-offset-1">
  170. <h4>אני מעוניין בקבלה המוכרת למס ב:</h4>
  171. <div class="radio">
  172. <label>
  173. <input type="radio" name="c_tax" class="c_tax" id="israel" value="israel" checked="checked">
  174. ישראל
  175. </label>
  176. </div>
  177. <div class="radio">
  178. <label>
  179. <input type="radio" name="c_tax" class="c_tax" id="france" value="france">
  180. צרפת
  181. </label>
  182. </div>
  183. </div>
  184. </div>
  185. <hr>
  186. <a class="col-sm-offset-1 receipt collapsed" data-toggle="collapse" href="#receipt"><i class="fa fa-check-square-o"></i> קבלה על שם אחר</a>
  187. <div class="collapse" id="receipt">
  188. <div class="row">
  189. <div class="col-sm-3 col-sm-offset-1 col-xs-6">
  190. <div class="form-group">
  191. <label for="firstname2">שם פרטי</label>
  192. <input type="text" name="first_name_2" class="form-control" id="firstname">
  193. </div>
  194. </div>
  195. <div class="col-sm-3 col-xs-6">
  196. <div class="form-group">
  197. <label for="lastname2">שם משפחה</label>
  198. <input type="text" name="last_name_2" class="form-control" id="lastname">
  199. </div>
  200. </div>
  201. <div class="col-sm-3 col-xs-6">
  202. <div class="form-group">
  203. <label for="phone2">טלפון</label>
  204. <input type="text" name="phone_2" class="form-control" id="phone">
  205. </div>
  206. </div>
  207. <div class="col-sm-3 col-sm-offset-1 col-xs-6">
  208. <div class="form-group has-feedback">
  209. <label for="email2">דוא"ל</label>
  210. <input type="email" name="email_2" class="form-control" id="email2" data-fv-field="email_2"> </div>
  211. </div>
  212. <div class="col-sm-6 col-xs-12">
  213. <div class="form-group">
  214. <label for="address2">כתובת</label>
  215. <input type="text" name="address_2" class="form-control" id="address2" placeholder="כתובת מלאה למשלוח קבלה">
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. <hr>
  222. </div>
  223. <h3 class="green-title col-sm-offset-1"><i class="fa fa-credit-card"></i> סיכום ופרטי אשראי</h3>
  224.  
  225.  
  226. <div class="col-sm-offset-1 payments-options" role="group">
  227. <button type="button" name="credit_cart" class="btn btn-lg btn-pink" value="credit" id="pay_credit_card" style="display: inline-block;">תרומה בכרטיס אשראי</button>
  228. <button type="submit" name="paypal" class="btn btn-lg btn-pink" value="paypal">תרומה באמצעות PayPal</button>
  229.  
  230. </div>
  231. </form>
  232. </div>
  233.  
  234. <!-- Modal -->
  235. <div class="modal fade" id="taxModal" role="dialog">
  236. <div class="modal-dialog">
  237. <div class="modal-content">
  238. <div class="modal-header">
  239. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  240. <h4 class="modal-title" id="myModalLabel">מידע על קבלות תרומה לצורך החזר מס</h4>
  241. </div>
  242. <div class="modal-body">
  243. בתרומה כאן באתר ניתן לקבל קבלה המוכרת לצורך מס בישראל (על פי סעיף 46) או בצרפת (CERFA)
  244. <br>
  245. <br>
  246. <strong>לקבלה המוכרת למס בארה"ב:</strong><br>
  247. American Friends of Yad Eliezer<br>
  248. American tax ID number: 11-3459952<br>
  249. למעבר לתרומה באתר <a href="http://www.yadeliezer.org/" target="_blank">לחץ כאן</a><br>
  250.  
  251. <strong>לקבלה המוכרת למס בקנדה ניתן ליצור קשר:</strong><br>
  252. Canadian Friend of Yad Eliezer<br>
  253. Canadian Tax ID Number: BN889966867RR0001<br>
  254. Tel: (1)- 514-735-283<br>
  255. Email:[email protected]<br>
  256.  
  257. <strong>לקבלה המוכרת למס בבריטניה ניתן ליצור קשר:</strong><br>
  258. Yad Eliezer Trust<br>
  259. UK Registered Charity Number: 1115426<br>
  260. Tel:(44)-0208-455-8394<br>
  261. Email: [email protected]<br>
  262. </div>
  263. <div class="modal-footer">
  264. <button type="button" class="btn btn-primary" data-dismiss="modal">סגור</button>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </article>
  271. </section>
  272.  
  273. <script type="text/javascript">
  274. //jQuery('#myForm').validator();
  275. jQuery('input#france').click(function(){
  276. jQuery('button#pay_credit_card').hide();
  277. });
  278. jQuery('input#israel').click(function(){
  279. jQuery('button#pay_credit_card').show();
  280. });
  281. jQuery(document).ready(function() {
  282. jQuery(document).on("click", "button.btn.btn-default.btn-block.add", function() {
  283. var column = jQuery(this).parents(".row.donation.repeatable").clone();
  284. jQuery(this).removeClass("show").addClass("hide").parent().siblings().find("button.btn.btn-link.btn-block.remove").removeClass("hide").addClass("show").parents("#donation-list").append(column);
  285. jQuery("#donation-list").find(".row.donation.repeatable:last-child").find("input.donation-amount").val("");
  286. jQuery(this).parents(".row.donation.repeatable").siblings().find("button.btn.btn-link.btn-block.remove").addClass("show");
  287. });
  288. jQuery(document).on("click", "button.btn.btn-link.btn-block.remove", function() {
  289. var lists = jQuery(this).parents("#donation-list").children().length;
  290. jQuery(this).parents(".row.donation.repeatable").remove();
  291. jQuery("#donation-list").find(".row.donation.repeatable:last-child").find("button.btn.btn-default.btn-block.add").removeClass("hide").addClass("show");
  292. if(lists < 3){
  293. jQuery("#donation-list").find(".row.donation.repeatable:first-child").find("button.btn.btn-link.btn-block.remove").removeClass("show").addClass("hide");
  294. }
  295. });
  296. jQuery(document).click( function(){
  297. var sum = 0;
  298. jQuery("input.donation-amount").each(function() {
  299. var amount = jQuery(this).val();
  300. if(parseFloat(amount)){
  301. sum += parseFloat(amount);
  302. }
  303. jQuery("#total_amount").text(sum+".00");
  304. });
  305. });
  306. jQuery("select#currency").change(function() {
  307. var currency = jQuery(this).val();
  308. if(currency == "EUR"){
  309. jQuery("#total_currency").text(" €");
  310. } else if(currency == "ILS"){
  311. jQuery("#total_currency").text(" ₪");
  312. } else if(currency == "USD"){
  313. jQuery("#total_currency").text(" $");
  314. }
  315. });
  316. });
  317.  
  318. </script>
  319. <?php get_footer();?>
  320.  
  321. /=============================== style ========================\
  322. @import "../../../river/assets/css/style.min.css";
  323.  
  324. /* Your CSS code goes here
  325. -------------------------------------- */
  326.  
  327. .donation-form .form-control, .donation-form .comment-form input[type="text"], .donation-form .comment-form input[type="email"], .donation-form .comment-form input[type="url"], .donation-form .comment-form textarea, .donation-form .new-donation .btn, .donation-form .comment-form input[type="text"], .donation-form .comment-form input[type="email"], .donation-form .comment-form input[type="url"], .donation-form .comment-form textarea, .donation-form .new-donation .comment-form input[type="submit"] {
  328. height: 55px;
  329. padding: 6px 12px;
  330. font-size: 18px;
  331. line-height: 18px;
  332. color: #344149;
  333. background-color: #EBECED;
  334. border: none;
  335. -webkit-box-shadow: none;
  336. box-shadow: none;
  337. }
  338. .donation-form h3.pink-title {
  339. color: #EE5772;
  340. }
  341. .donation-form h3 {
  342. margin-top: 30px;
  343. margin-bottom: 15px;
  344. font-size: 28px;
  345. font-weight: 700;
  346. }
  347.  
  348. .donation-form .btn.add, .donation-form .comment-form input[type="submit"].add {
  349. margin-top: 31px;
  350. background-color: transparent;
  351. }
  352. button#add:focus {
  353. outline: 0px;
  354. }
  355. input.form-control.combobox {
  356. width: 100%;
  357. }
  358. .combobox-container .input-group {
  359. display: block;
  360. }
  361.  
  362. select#projectID {
  363. border-radius: 0px;
  364. }
  365. label {
  366. display: inline-block;
  367. max-width: 100%;
  368. margin-bottom: 5px;
  369. font-weight: bold;
  370. }
  371. .donation-form label {
  372. color: #344149;
  373. font-size: 18px;
  374. }
  375. button, input, optgroup, select, textarea {
  376. color: inherit;
  377. font: inherit;
  378. margin: 0;
  379. }
  380. button, select {
  381. text-transform: none;
  382. }
  383. input, button, select, textarea {
  384. font-family: inherit;
  385. font-size: inherit;
  386. line-height: inherit;
  387. }
  388. .form-control, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  389. display: block;
  390. width: 100%;
  391. height: 34px;
  392. padding: 6px 12px;
  393. font-size: 14px;
  394. line-height: 1.42857143;
  395. color: #555555;
  396. background-color: #fff;
  397. background-image: none;
  398. border: 1px solid #ccc;
  399. border-radius: 0;
  400. -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  401. box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  402. -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
  403. -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  404. transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  405. }
  406. .donation-form .form-control, .donation-form .comment-form input[type="text"], .donation-form .comment-form input[type="email"], .donation-form .comment-form input[type="url"], .donation-form .comment-form textarea, .donation-form .new-donation .btn, .donation-form .comment-form input[type="text"], .donation-form .comment-form input[type="email"], .donation-form .comment-form input[type="url"], .donation-form .comment-form textarea, .donation-form .new-donation .comment-form input[type="submit"] {
  407. height: 55px;
  408. padding: 6px 12px;
  409. font-size: 18px;
  410. line-height: 18px;
  411. color: #344149;
  412. background-color: #EBECED;
  413. border: none;
  414. -webkit-box-shadow: none;
  415. box-shadow: none;
  416. }
  417. .donation-form .btn.add, .donation-form .comment-form input[type="submit"].add {
  418. margin-top: 31px;
  419. background-color: transparent;
  420. }
  421. .col-sm-offset-1 {
  422. margin-right: 8.33333333%;
  423. margin-left: 0;
  424. }
  425. .btn-lg, .btn-group-lg > .btn, .btn-group-lg > .comment-form input[type="submit"] {
  426. padding: 10px 16px;
  427. font-size: 18px;
  428. line-height: 1.33;
  429. border-radius: 0;
  430. }
  431. .btn.btn-pink, .comment-form input[type="submit"].btn-pink, .comment-form input[type="submit"].btn-pink {
  432. color: #fff;
  433. background-color: #EE5772;
  434. }
  435. .btn.btn-pink:hover, .comment-form input[type="submit"].btn-pink:hover, .btn.btn-pink:focus, .comment-form input[type="submit"].btn-pink:focus, .comment-form input[type="submit"].btn-pink:hover, .comment-form input[type="submit"].btn-pink:focus {
  436. color: #fff;
  437. background-color: #e9294b;
  438. }
  439. .donation-form h3.green-title {
  440. color: #2E938B;
  441. }
  442. .donation-form h3 {
  443. margin-top: 30px;
  444. margin-bottom: 15px;
  445. font-size: 28px;
  446. font-weight: 700;
  447. }
  448. .donation-form .total .checkout-total-amount {
  449. height: 45px;
  450. font-size: 30px;
  451. font-weight: 700; padding-top: 10px;
  452. text-align: center; color: #333333;}
  453. .donation-form .total {text-align: center;}
  454. button.btn.btn-link.btn-block.remove {color: #14191c; margin-top: 31px;}
  455. button.btn.btn-link.btn-block.remove:focus {outline:0}
  456. .modal-backdrop.fade.in {z-index: 0;}
  457. button.btn.btn-lg.btn-link.btn-modal {color: #000; float: left;}
  458. button.btn.btn-lg.btn-link.btn-modal:focus {outline:0}
  459. .modal {background: rgba(0, 0, 0, 0.6);}
  460. .modal-content {border-radius: 0;}
  461. button.btn.btn-primary {
  462. background-color: #1f262b;
  463. border-color: #101416;
  464. border-radius: 0px;
  465. }
  466.  
  467. h4#myModalLabel {
  468. color: #333;
  469. }
  470.  
  471. .modal-body {
  472. color: #333;
  473. font-size: 14px;
  474. }
  475. .uneditable-input, button, input[type=time], input[type=week], input[type=number], input[type=email], input[type=url], input[type=search], input[type=tel], input[type=color], input[type=submit], input[type=text], input[type=password], input[type=datetime], input[type=datetime-local], input[type=date], input[type=month], textarea {
  476. -webkit-border-radius: 0px;
  477. -moz-border-radius: 0px;
  478. border-radius: 0;
  479. }
  480.  
  481. a.col-sm-offset-1.receipt-info {
  482. color: #344149;
  483. font-size: 18px;
  484. }
  485.  
  486. .col-sm-11.col-sm-offset-1 h4 {
  487. color: #344149;
  488. font-size: 18px;
  489. }
  490.  
  491. a.col-sm-offset-1.receipt {
  492. color: #344149;
  493. font-size: 18px;
  494. }
  495. input, button, select, textarea {
  496. font-family: inherit;
  497. font-size: inherit;
  498. line-height: inherit;
  499. }
  500. input[type="checkbox"], input[type="radio"] {
  501. -webkit-box-sizing: border-box;
  502. box-sizing: border-box;
  503. padding: 0;
  504. }
  505. input[type="radio"], input[type="checkbox"] {
  506. margin: 4px 0 0;
  507. margin-top: 1px \9;
  508. line-height: normal;
  509. }
  510. .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
  511. position: absolute;
  512. margin-left: -20px;
  513. margin-top: 4px \9;
  514. }
  515. .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
  516. margin-right: -20px;
  517. margin-left: auto;
  518. }
  519. label {
  520. display: inline-block;
  521. max-width: 100%;
  522. margin-bottom: 5px;
  523. font-weight: bold;
  524. }
  525. .radio label, .checkbox label {
  526. min-height: 20px;
  527. padding-left: 20px;
  528. margin-bottom: 0;
  529. font-weight: normal;
  530. cursor: pointer;
  531. }
  532. .radio label, .checkbox label {
  533. padding-right: 20px;
  534. padding-left: initial;
  535. }
  536.  
  537. .help-block.with-errors {
  538. float: left;
  539. }
  540. button.btn.btn-link.btn-block.remove {
  541. display: none;
  542. }
  543. button.btn.btn-default.btn-block.add:focus {
  544. outline: 0;
  545. }
  546. .donation-form .receipt.collapsed i.fa-check-square-o:before {
  547. content: "\f096";
  548. }
  549.  
  550. site link :
  551. main site https://www.yadeliezer.org.il/%D7%AA%D7%A8%D7%95%D7%9E%D7%94/
  552. work site http://www.chasdei-naomi.org.il/?page_id=7487
Advertisement
Add Comment
Please, Sign In to add comment