@php $actions = []; // View Details Action $actions[] = [ 'icon' => 'eye', 'label' => __('View Details'), 'click' => "\$emit('showModal', 'modals.project-sources.view-project-source-modal', {$row->id})", 'title' => __('View Details') ]; // Edit Action if(Gate::allows('update', \App\Models\ProjectSource::withoutGlobalScopes()->find($row->id))) { $actions[] = [ 'icon' => 'edit', 'label' => __('Edit'), 'click' => "\$emit('showModal', 'modals.project-sources.save-project-source-modal', {$row->id})", 'title' => __('Edit') ]; } // Toggle Status (Back office only) if(Auth::user()->is_bo) { $actions[] = [ 'icon' => $row->is_active ? 'cross' : 'check', 'label' => $row->is_active ? __('Deactivate') : __('Activate'), 'click' => "\$emit('confirmAction', 'toggleStatus', {$row->id}, '" . ($row->is_active ? __('Deactivate this project source?') : __('Activate this project source?')) . "')", 'title' => $row->is_active ? __('Deactivate') : __('Activate'), 'confirm' => true, 'confirm_message' => $row->is_active ? __('Deactivate this project source?') : __('Activate this project source?') ]; } // Delete Action (Only for creators or back office) if(Auth::user()->is_bo || Auth::id() === $row->created_by) { if(count($actions) > 0) { $actions[] = ['divider' => true]; } $actions[] = [ 'icon' => 'trash', 'label' => __('Delete'), 'click' => "\$emit('confirmAction', 'delete', {$row->id}, '" . __('Are you sure you want to delete this project source?') . "')", 'title' => __('Delete'), 'confirm' => true, 'confirm_message' => __('Are you sure you want to delete this project source?') ]; } @endphp