From 6ef1bfbe0b8e886707d6bb0350ef995d65fd7023 Mon Sep 17 00:00:00 2001 From: Thomas LaFreniere Date: Wed, 18 Nov 2015 17:51:35 -0800 Subject: [PATCH 1/3] added terrible icons hoping someone will replace --- web/images/provider/pin.png | Bin 0 -> 619 bytes web/images/provider/rfid.png | Bin 0 -> 802 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 web/images/provider/pin.png create mode 100644 web/images/provider/rfid.png diff --git a/web/images/provider/pin.png b/web/images/provider/pin.png new file mode 100644 index 0000000000000000000000000000000000000000..8c58b23e4af9bbe36d12a90a8c83515b32852c4c GIT binary patch literal 619 zcmV-x0+juUP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0su)wK~z{r<(EB@ z!Y~YlLq|ymB}d^96dZw);SwByl4Ec*O7;!!MI$TNB(e8rX1`)5k|n*^QWCa%{t|yf z_l(FU)cC z^Wr^Wb+g$hxn3AWX<}Yj-Fw0+ufg$nWO{)Q!hYO1tKJhb4JhX!=!N z0EU%Gg09!AQpY6+lsQA#rsHrp&=bZ7=6bzm41oW9KJRuruF5+@Sb1Idcs%GqX?oB? zsIFEkn#N+Wz+bkX9>Cl(?}cTjE%Z;z5CrS0iLgg&{aE=irbk8-Vc%n|bsd}PpCty% zXd>);%nJh3-wK0e)ChA*f!|iZ-%2L3{q+lg{Hy&KD1mU2Kf`KhrL(nlqg)7rrAIqUjYg9j5-#8m#E6j1zS?B7h{Ei z3Jh9k-C=2a=j``;`iXy1Km*~^=|n$EL(-f6s9xcsfp922d?sZy7Y15*E#atTyfcmV z!gkaEX6~nFV`2Z*3g1eaMjK%p>@d23ejvN2jd0kdk!vuRBMi{U+`G_I_}^lJu$?Cv zo@&5vH=G2RAnYGdFsu~_;~khFJe6GI$u|m@`ESC{=NApsSzL_rZ$JP5002ovPDHLk FV1lny5N-ef literal 0 HcmV?d00001 diff --git a/web/images/provider/rfid.png b/web/images/provider/rfid.png new file mode 100644 index 0000000000000000000000000000000000000000..71aab5c8903699dd022b50f318f5611d41f22a74 GIT binary patch literal 802 zcmV+-1Ks?IP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0=G#-K~z{r&6h2* z>Oc@iQy`#F2n2-zMWIk=3LI4!Boc{a2M7d9K(Y*$#1fEsU+7M!(=(Gv!mE1khg$sx;bcDvo}cB3}HP{qZ|%0Sdz>{t)e zIUf!O)GE5)$1{wT7OEZJry1ksXijOz+WmgNsR1NGU&>@MF=xBq?{QSX#0eb-nYems zfD+d0HRXW8V1S=`q53fNB$vyDf2#w7gos}ZqHam>T9LpV=Y2YxSu5cQTi3axV?YN=`-JMw}@aVIw*)0 zM8rV50lq(YAjc$x&{hx^12eVz5s$i!71R;~e8lnH%+vU;+;#VQJ#OU%rKu|h=5-H3 zZ?{mnX&Q(Lvop8iu#~73G!_HzjbitJJ2@dMXd@ Date: Wed, 18 Nov 2015 17:59:32 -0800 Subject: [PATCH 2/3] fixed admin profile user edit issue #135 https://github.com/vhs/nomos/issues/135 --- web/admin/users/profile.html | 4 ++-- web/admin/users/profile.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/web/admin/users/profile.html b/web/admin/users/profile.html index e0d7219b..1604c453 100644 --- a/web/admin/users/profile.html +++ b/web/admin/users/profile.html @@ -332,7 +332,7 @@

Privileges

-
+
@@ -353,7 +353,7 @@

Privileges

-
+
diff --git a/web/admin/users/profile.js b/web/admin/users/profile.js index c3b0693c..56e5fe47 100644 --- a/web/admin/users/profile.js +++ b/web/admin/users/profile.js @@ -156,8 +156,14 @@ angular } }); + $scope.updating = true; + $scope.pendingUpdate = 1; + PrivilegeService1.PutUserPrivileges(profile.id, codes).then(function(){ $scope.privilegeDirty = false; + + $scope.checkUpdated(); + $scope.pendingUpdate -= 1; }); }; @@ -193,8 +199,14 @@ angular if (membership == null) return; + $scope.updating = true; + $scope.pendingUpdate = 1; + UserService1.UpdateMembership(profile.id, membership.id).then(function(){ $scope.membershipDirty = false; + + $scope.checkUpdated(); + $scope.pendingUpdate -= 1; }); }; @@ -230,8 +242,14 @@ angular if (status == null) return; + $scope.updating = true; + $scope.pendingUpdate = 1; + UserService1.UpdateStatus(profile.id, status.code).then(function(){ $scope.statusDirty = false; + + $scope.checkUpdated(); + $scope.pendingUpdate -= 1; }); }; From 0110ee122c27eb7e03f407ad67ed623155ae586f Mon Sep 17 00:00:00 2001 From: Thomas LaFreniere Date: Wed, 18 Nov 2015 19:20:32 -0800 Subject: [PATCH 3/3] admin profile fixes & user payment history --- app/contracts/IUserService1.php | 8 ++ app/services/PaymentService.php | 14 ++- app/services/UserService.php | 22 +++- web/admin/users/profile.html | 33 +++++- web/admin/users/profile.js | 62 ++++++----- web/providers/user.js | 6 + web/user/getinvolved/getinvolved.html | 6 +- web/user/transactions/transactions.html | 116 +++++++++++++++++++- web/user/transactions/transactions.js | 139 +++++++++++++++++++++++- web/user/user.html | 4 + 10 files changed, 364 insertions(+), 46 deletions(-) diff --git a/app/contracts/IUserService1.php b/app/contracts/IUserService1.php index d27662a8..01128524 100644 --- a/app/contracts/IUserService1.php +++ b/app/contracts/IUserService1.php @@ -141,4 +141,12 @@ public function UpdateStatus($userid, $status); * @return mixed */ public function GetStatuses(); + + /** + * @permission administrator + * @param $userid + * @param $date + * @return mixed + */ + public function UpdateExpiry($userid, $date); } \ No newline at end of file diff --git a/app/services/PaymentService.php b/app/services/PaymentService.php index ab09d489..51b1c635 100644 --- a/app/services/PaymentService.php +++ b/app/services/PaymentService.php @@ -5,7 +5,9 @@ use app\contracts\IPaymentService1; use app\domain\Payment; +use app\endpoints\web\UserService1; use app\schema\SettingsSchema; +use Aws\CloudFront\Exception\Exception; use vhs\database\Database; use vhs\domain\Filter; use vhs\security\CurrentUser; @@ -31,10 +33,16 @@ public function GetPayment($id) { } public function ListUserPayments($userid, $page, $size, $columns, $order, $filters) { - if (!(CurrentUser::getIdentity() == $userid || CurrentUser::hasAnyPermissions("administrator"))) - return null; + $userService = new UserService(); + $user = $userService->GetUser($userid); + + if (is_string($filters)) //todo total hack.. this is to support GET params for downloading payments + $filters = json_decode($filters); + + if (is_null($user)) + throw new \Exception("User not found or you do not have access"); - $userFilter = Filter::Equal("user_id", $userid); + $userFilter = Filter::_Or(Filter::Equal("user_id", $user->id), Filter::Equal("payer_email", $user->email)); if (is_null($filters) || $filters == "") $filters = $userFilter; diff --git a/app/services/UserService.php b/app/services/UserService.php index 0167d9c4..3ec997b8 100644 --- a/app/services/UserService.php +++ b/app/services/UserService.php @@ -33,10 +33,6 @@ public function GetUser($userid) { } public function UpdatePassword($userid, $password) { - if (CurrentUser::getIdentity() != $userid || CurrentUser::hasAnyPermissions("administrator") != true) { - return; - } - $user = $this->GetUser($userid); if(is_null($user)) return; @@ -295,4 +291,22 @@ public function ListUsers($page, $size, $columns, $order, $filters) { return User::page($page, $size, $columns, $order, $filters); } + + /** + * @permission administrator + * @param $userid + * @param $date + * @return mixed + */ + public function UpdateExpiry($userid, $date) + { + $user = User::find($userid); + + if (is_null($user)) + return; + + $user->mem_expire = (new DateTime($date))->format("Y-m-d H:i:s"); + + $user->save(); + } } diff --git a/web/admin/users/profile.html b/web/admin/users/profile.html index 1604c453..2225d0ed 100644 --- a/web/admin/users/profile.html +++ b/web/admin/users/profile.html @@ -8,7 +8,7 @@
- Profile + Profile - Userid {{profile.id}}
@@ -119,7 +119,7 @@
@@ -375,3 +375,32 @@

Privileges

+ \ No newline at end of file diff --git a/web/admin/users/profile.js b/web/admin/users/profile.js index 56e5fe47..ec6ff1ce 100644 --- a/web/admin/users/profile.js +++ b/web/admin/users/profile.js @@ -77,39 +77,45 @@ angular $scope.profile.username ).then(function() { - if ($scope.currentUser.hasPrivilege("full-profile")) { - $scope.pendingUpdate += 1; - UserService1.UpdateName( - $scope.currentUser.id, - $scope.profile.fname, - $scope.profile.lname - ).then(function() { $scope.pendingUpdate -= 1; }); - - $scope.pendingUpdate += 1; - UserService1.UpdateEmail( - $scope.currentUser.id, - $scope.profile.email - ).then(function() { $scope.pendingUpdate -= 1; }); - } + if ($scope.currentUser.hasPrivilege("full-profile")) { + $scope.pendingUpdate += 1; + UserService1.UpdateName( + $scope.currentUser.id, + $scope.profile.fname, + $scope.profile.lname + ).then(function() { $scope.pendingUpdate -= 1; }); $scope.pendingUpdate += 1; - UserService1.UpdateNewsletter( - $scope.profile.id, - $scope.profile.newsletter + UserService1.UpdateEmail( + $scope.currentUser.id, + $scope.profile.email ).then(function() { $scope.pendingUpdate -= 1; }); + } + + $scope.pendingUpdate += 1; + UserService1.UpdateNewsletter( + $scope.profile.id, + $scope.profile.newsletter + ).then(function() { $scope.pendingUpdate -= 1; }); - $scope.profile.keys.forEach(function(key) { - if(key.type == 'pin' && key.pin) { - $scope.pendingUpdate += 1; - $scope.PinService1.UpdatePin(key.id, key.pin).then(function() { - $scope.pendingUpdate -= 1; - }); - } - }); - - $scope.checkUpdated(); - $scope.pendingUpdate -= 1; + $scope.profile.keys.forEach(function(key) { + if(key.type == 'pin' && key.pin) { + $scope.pendingUpdate += 1; + $scope.PinService1.UpdatePin(key.id, key.pin).then(function() { + $scope.pendingUpdate -= 1; + }); + } }); + + $scope.pendingUpdate += 1; + UserService1.UpdateExpiry( + $scope.profile.id, + $scope.profile.mem_expire + ).then(function() { $scope.pendingUpdate -= 1; }); + + $scope.checkUpdated(); + $scope.pendingUpdate -= 1; + }); }; $scope.checkUpdated = function() { diff --git a/web/providers/user.js b/web/providers/user.js index 247e7cc2..b466bc9b 100644 --- a/web/providers/user.js +++ b/web/providers/user.js @@ -106,6 +106,12 @@ angular .then(function(response) { return response.data; }); + }, + UpdateExpiry: function(userid, date) { + return $http.post("/services/web/UserService1.svc/UpdateExpiry", {userid: userid, date: date}) + .then(function(response) { + return response.data; + }); } }; }]); \ No newline at end of file diff --git a/web/user/getinvolved/getinvolved.html b/web/user/getinvolved/getinvolved.html index 53c20b39..422e6e87 100644 --- a/web/user/getinvolved/getinvolved.html +++ b/web/user/getinvolved/getinvolved.html @@ -8,16 +8,16 @@

Get involved!

Great, here's how you can help

Source Code

The code for this web app (Nomos) is located on Github:

-

https://github.com/vhs/membership-manager-pro

+

https://github.com/vhs/nomos

- It is a private repo, so you will need to be added to the VHS account. Contact Jarrett, Funvill, or + It is a private repo, so you will need to be added to the VHS account. Contact Jarrett, Laftho, Funvill, or Garthomite on the forums to get access.

Development

-Check the Project GitHub wiki for instructions on how to get started. +Check the Project GitHub wiki for instructions on how to get started. Nomos testing is done with a Vagrant file that automagically sets up a test VM with the proper settings.

diff --git a/web/user/transactions/transactions.html b/web/user/transactions/transactions.html index fdcdcc3a..4e043636 100644 --- a/web/user/transactions/transactions.html +++ b/web/user/transactions/transactions.html @@ -1,6 +1,112 @@ -Transactions -
-
+
+
+

Payment History

+
+
+
+
+
+
+
-This isn't done yet! -Want to help out? Get involved! \ No newline at end of file +
+
+ +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+

Search

+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+

Quick Filters

+
+
+ + +
+
+
+
+ + +
+
+ +

No payments

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateTXN IDUserProcessorAmountStatus
DateTXN IDUserProcessorAmountStatus
{{payment.date}}{{payment.txn_id}}{{payment.payer_fname}} {{payment.payer_lname}}{{payment.payer_email}}{{payment.pp}}${{payment.rate_amount}} {{payment.currency}}CompletedPending
+ Download Current View + +
+
\ No newline at end of file diff --git a/web/user/transactions/transactions.js b/web/user/transactions/transactions.js index ad6ba56b..db610f2f 100644 --- a/web/user/transactions/transactions.js +++ b/web/user/transactions/transactions.js @@ -8,8 +8,145 @@ angular parent: "user", url: '/transactions/', templateUrl: 'user/transactions/transactions.html', - controller: ['$scope', function($scope) { + controller: ['$scope', 'PaymentService1', function($scope, PaymentService1) { + $scope.payments = []; + $scope.showPending = false; + $scope.togglePending = function(val) { + $scope.showPending = val; + $scope.refresh(); + }; + + $scope.listService = { + page: 0, + size: 10, + columns: "id,txn_id,status,payer_fname,payer_lname,payer_email,date,pp,rate_amount,currency", + order: "date desc", + search: null, + filter: null + }; + + $scope.updating = false; + $scope.pendingUpdate = 0; + + $scope.checkUpdated = function() { + if($scope.pendingUpdate <= 0) { + $scope.updated(); + } else { + $timeout($scope.checkUpdated, 10); + } + }; + + $scope.getPayments = function() { + + $scope.listService.filter = null; + var filters = []; + + if ($scope.showPending) { + filters.push({ + column: "status", + operator: "=", + value: "0" + }); + } + + if ($scope.listService.search != null && $scope.listService.search != "") { + var val = "%" + $scope.listService.search + "%"; + filters.push({ + left: { + column: "payer_email", + operator: "like", + value: val + }, + operator: "or", + right: { + left: { + column: "payer_fname", + operator: "like", + value: val + }, + operator: "or", + right: { + left: { + column: "payer_lname", + operator: "like", + value: val + }, + operator: "or", + right: { + left: { + column: "item_name", + operator: "like", + value: val + }, + operator: "or", + right: { + left: { + column: "item_number", + operator: "like", + value: val + }, + operator: "or", + right: { + column: "txn_id", + operator: "like", + value: val + } + } + } + } + } + }); + } + + var addRightmost = function(filter, val) { + if (filter.right != null) + addRightmost(filter.right, val); + filter.right = val; + }; + + for (var i = 0; i < filters.length; i++) { + if ($scope.listService.filter == null) { + if (filters.length > 1) { + $scope.listService.filter = { + left: filters[i], + operator: "and", + right: null + }; + } else { + $scope.listService.filter = filters[i]; + break; + } + } else { + if (i == filters.length - 1) { + addRightmost($scope.listService.filter, filters[i]); + } else { + addRightmost($scope.listService.filter, { + left: filters[i], + operator: "and", + right: null + }); + } + } + } + + return PaymentService1.ListUserPayments($scope.currentUser.id, $scope.listService.page, $scope.listService.size, $scope.listService.columns, $scope.listService.order, $scope.listService.filter); + }; + + $scope.updated = function() { + $scope.getPayments().then(function(data) { + $scope.payments = data; + $scope.updating = false; + $scope.pendingUpdate = 0; + }); + }; + + $scope.refresh = function() { + $scope.updating = true; + $scope.updated(); + }; + + $scope.refresh(); }] }); }]); \ No newline at end of file diff --git a/web/user/user.html b/web/user/user.html index 6a4ec38b..6a06fb3b 100644 --- a/web/user/user.html +++ b/web/user/user.html @@ -45,6 +45,10 @@ User Profile +
  • + Payment History +
  • +
  • Door Access