desktop version can add new projects, and start and stop working, and saves it to localstorage
@@ -1,29 +1,60 @@
|
|||||||
|
|
||||||
angular.module('workApp', [])
|
angular.module('workApp', [])
|
||||||
.controller('workController', function(
|
.controller('workController', function(
|
||||||
$scope
|
$scope,
|
||||||
|
$interval
|
||||||
) {
|
) {
|
||||||
$scope.username="user";
|
$scope.username="user";
|
||||||
//localStorage.clear();
|
//localStorage.clear();
|
||||||
|
$scope.working=false;
|
||||||
$scope.projects=[];
|
$scope.projects=[];
|
||||||
|
$scope.currentproject={};
|
||||||
if(localStorage.getItem("w_l_projects"))
|
if(localStorage.getItem("w_l_projects"))
|
||||||
{
|
{
|
||||||
$scope.projects=JSON.parse(localStorage.getItem("w_l_projects")); //w_local_
|
$scope.projects=JSON.parse(localStorage.getItem("w_l_projects")); //w_local_
|
||||||
}
|
}
|
||||||
|
if($scope.projects.length>0)
|
||||||
$scope.newproject={};
|
{
|
||||||
$scope.newproject.id=$scope.projects[$scope.projects.length-1].id+1;
|
$scope.newproject={
|
||||||
|
id: $scope.projects[$scope.projects.length-1].id+1
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
$scope.newproject={
|
||||||
|
id: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//$scope.newproject.id=$scope.projects[$scope.projects.length-1].id+1;
|
||||||
$scope.addNewProject = function(){
|
$scope.addNewProject = function(){
|
||||||
$scope.newproject.totaltime="0";
|
$scope.newproject.totaltime="0";
|
||||||
$scope.projects.push($scope.newproject);
|
$scope.projects.push($scope.newproject);
|
||||||
localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
|
localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
|
||||||
$scope.newproject={};
|
$scope.newproject={
|
||||||
$scope.newproject.id=$scope.projects.length+1;
|
id: $scope.projects[$scope.projects.length-1].id+1
|
||||||
|
};
|
||||||
};
|
};
|
||||||
$scope.removeProject = function(index){
|
$scope.removeProject = function(index){
|
||||||
$scope.projects.splice(index, 1);
|
$scope.projects.splice(index, 1);
|
||||||
localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
|
localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
|
||||||
};
|
};
|
||||||
|
$scope.projectSelect = function(index){
|
||||||
|
$scope.currentproject=$scope.projects[index];
|
||||||
|
};
|
||||||
|
var interval;
|
||||||
|
$scope.currentStrike=0;
|
||||||
|
$scope.btnWork = function(){
|
||||||
|
$scope.working=true;
|
||||||
|
$scope.currentStrike=0;
|
||||||
|
interval = $interval(function(){
|
||||||
|
$scope.currentStrike++;
|
||||||
|
$scope.currentproject.totaltime++;
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
$scope.btnStop = function(){
|
||||||
|
$interval.cancel(interval);
|
||||||
|
$scope.working=false;
|
||||||
|
localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$scope.openCode = function(){
|
$scope.openCode = function(){
|
||||||
toastr.info("Visiting code");
|
toastr.info("Visiting code");
|
||||||
@@ -38,4 +69,10 @@ angular.module('workApp', [])
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
})
|
||||||
|
|
||||||
|
.filter('secondsToDateTime', [function() {
|
||||||
|
return function(seconds) {
|
||||||
|
return new Date(2016, 0, 1).setSeconds(seconds);
|
||||||
|
};
|
||||||
|
}]);
|
||||||
|
|||||||
BIN
desktopapp/img/coding/adaptive-layout.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
desktopapp/img/coding/api.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
desktopapp/img/coding/binary-code.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
desktopapp/img/coding/bugs-search-1.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
desktopapp/img/coding/bugs-search.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
desktopapp/img/coding/c-document.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
desktopapp/img/coding/cloud-coding.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
desktopapp/img/coding/code-rate.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
desktopapp/img/coding/command-line.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
desktopapp/img/coding/css-code.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
desktopapp/img/coding/css-document.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
desktopapp/img/coding/document-settings.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
desktopapp/img/coding/editing-code.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
desktopapp/img/coding/error-404.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
desktopapp/img/coding/hacker.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
desktopapp/img/coding/html-document.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
desktopapp/img/coding/html.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
desktopapp/img/coding/list.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
desktopapp/img/coding/mobile-programming.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
desktopapp/img/coding/password.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
desktopapp/img/coding/php-code.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
desktopapp/img/coding/php-document.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
desktopapp/img/coding/program-interface.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
desktopapp/img/coding/programming-1.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
desktopapp/img/coding/programming.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
desktopapp/img/coding/table.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
desktopapp/img/coding/ui-design.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
desktopapp/img/coding/ux-design.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
desktopapp/img/coding/virus.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
desktopapp/img/coding/web-interface.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
@@ -14,8 +14,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<title>Open Work Time - local version</title>
|
<title>Open Work Time - local version</title>
|
||||||
|
|
||||||
<!-- ANGULAR -->
|
|
||||||
<script src="libraries/angular.min.js"></script>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -50,48 +49,16 @@
|
|||||||
<div class="card blue-grey lighten-4 col s12 m5 l5">
|
<div class="card blue-grey lighten-4 col s12 m5 l5">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<span class="card-title">Projects</span>
|
<span class="card-title">Projects</span>
|
||||||
<ul class="collection">
|
<div class="collection">
|
||||||
<!--<li class="collection-item avatar blue-grey lighten-4">
|
<a href="#!" ng-click="projectSelect($index)" ng-repeat="project in projects" class="collection-item avatar blue-grey lighten-4">
|
||||||
<img src="img/webicons/modeling.png" class="circle"/>
|
<div class="waves-effect waves-light btn-floating blue-grey lighten-2 right" ng-click="removeProject($index)">
|
||||||
<span class="title">Piratel</span>
|
|
||||||
<span class="badge">14h</span>
|
|
||||||
<p class="grey-text">User1, User2</p>
|
|
||||||
</li>
|
|
||||||
<li class="collection-item avatar blue-grey lighten-3">
|
|
||||||
<img src="img/webicons/smartphone.png" class="circle"/>
|
|
||||||
<span class="title">CarsharingApp Frontend</span>
|
|
||||||
<span class="badge">10h 34min</span>
|
|
||||||
<p class="grey-text">User4, User3</p>
|
|
||||||
</li>
|
|
||||||
<li class="collection-item avatar blue-grey lighten-4">
|
|
||||||
<img src="img/webicons/browser-4.png" class="circle"/>
|
|
||||||
<span class="title">CarsharingApp Backend</span>
|
|
||||||
<span class="badge">11h 20min</span>
|
|
||||||
<p class="grey-text">User1, User2</p>
|
|
||||||
</li>
|
|
||||||
<li class="collection-item avatar blue-grey lighten-4">
|
|
||||||
<img src="img/webicons/coding.png" class="circle"/>
|
|
||||||
<span class="title">OpenWorkTime</span>
|
|
||||||
<span class="badge">2h 15min</span>
|
|
||||||
<p class="grey-text">User1, User2, User3, User4</p>
|
|
||||||
</li>
|
|
||||||
<li class="collection-item avatar blue-grey lighten-4">
|
|
||||||
<img src="img/webicons/devices-1.png" class="circle"/>
|
|
||||||
<span class="title">WebPrimusTech</span>
|
|
||||||
<span class="badge">0h</span>
|
|
||||||
<p class="grey-text">no workers</p>
|
|
||||||
</li>-->
|
|
||||||
|
|
||||||
<li ng-repeat="project in projects" class="collection-item avatar blue-grey lighten-4">
|
|
||||||
<a class="waves-effect waves-light btn-floating blue-grey lighten-2 right" ng-click="removeProject($index)">
|
|
||||||
<i class="material-icons"><img src="img/trash.png" class="o_trash_icon" /></i>
|
<i class="material-icons"><img src="img/trash.png" class="o_trash_icon" /></i>
|
||||||
</a>
|
</div>
|
||||||
<img ng-src="img/webicons/{{project.icon}}.png" class="circle"/>
|
<img ng-src="img/coding/{{project.icon}}.png" class="circle"/>
|
||||||
<span class="title">{{project.title}}</span>
|
<span class="title">{{project.title}}</span>
|
||||||
<span class="badge">0h</span>
|
<p class="grey-text">{{project.totaltime | secondsToDateTime | date:'HH:mm:ss'}}</p>
|
||||||
<p class="grey-text">{{username}}</p>
|
</a>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<div class="input-field col s6">
|
<div class="input-field col s6">
|
||||||
@@ -102,29 +69,27 @@
|
|||||||
<input ng-model="newproject.icon" id="icon" type="text" class="validate">
|
<input ng-model="newproject.icon" id="icon" type="text" class="validate">
|
||||||
<label for="icon">icon</label>
|
<label for="icon">icon</label>
|
||||||
</div>
|
</div>
|
||||||
<a ng-click="addNewProject()" class="waves-effect waves-light btn blue-grey lighten-1">Add new project</a>
|
<a ng-click="addNewProject()" class="waves-effect waves-light btn blue-grey lighten-1 right">Add new project</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card blue-grey lighten-4 col s12 m7 l7">
|
<div ng-show="currentproject.title" class="card blue-grey lighten-4 col s12 m7 l7">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<span class="card-title"> <img src="img/webicons/smartphone.png" class="o_project_title_img"/>CarsharingApp Frontend</span>
|
<span class="card-title">
|
||||||
|
<img ng-src="img/coding/{{currentproject.icon}}.png" class="o_project_title_img"/>
|
||||||
|
{{currentproject.title}}
|
||||||
|
</span>
|
||||||
<p>
|
<p>
|
||||||
project github: <a href="#">https://github.com/idoctnef/collectivecarApp</a>
|
Total time: {{currentproject.totaltime | secondsToDateTime | date:'HH:mm:ss'}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
project Taigan: <a href="#">https://github.com/idoctnef/collectivecarApp</a>
|
Current strike time: <b>{{currentStrike | secondsToDateTime | date:'HH:mm:ss'}}</b>
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Total time: 10h 34min
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Current strike time: <b>10h 34min</b>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a class="waves-effect waves-light btn blue-grey lighten-1">Work!</a>
|
<a ng-click="btnWork()" ng-show="!working" class="waves-effect waves-light btn green lighten-2">Work!</a>
|
||||||
|
<a ng-click="btnStop()" ng-show="working" class="waves-effect waves-light btn red lighten-2">Stop!</a>
|
||||||
|
|
||||||
<!--<a class="waves-effect waves-light btn deep-orange lighten-2">Stop working!</a>-->
|
<!--<a class="waves-effect waves-light btn deep-orange lighten-2">Stop working!</a>-->
|
||||||
</div>
|
</div>
|
||||||
@@ -140,7 +105,8 @@ Insert this line above script imports
|
|||||||
Works for both browser and electron with the same code -->
|
Works for both browser and electron with the same code -->
|
||||||
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
|
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
|
||||||
|
|
||||||
|
<!-- ANGULAR -->
|
||||||
|
<script src="libraries/angular.min.js"></script>
|
||||||
|
|
||||||
<!--Import jQuery before materialize.js-->
|
<!--Import jQuery before materialize.js-->
|
||||||
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
|
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
|
||||||
|
|||||||
55
desktopapp/main.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
const electron = require('electron')
|
||||||
|
// Module to control application life.
|
||||||
|
const app = electron.app
|
||||||
|
// Module to create native browser window.
|
||||||
|
const BrowserWindow = electron.BrowserWindow
|
||||||
|
|
||||||
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
let mainWindow
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
// Create the browser window.
|
||||||
|
mainWindow = new BrowserWindow({width: 1100, height: 650})
|
||||||
|
|
||||||
|
mainWindow.setMenu(null);
|
||||||
|
|
||||||
|
// and load the index.html of the app.
|
||||||
|
mainWindow.loadURL(`file://${__dirname}/index.html`)
|
||||||
|
|
||||||
|
// Open the DevTools.
|
||||||
|
//mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
|
// Emitted when the window is closed.
|
||||||
|
mainWindow.on('closed', function () {
|
||||||
|
// Dereference the window object, usually you would store windows
|
||||||
|
// in an array if your app supports multi windows, this is the time
|
||||||
|
// when you should delete the corresponding element.
|
||||||
|
mainWindow = null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method will be called when Electron has finished
|
||||||
|
// initialization and is ready to create browser windows.
|
||||||
|
// Some APIs can only be used after this event occurs.
|
||||||
|
app.on('ready', createWindow)
|
||||||
|
|
||||||
|
// Quit when all windows are closed.
|
||||||
|
app.on('window-all-closed', function () {
|
||||||
|
// On OS X it is common for applications and their menu bar
|
||||||
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('activate', function () {
|
||||||
|
// On OS X it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (mainWindow === null) {
|
||||||
|
createWindow()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// In this file you can include the rest of your app's specific main process
|
||||||
|
// code. You can also put them in separate files and require them here.
|
||||||
28
desktopapp/package.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "OpenWorkTime-offline",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Open Work Time, offline version. Time tracking app",
|
||||||
|
"main": "main.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron ."
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/idoctnef/openworktime"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"work",
|
||||||
|
"time",
|
||||||
|
"traking",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"author": "idoctnef",
|
||||||
|
"license": "GNU-1.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/idoctnef/openworktime/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/idoctnef/openworktime",
|
||||||
|
"devDependencies": {
|
||||||
|
"electron-prebuilt": "^1.2.0"
|
||||||
|
}
|
||||||
|
}
|
||||||