diff --git a/desktopapp/controllers.js b/desktopapp/controllers.js index 772bfce..97f4503 100644 --- a/desktopapp/controllers.js +++ b/desktopapp/controllers.js @@ -1,29 +1,60 @@ angular.module('workApp', []) .controller('workController', function( - $scope + $scope, + $interval ) { $scope.username="user"; //localStorage.clear(); + $scope.working=false; $scope.projects=[]; + $scope.currentproject={}; if(localStorage.getItem("w_l_projects")) { $scope.projects=JSON.parse(localStorage.getItem("w_l_projects")); //w_local_ } - - $scope.newproject={}; - $scope.newproject.id=$scope.projects[$scope.projects.length-1].id+1; + if($scope.projects.length>0) + { + $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.newproject.totaltime="0"; $scope.projects.push($scope.newproject); localStorage.setItem("w_l_projects", angular.toJson($scope.projects)); - $scope.newproject={}; - $scope.newproject.id=$scope.projects.length+1; + $scope.newproject={ + id: $scope.projects[$scope.projects.length-1].id+1 + }; }; $scope.removeProject = function(index){ $scope.projects.splice(index, 1); 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(){ 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); + }; +}]); diff --git a/desktopapp/img/coding/adaptive-layout.png b/desktopapp/img/coding/adaptive-layout.png new file mode 100644 index 0000000..00610e1 Binary files /dev/null and b/desktopapp/img/coding/adaptive-layout.png differ diff --git a/desktopapp/img/coding/api.png b/desktopapp/img/coding/api.png new file mode 100644 index 0000000..6aed245 Binary files /dev/null and b/desktopapp/img/coding/api.png differ diff --git a/desktopapp/img/coding/binary-code.png b/desktopapp/img/coding/binary-code.png new file mode 100644 index 0000000..fc746f7 Binary files /dev/null and b/desktopapp/img/coding/binary-code.png differ diff --git a/desktopapp/img/coding/bugs-search-1.png b/desktopapp/img/coding/bugs-search-1.png new file mode 100644 index 0000000..a5cf069 Binary files /dev/null and b/desktopapp/img/coding/bugs-search-1.png differ diff --git a/desktopapp/img/coding/bugs-search.png b/desktopapp/img/coding/bugs-search.png new file mode 100644 index 0000000..89fa435 Binary files /dev/null and b/desktopapp/img/coding/bugs-search.png differ diff --git a/desktopapp/img/coding/c-document.png b/desktopapp/img/coding/c-document.png new file mode 100644 index 0000000..9b346f3 Binary files /dev/null and b/desktopapp/img/coding/c-document.png differ diff --git a/desktopapp/img/coding/cloud-coding.png b/desktopapp/img/coding/cloud-coding.png new file mode 100644 index 0000000..fa7139e Binary files /dev/null and b/desktopapp/img/coding/cloud-coding.png differ diff --git a/desktopapp/img/coding/code-rate.png b/desktopapp/img/coding/code-rate.png new file mode 100644 index 0000000..cd4f371 Binary files /dev/null and b/desktopapp/img/coding/code-rate.png differ diff --git a/desktopapp/img/coding/command-line.png b/desktopapp/img/coding/command-line.png new file mode 100644 index 0000000..a8b47c6 Binary files /dev/null and b/desktopapp/img/coding/command-line.png differ diff --git a/desktopapp/img/coding/css-code.png b/desktopapp/img/coding/css-code.png new file mode 100644 index 0000000..2980d0a Binary files /dev/null and b/desktopapp/img/coding/css-code.png differ diff --git a/desktopapp/img/coding/css-document.png b/desktopapp/img/coding/css-document.png new file mode 100644 index 0000000..347eb20 Binary files /dev/null and b/desktopapp/img/coding/css-document.png differ diff --git a/desktopapp/img/coding/document-settings.png b/desktopapp/img/coding/document-settings.png new file mode 100644 index 0000000..34fbc70 Binary files /dev/null and b/desktopapp/img/coding/document-settings.png differ diff --git a/desktopapp/img/coding/editing-code.png b/desktopapp/img/coding/editing-code.png new file mode 100644 index 0000000..d95f028 Binary files /dev/null and b/desktopapp/img/coding/editing-code.png differ diff --git a/desktopapp/img/coding/error-404.png b/desktopapp/img/coding/error-404.png new file mode 100644 index 0000000..b0c7f6b Binary files /dev/null and b/desktopapp/img/coding/error-404.png differ diff --git a/desktopapp/img/coding/hacker.png b/desktopapp/img/coding/hacker.png new file mode 100644 index 0000000..f241735 Binary files /dev/null and b/desktopapp/img/coding/hacker.png differ diff --git a/desktopapp/img/coding/html-document.png b/desktopapp/img/coding/html-document.png new file mode 100644 index 0000000..e9aed14 Binary files /dev/null and b/desktopapp/img/coding/html-document.png differ diff --git a/desktopapp/img/coding/html.png b/desktopapp/img/coding/html.png new file mode 100644 index 0000000..0f31e0b Binary files /dev/null and b/desktopapp/img/coding/html.png differ diff --git a/desktopapp/img/coding/list.png b/desktopapp/img/coding/list.png new file mode 100644 index 0000000..aab6c3d Binary files /dev/null and b/desktopapp/img/coding/list.png differ diff --git a/desktopapp/img/coding/mobile-programming.png b/desktopapp/img/coding/mobile-programming.png new file mode 100644 index 0000000..7081e42 Binary files /dev/null and b/desktopapp/img/coding/mobile-programming.png differ diff --git a/desktopapp/img/coding/password.png b/desktopapp/img/coding/password.png new file mode 100644 index 0000000..847c349 Binary files /dev/null and b/desktopapp/img/coding/password.png differ diff --git a/desktopapp/img/coding/php-code.png b/desktopapp/img/coding/php-code.png new file mode 100644 index 0000000..9efba0e Binary files /dev/null and b/desktopapp/img/coding/php-code.png differ diff --git a/desktopapp/img/coding/php-document.png b/desktopapp/img/coding/php-document.png new file mode 100644 index 0000000..04005ca Binary files /dev/null and b/desktopapp/img/coding/php-document.png differ diff --git a/desktopapp/img/coding/program-interface.png b/desktopapp/img/coding/program-interface.png new file mode 100644 index 0000000..33810ce Binary files /dev/null and b/desktopapp/img/coding/program-interface.png differ diff --git a/desktopapp/img/coding/programming-1.png b/desktopapp/img/coding/programming-1.png new file mode 100644 index 0000000..9a57a76 Binary files /dev/null and b/desktopapp/img/coding/programming-1.png differ diff --git a/desktopapp/img/coding/programming.png b/desktopapp/img/coding/programming.png new file mode 100644 index 0000000..3b48b8c Binary files /dev/null and b/desktopapp/img/coding/programming.png differ diff --git a/desktopapp/img/coding/table.png b/desktopapp/img/coding/table.png new file mode 100644 index 0000000..3bcef97 Binary files /dev/null and b/desktopapp/img/coding/table.png differ diff --git a/desktopapp/img/coding/ui-design.png b/desktopapp/img/coding/ui-design.png new file mode 100644 index 0000000..773b087 Binary files /dev/null and b/desktopapp/img/coding/ui-design.png differ diff --git a/desktopapp/img/coding/ux-design.png b/desktopapp/img/coding/ux-design.png new file mode 100644 index 0000000..1572191 Binary files /dev/null and b/desktopapp/img/coding/ux-design.png differ diff --git a/desktopapp/img/coding/virus.png b/desktopapp/img/coding/virus.png new file mode 100644 index 0000000..3a50c90 Binary files /dev/null and b/desktopapp/img/coding/virus.png differ diff --git a/desktopapp/img/coding/web-interface.png b/desktopapp/img/coding/web-interface.png new file mode 100644 index 0000000..36daf4a Binary files /dev/null and b/desktopapp/img/coding/web-interface.png differ diff --git a/desktopapp/index.html b/desktopapp/index.html index a2dc67e..6fb1f72 100644 --- a/desktopapp/index.html +++ b/desktopapp/index.html @@ -14,8 +14,7 @@ Open Work Time - local version - - + @@ -50,48 +49,16 @@
Projects - +

{{project.totaltime | secondsToDateTime | date:'HH:mm:ss'}}

+ +
@@ -102,29 +69,27 @@
- Add new project + Add new project
-
+
- CarsharingApp Frontend -

- project github: https://github.com/idoctnef/collectivecarApp -

+ + + {{currentproject.title}} +

- project Taigan: https://github.com/idoctnef/collectivecarApp + Total time: {{currentproject.totaltime | secondsToDateTime | date:'HH:mm:ss'}}

- Total time: 10h 34min -

-

- Current strike time: 10h 34min + Current strike time: {{currentStrike | secondsToDateTime | date:'HH:mm:ss'}}

- Work! + Work! + Stop!
@@ -140,7 +105,8 @@ Insert this line above script imports Works for both browser and electron with the same code --> - + + diff --git a/desktopapp/main.js b/desktopapp/main.js new file mode 100644 index 0000000..f451662 --- /dev/null +++ b/desktopapp/main.js @@ -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. diff --git a/desktopapp/package.json b/desktopapp/package.json new file mode 100644 index 0000000..b52fa46 --- /dev/null +++ b/desktopapp/package.json @@ -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" + } +}