archive instead of delete
This commit is contained in:
parent
dfc971f9c0
commit
d8173208da
|
|
@ -9,6 +9,7 @@ class Job {
|
|||
public $location;
|
||||
public $categoryId;
|
||||
public $clientId;
|
||||
public $archived;
|
||||
private $catsTable;
|
||||
private $appsTable;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Jobs {
|
|||
}
|
||||
|
||||
public function home() {
|
||||
$this->vars['jobs'] = $this->jobsTable->find(["closingDate"], ['value0' => date('y-m-d')], ['>'], "DESC", "closingDate");
|
||||
$this->vars['jobs'] = $this->jobsTable->find(["closingDate", 'archived'], ['value0' => date('y-m-d'), 'value1' => 'n'], ['>', '='], "DESC", "closingDate");
|
||||
return ['template' => 'home.html.php',
|
||||
'title' => 'Jo\'s Jobs- Home',
|
||||
'vars' => $this->vars
|
||||
|
|
@ -28,16 +28,17 @@ class Jobs {
|
|||
}
|
||||
else {
|
||||
if (isset($_GET['filter'])) {
|
||||
$columns = ['categoryId', "location", 'closingDate'];
|
||||
$columns = ['categoryId', "location", 'closingDate', 'archived'];
|
||||
$values = ['value0' => $cat[0]->id,
|
||||
'value1' => $_GET['filter'],
|
||||
'value2' => date('y-m-d')
|
||||
'value2' => date('y-m-d'),
|
||||
'value3' => 'n'
|
||||
];
|
||||
$comparators = ["=","=",">"];
|
||||
$comparators = ["=","=",">",'='];
|
||||
$this->vars['jobs'] = $this->jobsTable->find($columns, $values, $comparators);
|
||||
}
|
||||
else {
|
||||
$this->vars['jobs'] = $this->jobsTable->find(['categoryId', 'closingDate'], ["value0" => $cat[0]->id, "value1" => date("y-m-d")], ["=", ">"]);
|
||||
$this->vars['jobs'] = $this->jobsTable->find(['categoryId', 'closingDate', 'archived'], ["value0" => $cat[0]->id, "value1" => date("y-m-d"), 'value2' => 'n'], ["=", ">", '=']);
|
||||
|
||||
}
|
||||
$this->vars['heading'] = $cat[0]->name;
|
||||
|
|
|
|||
|
|
@ -41,9 +41,13 @@ class Portal {
|
|||
if ($_POST['submit'] == "List") {
|
||||
//TODO: Direct to edit job date
|
||||
}
|
||||
else { //TODO: Change to archive instead of delete
|
||||
else {
|
||||
if (isset($_POST['job_id'])) {
|
||||
$this->jobsTable->delete("id", $_POST['job_id']);
|
||||
$record = [
|
||||
'id' => $_POST['job_id'],
|
||||
'archived' => 'y'
|
||||
];
|
||||
$this->jobsTable->save($record);
|
||||
return $this->home();
|
||||
}
|
||||
if (isset($_POST['cat_id'])) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<th>Title</th>
|
||||
<th style="width: 15%">Salary</th>
|
||||
<th>Category</th>
|
||||
<th>Archived</th>
|
||||
<th style="width: 5%"> </th>
|
||||
<th style="width: 15%"> </th>
|
||||
<th style="width: 5%"> </th>
|
||||
|
|
@ -25,15 +26,23 @@
|
|||
<td><?=$job->title?></td>
|
||||
<td><?=$job->salary?></td>
|
||||
<td><?=$job->getCat()->name?></td>
|
||||
<td>
|
||||
<?php if ($job->archived == 'n') {
|
||||
echo 'no';
|
||||
}
|
||||
if ($job->archived == 'y') {
|
||||
echo 'yes';
|
||||
} ?>
|
||||
</td>
|
||||
<td><a style="float: right" href="portal/edit?job_id=<?=$job->id?>">Edit</a></td>
|
||||
<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?>" />
|
||||
<?php if (date('y-m-d', strtotime($job->closingDate)) > date('y-m-d')) { ?>
|
||||
<?php if ($job->archived == 'n') { ?>
|
||||
<input type="submit" name="submit" value="Archive" />
|
||||
<?php }
|
||||
else { ?>
|
||||
else if ($job->archived == 'y') { ?>
|
||||
<input type="submit" name="submit" value="List" />
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue