diff --git a/app/Http/Controllers/ResellerServicesController.php b/app/Http/Controllers/ResellerServicesController.php new file mode 100644 index 0000000..9874a38 --- /dev/null +++ b/app/Http/Controllers/ResellerServicesController.php @@ -0,0 +1,19 @@ +services + ->filter(function($item) use ($request) { + return $item->active || ($item->id == $request->include); + }); + } +} \ No newline at end of file diff --git a/app/Models/Service.php b/app/Models/Service.php index adc7b1c..8d86b5a 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -33,6 +33,7 @@ use App\Traits\SiteID; * + billing_interval_string : The period that this service is billed for by default as a name * + billed_to : When this service has been billed to // @todo rename all references to invoice_to * + category : The type of service this is, eg: broadband, phone + * + category_name : The type of service this is, eg: Broadband, Telephone (in human friendly) * + contract_term : The term that this service must be active * + contract_end : The date that the contract ends for this service * + name : Service short name with service address @@ -65,6 +66,27 @@ class Service extends Model implements IDs 'stop_at', ]; + protected $appends = [ + 'category_name', + 'name_short', + ]; + + protected $visible = [ + // 'account_name', + // 'admin_service_id_url', + 'active', + 'category_name', + // 'billing_price', + // 'data_orig', + 'id', + 'name_short', + // 'next_invoice', + // 'product.name', + // 'service_id', + // 'service_id_url', + // 'status', + ]; + protected $with = [ 'invoice_items', 'product.type.supplied', @@ -483,6 +505,16 @@ class Service extends Model implements IDs return number_format($this->getBillingChargeAttribute()/Arr::get(Invoice::billing_periods,$this->recur_schedule.'.interval',1),2); } + public function getCategoryAttribute(): string + { + return $this->product->category; + } + + public function getCategoryNameAttribute(): string + { + return $this->product->category_name; + } + /** * The date the contract ends * diff --git a/resources/views/theme/backend/adminlte/a/charge/addedit.blade.php b/resources/views/theme/backend/adminlte/a/charge/addedit.blade.php index e27ee37..c821319 100644 --- a/resources/views/theme/backend/adminlte/a/charge/addedit.blade.php +++ b/resources/views/theme/backend/adminlte/a/charge/addedit.blade.php @@ -284,7 +284,7 @@ success: function(data) { $("select[name=service_id]").empty(); $.each(data,function(i,j) { - var row = ''; + var row = ''; $(row).appendTo("select[name=service_id]"); }); diff --git a/resources/views/theme/backend/adminlte/a/charge/widgets/pending.blade.php b/resources/views/theme/backend/adminlte/a/charge/widgets/pending.blade.php index 1e4376c..1012499 100644 --- a/resources/views/theme/backend/adminlte/a/charge/widgets/pending.blade.php +++ b/resources/views/theme/backend/adminlte/a/charge/widgets/pending.blade.php @@ -22,8 +22,8 @@ @foreach ($x as $co)