feat(admin): IP pool allocation, billing exports, service attachments
- IP pool: sheet import (xlsx/csv) matched by address, bulk allocate/revoke with notification email (ip_allocated/ip_revoked), ip_pool_logs history. - Orders/invoices: Excel export on branded template (BrandedReportWriter), shared billing filters, order item service info in list responses. - Web design quote Excel export; activity log export. - Service attachments with copy-to-invoice; deployment invoice attachments. - Customer email attachments stored on disk and attached by path. - Admin password change endpoint; user.fullname backfill migration; orders.user_id backfill from logs. - Disable deploy workflow until CI/CD is set up. - Ignore stored customer email and service attachment uploads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ea5697cb81
commit
46aa138eec
@@ -13,6 +13,10 @@ class InvoiceResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'order_num' => $this->whenLoaded('order', fn() => $this->order?->order_num),
|
||||
'order_items' => $this->when(
|
||||
$this->relationLoaded('order') && $this->order?->relationLoaded('orderItems'),
|
||||
fn() => OrderItemServiceResource::collection($this->order->orderItems)->resolve(),
|
||||
),
|
||||
'customer' => $this->whenLoaded('customer', fn() => [
|
||||
'id' => $this->customer->id,
|
||||
'uuid' => $this->customer->uuid,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Api\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OrderItemServiceResource extends JsonResource
|
||||
{
|
||||
public const RELATIONS = ['product:id,name,product_type', 'service'];
|
||||
|
||||
public static function relationsFor(string $orderItemsPath): array
|
||||
{
|
||||
return array_map(fn ($relation) => "{$orderItemsPath}.{$relation}", self::RELATIONS);
|
||||
}
|
||||
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_name' => $this->server_name,
|
||||
'domain_name' => $this->domain_name,
|
||||
'product' => $this->product ? [
|
||||
'id' => $this->product->id,
|
||||
'name' => $this->product->name,
|
||||
'product_type' => $this->product->product_type,
|
||||
] : null,
|
||||
'service' => $this->service ? [
|
||||
'id' => $this->service->id,
|
||||
'vm_id' => $this->service->vm_id,
|
||||
'server_name' => $this->service->server_name,
|
||||
'type' => $this->service->type,
|
||||
'status' => $this->service->status,
|
||||
'started_at' => $this->service->started_at,
|
||||
'expires_at' => $this->service->expires_at,
|
||||
] : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,7 @@ class OrderResource extends JsonResource
|
||||
]),
|
||||
'user' => $this->whenLoaded('user', fn() => [
|
||||
'id' => $this->user->id,
|
||||
'firstname' => $this->user->firstname,
|
||||
'lastname' => $this->user->lastname,
|
||||
'fullname' => $this->user->fullname,
|
||||
'email' => $this->user->email,
|
||||
]),
|
||||
'payment' => $this->whenLoaded('payment', fn() => [
|
||||
@@ -117,34 +116,19 @@ class OrderResource extends JsonResource
|
||||
'status' => $vm->status,
|
||||
'next_due_date' => $vm->next_due_date,
|
||||
])),
|
||||
'order_items' => $this->whenLoaded('orderItems', fn() => $this->orderItems->map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'product' => $item->product ? [
|
||||
'id' => $item->product->id,
|
||||
'name' => $item->product->name,
|
||||
'product_type' => $item->product->product_type,
|
||||
] : null,
|
||||
'os' => $item->os ? [
|
||||
'id' => $item->os->id,
|
||||
'name' => $item->os->name,
|
||||
'version' => $item->os->version,
|
||||
] : null,
|
||||
'billing_cycle' => $item->billing_cycle,
|
||||
'months' => $item->months,
|
||||
'expiry_date' => $item->expiry_date,
|
||||
'quantity' => $item->quantity,
|
||||
'server_name' => $item->server_name,
|
||||
'price' => $item->price,
|
||||
'service' => $item->service ? [
|
||||
'id' => $item->service->id,
|
||||
'vm_id' => $item->service->vm_id,
|
||||
'status' => $item->service->status,
|
||||
'started_at' => $item->service->started_at,
|
||||
'expires_at' => $item->service->expires_at,
|
||||
] : null,
|
||||
];
|
||||
})),
|
||||
'order_items' => $this->whenLoaded('orderItems', fn() => $this->orderItems->map(fn($item) => [
|
||||
...OrderItemServiceResource::make($item)->resolve(),
|
||||
'os' => $item->os ? [
|
||||
'id' => $item->os->id,
|
||||
'name' => $item->os->name,
|
||||
'version' => $item->os->version,
|
||||
] : null,
|
||||
'billing_cycle' => $item->billing_cycle,
|
||||
'months' => $item->months,
|
||||
'expiry_date' => $item->expiry_date,
|
||||
'quantity' => $item->quantity,
|
||||
'price' => $item->price,
|
||||
])),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user