Latest Code

This commit is contained in:
Dobie Wollert
2015-04-06 03:28:20 -04:00
parent 966152a631
commit d3089dcd17
105 changed files with 8731 additions and 96 deletions

View File

@ -46,6 +46,10 @@
min-height: 40px;
}
.nav {
width: 100%;
}
.nav > li {
border-right: 1px solid #41bedd;
}
@ -76,3 +80,13 @@
background-color: @navbarSecondaryLinkBackgroundActive;
}
}
.day-of-year {
float: right !important;
position: relative;
color: white;
font-size: 18px;
top: 10px;
right: 10px;
}

View File

@ -288,6 +288,10 @@ header {
width: 140px;
}
.tech-current {
font-weight: bold;
}
.enteries {
margin-left: 150px;
position: relative;
@ -719,3 +723,33 @@ header {
background-position: -7px -400px;
}
}
th.sort-true::after {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #000;
content: "";
top: 12px;
left: 10px;
position: relative;
}
th.sort-false::after {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #000;
content: "";
bottom: 11px;
left: 10px;
position: relative;
}

View File

@ -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) {

View File

@ -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;
});

View File

@ -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])

View File

@ -257,7 +257,7 @@
</div>
</div>
</div>
<div class="tab-pane" title="Frequency">
<div class="tab-pane" title="Frequency" visible="{{accountHasPermission('client.frequency')}}">
<table class="table frequency">
<thead>
<tr>

View File

@ -20,10 +20,10 @@
<table class="biomed-table" infinite-scroll="addItems()" can-load="canLoad" threshold="300">
<thead>
<tr>
<th style="width: 20%"></th>
<th style="width: 48%">Client Name</th>
<th style="width: 20%">Contact</th>
<th style="width: 12%">Phone</th>
<th style="width: 20%" ng-class="selectedCls('identifier')" ng-click="changeSorting('identifier')">ID</th>
<th style="width: 48%" ng-class="selectedCls('name')" ng-click="changeSorting('name')">Client Name</th>
<th style="width: 20%" ng-class="selectedCls('contacts[0].name')" ng-click="changeSorting('contacts[0].name')">Contact</th>
<th style="width: 12%" ng-class="selectedCls('contacts[0].phone')" ng-click="changeSorting('contacts[0].phone')">Phone</th>
</tr>
</thead>
<tbody>

View File

@ -29,6 +29,32 @@
<textarea ng-model="model.details" class="input-xlarge"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">Posted On</label>
<div class="controls">
<span><input ng-model="model.postedOn" datepicker type="text" class="input-small"></span>
</div>
</div>
<div class="control-group">
<label class="control-label">Pages</label>
<div class="controls">
<label ng-repeat="page in pages">
<input
type="checkbox"
name="model.pages[]"
value="page.value"
ng-checked="model.pages.indexOf(page.value) > -1"
ng-click="togglePage(page)"
>{{page.label}}</input>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">Tags</label>
<div class="controls">
<input type="text" ui-select2="tagOptions" ng-model="model.tags" class="input-xxlarge" />
</div>
</div>
</div>
</div>
</div>
@ -42,7 +68,7 @@
<div class="dropzone" dropzone="titleImageOptions"></div>
</div>
</div>
<div class="control-group">
<div class="control-group" ng-show="model.image">
<label class="control-label">Gallery</label>
<div class="controls">
<div class="dropzone" dropzone="galleryImageOptions"></div>

View File

@ -29,6 +29,32 @@
<textarea ng-model="model.details" class="input-xlarge"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">Posted On</label>
<div class="controls">
<span><input ng-model="model.postedOn" datepicker type="text" class="input-small"></span>
</div>
</div>
<div class="control-group">
<label class="control-label">Pages</label>
<div class="controls">
<label ng-repeat="page in pages">
<input
type="checkbox"
name="model.pages[]"
value="page.value"
ng-checked="model.pages.indexOf(page.value) > -1"
ng-click="togglePage(page)"
>{{page.label}}</input>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">Tags</label>
<div class="controls">
<input type="text" ui-select2="tagOptions" ng-model="model.tags" class="input-xxlarge" />
</div>
</div>
</div>
</div>
</div>
@ -42,7 +68,7 @@
<div class="dropzone" dropzone="titleImageOptions" existing="existingTitleImages"></div>
</div>
</div>
<div class="control-group">
<div class="control-group" ng-show="model.image">
<label class="control-label">Gallery</label>
<div class="controls">
<div class="dropzone" dropzone="galleryImageOptions" existing="existingGalleryImages"></div>

View File

@ -9,20 +9,28 @@
<div class="span12">
<div class="toolbelt">
<a href="/posts/add" class="btn btn-primary">Create new Post</a>
<a ng-click="selectPage('')" class="btn">All</a>
<a ng-click="selectPage('front')" class="btn">Front Page</a>
<a ng-click="selectPage('about-us')" class="btn">About Us</a>
<a ng-click="selectPage('sales')" class="btn">Sales</a>
<a ng-click="selectPage('service')" class="btn">Service</a>
<div class="pull-right">
<span class="toolbelt-text">Total Published: {{posted}}</span>
</div>
</div>
<table class="biomed-table" infinite-scroll="addItems()" can-load="canLoad" threshold="300">
<thead>
<tr>
<th style="width: 5%">Title</th>
<th style="width: 5%">Author</th>
<th style="width: 5%">Created on</th>
<th style="width: 5%">Posted on</th>
<th style="width: 5%">Status</th>
<th style="width: 45%">Title</th>
<th style="width: 15%">Author</th>
<th style="width: 15%">Created on</th>
<th style="width: 15%">Posted on</th>
<th style="width: 10%">Status</th>
</tr>
</thead>
<tbody>
<tr ng-show="loading"><td colspan="4" class="table-loading"><i class="loader"></i></td></tr>
<tr ng-hide="loading || posts.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
<tr ng-show="loading"><td colspan="5" class="table-loading"><i class="loader"></i></td></tr>
<tr ng-hide="loading || posts.length"><td colspan="5" class="table-message">There is no information to display.</td></tr>
<tr ng-hide="loading" ng-repeat="post in posts">
<td>
<a href="/posts/{{post._id}}">

View File

@ -33,20 +33,20 @@
<table class="biomed-table" infinite-scroll="addItems()" can-load="canLoad" threshold="300">
<thead>
<tr>
<th style="width: 48%">Client Name</th>
<th style="width: 20%">Reason</th>
<th style="width: 20%">Contact</th>
<th style="width: 12%">Phone</th>
<th style="width: 48%" ng-class="selectedCls('client.name')" ng-click="changeSorting('client.name')">Client Name</th>
<th style="width: 20%" ng-class="selectedCls('reason')" ng-click="changeSorting('reason')">Reason</th>
<th style="width: 20%" ng-class="selectedCls('client.contacts[0].name')" ng-click="changeSorting('client.contacts[0].name')">Contact</th>
<th style="width: 12%" ng-class="selectedCls('client.contacts[0].phone')" ng-click="changeSorting('client.contacts[0].phone')">Phone</th>
</tr>
</thead>
<tbody>
<tr ng-show="loading"><td colspan="4" class="table-loading"><i class="loader"></i></td></tr>
<tr ng-hide="loading || pms.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
<tr ng-hide="loading" ng-repeat="pm in pms">
<tr ng-hide="loading" ng-repeat="pm in pms | orderBy : sort.column : sort.descending">
<td><a ng-href="/workorders/add?workorderType=pm&amp;clientId={{pm.client._id}}&amp;type={{pm.reason}}">{{pm.client.name}} ({{pm.client.identifier | uppercase}})</a><br>
<td>{{pm.reason}}</td>
<td>{{pm.client.contacts[0].name}}</td>
<td>{{pm.lient.contacts[0].phone}}</td>
<td>{{pm.client.contacts[0].phone}}</td>
</tr>
</tbody>
</table>

View File

@ -12,7 +12,7 @@
</div>
</div>
<div ng-repeat="(name, values) in data" class="tech">
<div class="tech-label text-right">{{values.label}}</div>
<div class="tech-label text-right" ng-class="{'tech-current': values.current}">{{values.label}}</div>
<div class="enteries">
<div ng-repeat="entry in values.values" ng-style="entry.style" class="entry" ng-click="onEntryClick({entry: entry})" title="{{entry.workorder.client.name}} ({{entry.workorder.client.identifier}}) - {{entry.workorder.client.address.city}}">{{entry.workorder.client.identifier}}</div>
</div>

View File

@ -21,7 +21,7 @@
<tr>
<th colspan="2"></th>
<th colspan="5">Groups</th>
<th colspan="6">Permissions</th>
<th colspan="7">Permissions</th>
</tr>
<tr>
<th style="width: 15%">Name</th>
@ -37,6 +37,7 @@
<th style="width: 5%">Edit</th>
<th style="width: 5%">Site</th>
<th style="width: 5%">Admin</th>
<th style="width: 5%">Frequency</th>
</tr>
</thead>
<tbody>
@ -57,6 +58,7 @@
<td class="{{ checkPerm(user, 'system.edit') }}"><a ng-click="togglePerm(user, 'system.edit')"><i ng-class="{ 'icon-ok': checkPerm(user, 'system.edit'), 'icon-remove': !checkPerm(user, 'system.edit')}"></i></a></td>
<td class="{{ checkPerm(user, 'system.site') }}"><a ng-click="togglePerm(user, 'system.site')"><i ng-class="{ 'icon-ok': checkPerm(user, 'system.site'), 'icon-remove': !checkPerm(user, 'system.site')}"></i></a></td>
<td class="{{ checkPerm(user, 'system.admin') }}"><a ng-click="togglePerm(user, 'system.admin')"><i ng-class="{ 'icon-ok': checkPerm(user, 'system.admin'), 'icon-remove': !checkPerm(user, 'system.admin')}"></i></a></td>
<td class="{{ checkPerm(user, 'client.frequency') }}"><a ng-click="togglePerm(user, 'client.frequency')"><i ng-class="{ 'icon-ok': checkPerm(user, 'client.frequency'), 'icon-remove': !checkPerm(user, 'client.frequency')}"></i></a></td>
</tr>
</tbody>
</table>

View File

@ -21,6 +21,26 @@
</select>
</div>
</div>
<div class="control-group" ng-show="currentClient.address">
<label class="control-label"></label>
<div class="controls">
<span style="font-weight: bold">{{currentClient.contacts[0].name}}</span>
<div>
{{currentClient.address.street1}}<br>
{{currentClient.address.street2}}<br ng-show="currentClient.address.street2">
{{currentClient.address.city}}, {{currentClient.address.state}}. {{currentClient.address.zip}}
</div>
{{currentClient.contacts[0].phone}}
</div>
</div>
<div class="control-group" ng-show="currentClient.notes['internal']">
<label class="control-label">Internal Notes</label>
<div class="controls">{{currentClient.notes['internal']}}</div>
</div>
<div class="control-group" ng-show="currentClient.notes['tech']">
<label class="control-label">Tech Notes</label>
<div class="controls">{{currentClient.notes['tech']}}</div>
</div>
<div class="control-group">
<label class="control-label">Additional E-Mails</label>
<div class="controls">

View File

@ -27,17 +27,17 @@
</div>
<table class="biomed-table" infinite-scroll="addItems()" can-load="canLoad" threshold="300">
<thead>
<tr>
<th style="width: 50%">Workorder</th>
<th style="width: 30%">Client</th>
<th style="width: 10%">Date</th>
<th style="width: 10%">Status</th>
</tr>
<tr>
<th style="width: 50%" ng-class="selectedCls('biomedId')" ng-click="changeSorting('biomedId')">Workorder</th>
<th style="width: 30%" ng-class="selectedCls('client.name')" ng-click="changeSorting('client.name')">Client</th>
<th style="width: 10%" ng-class="selectedCls('scheduling.start')" ng-click="changeSorting('scheduling.start')">Date</th>
<th style="width: 10%" ng-class="selectedCls('status')" ng-click="changeSorting('status')">Status</th>
</tr>
</thead>
<tbody>
<tr ng-show="loading"><td colspan="4" class="table-loading"><i class="loader"></i></td></tr>
<tr ng-hide="loading || workorders.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
<tr ng-hide="loading" ng-repeat="workorder in workorders">
<tr ng-hide="loading" ng-repeat="workorder in workorders | orderBy : sort.column : sort.descending">
<td>
<a ng-href="/workorders/{{workorder._id}}">#{{workorder.biomedId}} - {{workorder.reason}}</a><br>
<strong>Techs:</strong> {{ workorder.techs | techs }}<br>