Giant Update

This commit is contained in:
Wian Drs
2026-07-31 13:57:11 +07:00
parent f68d967c8b
commit b0d08211ec
112 changed files with 6674 additions and 3 deletions
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
class IndexNotificationRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'search' => ['nullable', 'string', 'max:255'],
'status' => ['nullable', 'string', 'max:30'],
'unread' => ['nullable', 'boolean'],
'page' => ['nullable', 'integer', 'min:1'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class SaveNotificationPreferencesRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'preferences' => ['required', 'array'],
'preferences.*.tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
'preferences.*.notification_event_id' => ['required', 'integer', 'exists:notification_events,id'],
'preferences.*.notification_channel_id' => ['nullable', 'integer', 'exists:notification_channels,id'],
'preferences.*.channel' => ['required', Rule::in(['system', 'whatsapp_official', 'whatsapp_unofficial', 'email', 'telegram'])],
'preferences.*.enabled' => ['required', 'boolean'],
'preferences.*.priority' => ['nullable', 'integer', 'between:1,20'],
'preferences.*.send_delay_minutes' => ['nullable', 'integer', 'between:0,10080'],
'preferences.*.quiet_hours_start' => ['nullable', 'date_format:H:i'],
'preferences.*.quiet_hours_end' => ['nullable', 'date_format:H:i'],
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreCustomerContactRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'type' => ['required', Rule::in(['email', 'whatsapp', 'telegram'])],
'value' => ['required', 'string', 'max:255'],
'label' => ['nullable', 'string', 'max:100'],
'is_primary' => ['nullable', 'boolean'],
'is_verified' => ['nullable', 'boolean'],
'can_receive_transactional' => ['nullable', 'boolean'],
'can_receive_broadcast' => ['nullable', 'boolean'],
'opted_out_at' => ['nullable', 'date'],
];
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreNotificationBroadcastRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
'name' => ['required_without:preview', 'string', 'max:255'],
'channel' => ['required', Rule::in(['system', 'whatsapp_official', 'whatsapp_unofficial', 'email', 'telegram'])],
'notification_template_id' => ['nullable', 'integer', 'exists:notification_templates,id'],
'notification_channel_id' => ['nullable', 'integer', 'exists:notification_channels,id'],
'subject' => ['nullable', 'string', 'max:255'],
'body' => ['required_without:notification_template_id', 'nullable', 'string', 'max:20000'],
'scheduled_at' => ['nullable', 'date'],
'filters' => ['nullable', 'array'],
'filters.customer_status' => ['nullable', 'array'],
'filters.customer_status.*' => [Rule::in(['order', 'active', 'inactive', 'unmanaged'])],
'filters.source' => ['nullable', Rule::in(['manual', 'nas'])],
'filters.package_profile_id' => ['nullable', 'integer'],
'filters.billing_profile_id' => ['nullable', 'integer'],
'filters.topology_node_id' => ['nullable', 'integer', 'exists:topology_nodes,id'],
'filters.provinsi_id' => ['nullable', 'integer'],
'filters.kabupaten_id' => ['nullable', 'integer'],
'filters.kecamatan_id' => ['nullable', 'integer'],
'filters.desa_id' => ['nullable', 'integer'],
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreNotificationChannelRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
'channel' => ['required', Rule::in(['system', 'whatsapp_official', 'whatsapp_unofficial', 'email', 'telegram'])],
'provider' => ['nullable', 'string', 'max:50'],
'name' => ['required', 'string', 'max:255'],
'enabled' => ['nullable', 'boolean'],
'is_default' => ['nullable', 'boolean'],
'credentials' => ['nullable', 'array'],
'credentials.*' => ['nullable', 'string', 'max:4000'],
'settings' => ['nullable', 'array'],
];
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Notification;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreNotificationTemplateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
'notification_event_id' => ['required', 'integer', 'exists:notification_events,id'],
'notification_channel_id' => ['nullable', 'integer', 'exists:notification_channels,id'],
'channel' => ['required', Rule::in(['system', 'whatsapp_official', 'whatsapp_unofficial', 'email', 'telegram'])],
'name' => ['required', 'string', 'max:255'],
'subject' => ['nullable', 'string', 'max:255'],
'body' => ['required', 'string', 'max:20000'],
'provider_template_name' => ['nullable', 'string', 'max:255'],
'provider_template_id' => ['nullable', 'string', 'max:255'],
'language' => ['nullable', 'string', 'max:10'],
'approval_status' => ['nullable', Rule::in(['not_required', 'pending', 'approved', 'rejected'])],
'enabled' => ['nullable', 'boolean'],
];
}
}