feat(service): detach/attach service to customer with activity log

- Customer tab "delete" no longer deletes the service: it detaches the
  customer, discards the order/invoices and logs a `detached` activity
  with the previous customer and order.
- New POST customers/{uuid}/services/attach assigns an unassigned
  service (GET services?unassigned=1) to a customer, creating a pending
  order + unpaid invoice when missing, and logs `attached`.
- Detach/attach also sync module_vmware/module_hosting_accounts
  customer_id: ResolvesVm authorises by module_vmware.customer_id, so a
  detached customer could still control the VM.
- /services detach-customer (single + bulk) go through the same path.
- GET services/{id} returns the service activity logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-15 09:39:21 +07:00
co-authored by Claude Opus 5.5
parent 2ca11d42fb
commit ecd6f20a5b
6 changed files with 195 additions and 16 deletions
+1
View File
@@ -29,6 +29,7 @@ Route::prefix('customers')
Route::post('{uuid}/add-total', 'addTotal')->middleware('perm:customer.edit');
Route::get('{uuid}/services', 'getServices')->middleware('perm:customer.view');
Route::post('{uuid}/services', 'createService')->middleware('perm:customer.edit');
Route::post('{uuid}/services/attach', 'attachService')->middleware('perm:customer.edit');
Route::post('{uuid}/services/bulk-delete', 'bulkDeleteServices')->middleware(
'perm:customer.edit',
);