Merge branch '103-add-cancel-button-for-fulfilled-jo-in-view-all' into 'master'

Resolve "Add cancel button for fulfilled JO in view all"

Closes #103

See merge request jankstudio/resq!84
This commit is contained in:
Kendrick Chan 2018-04-24 15:59:05 +00:00
commit 4ac54bfe21
3 changed files with 9 additions and 1 deletions

View file

@ -153,6 +153,7 @@ class JobOrderController extends BaseController
'set_map_coordinate' => true,
'preset_vehicle' => false,
'ticket_table' => true,
'cancel_button' => true,
];
}
@ -167,12 +168,14 @@ class JobOrderController extends BaseController
$params['ftags']['set_map_coordinate'] = false;
$params['ftags']['invoice_edit'] = true;
$params['ftags']['ticket_table'] = false;
$params['ftags']['cancel_button'] = false;
break;
case 'create_vehicle':
$params['ftags']['set_map_coordinate'] = false;
$params['ftags']['invoice_edit'] = true;
$params['ftags']['preset_vehicle'] = true;
$params['ftags']['ticket_table'] = false;
$params['ftags']['cancel_button'] = false;
break;
case 'open_edit':
$params['ftags']['invoice_edit'] = true;

View file

@ -613,4 +613,9 @@ class JobOrder
{
return !$this->isClosed();
}
public function isCancelled()
{
return $this->status == JOStatus::CANCELLED;
}
}

View file

@ -779,7 +779,7 @@
{% if mode != 'update-all' %}
<button type="submit" class="btn btn-success">{{ mode == 'update-fulfillment' ? 'Fulfill' : 'Submit' }}</button>
{% endif %}
{% if mode != 'create' and mode != 'create_vehicle' and is_granted('joborder.cancel') and obj.isOpen %}
{% if ftags.set_map_coordinate and is_granted('joborder.cancel') and not obj.isCancelled %}
<a href="{{ url('jo_cancel', {'id': obj.getID}) }}" class="btn btn-danger btn-cancel-job-order">Cancel Job Order</button>
{% endif %}
{% if mode != 'create' %}