Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to search through applicants #186

Merged
merged 9 commits into from
Oct 9, 2017
27 changes: 25 additions & 2 deletions api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Query {
# seen from the latest page retrieved, if you want the first page leave this out.
users(pagination_token: ID, n: Int!, filter: UserFilter): [User!]!
# Search through a user's name and email through regex
search_user(search: String!, use_regex: Boolean = false, offset: Int!, n: Int!, filter: UserFilter): [User!]!
search_user(search: String!, use_regex: Boolean = false, offset: Int!, n: Int!, filter: UserFilter): SearchResult!
# All possible application question branches
application_branches: [String!]!
# All possible confirmation question branches
Expand All @@ -24,6 +24,18 @@ type Query {
question_names(branch: String): [String!]
}

# A search result containing the results and associated data
type SearchResult {
# The offset passed to the search
offset: Int!
# The number of users returned by this query (limited by n)
count: Int!
# The total number of users that match this query (but not necessarily returned)
total: Int!
# The array of matching users
users: [User!]!
}

# Registration info about the user
type User {
# User ID, valid across the entire system
Expand All @@ -35,6 +47,11 @@ type User {
email: String!
# If the user's email is a verified email
email_verified: Boolean!
# Login method(s) this user uses (merged by email address)
login_methods: [String!]!

# If the user has admin privileges
admin: Boolean!

# If the user has applied to the event
applied: Boolean!
Expand Down Expand Up @@ -100,12 +117,16 @@ type Branch {
type Team {
# ID of the Team
id: ID!
# Name of the Team
name: String!
}

# Entries to various forms (application, confirmation, etc.)
type FormItem {
# Name of the question / form item
# Name (basically the ID) of the question / form item
name: String!
# Label of form item
label: String!
# Type of form item (textbox, checkbox, phone no.)
type: String!
# Value (if just one string)
Expand All @@ -128,5 +149,7 @@ type File {
path: String!
# The size of the file in bytes
size: Int!
# The formatted size of the file in human-readable units
size_formatted: String!
}

23 changes: 18 additions & 5 deletions client/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/admin.css" />
<link rel="stylesheet" href="/css/theme.css" />
<script src="/node_modules/es6-promise/dist/es6-promise.auto.min.js"></script>
<script src="/node_modules/whatwg-fetch/fetch.js"></script>
<script src="/node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
Expand Down Expand Up @@ -138,9 +137,14 @@ <h2>Users</h2>
<section id="applicants">
<h2>Applicants</h2>
<div class="center">
<a href="/api/user/all/export" class="btn">Export for check in</a>
<button id="send-acceptances">Send acceptance emails</button>
</div>
<div class="center search">
<input id="applicant-search" type="text" placeholder="Search applicants" />
<label for="applicant-search-regex">Use regex</label>
<input id="applicant-search-regex" type="checkbox" />
<button id="applicant-search-execute">Search</button>
</div>
<table>
<thead>
<th>Name</th>
Expand All @@ -150,15 +154,24 @@ <h2>Applicants</h2>
<th>
<select id="branch-filter">
<option value="*">All types</option>
{{#each branchNames}}
<option value="{{this}}">{{this}}</span>
{{/each}}
<optgroup label="Application">
{{#each settings.branches.application}}
<option value="application-{{this.name}}">{{this.name}}</option>
{{/each}}
</optgroup>
<optgroup label="Confirmation">
{{#each settings.branches.confirmation}}
<option value="confirmation-{{this.name}}">{{this.name}}</option>
{{/each}}
</optgroup>
</select>
</th>
<th>
<select id="status-filter">
<option value="no-decision">No decision</option>
<option value="accepted">Accepted</option>
<option value="not-confirmed">Not confirmed</option>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between accepted and not-confirmed? Where does not-confirmed apply to a user (since a single application branch can potentially have multiple confirmation branches)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted includes all accepted applicants regardless of whether or not they have confirmed whereas not confirmed only includes accepted applicants who have not confirmed

<option value="confirmed">Confirmed</option>
<!--<option value="rejected">Rejected</option>-->
<option value="*">All</option>
</select>
Expand Down
1 change: 0 additions & 1 deletion client/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/application.css" />
<link rel="stylesheet" href="/css/theme.css" />
<script src="/node_modules/es6-promise/dist/es6-promise.auto.min.js"></script>
<script src="/node_modules/whatwg-fetch/fetch.js"></script>
<script src="/node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<script src="/js/common.js"></script>
Expand Down
1 change: 0 additions & 1 deletion client/confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/application.css" />
<link rel="stylesheet" href="/css/theme.css" />
<script src="/node_modules/es6-promise/dist/es6-promise.auto.min.js"></script>
<script src="/node_modules/whatwg-fetch/fetch.js"></script>
<script src="/node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<script src="/js/common.js"></script>
Expand Down
10 changes: 10 additions & 0 deletions client/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ table td:last-child {
width: 50px;
text-align: center;
}
#applicants > .search > * {
padding: 10px;
}
#applicants > .search > label {
min-width: 60px;
text-align: right;
}
#applicants > .search > button {
min-width: 100px;
}
#applicants table td:last-child {
width: 140px;
}
Expand Down
Loading