From e4c449f188e19916fdd4a2976d8781862591481b Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Mon, 11 Mar 2019 15:28:00 -0600 Subject: [PATCH] Add camper table --- langs/en/actions.json | 5 ++- langs/en/labels.json | 12 ++++-- pages.php | 8 ++-- pages/campers.php | 91 +++++++++++++++++++++++++++++++++++++++++++ pages/families.php | 91 ------------------------------------------- pages/home.php | 35 ++++++++--------- static/js/campers.js | 34 ++++++++++++++++ 7 files changed, 157 insertions(+), 119 deletions(-) create mode 100644 pages/campers.php delete mode 100644 pages/families.php create mode 100644 static/js/campers.js diff --git a/langs/en/actions.json b/langs/en/actions.json index c89d52d..51f5460 100644 --- a/langs/en/actions.json +++ b/langs/en/actions.json @@ -1,12 +1,13 @@ { - "Add Family": "Add Family", + "Add Camper": "Add Camper", "Edit": "Edit", "View": "View", "Save": "Save", "Delete": "Delete", "Cancel": "Cancel", "Edit Family": "Edit Family", - "View Families": "View Families", + "View Campers": "View Campers", + "View Volunteers": "View Volunteers", "View Payments": "View Payments", "Manual Entry": "Manual Entry", "View Expiring": "View Expiring", diff --git a/langs/en/labels.json b/langs/en/labels.json index 10648c9..3a7c6af 100644 --- a/langs/en/labels.json +++ b/langs/en/labels.json @@ -1,8 +1,15 @@ { "Name": "Name", "Actions": "Actions", - "Father": "Father", - "Mother": "Mother", + "Campers": "Campers", + "Volunteers": "Volunteers", + "Card Payments": "Card Payments", + "First": "First", + "Last": "Last", + "Parent": "Parent", + "Unit": "Unit", + "Rank": "Rank", + "Sex": "Sex", "Phone": "Phone", "Email": "Email", "Address": "Address", @@ -10,7 +17,6 @@ "State": "State", "ZIP Code": "ZIP Code", "ZIP": "ZIP", - "Photo Permission": "Photo Permission", "Yes": "Yes", "No": "No", "Newsletter": "Newsletter", diff --git a/pages.php b/pages.php index 8210e5e..be169fa 100644 --- a/pages.php +++ b/pages.php @@ -11,17 +11,17 @@ define("PAGES", [ "navbar" => true, "icon" => "fas fa-home" ], - "families" => [ - "title" => "Families", + "campers" => [ + "title" => "Campers", "navbar" => true, - "icon" => "fas fa-users", + "icon" => "fas fa-campground", "styles" => [ "static/css/datatables.min.css", "static/css/tables.css" ], "scripts" => [ "static/js/datatables.min.js", - "static/js/families.js" + "static/js/campers.js" ], ], "viewfamily" => [ diff --git a/pages/campers.php b/pages/campers.php new file mode 100644 index 0000000..71448a6 --- /dev/null +++ b/pages/campers.php @@ -0,0 +1,91 @@ + + +
+ get("Add Camper"); ?> +
+ + + + + + + + + + + + + + + + + + select( + "people", [ + "[>]campers" => [ + "camperid" => "camperid" + ] + ], [ + 'personid (id)', + 'firstname', + 'lastname', + 'address', + 'zip', + 'phone1', + 'phone2', + 'email', + 'unit', + 'shirt', + 'sex', + 'parentname', + 'rank' + ], [ + 'people.camperid[!]' => null + ]); + + foreach ($campers as $person) { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get('Actions'); ?> get('First'); ?> get('Last'); ?> get('Parent'); ?> get('Phone'); ?> get('Email'); ?> get('Unit'); ?> get('Rank'); ?> get('Sex'); ?>
+ get("View"); ?> + get("Edit"); ?> +
get('Actions'); ?> get('First'); ?> get('Last'); ?> get('Parent'); ?> get('Phone'); ?> get('Email'); ?> get('Unit'); ?> get('Rank'); ?> get('Sex'); ?>
\ No newline at end of file diff --git a/pages/families.php b/pages/families.php deleted file mode 100644 index 0e2ac51..0000000 --- a/pages/families.php +++ /dev/null @@ -1,91 +0,0 @@ -hasPermission("HACHEPORTAL_VIEW")) { - header("Location: ./app.php?msg=no_permission"); - die(); -} - -$writeaccess = $user->hasPermission("HACHEPORTAL_EDIT"); -?> - -
- - get("Add Family"); ?> - - -
get("Only showing expired or expiring memberships."); ?>   get("Remove Filter"); ?>
- -
- - - - - - - - - - - - - - - - date("Y-m-d", strtotime("+1 month"))]; - } - $families = $database->select("families", ['familyid (id)', 'familyname', 'phone', 'email', 'father_name (father)', 'mother_name (mother)', 'expires'], $where); - - foreach ($families as $f) { - ?> - - - - - - - - - - - - - - - - - - - - - - - - -
get('Actions'); ?> get('Name'); ?> get('Father'); ?> get('Mother'); ?> get('Phone'); ?> get('Email'); ?> get('Expires'); ?>
- get("View"); ?> - - get("Edit"); ?> - - ">
get('Actions'); ?> get('Name'); ?> get('Father'); ?> get('Mother'); ?> get('Phone'); ?> get('Email'); ?> get('Expires'); ?>
\ No newline at end of file diff --git a/pages/home.php b/pages/home.php index ef3b74e..a1dc72c 100644 --- a/pages/home.php +++ b/pages/home.php @@ -4,21 +4,31 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ?>
+
+
+

get("Campers") ?>

+

count('campers'); ?>

+
+ +
+
-

get("Families") ?>

-

count('families'); ?>

+

get("Volunteers") ?>

+

count('adults'); ?>

-

get("Recent Payments") ?>

-

select("payments", "amount", ["AND" => ["paid" => 1, "date[>]" => date("Y-m-d H:i:s", strtotime("-30 days"))]]); +

get("Card Payments") ?>

+

$select("payments", "amountpaid"); $total = 0.0; foreach ($amounts as $amt) { $total += $amt; @@ -30,17 +40,4 @@ get("View Payments"); ?>

- - count('families', ["expires[<]" => date("Y-m-d", strtotime("+1 month"))]); - ?> -
text-light"> -
-

get("Expiring Memberships") ?>

-

-
- -
diff --git a/static/js/campers.js b/static/js/campers.js new file mode 100644 index 0000000..c7c4807 --- /dev/null +++ b/static/js/campers.js @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +$('#campertable').DataTable({ + responsive: { + details: { + display: $.fn.dataTable.Responsive.display.modal({ + header: function (row) { + var data = row.data(); + return " " + data[2]; + } + }), + renderer: $.fn.dataTable.Responsive.renderer.tableAll({ + tableClass: 'table' + }), + type: "column" + } + }, + columnDefs: [ + { + targets: 0, + className: 'control', + orderable: false + }, + { + targets: 1, + orderable: false + } + ], + order: [ + [2, 'asc'] + ] +}); \ No newline at end of file