/ resources / views / livewire / tasks / task / view.blade.php
view.blade.php
  1  <div class="flex flex-row gap-3">
  2      <div class="shrink">
  3          <x-card title="{{ __('dossiers.information') }}" headerClasses="text-sm">
  4              @if ($this->canEdit())
  5                  <x-slot name="action">
  6                      @can('update', $task)
  7                          <x-icon
  8                              onclick="Livewire.emit('openPanel', '{{ __('tasks.task.panel.title.update') }}', 'dossiers.dossier.stage.task.update', {{ $task->id }})"
  9                              name="pencil" class="w-4 h-4 text-white hover:cursor-pointer" />
 10                      @endcan
 11                  </x-slot>
 12              @endif
 13              <div class="grid grid-cols-2 gap-4">
 14                  <div class="flex flex-col">
 15                      <div class="text-xs font-medium text-gray-400">
 16                          {{ __('tasks.task.panel.form.status') }}
 17                      </div>
 18                      <x-task-status :statusId="$task->task_status_id" />
 19                  </div>
 20  
 21                  <div class="flex flex-col">
 22                      @can('update', $task)
 23                          <x-select wire:model="statusId" placeholder="{{ __('tasks.task.panel.form.placeholders.status') }}"
 24                              :options="$this->status" option-label="name" option-value="id" />
 25                      @endcan
 26                  </div>
 27  
 28                  <div class="flex flex-col">
 29                      <div class="text-xs font-medium text-gray-400">
 30                          {{ __('tasks.task.panel.form.source') }}
 31                      </div>
 32                      <div class="text-sm font-medium ">
 33                          {{ __('tasks.task.fields.source.' . $this->task->source) }}
 34                      </div>
 35                  </div>
 36  
 37                  <div class="flex flex-col">
 38                      <div class="text-xs font-medium text-gray-400">
 39                          {{ __('tasks.task.panel.form.dossier') }}</div>
 40                      <div class="text-sm font-medium text-secondary-700 @if ($this->task->stage?->dossier) hover:cursor-pointer @endif"
 41                          wire:click="redirectToDossier">
 42                          {{ $this->task->stage->dossier->code ?? __('tasks.task.panel.form.not-dossier') }}
 43                      </div>
 44                  </div>
 45  
 46                  <div class="flex flex-col">
 47                      <div class="text-xs font-medium text-gray-400">{{ __('tasks.task.panel.form.user') }}
 48                      </div>
 49                      <div class="text-sm font-medium text-secondary-700">
 50                          {{ $this->task->user->username ?? __('tasks.task.panel.form.not-user') }}
 51                      </div>
 52                  </div>
 53  
 54                  <div class="flex flex-col">
 55                      <div class="text-xs font-medium text-gray-400">{{ __('tasks.task.panel.form.role') }}</div>
 56  
 57                      <div class="text-sm font-medium text-secondary-700">
 58                          {{ $this->task->role ? __('roles.' . $this->task->role->name) : __('tasks.task.panel.form.not-role') }}
 59                      </div>
 60                  </div>
 61  
 62                  <div class="flex flex-col">
 63                      <div class="text-xs font-medium text-gray-400">
 64                          {{ __('tasks.task.panel.form.start_date') }}
 65                      </div>
 66                      <div class="text-sm font-medium ">
 67  
 68                          @if ($this->task->start_date)
 69                              <x-show-date :date="$this->task->start_date" :format="'Y-m-d'" />
 70                          @else
 71                              {{ __('tasks.task.panel.form.not-start_date') }}
 72                          @endif
 73                      </div>
 74                  </div>
 75                  <div class="flex flex-col">
 76                      <div class="text-xs font-medium text-gray-400">
 77                          {{ __('tasks.task.panel.form.end_date') }}</div>
 78                      <div class="text-sm font-medium ">
 79                          @php
 80                              $dateToShow = $this->task->is_milestone
 81                                  ? $this->task->milestone_end_date
 82                                  : $this->task->end_date;
 83                          @endphp
 84  
 85                          @if ($dateToShow)
 86                              <x-show-date :date="$dateToShow" :format="'Y-m-d'" />
 87                          @else
 88                              {{ __('tasks.task.panel.form.not-end_date') }}
 89                          @endif
 90                      </div>
 91                  </div>
 92                  <div class="flex flex-col">
 93                      <div class="text-xs font-medium text-gray-400">
 94                          {{ __('tasks.task.panel.form.expiration_date') }}</div>
 95                      <div class="text-sm font-medium ">
 96                          <x-show-date :date="$task->expiration_date" :format="'Y-m-d'" />
 97                      </div>
 98                  </div>
 99  
100                  @if ($this->task->document())
101                      <div class="flex flex-col col-span-2">
102                          <div class="text-xs font-medium text-gray-400">
103                              {{ __('tasks.task.panel.form.document') }}
104                          </div>
105                          <div class="font-medium text-secondary-700">
106                              {{ $this->task->document()->name }}
107                          </div>
108                      </div>
109                  @endif
110  
111                  {{-- @if (!$isCompleted) --}}
112                  @if ($this->task->revision?->document?->inboxfile?->id)
113                      <x-slot name="footer">
114                          <div class="flex flex-col space-y-3">
115  
116                              <div class="flex">
117                                  <x-button label="{{ __('tasks.task.panel.actions.redirect-to-inbox-file') }}"
118                                      wire:click="redirectToInboxFile" />
119                              </div>
120                          </div>
121                      </x-slot>
122                  @elseif($this->task->revision?->document?->id)
123                      <x-slot name="footer">
124                          <div class="flex flex-col space-y-3">
125                              <div class="flex">
126                                  <x-button label="{{ __('tasks.task.panel.actions.details') }}"
127                                  onclick="Livewire.emit('openPanel', '{{ __('documents.panel.title.details') }}', 'documents.document.view', {{ $this->task->revision?->document->id}})" />
128                              </div>
129                          </div>
130                      </x-slot>
131                  @endif
132              </div>
133          </x-card>
134      </div>
135  
136      @if (!$this->task->is_milestone)
137          <div class="space-y-3 grow">
138  
139              <x-card title="{{ __($task->title) }}">
140                  <p class="text-sm">{{ $task->description }}
141                  </p>
142              </x-card>
143              <x-card title="{{ __('tasks.comment.title') }}" headerClasses="text-sm">
144                  @can('can_write_tasks')
145                      @if (!$isCompleted)
146                          <x-slot name="action">
147                              <x-dropdown>
148                                  <x-slot name="trigger">
149                                      <button class="rounded-full focus:outline-none focus:ring-2 focus:ring-white">
150                                          <x-icon name="dots-vertical" class="w-4 h-4 text-white" />
151                                      </button>
152                                  </x-slot>
153                                  <x-dropdown.item
154                                      onclick="Livewire.emit('openPanel', '{{ __('tasks.comment.panel.title.create') }}', 'tasks.comment.create', {{ $this->task->id }})"
155                                      label="{{ __('tasks.comment.cards.actions.create') }}" />
156                              </x-dropdown>
157                          </x-slot>
158                      @endif
159                  @endcan
160  
161                  <div class="flex flex-col pb-4 space-y-4">
162                      @forelse($this->comments as $comment)
163                          <div class="p-4 rounded shadow bg-gray-50">
164  
165                              <div class="flex flex-col space-y-4">
166  
167                                  <div class="flex flex-row items-center justify-between">
168  
169                                      <div class="flex flex-col">
170                                          <div class="text-sm font-medium text-secondary-700">
171                                              {{ $comment->user->username }}
172                                          </div>
173                                          <div class="text-xs font-medium"> <x-show-date :date='$comment->created_at' />
174                                          </div>
175                                      </div>
176  
177                                      <div>
178                                          @if (!$isCompleted)
179                                              @if ($comment->user->id === Auth::user()->id)
180                                                  <x-dropdown>
181                                                      <x-slot name="trigger">
182                                                          <button
183                                                              class="rounded-full focus:outline-none focus:ring-2 focus:ring-white">
184                                                              <x-icon name="dots-vertical"
185                                                                  class="w-4 h-4 text-secondary-700" />
186                                                          </button>
187                                                      </x-slot>
188                                                      <x-dropdown.item
189                                                          onclick="Livewire.emit('openPanel', '{{ __('tasks.comment.panel.title.update') }}', 'tasks.comment.update', {{ $comment->id }})"
190                                                          label="{{ __('tasks.comment.cards.actions.update') }}" />
191                                                      <x-dropdown.item
192                                                          onclick="Livewire.emit('openPanel', '{{ __('tasks.comment.panel.title.remove') }}', 'tasks.comment.remove', {{ $comment->id }})"
193                                                          label="{{ __('tasks.comment.cards.actions.remove') }}" />
194                                                  </x-dropdown>
195                                              @endif
196                                          @endif
197                                      </div>
198                                  </div>
199  
200                                  <div class="text-sm">{{ $comment->comment }}</div>
201  
202                              </div>
203                          </div>
204                      @empty
205                          <div class="flex flex-col items-center justify-center py-8 text-gray-400">
206                              <x-icon name="exclamation-circle" class="w-6 h-6 " />
207                              <span class="text-sm font-semibold"> {{ __('tasks.comment.table.empty') }}</span>
208                          </div>
209                      @endforelse
210                  </div>
211  
212                  {{ $this->comments->links() }}
213              </x-card>
214          </div>
215      @endif
216  
217  </div>