Selaa lähdekoodia

Add "Billing" to-do item to account menu

Alan Lam 1 vuosi sitten
vanhempi
commit
e6ec956734
2 muutettua tiedostoa jossa 19 lisäystä ja 6 poistoa
  1. 19 3
      controllers/account.php
  2. 0 3
      views/test_verify_form.php

+ 19 - 3
controllers/account.php

@@ -4,6 +4,7 @@ $page_title = __("Account");
 
 $customer = null;
 
+$unpaid_count = 0;
 $test_count = 0;
 $pass_count = 0;
 $pass_fail_test_count = 0;
@@ -14,6 +15,8 @@ $stage_chart = null;
 $pass_rate = null;
 $logo_path = null;
 
+$to_do = [];
+
 $user = Core::$user;
 
 if($user->isCustomer()) {
@@ -167,14 +170,28 @@ if($user->canAccessTests()) {
 	$tests = $user->getPendingTests();
 	$tests_remaining = count($tests);
 
+
+
 	$tests_url = $user->isTesterManager() ? "/account/tests?custom=overdue_test" : "/account/tests";
 
 	$tests_icon = new AccountIcon(__("Tests"), $tests_url, "clipboard-check");
 	$tests_icon->setCounter($tests_remaining);
 	$icons[] = $tests_icon;
 
-	$retests_icon = new AccountIcon(__("Retests"), "/account/tests?retest=1", "clipboard-check");
-	$icons[] = $retests_icon;
+	$icons[] = new AccountIcon(__("Retests"), "/account/tests?retest=1", "clipboard-check");
+
+	if($user->isAdmin()) {
+		$unpaid_count = Test::count([
+			"status" => Constraint::moreThan(Test::STATUS_CANCELLED),
+			"payment_required" => "1",
+			"dts_paid" => null
+		]);
+
+		$billing_icon = new AccountIcon(__("Billing"), "/account/tests?custom=payment_required_unpaid", "file-invoice");
+		$billing_icon->setCounter($unpaid_count);
+		$to_do[] = $billing_icon;
+	}
+
 }
 
 if($user->canAccessPractice()) {
@@ -220,7 +237,6 @@ if($user->canDeactivate()) {
 $actions[] = new AccountIcon(__("Delete Account..."), "/account/delete", "user-slash");
 
 // To-do
-$to_do = [];
 if($users_pending_verification) {
 	$icon = new AccountIcon(__("Verify Users"), "/account/users?level=" . User::LEVEL_UNVERIFIED, "user-check");
 	$icon->setCounter($users_pending_verification);

+ 0 - 3
views/test_verify_form.php

@@ -364,10 +364,7 @@ function render_card_list_group($details) {
 									</div>
 									<?php
 								}
-
 								?>
-
-
 							</div>
 							<?php
 						}