adding jobs now works
This commit is contained in:
parent
c7bd30da52
commit
48508fc429
|
|
@ -77,9 +77,32 @@ class Portal {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: add functions for adding jobs and categories
|
||||
public function addJob() {
|
||||
return ['template' => 'add.html.php',
|
||||
return ['template' => 'job_add.html.php',
|
||||
'title' => 'Jo\'s Jobs- Add Job',
|
||||
'vars' => $this->vars
|
||||
];
|
||||
}
|
||||
|
||||
public function addJobSubmit() {
|
||||
if (count($this->jobsTable->find(['title', 'clientId'], ['value0' => $_POST['title'], 'value1' => $_POST['client_id']])) == 0 && $this->catsTable->find(['name'], ['value0' => $_POST['categoryName']]) != 0) {
|
||||
$record = [
|
||||
'title' => $_POST['title'],
|
||||
'description' => $_POST['description'],
|
||||
'salary' => $_POST['salary'],
|
||||
'closingDate' => $_POST['closingDate'],
|
||||
'categoryId' => $this->catsTable->find(['name'], ['value0' => $_POST['categoryName']])[0]->id,
|
||||
'location' => $_POST['location'],
|
||||
'clientId' => $_POST['client_id']
|
||||
];
|
||||
$this->jobsTable->save($record);
|
||||
$this->vars['response'] = 'Job made successfully';
|
||||
}
|
||||
else {
|
||||
$this->vars['response'] = 'Some data was incorrect';
|
||||
}
|
||||
|
||||
return ['template' => 'response.html.php',
|
||||
'title' => 'Jo\'s Jobs- Add Job',
|
||||
'vars' => $this->vars
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
<main class="home">
|
||||
<form>
|
||||
<!-- TODO: Create form for adding a job -->
|
||||
<!-- Look in to generifying for all add types -->
|
||||
</form>
|
||||
</main>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<td><a style="float: right" href="/portal/edit?cat_id=<?=$cat->id?>">Edit</a></td>
|
||||
<td><form method="post" action="/portal/">
|
||||
<input type="hidden" name="cat_id" value="<?=$cat->id?>" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
<input type="submit" name="submit" value="Archive" />
|
||||
</form></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<main class="home">
|
||||
<form method="post" action="/portal/addJob">
|
||||
<label>Enter Job Title</label>
|
||||
<input type="text" name="title"/>
|
||||
<label>Enter Job Description</label>
|
||||
<input type="text" name="description"/>
|
||||
<label>Enter Salary</label>
|
||||
<input type="text" name="salary"/>
|
||||
<label>Enter Closing Date</label>
|
||||
<input type="date" name="closingDate"/>
|
||||
<label>Enter Category Name</label>
|
||||
<input type="text" name="categoryName"/>
|
||||
<label>Enter Location</label>
|
||||
<input type="text" name="location"/>
|
||||
<input type="hidden" name="client_id" value="<?=$_SESSION['loggedin']?>" />
|
||||
<input type="submit" name="submit" value="Create"/>
|
||||
</form>
|
||||
</main>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<td><a style="float: right" href="portal/applicants?job_id=<?=$job->id?>">View applicants (<?=count($job->getApps())?>)</a></td>
|
||||
<td><form method="post" action="portal/">
|
||||
<input type="hidden" name="job_id" value="<?=$job->id?>" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
<input type="submit" name="submit" value="Archive" />
|
||||
</form></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<label>Enter Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit"/>
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
</main>
|
||||
<p><?=nl2br($response)?></p>
|
||||
|
|
|
|||
2
todo
2
todo
|
|
@ -11,7 +11,7 @@ Assignment 2:
|
|||
- Add filter to be able to filter by cat @done
|
||||
- Allow customers to filter by location @done
|
||||
- Move new framework into project @done
|
||||
- Fix Adding categories
|
||||
- Fix Adding categories @done
|
||||
- Archive jobs instead of delete
|
||||
- Add admin user control to admin portal
|
||||
- User accounts made in admin portal
|
||||
|
|
|
|||
Loading…
Reference in New Issue