Added Service Reference for SUBMIT-SENT

This commit is contained in:
Deon George 2019-01-24 20:12:00 +11:00
parent 95bd89aa93
commit 8402e4fcb6
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
8 changed files with 186 additions and 4 deletions

View File

@ -49,6 +49,10 @@ class AdminHomeController extends Controller
$o->nextStatus($action); $o->nextStatus($action);
break; break;
case 'update_reference':
$o->order_info = array_merge($o->order_info ? $o->order_info : [],['order_reference'=>$request->input('notes')]);
$o->save();
// No action specified. // No action specified.
default: default:
return $this->service($o); return $this->service($o);

View File

@ -57,6 +57,7 @@ class Service extends Model
private $valid_status = [ private $valid_status = [
'ORDER-SUBMIT' => ['approve'=>'ORDER-SENT','reject'=>'ORDER-REJECTED'], 'ORDER-SUBMIT' => ['approve'=>'ORDER-SENT','reject'=>'ORDER-REJECTED'],
'ORDER-SENT' => ['update_reference'=>'ORDER-SENT'],
]; ];
public function account() public function account()
@ -175,7 +176,12 @@ class Service extends Model
$result = ''; $result = '';
foreach ($this->order_info as $k=>$v) foreach ($this->order_info as $k=>$v)
{
if (in_array($k,['order_reference']))
continue;
$result .= sprintf('%s: <b>%s</b><br>',ucfirst($k),$v); $result .= sprintf('%s: <b>%s</b><br>',ucfirst($k),$v);
}
return $result; return $result;
} }
@ -198,7 +204,7 @@ class Service extends Model
public function getServiceIdUrlAttribute() public function getServiceIdUrlAttribute()
{ {
return sprintf('<a href="/u/service/view/%s">%s</a>',$this->id,$this->service_id); return sprintf('<a href="/u/service/%s">%s</a>',$this->id,$this->service_id);
} }
public function getServiceNumberAttribute() public function getServiceNumberAttribute()
@ -208,7 +214,12 @@ class Service extends Model
public function getStatusAttribute() public function getStatusAttribute()
{ {
return $this->order_status ? $this->order_status : ( $this->active ? 'Active' : 'Inactive'); if (! $this->order_status)
return $this->active ? 'Active' : 'Inactive';
return $this->order_status=='ORDER-SENT'
? sprintf('%s: <span class="white-space: nowrap"><small><b>#%s</b></small></span>',$this->order_status,array_get($this->order_info,'order_reference','Unknown'))
: $this->order_status;
} }
public function setDateOrigAttribute($value) public function setDateOrigAttribute($value)

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@ -22,13 +22,16 @@
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="col-md-3"> <div class="col-md-3">
@switch($o->order_status) @switch($o->order_status)
@case('ORDER-SUBMIT') @case('ORDER-SUBMIT')
@include('a.widgets.service.order.submit') @include('a.widgets.service.order.submit')
@break @break
@case('ORDER-SENT')
@include('a.widgets.service.order.sent')
@break
@default @default
@include('u.widgets.service_info') @include('u.widgets.service_info')
@endswitch @endswitch
@ -47,9 +50,14 @@
<button type="submit" class="btn btn-info btn-danger" name="action" value="reject">Reject</button> <button type="submit" class="btn btn-info btn-danger" name="action" value="reject">Reject</button>
<button type="submit" class="btn btn-info btn-warning" name="action" value="approve">Approve</button> <button type="submit" class="btn btn-info btn-warning" name="action" value="approve">Approve</button>
@break; @break;
@case('ORDER-SENT')
<button type="submit" class="btn btn-info btn-danger" name="action" value="update_reference">Update</button>
@break;
@endswitch @endswitch
<button type="submit" class="btn btn-info" name="action" value="save">Save</button> {{-- <button type="submit" class="btn btn-info" name="action" value="save">Back</button> --}}
</div> </div>
</form> </form>
</div> </div>

View File

@ -0,0 +1,44 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">New Order</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-condensed" width="100%">
<tr>
<th>Account</th><td>{{ $o->account->company }}</td>
</tr>
<tr>
<th>Product</th><td>{{ $o->product->name }}</td>
</tr>
@if($o->date_last_invoice)
<tr>
<th>Last Invoice</th><td>{{ $o->date_last_invoice }}</td>
</tr>
<tr>
<th>Paid Until</th><td>{{ 'TBA' }}</td>
</tr>
<tr>
<th>Next Invoice</th><td>{{ $o->date_next_invoice }}</td>
</tr>
@endif
<tr>
<th>Order Details</th><td>{!! $o->order_info_details !!}</td>
</tr>
<tr>
<th>Reference:</th><td><input type="text" name="notes" class="" value="{{ array_get($o->order_info,'order_reference','') }}"></td>
</tr>
</table>
</div>
{{--
<div class="box-footer">
</div>
--}}
</div>

View File

@ -0,0 +1,36 @@
@extends('adminlte::layouts.app')
@section('htmlheader_title')
Service #{{ $o->id }}
@endsection
@section('contentheader_title')
Service #
@endsection
@section('contentheader_description')
{{ $o->service_id }}
@endsection
@section('main-content')
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Service Information</h3>
</div>
<div class="box-body">
<div class="col-md-3">
@switch($o->order_status)
@case('ORDER-SUBMIT')
@case('ORDER-SENT')
@include('u.widgets.service.order.sent')
@break
@default
@include('u.widgets.service.info')
@endswitch
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,44 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">New Order</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-condensed" width="100%">
<tr>
<th>Account</th><td>{{ $o->account->company }}</td>
</tr>
<tr>
<th>Product</th><td>{{ $o->product->name }}</td>
</tr>
@if($o->date_last_invoice)
<tr>
<th>Last Invoice</th><td>{{ $o->date_last_invoice }}</td>
</tr>
<tr>
<th>Paid Until</th><td>{{ 'TBA' }}</td>
</tr>
<tr>
<th>Next Invoice</th><td>{{ $o->date_next_invoice }}</td>
</tr>
@endif
<tr>
<th>Order Details</th><td>{!! $o->order_info_details !!}</td>
</tr>
<tr>
<th>Reference:</th><td>{{ array_get($o->order_info,'order_reference','') }}</td>
</tr>
</table>
</div>
{{--
<div class="box-footer">
</div>
--}}
</div>