Skip to content

Commit

Permalink
All changes since last year
Browse files Browse the repository at this point in the history
  • Loading branch information
Samshal committed Feb 18, 2018
1 parent bf32ceb commit 3c65d4a
Show file tree
Hide file tree
Showing 70 changed files with 4,068 additions and 276 deletions.
23 changes: 21 additions & 2 deletions assets/angular/core/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ angular.module("EmmetBlue")
},
history: {
menu: false
},
mobile: {
swipe_dismiss: true,
styling: true
}
});
};
Expand Down Expand Up @@ -149,13 +153,19 @@ angular.module("EmmetBlue")
services.serverUpload = function(url, requestType, data={}){
var deferred = $q.defer();

return $http({
var _req = {
url: url,
method: requestType,
data: data,
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).then(function(result){
}

if (typeof $cookies.getObject(CONSTANTS.USER_COOKIE_IDENTIFIER) !== "undefined"){
_req.headers.Authorization = $cookies.getObject(CONSTANTS.USER_COOKIE_IDENTIFIER).token;
}

return $http(_req).then(function(result){
deferred.resolve(result.data.contentData);
return deferred.promise;
}, function(result){
Expand Down Expand Up @@ -281,6 +291,10 @@ angular.module("EmmetBlue")
}
}

services.newWebSocket = function(){
return new WebSocket(CONSTANTS.WEB_SOCKET_SERVER);
}

services.substringMatcher = function(strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
Expand All @@ -305,6 +319,11 @@ angular.module("EmmetBlue")
};
};

services.generateQrCode = function(content, type="label"){
var data = {type: type, content: content};
return generateQrCode(JSON.stringify(data));
}

services.globalConstants = CONSTANTS;

services.serializeParams = $httpParamSerializer;
Expand Down
6 changes: 6 additions & 0 deletions assets/angular/core/controllers/core/core-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,10 @@ angular.module("EmmetBlue")
})
}
}

var userSessionQrCodeHandler = function(){
$(".userSessionQrCodeSvg").html(utils.generateQrCode(JSON.stringify(utils.userSession.cookie()), "user"));
}

userSessionQrCodeHandler();
});
3 changes: 2 additions & 1 deletion assets/angular/core/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ angular.module('EmmetBlue', [
'ngStorage',
'ngPrint',
'angularUtils.directives.dirPagination',
'angular-toArrayFilter' //<--- LIFE SAVER! Thanks https://github.com/petebacondarwin! (in case, paradventure, probably, you ever read this code)
'angular-toArrayFilter', //<--- LIFE SAVER! Thanks https://github.com/petebacondarwin! (in case, paradventure, probably, you ever read this code)
'mwl.calendar'
])

.constant("CONSTANTS", getConstants())
Expand Down
40 changes: 37 additions & 3 deletions assets/angular/core/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ul>

<p class="navbar-text"><i class="icon-location4"></i> {{currentDepartmentName}}</p>
<p class="navbar-text"><span class="label bg-success-400">Online</span></p>
<p class="navbar-text"><span class="label bg-success-400">Local Intranet</span></p>
</div>

<div class="navbar-collapse collapse" id="navbar-mobile">
Expand All @@ -19,7 +19,13 @@
Switch Department <i class="caret"></i>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li ng-repeat="department in switchableDepartments" ng-click="switch(department.DepartmentID)"><a href="#">{{department.Name}}</a></li>
<li>
<div class="form-group" style=" padding: 0 !important; margin: 0 !important;">
<input class="form-control" type="text" placeholder="Filter departments " style="border-radius: 0;" ng-model="departmentsFilter" id="__departmentsFilter"/>
</div>
</li>
<li class="divider"></li>
<li ng-repeat="department in switchableDepartments | filter: departmentsFilter" ng-click="switch(department.DepartmentID)"><a href="#">{{department.Name}}</a></li>
</ul>
</li>

Expand All @@ -32,13 +38,41 @@
</a>

<ul class="dropdown-menu dropdown-menu-right">
<li data-toggle="modal" data-target="#userSessionQrCodeSvgModal">
<a href="#"><div style="width:100%; background-color:transparent;" class="userSessionQrCodeSvg"></div></a>
</li>
<li class="divider"></li>
<li><a href="/user/switch-department"><i class="icon-cog5"></i> Switch Department</a></li>
<!-- <li><a href="#"><i class="icon-coins"></i> Inbox</a></li> -->
<li data-toggle="modal" data-target="#userWorkScheduleModal"><a href="#"><i class="fa fa-calendar"></i> Work Schedules</a></li>

<li class="divider"></li>
<!-- <li><a href="#"><i class="icon-cog5"></i> Account settings</a></li> -->
<li><a href="#" ng-click="logout()"><i class="icon-switch2"></i> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="modal modal-fade" id="userSessionQrCodeSvgModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div style="width:98%; height: 90%; background-color:transparent;" class="userSessionQrCodeSvg"></div>
</div>
</div>
</div>
</div>
</div>

<div class="modal modal-fade" id="userWorkScheduleModal">
<div class="modal-full">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<ng-include src="'plugins/user/work-schedules.html'"></ng-include>
</div>
</div>
</div>
</div>
</div>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/angular/libraries/angular-moment.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions assets/js/jsbarcode.code128.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/js/moment.min.js

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions assets/js/qrcodegen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* QR Code generator (JavaScript)
*
* Copyright (c) Project Nayuki. (MIT License)
* https://www.nayuki.io/page/qr-code-generator-library
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* - The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* - The Software is provided "as is", without warranty of any kind, express or
* implied, including but not limited to the warranties of merchantability,
* fitness for a particular purpose and noninfringement. In no event shall the
* authors or copyright holders be liable for any claim, damages or other
* liability, whether in an action of contract, tort or otherwise, arising from,
* out of or in connection with the Software or the use or other dealings in the
* Software.
*/

"use strict";


function generateQrCode(qrContent) {
// Returns a QrCode.Ecc object based on the radio buttons in the HTML form.
function getInputErrorCorrectionLevel() {
return qrcodegen.QrCode.Ecc.LOW;
}

// Get form inputs and compute QR Code
var ecl = getInputErrorCorrectionLevel();
var text = qrContent;
var segs = qrcodegen.QrSegment.makeSegments(text);
var minVer = parseInt(1, 10);
var maxVer = parseInt(40, 10);
var mask = parseInt(-1, 10);
var boostEcc = true;
var qr = qrcodegen.QrCode.encodeSegments(segs, ecl, minVer, maxVer, mask, boostEcc);

// Draw image output
var border = parseInt(2, 10);
if (border < 0 || border > 100)
return;
var code = qr.toSvgString(border);

return code;
}
Loading

0 comments on commit 3c65d4a

Please sign in to comment.