@@ -329,13 +329,25 @@ defmodule AlgoraWeb.ContractLive do
329
329
</ div >
330
330
</ div >
331
331
<%= if transaction = Enum . find ( @ transactions , fn tx -> tx . type = = :charge and tx . status = = :requires_capture end ) do %>
332
- < . button
333
- phx-click = "accept_contract "
334
- phx-disable-with = "Accepting... "
335
- phx-value-tx_id = { transaction . id }
336
- >
337
- Accept contract
338
- </ . button >
332
+ <%= if @ current_user && @ current_user . id == @ contractor . id do %>
333
+ < . button
334
+ phx-click = "accept_contract "
335
+ phx-disable-with = "Accepting... "
336
+ phx-value-tx_id = { transaction . id }
337
+ >
338
+ Accept contract
339
+ </ . button >
340
+ <% else %>
341
+ < . badge variant = "warning " class = "mb-auto " >
342
+ Offer sent
343
+ </ . badge >
344
+ <% end %>
345
+ <% end %>
346
+
347
+ <%= if _transaction = Enum . find ( @ transactions , fn tx -> tx . type = = :debit end ) do %>
348
+ < . badge variant = "success " class = "mb-auto " >
349
+ Active
350
+ </ . badge >
339
351
<% end %>
340
352
</ div >
341
353
</ . card_content >
@@ -352,7 +364,7 @@ defmodule AlgoraWeb.ContractLive do
352
364
</ div >
353
365
</ . card_content >
354
366
</ . card >
355
- < . card :if = { length ( @ transactions ) == 0 } >
367
+ < . card :if = { length ( @ transactions ) == 0 and @ can_create_bounty } >
356
368
< . card_header >
357
369
< . card_title >
358
370
Finalize offer
@@ -392,7 +404,7 @@ defmodule AlgoraWeb.ContractLive do
392
404
</ div >
393
405
</ dt >
394
406
</ div >
395
- < . button :if = { @ can_create_bounty } phx-click = "reward " >
407
+ < . button phx-click = "reward " >
396
408
Authorize
397
409
</ . button >
398
410
</ dl >
@@ -422,7 +434,10 @@ defmodule AlgoraWeb.ContractLive do
422
434
</ thead >
423
435
< tbody class = "divide-y divide-border " >
424
436
<%= for transaction <- @ transactions do %>
425
- < tr class = "hover:bg-muted/50 " >
437
+ < tr
438
+ :if = { @ can_create_bounty or transaction . status != :requires_release }
439
+ class = "hover:bg-muted/50 "
440
+ >
426
441
< td class = "whitespace-nowrap px-6 py-4 text-sm " >
427
442
< div :if = { @ timezone } >
428
443
{ Util . timestamp ( transaction . inserted_at , @ timezone ) }
0 commit comments