<% include header %>
</head>
<body>
<% include navbar %>
<!-- Wrapper
================================================== -->
<div class="container" id="wrapper">
<div class="row-fluid">
<div class="smallfullwidth span5">
<h1>Prosjekter</h1>
<section class="projects">
<% if (projects.length === 0) { %>
<p>Du har ingen aktive prosjekt. Du kan starte et prosjekt ved å klikke <a href="/project/new">her</a>.</p>
<% } else { projects.forEach(function(projects) { %>
<section class="project">
<div class="row-fluid">
<div class="span11">
<h1><a href="/project/<%= projects.project.shortURL %>"><strong><%= projects.project.name %></strong></a></h1>
<div class="row-fluid">
<div class="span8">
<small>
<% var ppl = 'Meg';
participants.forEach(function(participant) {
if (String(participant.project) === String(projects.project._id) && String(participant.user._id) !== String(user._id)) {
ppl += ', ' + participant.user.name;
}
}); %>
<%- ppl %>
</small>
</div>
<div class="span4">
<% s = (pro.project[projects.project._id].user - (pro.project[projects.project._id].total / pro.project[projects.project._id].users)).toFixed(2); %>
<small>Oppgjør: <%- s >= 0 ? '<span class="text-success">' + s : '<span class="text-error">' + s %></span> <%= projects.project.currency %></small>
</div>
</div>
</div>
<div class="span1">
<p class="flip"><a href="/project/<%= projects.project.shortURL %>/post">Før utgift</a></p>
</div>
</div>
</section>
<% }); } %>
<a href="/project/new" class="btn btn-large btn-block" type="button">+</a>
</section>
</div><!-- /div.span5 -->
<div class="smallfullwidth span7">
<section class="status">
<h1>Status total</h1>
<canvas id="myChart" width="530" height="200"></canvas>
</section>
<section class="overview">
<h1>Siste aktivitet</h1>
<div class="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">▼</a></div>
</div>
<div class="span8">
<div class="row-fluid">
<div class="span2 info text-right smallfullwidth">prosjekt</div>
<div class="span10 smallfullwidth"><a href="/project/<%= post.project.shortURL %>"><%= post.project.name %></a></div>
</div>
<div class="row-fluid">
<div class="span2 info text-right smallfullwidth">av</div>
<div class="span10 smallfullwidth"><%= post.user.name === undefined ? post.user.email + ' <span class="muted">(ikke registrert)</span>' : 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 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>
<div class="span2">
<div class="row-fluid info">
</div>
</div>
</div>
</div>
<% }); %>
</div>
</section>
</div><!-- /div.span7 -->
</div><!-- /div.row -->
</div><!-- /div.#wrapper -->
<% include 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>