feat: profile_photo en contratos activos, notificaciones bilingues en reportes y foto en panel usuarios
- API contratos activos (cliente y proveedor): agrega campo profile_photo (técnico asignado o supplier, null si no tiene) - Notificaciones push bilingues en comentarios de reporte: "Nueva actividad en tu reporte" / "New activity on your report" - Moderador en web panel notifica a cliente y proveedor al comentar, con prefijo Moderador/Moderator - Panel usuarios: columna de foto de perfil entre ID y Nombre Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,9 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Report;
|
||||
use App\Models\ReportComment;
|
||||
use App\Models\FinishedContracts;
|
||||
use App\Models\Suppliers;
|
||||
use App\Models\NoHome;
|
||||
use OneSignal;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@@ -15,7 +17,7 @@ class ReportCommentController extends Controller
|
||||
public function index(Request $request, $id)
|
||||
{
|
||||
$report = Report::find($id);
|
||||
$contract = FinishedContracts::with(['user', 'suppliers.user', 'categories'])->find($report->contract_id);
|
||||
$contract = FinishedContracts::with(['user', 'suppliers.user', 'categories', 'status'])->find($report->contract_id);
|
||||
$nohome = NoHome::where('contract_id', $contract->id)->first();
|
||||
$comments = ReportComment::with('user')
|
||||
->where('report_id', $id)
|
||||
@@ -41,6 +43,31 @@ class ReportCommentController extends Controller
|
||||
$comment->comment = strip_tags($request->comment);
|
||||
$comment->save();
|
||||
|
||||
$report = Report::find($id);
|
||||
$contract = FinishedContracts::find($report->contract_id);
|
||||
$supplier = Suppliers::find($contract->supplier_id);
|
||||
|
||||
$recipients = array_filter([
|
||||
$contract->user_id,
|
||||
$supplier->user_id ?? null,
|
||||
]);
|
||||
|
||||
foreach ($recipients as $recipientId) {
|
||||
try {
|
||||
OneSignal::sendNotificationCustom([
|
||||
'include_external_user_ids' => [(string) $recipientId],
|
||||
'contents' => [
|
||||
'es' => 'Moderador: ' . $comment->comment,
|
||||
'en' => 'Moderator: ' . $comment->comment,
|
||||
],
|
||||
'headings' => [
|
||||
'es' => 'Nueva actividad en tu reporte',
|
||||
'en' => 'New activity on your report',
|
||||
],
|
||||
]);
|
||||
} catch (\Exception $e) {}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user