<!DOCTYPE html>
<html>
<head>
<link data-require="bootstrap-css@3.0.2" data-semver="3.0.2" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" />
<script data-require="lodash@*" data-semver="2.3.0" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script data-require="bootstrap@3.0.2" data-semver="3.0.2" src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<script data-require="angular.js@*" data-semver="2.0.0" src="https://code.angularjs.org/2.0.0-beta.6/angular2.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>
<a href="http://coffeescript.org/">Coffeescript</a>
, <a href="http://lodash.com/">lodash</a>
<small>Sandbox</small>
</h1>
<div class="alert alert-danger" role="alert">Please Fork Before Editing!</div>
How to use?
<ul>
<li>Write your code in script.coffee.</li>
<li>You can use <samp>console.log "some result"</samp>
.</li>
<li>You can use jquery to show anything in this html markup since the jquery library
is also included.
</li>
<li>You can get fancy and include other libraries like AngularJS to sketch out other ideas.</li>
</ul>
</div>
</div>
</body>
</html>
/* Styles go here */
presets = [
{
label: "Current Month",
value: {
from: "2016-07-01",
period: "WEEKLY",
to: "2016-07-14"
}
},
{
label: "Previous financial year",
value: {
from: "2015-07-01",
to: "2016-06-30"
keep_today: false,
period: "MONTHLY"
}
},
{
label: "Year to date",
value: {
period: "MONTHLY"
to: "2016-07-14"
from: "2016-07-01"
}
}
]
# Previous financial year
histParams = {from: "2015-07-01", to: "2016-06-30", period: "MONTHLY", keep_today: false, mode: "current"}
# Current Month
histParams = {from: "2016-07-01", to: "2016-07-14", period: "WEEKLY", keep_today: true, mode: "current"}
# YTD
#histParams = {from: "2016-07-01", to: "2016-07-14", period: "MONTHLY", keep_today: true, mode: "current"}
fyEndMonth = 6
#selectedPreset = _.find(presets, (p) ->
#_.every _.map(p.value, (v,k) ->
#histParams[k] == v
#)
#)
selectedPreset = _.find(presets, (p) -> _.every(p.value, (v, k) -> histParams[k] == v))
console.log(selectedPreset.label)