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

Story 2 - Edit applicants #4

Open
wants to merge 109 commits into
base: main
Choose a base branch
from
Open

Story 2 - Edit applicants #4

wants to merge 109 commits into from

Conversation

fennel3
Copy link
Contributor

@fennel3 fennel3 commented Nov 21, 2024

As an: Academy Admin

I want: To be able to edit applicants

So that: I can correct mistakes made when adding an applicant, or when an applicant changes their details

We have assigned this 8 story points.

Requirements:

Must display an ‘Edit’ button next to each applicant on the applicants page in the ‘Actions’ column

This should take you to a seperate edit page

Must be able to edit all applicant and application fields

All form fields should be pre-populated with the existing data for that applicant

If the applicant does not have a row in the applications table, do not display any of the application fields on the edit page

Should be redirected to the single applicant page for the edited applicant upon success

Must display appropriate validation messages (should be consistent with adding an applicant)

Jago971 and others added 30 commits November 18, 2024 16:06
…rm data. Points too non-existant 'EditApplicantController'
…dio buttons for binary options with prepopulated info from DB
Comment on lines +5 to 18
:root{
--white: #ffffff;
--black: #000000;
--light-grey: #dddddd;
--dark-grey: #333333;
--light-blue: #337ab7;
--red: #FF0000;
--io-pink: #FF3366;
--io-purple: #743DFB;
--io-purple-dark: #0F0028;
--io-green: #5FFFB4;

--small: 768px;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is good to see that you have added the variables, but then you don't use them 😔.

For example, you should replace every occurrence of #dddddd in this file with var(--light-grey)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

}

.btn:hover {
background-color: rgb(0, 248, 131.75);
background-color: rgb(0, 248, 131.75);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this the variable --io-green?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

.admin .links {
grid-template-columns: 1fr;
}
@media screen and (max-width: 768px) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@media screen and (max-width: 768px) {
@media screen and (max-width: var(--small)) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Comment on lines 57 to 61
public function getDate (){
$query = $this->db->prepare("SELECT `id`, `date` FROM `cohorts`;");
$query->execute();
return $query->fetchAll();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This returns multiple dates so it should be getDates or getCohortDates.

But also why don't you juse use the getAll to get a list of all of the cohorts and then access the date from those entities? That's what I meant by saying it looked like this had already been done.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've done this now :)

@@ -42,6 +43,7 @@
<td><a href="/admin/applicants/<?= $applicant->getId() ?>"><?= $applicant->getName(); ?></a></td>
<td><?php echo $applicant->getEmail(); ?></td>
<td><?php echo $applicant->getFormattedApplicationDate(); ?></td>
<td><a href="/admin/applicant/edit/<?= $applicant->getId() ?>" class="edit-button">EDIT</a></td>
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's really easy to make the button consistent with other buttons because there is already a CSS class...

Suggested change
<td><a href="/admin/applicant/edit/<?= $applicant->getId() ?>" class="edit-button">EDIT</a></td>
<td><a href="/admin/applicant/edit/<?= $applicant->getId() ?>" class="btn">EDIT</a></td>

Don't reinvent the wheel.

Comment on lines 308 to 340
.edit-button {
top: 50%;
transform: translateY(-50%);
padding: 6px;
border: 1px solid #dddddd;
border-radius: 10px;
font-size: 14px;
position: absolute;
background-color: #61fed2;
color: black;
transition: all 0.1s linear;
box-shadow: 0 0 0 0 rgb(0,0,0);
}
.edit-button:hover {
background-color: #dddddd;
}

.archive-button {
left: 50%;
transform: translateY(-50%);
padding: 6px;
border: 1px solid #dddddd;;
border-radius: 10px;
font-size: 14px;
position: absolute;
background-color: #61fed2;
color: black;
transition: all 0.1s linear;
box-shadow: 0 0 0 0 rgb(0,0,0);
}
.archive-button:hover {
background-color: #dddddd;
}
Copy link
Collaborator

@mallowmew mallowmew Nov 22, 2024

Choose a reason for hiding this comment

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

Remove these CSS classes, they're redundant / not part of this story.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Comment on lines 84 to 86
WHERE `applicant_id` = :id");
$query->execute([
'id' => $details['id'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

id usages should be applicant ID to disambiguate for later readers whether you mean the applicant ID or the application ID.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants