can relist archived listings

This commit is contained in:
Joshua Perry 2023-02-05 14:09:02 +00:00
parent d8173208da
commit 7e29e9c8b4
3 changed files with 36 additions and 4 deletions

View File

@ -38,8 +38,11 @@ class Portal {
}
public function homeSubmit() {
if ($_POST['submit'] == "List") {
//TODO: Direct to edit job date
if ($_POST['submit'] == "List") {
$this->vars['job'] = $this->jobsTable->find(['id'], ['value0' => $_POST['job_id']])[0];
return ['template' => 'job_edit.html.php',
'title' => 'Jo\'s Jobs- Update Job',
'vars' => $this->vars];
}
else {
if (isset($_POST['job_id'])) {
@ -57,6 +60,22 @@ class Portal {
}
}
public function secondHomeSubmit() {
if(isset($_POST['archived'])) {
$record = [
'id' => $_POST['jobId'],
'closingDate' => $_POST['closingDate'],
'archived' => $_POST['archived']
];
$this->jobsTable->save($record);
}
$this->vars['response'] = 'Update successful';
return ['template' => 'response.html.php',
'title' => 'Jo\'s Jobs- Success',
'vars' => $this->vars
];
}
public function categories() {
if ($_SESSION['userType'] == 'admin') {
$this->vars['table'] = 'category_table.html.php';
@ -79,7 +98,7 @@ class Portal {
public function edit() { //TODO: finish this function
if (isset($_GET['job_id'])) {
$this->vars['job'] = $this->jobsTable->find(["id"], ['value0' => $_GET['jod_id']]);
$this->vars['job'] = $this->jobsTable->find(["id"], ['value0' => $_GET['job_id']]);
}
if (isset($_GET['cat_id'])) {
$this->vars['cat'] = $this->catsTable->find(["id"], ['value0' => $_GET['cat_id']]);

View File

@ -0,0 +1,12 @@
<main class="home">
<h2>Update <?=$job->title?></h2>
<form method="post" action="/portal/secondHome">
<?php if ($job->archived == 'y') { ?>
<label>Enter new Closing Date</label>
<input type="date" name="closingDate"/>
<input type="hidden" name="archived" value="n"/>
<input type="hidden" name="jobId" value="<?=$job->id?>"/>
<?php } ?>
<input type="submit" name="submit" value="Update"/>
</form>
</main>

3
todo
View File

@ -12,7 +12,8 @@ Assignment 2:
- Allow customers to filter by location @done
- Move new framework into project @done
- Fix Adding categories @done
- Archive jobs instead of delete
- Archive jobs instead of delete @done
- Relist archived jobs with new closing date @done
- Add admin user control to admin portal
- User accounts made in admin portal
- Client user accounts