ddrillini / uiuc-wendy

Issue tracker for UIUC's ITG cabinet, and public assets.
http://ddrillini.club
2 stars 1 forks source link

rip-calculator #13

Closed ianklatzco closed 6 years ago

ianklatzco commented 6 years ago

got another project for tucker: https://github.com/ddrillini/uiuc-wendy/blob/master/rip-calculator.html

I'd like to have a page I can link of the signups google form that helps people calculate how much money to pay.

Clicking a checkbox should tell you how much money to send, following the rules outlined here, on the google form.

Goals:

The first one should be easy, everything's already there and a couple of values need to be updated. The second one is a little more tricky and would probably require rewriting the function that updates the textbox to instead display & update a paypal.me link.

ianklatzco commented 6 years ago

@tcampbell0092

ianklatzco commented 6 years ago

please give this a shot, if you're feeling up to it! it'd be a huge help c:

you can start by saving the html file to your computer, then opening it up with your browser.

tcampbell0092 commented 6 years ago

I got some free time this week, will definitely work on it when I'm not at my job(s)

tcampbell0092 commented 6 years ago

Here's my version that labels the boxes and corrects the values, and displays the wanted text when you enter all the tournaments;

tcampbell0092 commented 6 years ago
<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <script type="text/javascript">
      function add_sub(el)
    {
    var cbs = document.getElementById('checkboxes').getElementsByTagName('input');
    var textareaValue = 0;
    for (var i = 0, len = cbs.length; i<len; i++) {
        if ( cbs[i].type === 'checkbox' && cbs[i].checked) {
              textareaValue += parseInt(cbs[i].value);
        }
        if (textareaValue == 38)
        {
          textareaValue = "38: you're entering all the tournaments!"
        }
      }
       document.getElementById('textarea').value = textareaValue;
      }
    </script>

  </head>

<body>
  <form name="form1" method=post>
  <textarea id="textarea" name="type" rows="5" cols="35" onclick="this.focus();this.select();"></textarea><br>
  <div id="checkboxes">
            <input type="checkbox" name="mis10" id="id1" value="10" onclick="add_sub(this);"><label>ITG Singles ($10)</label><br>
            <input type="checkbox" name="mis10" id="id2" value="10" onclick="add_sub(this);"><label>ITG Doubles ($10)</label><br>
            <input type="checkbox" name="mis5" id="id3" value="5" onclick="add_sub(this);"><label>Mods SRT ($5)</label><br>
            <input type="checkbox" name="mis5" id="id4" value="5" onclick="add_sub(this);"><label>ITG Couples ($5)</label><br>
            <input type="checkbox" name="mis5" id="id5" value="5" onclick="add_sub(this);"><label>PIU Singles ($5)</label><br>
            <input type="checkbox" name="mis3" id="id6" value="3" onclick="add_sub(this);"><label>Venue Fee ($3)</label>

<!--  <input type="checkbox" id="singles"> ITG Singles ($10)
  <br>
  <input type="checkbox" name="doubles"> ITG Doubles ($10)
  <br>
  <input type="checkbox" name="couples"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="srt"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="pump"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="venue"> Venue Fee ($3)
  <br>
-->
  </div>
  </form>

    Please send this amount here! <a href="http://paypal.me/ianek/3">http://paypal.me/ianek/3</a>
</body>

</html>
ianklatzco commented 6 years ago

sweet! thanks a lot! i'll add it to the signup form in a bit one thing:

this might be a lot harder, but if you're feeling up for the challenge:

tcampbell0092 commented 6 years ago

Changed the text so they get $5 off when all boxes are checked, can't figure out how to start the second part, though.

<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <script type="text/javascript">
      function add_sub(el)
    {
    var cbs = document.getElementById('checkboxes').getElementsByTagName('input');
    var textareaValue = 0;
    for (var i = 0, len = cbs.length; i<len; i++) {
        if ( cbs[i].type === 'checkbox' && cbs[i].checked) {
              textareaValue += parseInt(cbs[i].value);
        }
        if (textareaValue == 38)
        {
          textareaValue = "33: you're entering all the tournaments, so you get $5 off!"
        }
      }
       document.getElementById('textarea').value = textareaValue;
      }
    </script>

  </head>

<body>
  <form name="form1" method=post>
  <textarea id="textarea" name="type" rows="5" cols="35" onclick="this.focus();this.select();"></textarea><br>
  <div id="checkboxes">
            <input type="checkbox" name="mis10" id="id1" value="10" onclick="add_sub(this);"><label>ITG Singles ($10)</label><br>
            <input type="checkbox" name="mis10" id="id2" value="10" onclick="add_sub(this);"><label>ITG Doubles ($10)</label><br>
            <input type="checkbox" name="mis5" id="id3" value="5" onclick="add_sub(this);"><label>Mods SRT ($5)</label><br>
            <input type="checkbox" name="mis5" id="id4" value="5" onclick="add_sub(this);"><label>ITG Couples ($5)</label><br>
            <input type="checkbox" name="mis5" id="id5" value="5" onclick="add_sub(this);"><label>PIU Singles ($5)</label><br>
            <input type="checkbox" name="mis3" id="id6" value="3" onclick="add_sub(this);"><label>Venue Fee ($3)</label>

<!--  <input type="checkbox" id="singles"> ITG Singles ($10)
  <br>
  <input type="checkbox" name="doubles"> ITG Doubles ($10)
  <br>
  <input type="checkbox" name="couples"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="srt"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="pump"> ITG Couples ($10)
  <br>
  <input type="checkbox" name="venue"> Venue Fee ($3)
  <br>
-->
  </div>
  </form>

    Please send this amount here! <a href="http://paypal.me/ianek/3">http://paypal.me/ianek/3</a>
</body>

</html>
ianklatzco commented 6 years ago

tucker did the meat of the code, and i wrapped it up in some pretty: http://rip.ddrillini.club/entry-fee-calculator/entrycalc.html

tucker, if you're interested, these ~5 lines are what i changed to accomplish the second checkbox at the top of this page. https://github.com/ddrillini/rip-website/commit/c288cd875fa6452191e016e7e9f45f6de34c8796#diff-c8c3c5087f27590e2c5e7e4c4867dd5bR50

thank you for helping out! :star2:

ianklatzco commented 6 years ago

adding this to the google form now