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:
I-Fun
2026-04-01 21:47:34 +07:00
parent d3c35ad730
commit 22f03ccca7
48 changed files with 2415 additions and 296 deletions

View File

@@ -30,26 +30,33 @@ class WahaNotifier
private function send(NotificationSetting $setting, string $text): void
{
$config = $setting->config ?? [];
$url = rtrim($config['waha_url'] ?? '', '/');
$session = $config['waha_session'] ?? 'default';
$phone = $config['phone'] ?? null;
$config = $setting->config ?? [];
$endpoint = $config['waha_endpoint'] ?? null;
$session = $config['waha_session'] ?? 'default';
$chatId = $config['chat_id'] ?? null;
$apiKey = $config['api_key'] ?? null;
if (! $url || ! $phone) {
throw new \RuntimeException('WAHA waha_url and phone are required.');
if (! $endpoint || ! $chatId) {
throw new \RuntimeException('WAHA waha_endpoint and chat_id are required.');
}
// Normalise phone: strip non-digits, ensure no leading +
$chatId = preg_replace('/[^0-9]/', '', $phone) . '@c.us';
$http = Http::timeout(15)->acceptJson()->contentType('application/json');
$response = Http::timeout(15)->post("{$url}/api/sendText", [
'session' => $session,
if ($apiKey) {
$http = $http->withHeaders(['X-Api-Key' => $apiKey]);
}
$response = $http->post($endpoint, [
'chatId' => $chatId,
'text' => $text,
'session' => $session,
]);
if (! $response->successful()) {
throw new \RuntimeException('WAHA API error: ' . $response->body());
$keyHint = $apiKey ? '(api_key set, length=' . strlen($apiKey) . ')' : '(no api_key)';
throw new \RuntimeException(
"WAHA API error {$response->status()} {$keyHint} → " . $response->body()
);
}
}
}