diff --git a/resources/lib/UnitySQL.php b/resources/lib/UnitySQL.php index 94fb45a..4d30d41 100644 --- a/resources/lib/UnitySQL.php +++ b/resources/lib/UnitySQL.php @@ -613,7 +613,9 @@ public function getGroupRequests() "requestor" => $row['requestor'], "group_type" => $row['group_type'], "group_name" => $row['group_name'], - "requested_on" => $row['requested_on'] + "requested_on" => $row['requested_on'], + "start_date" => $row['start_date'], + "end_date" => $row['end_date'] ); } diff --git a/tools/docker-dev/sql/bootstrap.sql b/tools/docker-dev/sql/bootstrap.sql index 871bac3..f448bdb 100644 --- a/tools/docker-dev/sql/bootstrap.sql +++ b/tools/docker-dev/sql/bootstrap.sql @@ -88,8 +88,8 @@ CREATE TABLE `groupRequests` ( `group_name` varchar(1000) NOT NULL, `requestor` varchar(1000) NOT NULL, `requested_on` timestamp NOT NULL DEFAULT current_timestamp(), - `start_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `end_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' + `start_date` timestamp NULL DEFAULT NULL, + `end_date` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -------------------------------------------------------- @@ -256,8 +256,8 @@ CREATE TABLE `groupAttributes` ( `id` int(11) NOT NULL, `group_type` varchar(1000) NOT NULL, `group_id` varchar(1000) NOT NULL, - `start_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `end_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' + `start_date` timestamp NULL DEFAULT NULL, + `end_date` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- diff --git a/webroot/admin/group-mgmt.php b/webroot/admin/group-mgmt.php index 04546a3..b9c01d9 100644 --- a/webroot/admin/group-mgmt.php +++ b/webroot/admin/group-mgmt.php @@ -77,6 +77,7 @@ Group Type Requestor Requestor UID + Start/End Dates Mail Requested On Actions @@ -96,6 +97,11 @@ $USER->getTypeNameFromSlug($types, $request['group_type']) . ""; echo "" . $request_user->getFirstname() . " " . $request_user->getLastname() . ""; echo "" . $request_user->getUID() . ""; + if ($request['start_date'] == null || $request['end_date'] == null) { + echo ""; + } else { + echo "" . date("jS F, Y", strtotime($request['start_date'])) . " - " . date("jS F, Y", strtotime($request['end_date'])) . ""; + } echo "" . $request_user->getMail() . ""; echo "" . date("jS F, Y", strtotime($request['requested_on'])) . ""; echo ""; diff --git a/webroot/panel/new_group.php b/webroot/panel/new_group.php index 5e99f7f..e288b45 100644 --- a/webroot/panel/new_group.php +++ b/webroot/panel/new_group.php @@ -98,7 +98,7 @@
Name (cannot have spaces)  
-
+
@@ -131,14 +131,18 @@ const time_limited = type_info[2]; let date_selector = document.getElementById('dateSelector'); if (time_limited == 1) { + $("#requestGroupButton").prop("disabled", true); date_selector.style.display = 'block'; } else if (time_limited == 0) { + $("#requestGroupButton").prop("disabled", false); date_selector.style.display = 'none'; } let nameInputBox = document.getElementById('nameInputBox'); if (isNameable == 1) { + $("#requestGroupButton").prop("disabled", true); nameInputBox.style.display = 'block'; } else if (isNameable == 0) { + $("#requestGroupButton").prop("disabled", false); nameInputBox.style.display = 'none'; } }); @@ -146,23 +150,27 @@ $("input[type=text][name=group_name]").keyup(function() { $group_name = $(this).val(); $span = $("#groupNameError"); - if ($group_name.includes(" ")) { - $span.text("Invalid name. Make sure to not have spaces."); - $span.show(); + if ($group_name.length == 0) { $("#requestGroupButton").prop("disabled", true); } else { - $span.hide(); - $.ajax({url: "/panel/ajax/check_group_name.php?group_name=" - + $(this).val(), success: function(result) { - if (result == "not available") { - $span.text("Name not available. Try something different."); - $span.show(); - } else { - $span.hide(); - $("#requestGroupButton").prop("disabled", false); - } - }}); - $("#requestGroupButton").prop("disabled", true); + if ($group_name.includes(" ")) { + $span.text("Invalid name. Make sure to not have spaces."); + $span.show(); + $("#requestGroupButton").prop("disabled", true); + } else { + $span.hide(); + $.ajax({url: "/panel/ajax/check_group_name.php?group_name=" + + $(this).val(), success: function(result) { + if (result == "not available") { + $span.text("Name not available. Try something different."); + $span.show(); + $("#requestGroupButton").prop("disabled", true); + } else { + $span.hide(); + $("#requestGroupButton").prop("disabled", false); + } + }}); + } } });