aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/views/project
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/project')
-rw-r--r--app/views/project/newProject.ejs79
-rw-r--r--app/views/project/participants.ejs55
-rw-r--r--app/views/project/post.ejs103
-rw-r--r--app/views/project/project.ejs220
4 files changed, 457 insertions, 0 deletions
diff --git a/app/views/project/newProject.ejs b/app/views/project/newProject.ejs
new file mode 100644
index 0000000..2101138
--- /dev/null
+++ b/app/views/project/newProject.ejs
@@ -0,0 +1,79 @@
+<% include ../templates/header %>
+
+</head>
+<body>
+ <% include ../templates/navbar %>
+
+ <!-- Wrapper
+ ================================================== -->
+ <div class="container" id="wrapper">
+ <div class="row-fluid">
+
+
+ <form class="form-horizontal" action="/project/new" method="post">
+ <fieldset>
+
+ <h1><legend><%= title %></legend></h1>
+
+ <div class="control-group">
+ <label class="control-label">Prosjektnavn</label>
+ <div class="controls">
+ <input id="projectname" name="name" placeholder="" type="text" required="" maxlength="25">
+ <p class="help-block">Navnet på prosjektet du vil lage</p>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label">Beskrivelse</label>
+ <div class="controls">
+ <textarea id="description" name="description" class="span6"></textarea>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label">Valuta</label>
+ <div class="controls">
+ <span class="input-small uneditable-input">kr</span>
+ <!-- <input id="currency" name="currency" type="text" placeholder="kr" class="span2" required=""> -->
+ </div>
+ </div>
+
+<!-- <div class="control-group">
+ <label class="control-label">Invite only eller offentlig?</label>
+ <div class="controls">
+ <label class="radio">
+ <input type="radio" name="public" value="Invite only" checked="checked">
+ Invite only
+ </label>
+ <label class="radio">
+ <input type="radio" name="public" value="Offentlig">
+ Offentlig
+ </label>
+ </div>
+ </div>-->
+
+
+ <div class="control-group">
+ <label class="control-label">Double Button</label>
+ <div class="controls">
+ <button type="submit" id="button1id" name="button1id" class="btn btn-primary">Opprett prosjekt</button>
+ <button type="reset" id="button2id" name="button2id" class="btn">Nullstill</button>
+ </div>
+ </div>
+
+ </fieldset>
+ </form>
+
+
+
+
+
+
+
+ </div><!-- /div.row -->
+ </div><!-- /div.#wrapper -->
+
+
+<% include ../templates/footer %>
+</body>
+</html>
diff --git a/app/views/project/participants.ejs b/app/views/project/participants.ejs
new file mode 100644
index 0000000..4341a4f
--- /dev/null
+++ b/app/views/project/participants.ejs
@@ -0,0 +1,55 @@
+<% include ../templates/header %>
+
+</head>
+<body>
+ <% include ../templates/navbar %>
+
+ <!-- Wrapper
+ ================================================== -->
+ <div class="container" id="wrapper">
+ <div class="row-fluid">
+
+
+ <form class="form-horizontal" method="post">
+ <fieldset>
+
+ <h1><legend><%= title %></legend></h1>
+ <p>Her kan du invitere venner til å delta i prosjektet ditt. Skriv inn eposadressene deres, en på hver linje, i tekstboksen under.</p>
+ <div class="control-group">
+ <label class="control-label">Epostadresser</label>
+ <div class="controls">
+ <textarea id="emails" name="emails" class="span6"></textarea>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label">Beskrivelse</label>
+ <div class="controls">
+ <textarea id="description" name="description" class="span6">Hei! Jeg har oppdaget et nytt og kult program... Bla bla bla. Stian og Erling fixes.</textarea>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label"></label>
+ <div class="controls">
+ <button type="submit" id="button1id" name="button1id" class="btn btn-primary">Inviter</button>
+ <button type="reset" id="button2id" name="button2id" class="btn">Nullstill</button>
+ </div>
+ </div>
+
+ </fieldset>
+ </form>
+
+
+
+
+
+
+
+ </div><!-- /div.row -->
+ </div><!-- /div.#wrapper -->
+
+
+<% include ../templates/footer %>
+</body>
+</html>
diff --git a/app/views/project/post.ejs b/app/views/project/post.ejs
new file mode 100644
index 0000000..5e8f283
--- /dev/null
+++ b/app/views/project/post.ejs
@@ -0,0 +1,103 @@
+<% include ../templates/header %>
+
+</head>
+<body>
+ <% include ../templates/navbar %>
+
+ <!-- Wrapper
+ ================================================== -->
+ <div class="container" id="wrapper">
+ <div class="row-fluid">
+
+
+ <form class="form-horizontal" method="post">
+ <input type="hidden" name="project" value="<%= project._id %>">
+ <fieldset>
+
+ <h1><legend><%= title %></legend></h1>
+ <div class="control-group">
+ <label for="username" class="control-label">Av</label>
+ <div class="controls">
+ <span class="input-medium uneditable-input"><%= req.user.username %></span>
+ </div>
+ </div>
+ <div class="control-group">
+ <label for="what" class="control-label">Hva <strong class="text-error">*</strong></label>
+ <div class="controls">
+ <input type="text" name="what" id="what" placeholder="Hva ble kjøpt" required maxlength="40">
+ </div>
+ </div>
+ <%
+ // we need to populate the date- and timefield with the current time and date
+ var d = new Date();
+ var n = d.getFullYear() + '-' + ('0' + (d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2);
+ var t = d.toLocaleTimeString().slice(0, 5);
+ %>
+ <!-- <%= d %> -->
+ <div class="control-group">
+ <label for="date" class="control-label">Når</label>
+ <div class="controls">
+ <input type="date" name="date" value="<%= n %>" class="input-medium">
+ <input type="time" name="time" value="<%= t %>" class="input-medium">
+ </div>
+ </div>
+ <div class="control-group">
+ <label for="cost" class="control-label">Hvor mye <strong class="text-error">*</strong></label>
+ <div class="controls">
+ <input type="number" name="value" id="value" class="input-small" placeholder="0" required>
+ </div>
+ </div>
+<!-- <div class="control-group">
+ <label for="split_between" class="control-label">Delt på</label>
+ <div class="controls">
+
+ <span class="selectAll">Select all</span>
+ <select name="participants[]" id="participants" multiple="multiple">
+ <option value="5180e11b0074a8b029000001" selected="selected">Dennis</option>
+ <option value="51814b792c94cc5346000001" selected="selected">Kurt</option>
+ </select>
+ </div>
+ </div>
+ <div class="control-group">
+ <label for="file" class="control-label">Kvittering</label>
+ <div class="controls">
+ <input type="file" name="file" id="file">
+ </div>
+ </div>-->
+ <div class="control-group">
+ <label for="comment" class="control-label">Kommentar</label>
+ <div class="controls">
+ <textarea id="comment" name="comment" class="span6"></textarea>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <div class="form-actions">
+ <button type="submit" id="button1id" name="button1id" class="btn btn-primary">Post</button>
+ <button type="reset" id="button2id" name="button2id" class="btn">Nullstill</button>
+ </div>
+ </div>
+
+ </fieldset>
+ </form>
+
+
+
+
+
+
+
+ </div><!-- /div.row -->
+ </div><!-- /div.#wrapper -->
+
+
+<% include ../templates/footer %>
+<!-- <script>
+ $(".selectAll").click(function() {
+ $('#participants').children().attr('selected','selected');
+ //$(this).parent().find('option').attr('selected','selected');
+ });
+</script>-->
+
+</body>
+</html>
diff --git a/app/views/project/project.ejs b/app/views/project/project.ejs
new file mode 100644
index 0000000..7e06dad
--- /dev/null
+++ b/app/views/project/project.ejs
@@ -0,0 +1,220 @@
+<% include ../templates/header %>
+
+</head>
+<body>
+ <% include ../templates/navbar %>
+
+ <!-- Wrapper
+ ================================================== -->
+ <div class="container" id="wrapper">
+ <div class="row-fluid">
+ <div class="span6 smallfullwidth">
+ <div class="row-fluid">
+ <div class="span2 info text-right">
+ prosjekt
+ </div>
+ <div class="span10">
+ <h1><%= project.name %></h1>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span2 info text-right">
+ opprettet
+ </div>
+ <div class="span10">
+ <p>
+ <% var d = new Date(project.created); %>
+ <%= d.getFullYear() + '-' + ('0' + (d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + ' ' + d.toLocaleTimeString().slice(0, 5) %>
+ </p>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span2 info text-right">
+ deltakere
+ </div>
+ <div class="span10">
+ <% access.forEach(function(participants) { %>
+ <%- participants.user.name %><% if (participants.permissions >= 6) { %> <span class="muted">(<%= participants.permissions === 9 ? 'eier' : 'admin' %>)</span><% } %><br>
+ <% }); %>
+ <small><a href="/project/<%= project.shortURL %>/participants">Legg til flere deltakere</a></small>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span10 offset2">
+ <a class="btn btn-large" href="/project/<%= project.shortURL %>/post">Før utgift</a>
+ </div>
+ </div>
+ </div><!-- /div.span6 -->
+
+
+
+
+
+
+
+
+ <div class="span6 smallfullwidth" id="accordion">
+ <section class="status">
+ <div class="row-fluid">
+ <div class="span6 smallfullwidth">
+ <h2>Status total</h2>
+ </div>
+ <div class="span6 smallfullwidth">
+ <div class="row-fluid">
+ <table class="table table-bordered table-condensed">
+ <tr>
+ <td class="success"><%= pro.user[req.user._id].total %></td>
+ <td class="error"><%= pro.total %></td>
+ <td><%= pro.user[req.user._id].diff %></td>
+ </tr>
+ </table><a href="#table-info" class="accordion-toggle" data-toggle="collapse"><i class="icon-info-sign"></i></a>
+ </div>
+ </div>
+ </div>
+ <div class="row-fluid accordion-body collapse" id="table-info">
+ <p>Det er til sammen brukt <strong><%= (pro.total).toFixed(2) %></strong> <%= project.currency %>. Deltakerne skal altså betale <strong><%= (pro.each).toFixed(2) %></strong> <%= project.currency %> hver.</p>
+ <% for (var i in pro.user) { %>
+ <%- pro.user[i].name %> har betalt <%= pro.user[i].total %> <%= project.currency %>, og <%- pro.user[i].diff >= 0 ? 'skyldes <span class="text-success">' + pro.user[i].diff : 'skylder <span class="text-error">' + Math.abs(pro.user[i].diff) %></span> <%= project.currency %><br>
+ <% } %>
+ <p><small><a href="#example" data-toggle="collapse" class="accordion-toggle">Eksempel på hvordan oppgjøret kan gjøres</a></small></p>
+ </div>
+ <div class="row-fluid collapse" id="example">
+ <table>
+ <%
+ // FUGLY LAST-MINUTE CODE
+ var i = 1;
+ for (var u in pro.user) {
+ if (pro.user[u].coeff === 0) {
+ if (i === 1) {%>
+ <tr>
+ <td></td>
+ <% for (var p in pro.user) { %>
+ <%- pro.user[p].coeff > 0 ? '<td>' + pro.user[p].name + '</td>' : '' %>
+ <% } %>
+ </tr>
+ <% } %>
+ <tr>
+ <td><%- pro.user[u].name %></td>
+ <% for (var p in pro.user) { %>
+ <%- pro.user[p].coeff > 0 ? '<td>' + (Math.abs(pro.user[u].diff) * pro.user[p].coeff).toFixed(2) + '</td>' : '' %>
+ <% } %>
+ </tr>
+<% i++;
+ }} %>
+ </table>
+
+ </div>
+ <div class="row-fluid accordion-body in collapse" id="chart">
+ <canvas id="myChart" width="450" height="200"></canvas>
+ </div>
+ </section>
+ </div>
+ </div>
+
+
+
+
+
+
+
+
+ <div class="row-fluid">
+ <div class="span12 smallfullwidth">
+ <section class="overview">
+ <h2>Siste aktivitet</h2>
+ <div class="lastactivity" id="lastactivity">
+ <% posts.forEach(function(post) { %>
+ <div class="row-fluid post-<%= post._id %> activity">
+ <div class="row-fluid">
+ <div class="span1 date">
+ <%
+ var d = new Date(post.when);
+ var month = ['JAN', 'FEB', 'MAR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DES'];
+ %>
+ <div class="row-fluid"><%= d.getDate() %></div>
+ <div class="row-fluid info"><%= month[d.getMonth()] %></div>
+ <div class="row-fluid"><a href="#details-<%= post._id %>" data-toggle="collapse" class="no-text-decoration" data-parent="#lastactivity">&#9660;</a></div>
+ </div>
+ <div class="span6">
+ <div class="row-fluid">
+ <div class="span2 info text-right smallfullwidth">av</div>
+ <div class="span10 smallfullwidth"><%- post.user.name %></div>
+ </div>
+ <div class="row-fluid">
+ <div class="span2 info text-right smallfullwidth">hva</div>
+ <div class="span10 smallfullwidth"><%= post.what %></div>
+ </div>
+ </div>
+ <div class="span2">
+ <div class="row-fluid">
+ &nbsp;
+ </div>
+ </div>
+ <div class="span2">
+ <div class="row-fluid text-right">
+ <span class="info">sum</span>
+ <strong><%= post.value %> <%= post.currency %></strong>
+ </div>
+ <div class="row-fluid text-right">
+ <i class="icon-picture"></i>
+ </div>
+ </div>
+ </div>
+ <div class="fluid-row collapse details" id="details-<%= post._id %>">
+ <div class="span7">
+ <div class="row-fluid">
+ <div class="span2 info text-right smallfullwidth">kommentar</div>
+ <div class="span10">
+ <%= post.comment %>
+ </div>
+ </div>
+ </div>
+ <% if (String(post.user._id) === String(req.user._id) || req.user.permissions >= 6) { %>
+ <div class="span1">
+ <small><a href="/project/<%= project.shortURL %>/edit/<%= post._id %>">[edit]</a></small>
+ </div>
+ <div class="span1">
+ <small><a href="/project/<%= project.shortURL %>/delete/<%= post._id %>">[delete]</a></small>
+ </div>
+ <% } %>
+ </div>
+ </div>
+
+ <% }); %>
+ </div>
+ </section>
+ </div><!-- /div.span7 -->
+
+
+ </div><!-- /div.row -->
+ </div><!-- /div.#wrapper -->
+
+
+<% include ../templates/footer %>
+ <script src="/js/Chart.min.js"></script>
+ <script>
+ var data = {
+ labels : ["January","February","March","April","May","June","July"],
+ datasets : [
+ {
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,1)",
+ pointColor : "rgba(220,220,220,1)",
+ pointStrokeColor : "#fff",
+ data : [65,59,90,81,56,55,40]
+ },
+ {
+ fillColor : "rgba(151,187,205,0.5)",
+ strokeColor : "rgba(151,187,205,1)",
+ pointColor : "rgba(151,187,205,1)",
+ pointStrokeColor : "#fff",
+ data : [0,25,10,100,10,25,0]
+ }
+ ]
+ }
+ //var myLine = new Chart(document.getElementById("myChart").getContext("2d")).Line(data);
+ var ctx = $("#myChart").get(0).getContext("2d");
+ var myNewChart = new Chart(ctx).Line(data);
+ </script>
+</body>
+</html>