Add contract management and invoice settings pages
- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection. - Implemented success message notifications for contract actions. - Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices. - Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings. - Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
@@ -23,26 +23,26 @@ class NotificationSettingController extends Controller
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:100',
|
||||
'channel' => 'required|in:email,telegram,whatsapp',
|
||||
'triggers' => 'nullable|array',
|
||||
'triggers.*' => 'in:upcoming_event,invoice_due,content_due',
|
||||
'notify_before_hours' => 'nullable|integer|min:1|max:720',
|
||||
'name' => 'required|string|max:100',
|
||||
'channel' => 'required|in:email,telegram,whatsapp',
|
||||
'triggers' => 'nullable|array',
|
||||
'triggers.*' => 'in:upcoming_event,invoice_due,content_due',
|
||||
'notify_before_hours' => 'nullable|integer|min:1|max:720',
|
||||
// Email
|
||||
'config.to_email' => 'required_if:channel,email|nullable|email',
|
||||
'config.to_email' => 'required_if:channel,email|nullable|email',
|
||||
// Telegram
|
||||
'config.bot_token' => 'required_if:channel,telegram|nullable|string',
|
||||
'config.chat_id' => 'required_if:channel,telegram|nullable|string',
|
||||
'config.bot_token' => 'required_if:channel,telegram|nullable|string',
|
||||
'config.chat_id' => 'nullable|string',
|
||||
// WhatsApp (WAHA)
|
||||
'config.waha_url' => 'required_if:channel,whatsapp|nullable|url',
|
||||
'config.waha_session' => 'required_if:channel,whatsapp|nullable|string',
|
||||
'config.phone' => 'required_if:channel,whatsapp|nullable|string',
|
||||
'config.waha_endpoint' => 'required_if:channel,whatsapp|nullable|url',
|
||||
'config.waha_session' => 'nullable|string',
|
||||
'config.api_key' => 'nullable|string',
|
||||
]);
|
||||
|
||||
NotificationSetting::create([
|
||||
'name' => $validated['name'],
|
||||
'channel' => $validated['channel'],
|
||||
'config' => $validated['config'] ?? [],
|
||||
'config' => $request->input('config', []), // pass raw config — not stripped by validation
|
||||
'triggers' => $validated['triggers'] ?? [],
|
||||
'notify_before_hours' => $validated['notify_before_hours'] ?? 24,
|
||||
'is_enabled' => true,
|
||||
@@ -65,7 +65,7 @@ class NotificationSettingController extends Controller
|
||||
'name' => $validated['name'],
|
||||
'triggers' => $validated['triggers'] ?? [],
|
||||
'notify_before_hours' => $validated['notify_before_hours'] ?? $setting->notify_before_hours,
|
||||
'config' => $validated['config'] ?? $setting->config,
|
||||
'config' => $request->input('config', $setting->config), // use raw input so no keys are stripped
|
||||
]);
|
||||
|
||||
return back()->with('success', '🔔 Notification updated!');
|
||||
|
||||
Reference in New Issue
Block a user