Skip to content

Commit

Permalink
+ No fix
Browse files Browse the repository at this point in the history
+ Code style fix
  • Loading branch information
faizanakram99 committed Jan 14, 2018
1 parent daf36b4 commit 852c33e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ Report Manager in PHP and AngularJS

A simple SPA (Single Page Application) in AngularJS with REST API (using PHP ).

This app can be used to fill in daily timesheet (work hours, tasks, etc) and mail to your manager, etc.


Requirements
-------------
- PHP, MySQL, Apache or Nginx (Install [XAMPP](https://www.apachefriends.org/download.html) to get them all)
- PHP 7+, MySQL, Apache or Nginx (Install [XAMPP](https://www.apachefriends.org/download.html) to get them all)
- [composer](https://getcomposer.org/download)

- Modern web browser like Chrome or Firefox

Instructions
----------------
- Update `config/db.yaml` with database connection parameters (like `username`, `host`, `password`, etc)
- Create a database with the same as value of `dbname` in `config/db.yml`
- Run `composer install` (database schema shall update automatically as scripts for updating schema is included in `composer.json`)
- Update `email` parameters in `config/email.yaml`
- For IE support, replace `scripts.js` with `scripts_ie.js` in `index.html`
66 changes: 66 additions & 0 deletions assets/js/scripts_ie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
'use strict';

angular.module("reportsApp", ['ngResource', 'moment-picker']).controller("mainController", function ($scope, $resource, $timeout, $window) {
$scope.report = { reportdetails: [{}] };
$scope.currentdate = moment();
$scope.refresh = true;

var Report = $resource('/web/app.php/:date', { date: '@date' });
var getReport = function getReport() {
return Report.get({ date: $scope.date }, function (report) {
return $scope.report = report;
});
};

$scope.$watch('currentdate', function (newval) {
$scope.date = moment(newval).format("YYYY-MM-DD");
$scope.dateText = moment(newval).format("MMM Do YYYY");
if ($scope.refresh) getReport();
});

$scope.toggleEmail = function () {
return !($scope.report.reportdetails && $scope.report.reportdetails.find(function (x) {
return x && !x.id;
}));
};

$scope.$watch('report.login + report.logout', function () {
return $scope.workhours = $scope.report.login + ' - ' + $scope.report.logout;
});

$scope.add = function (index) {
$scope.report.reportdetails.push({});
$scope.toggleEmail();
};

$scope.remove = function (index) {
$scope.report.reportdetails.splice(index, 1);
$scope.toggleEmail();
};

$scope.save = function () {
Report.save({ date: $scope.date }, JSON.stringify($scope.report), function (response) {
getReport();
alert(response.message);
}, function (error) {
return console.log(error);
});
};

$scope.delete = function () {
Report.delete({ date: $scope.date }, function (response) {
getReport();
alert(response.message);
}, function (error) {
return console.log(error);
});
};

$scope.email = function () {
Report.get({ date: $scope.date, email: true }, function (response) {
return alert(response.message);
}, function (error) {
return console.log(error);
});
};
});

0 comments on commit 852c33e

Please sign in to comment.