mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Latest Code
This commit is contained in:
@ -9,6 +9,7 @@ angular.module('biomed', ['biomed.filters', 'biomed.services', 'biomed.directive
|
||||
sales: 'Sales',
|
||||
other: 'Others'
|
||||
};
|
||||
$rootScope.dayOfYear = moment().dayOfYear();
|
||||
})
|
||||
.config(function($routeProvider, $locationProvider, $httpProvider) {
|
||||
|
||||
|
@ -18,9 +18,10 @@ biomed.TechScheduleCtrl = function($scope, $routeParams, $location, Schedule, Us
|
||||
function updateDate() {
|
||||
Schedule.index({
|
||||
tech: $routeParams.id,
|
||||
start: $scope.date.toJSON(),
|
||||
end: moment($scope.date).add('days', 7).toDate().toJSON()
|
||||
start: moment($scope.date).subtract('days', 10).toDate().toJSON(),
|
||||
end: moment($scope.date).add('days', 21).toDate().toJSON()
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
$scope.schedule = result;
|
||||
});
|
||||
}
|
||||
@ -85,6 +86,25 @@ biomed.SchedulePmsCtrl = function($scope, Clients) {
|
||||
});
|
||||
}
|
||||
|
||||
$scope.sort = {
|
||||
column: 'client.name',
|
||||
descending: false
|
||||
};
|
||||
|
||||
$scope.selectedCls = function(column) {
|
||||
return column == $scope.sort.column && 'sort-' + $scope.sort.descending;
|
||||
}
|
||||
|
||||
$scope.changeSorting = function(column) {
|
||||
var sort = $scope.sort;
|
||||
if (sort.column == column) {
|
||||
sort.descending = !sort.descending;
|
||||
} else {
|
||||
sort.column = column;
|
||||
sort.descending = false;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$watch('month', filter);
|
||||
};
|
||||
|
||||
@ -181,17 +201,60 @@ biomed.UserClockCtrl = function($scope, $routeParams, Users) {
|
||||
};
|
||||
|
||||
biomed.PostIndexCtrl = function($scope, $routeParams, Posts, LocationBinder) {
|
||||
$scope.loading = true;
|
||||
var updatePosts = function() {
|
||||
$scope.loading = true;
|
||||
|
||||
$scope.posts = Posts.index(function() {
|
||||
$scope.loading = false;
|
||||
});
|
||||
$scope.posts = Posts.index(
|
||||
{page: $scope.page},
|
||||
function() {
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.posted = 0;
|
||||
|
||||
angular.forEach($scope.posts, function(value) {
|
||||
if (value.status === "posted") {
|
||||
$scope.posted += 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectPage = function(page) {
|
||||
$scope.page = page;
|
||||
};
|
||||
|
||||
$scope.$watch('page', updatePosts);
|
||||
};
|
||||
|
||||
biomed.PostAddCtrl = function($scope, Posts, $location) {
|
||||
|
||||
$scope.tagOptions = {
|
||||
'multiple': true,
|
||||
'simple_tags': true,
|
||||
'tags': [],
|
||||
'formatNoMatches': function() { return 'Type a tag and press return to add it.'; }
|
||||
};
|
||||
|
||||
$scope.pages = [
|
||||
{ value: 'front', label: 'Front Page' },
|
||||
{ value: 'about-us', label: 'About Us' },
|
||||
{ value: 'sales', label: 'Sales' },
|
||||
{ value: 'service', label: 'Service' }
|
||||
];
|
||||
|
||||
$scope.togglePage = function(page) {
|
||||
var idx = $scope.model.pages.indexOf(page.value);
|
||||
if (idx > -1) {
|
||||
$scope.model.pages.splice(idx, 1);
|
||||
} else {
|
||||
$scope.model.pages.push(page.value);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.model = {
|
||||
gallery: []
|
||||
gallery: [],
|
||||
pages: [],
|
||||
postedOn: new Date()
|
||||
};
|
||||
|
||||
$scope.titleImageOptions = {
|
||||
@ -255,10 +318,6 @@ biomed.PostAddCtrl = function($scope, Posts, $location) {
|
||||
$scope.model.status = status;
|
||||
$scope.model.createdOn = new Date();
|
||||
|
||||
if (status === 'posted') {
|
||||
$scope.model.postedOn = new Date();
|
||||
}
|
||||
|
||||
Posts.create($scope.model, function(result) {
|
||||
$location.path("/posts/" + result._id);
|
||||
});
|
||||
@ -276,9 +335,34 @@ biomed.PostAddCtrl = function($scope, Posts, $location) {
|
||||
biomed.PostEditCtrl = function($scope, Posts, $routeParams, $location) {
|
||||
var galleryImages = {};
|
||||
|
||||
$scope.tagOptions = {
|
||||
'multiple': true,
|
||||
'simple_tags': true,
|
||||
'tags': [],
|
||||
'formatNoMatches': function() { return 'Type a tag and press return to add it.'; }
|
||||
};
|
||||
|
||||
$scope.pages = [
|
||||
{ value: 'front', label: 'Front Page' },
|
||||
{ value: 'about-us', label: 'About Us' },
|
||||
{ value: 'sales', label: 'Sales' },
|
||||
{ value: 'service', label: 'Service' }
|
||||
];
|
||||
|
||||
$scope.togglePage = function(page) {
|
||||
var idx = $scope.model.pages.indexOf(page.value);
|
||||
if (idx > -1) {
|
||||
$scope.model.pages.splice(idx, 1);
|
||||
} else {
|
||||
$scope.model.pages.push(page.value);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.model = Posts.get($routeParams, function() {
|
||||
$scope.loading = false;
|
||||
|
||||
console.log($scope.model);
|
||||
|
||||
if ($scope.model.image) {
|
||||
$scope.existingTitleImages = [$scope.model.image];
|
||||
}
|
||||
@ -287,6 +371,10 @@ biomed.PostEditCtrl = function($scope, Posts, $routeParams, $location) {
|
||||
for (var i = 0; i < $scope.model.gallery.length; i++) {
|
||||
galleryImages[$scope.model.gallery[i]] = 1;
|
||||
}
|
||||
|
||||
if (!$scope.model.postedOn) {
|
||||
$scope.model.postedOn = new Date();
|
||||
}
|
||||
});
|
||||
|
||||
$scope.titleImageOptions = {
|
||||
@ -349,11 +437,7 @@ biomed.PostEditCtrl = function($scope, Posts, $routeParams, $location) {
|
||||
$scope.model.gallery = Object.keys(galleryImages);
|
||||
$scope.model.status = status;
|
||||
|
||||
if (status === 'posted') {
|
||||
$scope.model.postedOn = new Date();
|
||||
} else {
|
||||
$scope.model.postedOn = null;
|
||||
}
|
||||
console.log($scope.model);
|
||||
|
||||
Posts.update({id: $scope.model._id}, $scope.model, function(result) {
|
||||
$location.path("/posts/");
|
||||
@ -396,7 +480,7 @@ biomed.ClientIndexCtrl = function($scope, $filter, $routeParams, Clients, Locati
|
||||
LocationBinder($scope, ['query']);
|
||||
|
||||
$scope.filter = function() {
|
||||
filteredData = $filter('filter')(allData, $scope.query);
|
||||
filteredData = $filter('orderBy')($filter('filter')(allData, $scope.query), $scope.sort.column, $scope.sort.descending);
|
||||
index = initialPageSize;
|
||||
$scope.canLoad = true;
|
||||
$scope.clients = filteredData.slice(0, initialPageSize);
|
||||
@ -407,6 +491,27 @@ biomed.ClientIndexCtrl = function($scope, $filter, $routeParams, Clients, Locati
|
||||
index += pageSize;
|
||||
$scope.canLoad = index < filteredData.length;
|
||||
}
|
||||
|
||||
$scope.sort = {
|
||||
column: 'name',
|
||||
descending: false
|
||||
};
|
||||
|
||||
$scope.selectedCls = function(column) {
|
||||
return column == $scope.sort.column && 'sort-' + $scope.sort.descending;
|
||||
}
|
||||
|
||||
$scope.changeSorting = function(column) {
|
||||
var sort = $scope.sort;
|
||||
if (sort.column == column) {
|
||||
sort.descending = !sort.descending;
|
||||
} else {
|
||||
sort.column = column;
|
||||
sort.descending = false;
|
||||
}
|
||||
|
||||
$scope.filter();
|
||||
};
|
||||
};
|
||||
|
||||
biomed.ClientAddCtrl = function($scope, Clients, $location) {
|
||||
@ -578,6 +683,10 @@ biomed.WorkorderIndexCtrl = function($scope, $filter, $routeParams, Workorders,
|
||||
|
||||
$scope.$watch('end', fetchData);
|
||||
|
||||
$scope.sort = {
|
||||
column: 'scheduling.start',
|
||||
descending: true
|
||||
};
|
||||
|
||||
$scope.addItems = function() {
|
||||
$scope.workorders = $scope.workorders.concat(filteredData.slice(index, index + pageSize));
|
||||
@ -592,6 +701,20 @@ biomed.WorkorderIndexCtrl = function($scope, $filter, $routeParams, Workorders,
|
||||
$scope.workorders = filteredData.slice(0, initialPageSize);
|
||||
};
|
||||
|
||||
$scope.selectedCls = function(column) {
|
||||
return column == $scope.sort.column && 'sort-' + $scope.sort.descending;
|
||||
}
|
||||
|
||||
$scope.changeSorting = function(column) {
|
||||
var sort = $scope.sort;
|
||||
if (sort.column == column) {
|
||||
sort.descending = !sort.descending;
|
||||
} else {
|
||||
sort.column = column;
|
||||
sort.descending = false;
|
||||
}
|
||||
};
|
||||
|
||||
function fetchData() {
|
||||
$scope.loading = true;
|
||||
|
||||
@ -657,6 +780,10 @@ biomed.WorkorderAddCtrl = function($scope, $location, Workorders, Schedule, Clie
|
||||
|
||||
$scope.$watch('group', updateUsers);
|
||||
|
||||
$scope.$watch('model.client', function() {
|
||||
$scope.currentClient = Clients.get({ id: $scope.model.client });
|
||||
});
|
||||
|
||||
Clients.index(function(result) {
|
||||
$scope.clients = result;
|
||||
});
|
||||
|
@ -89,10 +89,17 @@ angular.module('biomed.directives', [])
|
||||
|
||||
attr.$observe('value', update)();
|
||||
attr.$observe('title', function(){ update(); a.text(tab.title); })();
|
||||
attr.$observe('visible', function(){
|
||||
update();
|
||||
tab.tabElement[0].style.display = (tab.visible === "false") ? 'none' : 'block';
|
||||
})();
|
||||
|
||||
function update() {
|
||||
console.log(attr.visible);
|
||||
tab.title = attr.title;
|
||||
tab.value = attr.value || attr.title;
|
||||
tab.visible = attr.visible;
|
||||
|
||||
if (!ngModel.$setViewValue && (!ngModel.$viewValue || tab == selectedTab)) {
|
||||
// we are not part of angular
|
||||
ngModel.$viewValue = tab.value;
|
||||
@ -235,17 +242,17 @@ angular.module('biomed.directives', [])
|
||||
function setupScale() {
|
||||
x = d3.scale.linear()
|
||||
.range([0, 100])
|
||||
.domain([420, 1320])
|
||||
.domain([420, 1140])
|
||||
.clamp(true);
|
||||
}
|
||||
|
||||
setupScale();
|
||||
|
||||
var color = d3.scale.category20();
|
||||
var hourWidth = 100 / 15;
|
||||
var hourWidth = 100 / 12;
|
||||
|
||||
$scope.hourMarkers = [];
|
||||
for (var i = 7; i < 22; i++) {
|
||||
for (var i = 7; i < 19; i++) {
|
||||
$scope.hourMarkers.push({
|
||||
date: moment({ hour: i }).toDate(),
|
||||
style: {
|
||||
@ -266,13 +273,16 @@ angular.module('biomed.directives', [])
|
||||
function generateDate() {
|
||||
var range = moment($scope.date);
|
||||
var data = {};
|
||||
var current = range.format('ddd MMM Do YYYY');
|
||||
|
||||
for (var i = 0; i < 7; i++) {
|
||||
for (var i = -7; i < 22; i++) {
|
||||
var day = range.clone().add(i, 'days');
|
||||
var key = day.format('MM-DD-YYYY');
|
||||
var label = day.format('ddd MMM Do YYYY');
|
||||
|
||||
data[key] = {
|
||||
order: i,
|
||||
current: current == label,
|
||||
label: label,
|
||||
values: []
|
||||
};
|
||||
@ -345,7 +355,12 @@ angular.module('biomed.directives', [])
|
||||
})
|
||||
});
|
||||
|
||||
$scope.data = data;
|
||||
var dataArray = [];
|
||||
for (var o in data) {
|
||||
dataArray.push(data[o]);
|
||||
}
|
||||
|
||||
$scope.data = dataArray;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -374,7 +389,7 @@ angular.module('biomed.directives', [])
|
||||
rangeDate = moment($scope.date).startOf('day');
|
||||
|
||||
rangeStart = moment(rangeDate).add('hours', 7);
|
||||
rangeEnd = moment(rangeDate).add('hours', 22);
|
||||
rangeEnd = moment(rangeDate).add('hours', 19);
|
||||
|
||||
x = d3.time.scale()
|
||||
.range([0, 100])
|
||||
|
Reference in New Issue
Block a user