update 1907240908
This commit is contained in:
52
app-new/objects.js
Normal file
52
app-new/objects.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// Weeks
|
||||
|
||||
function WeeklySpreadsheet(start, key) {
|
||||
|
||||
this.start = new Date(start);
|
||||
|
||||
this.key = key;
|
||||
|
||||
this.setTitle = () => {
|
||||
let end = addDays(this.start, 6);
|
||||
let monthsArr = new Months().short;
|
||||
return monthsArr[this.start.getMonth()] + ' ' + this.start.getDate() + ' — ' +
|
||||
monthsArr[end.getMonth()] + ' ' + end.getDate();
|
||||
};
|
||||
|
||||
this.createAnchor = purpose => {
|
||||
let title = this.setTitle(), text = '';
|
||||
let active = new Date().getTime() >= this.start.getTime();
|
||||
let anchor = '<a class="h" target="_blank" href="https://docs.google.com/spreadsheets/d/';
|
||||
anchor += this.key + '/edit#gid=';
|
||||
switch (purpose) {
|
||||
case 'expense': anchor += '914973738'; text = 'URL Collector'; break;
|
||||
case 'payroll': anchor += '978213208'; text = 'Payroll Hyperlinks'; break;
|
||||
}
|
||||
anchor += '" title="' + title + '">' + ((active) ? text + '</a>' : '</a>' + text);
|
||||
return anchor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Assistance
|
||||
|
||||
function Months() {
|
||||
|
||||
this.short = [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
|
||||
];
|
||||
|
||||
// this.long = [
|
||||
// 'January', 'February', 'March',
|
||||
// 'April', 'May', 'June',
|
||||
// 'July', 'August', 'September',
|
||||
// 'October', 'November', 'December'
|
||||
// ];
|
||||
|
||||
}
|
||||
|
||||
function addDays(date, days) {
|
||||
return new Date(date.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
Reference in New Issue
Block a user