diff --git a/src/app/Http/Controllers/CytoscapeController.php b/src/app/Http/Controllers/CytoscapeController.php index 007a29d5..8e5a158f 100644 --- a/src/app/Http/Controllers/CytoscapeController.php +++ b/src/app/Http/Controllers/CytoscapeController.php @@ -26,32 +26,77 @@ public function index() $lists = Field::whereCrewId(Auth::user()->crew_id)->whereRelation('dataType','name', 'List')->get(); $lists_name = $lists->pluck('title', 'id'); $field_list = json_encode($lists->pluck('linked_list','id')); - $relations = Link::whereRelation('RefugeeFrom.crew', 'crews.id', Auth::user()->crew->id) + $refugee_to_event_relations = Link::whereRelation('RefugeeFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('EventTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $refugee_to_place_relations = Link::whereRelation('RefugeeFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('PlaceTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $refugee_to_refugee_relations = Link::whereRelation('RefugeeFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('RefugeeTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $event_to_event_relations = Link::whereRelation('EventFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('EventTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $event_to_place_relations = Link::whereRelation('EventFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('PlaceTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $event_to_refugee_relations = Link::whereRelation('EventFrom.crew', 'crews.id', Auth::user()->crew->id) ->whereRelation('RefugeeTo.crew', 'crews.id', Auth::user()->crew->id) ->get(); + $place_to_place_relations = Link::whereRelation('PlaceFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('PlaceTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $place_to_refugee_relations = Link::whereRelation('PlaceFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('RefugeeTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $place_to_event_relations = Link::whereRelation('PlaceFrom.crew', 'crews.id', Auth::user()->crew->id) + ->whereRelation('EventTo.crew', 'crews.id', Auth::user()->crew->id) + ->get(); + $relations = $refugee_to_event_relations + ->merge($refugee_to_place_relations) + ->merge($refugee_to_refugee_relations) + ->merge($event_to_event_relations) + ->merge($event_to_place_relations) + ->merge($event_to_refugee_relations) + ->merge($place_to_place_relations) + ->merge($place_to_refugee_relations) + ->merge($place_to_event_relations); //get the role field $links = array(); $nodes = array(); $refugees = array(); + $events = array(); + $places = array(); $used_relations = array(); foreach ($relations as $relation) { $node["data"] = array(); $node["data"]["id"] = $relation->getFromId(); - $node["data"]["name"] = $relation->refugeeFrom->best_descriptive_value; + $node["data"]["name"] = $relation->refugeeFrom?->best_descriptive_value + ?? $relation->eventFrom?->name + ?? $relation->placeFrom?->name + ?? "Ø"; array_push($nodes, $node); $node["data"] = array(); $node["data"]["id"] = $relation->getToId(); - $node["data"]["name"] = $relation->refugeeTo->best_descriptive_value; + $node["data"]["name"] = $relation->refugeeTo?->best_descriptive_value + ?? $relation->eventTo?->name + ?? $relation->placeTo?->name + ?? "Ø"; array_push($nodes, $node); - $refugees[$relation->getToId()] = $relation->refugeeTo->best_descriptive_value; - $refugees[$relation->getFromId()] = $relation->refugeeFrom->best_descriptive_value; + $refugees[$relation->getToId()] = $relation->refugeeTo->best_descriptive_value ?? "Ø"; + $refugees[$relation->getFromId()] = $relation->refugeeFrom->best_descriptive_value ?? "Ø"; + $events[$relation->getToId()] = $relation->eventTo->name ?? "Ø"; + $events[$relation->getFromId()] = $relation->eventFrom->name ?? "Ø"; + $places[$relation->getToId()] = $relation->placeTo->name ?? "Ø"; + $places[$relation->getFromId()] = $relation->placeFrom->name ?? "Ø"; $link["data"] = array(); $link["data"]["id"] = $relation->id; @@ -103,6 +148,6 @@ public function index() // file_put_contents("js/cytoscape/content.json",json_encode(array_merge($nodes, $links))); Storage::disk('public')->put('content.json', $cytoscape_data); - return view("cytoscape.index", compact("relations", "refugees", "lists_name", "field_list", "persons", "used_relations")); + return view("cytoscape.index", compact("relations", "refugees", "events", "places","lists_name", "field_list", "persons", "used_relations")); } } diff --git a/src/app/Http/Controllers/EventController.php b/src/app/Http/Controllers/EventController.php index 32bc9dbf..d6f04092 100644 --- a/src/app/Http/Controllers/EventController.php +++ b/src/app/Http/Controllers/EventController.php @@ -9,6 +9,8 @@ use App\Models\Language; use App\Models\ListControl; use App\Models\Translation; +use App\Models\Link; +use App\Models\Crew; use Illuminate\View\View; class EventController extends Controller diff --git a/src/app/Http/Controllers/LinkController.php b/src/app/Http/Controllers/LinkController.php index 0738a208..7ed56385 100644 --- a/src/app/Http/Controllers/LinkController.php +++ b/src/app/Http/Controllers/LinkController.php @@ -13,6 +13,8 @@ use App\Models\ListRelation; use App\Models\ListRelationType; use App\Models\Refugee; +use App\Models\Event; +use App\Models\Place; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Auth; @@ -54,7 +56,7 @@ public static function handleApiRequest(StoreLinkApiRequest $request) { $link = Link::firstOrCreate($link, ["api_log" => $log->id]); } - array_push($responseArray, $link->id); + array_push ($responseArray, $link->id); } return response(json_encode($responseArray), 201, @@ -88,14 +90,32 @@ public function update(UpdateLinkRequest $request,Link $link) { * * @return Response */ + public function index() { - $links = Link::whereRelation('RefugeeFrom.crew', - 'crews.id', - Auth::user()->crew->id)->whereRelation('RefugeeTo.crew', - 'crews.id', - Auth::user()->crew->id)->get(); - return view("links.index", - compact('links')); + + $links_refugee_to_refugee = Link::createLinks('RefugeeFrom', 'RefugeeTo'); + $links_refugee_to_event = Link::createLinks('RefugeeFrom', 'EventTo'); + $links_refugee_to_place = Link::createLinks('RefugeeFrom', 'PlaceTo'); + $links_event_to_refugee = Link::createLinks('EventFrom', 'RefugeeTo'); + $links_event_to_event = Link::createLinks('EventFrom', 'EventTo'); + $links_event_to_place = Link::createLinks('EventFrom', 'PlaceTo'); + $links_place_to_place = Link::createLinks('PlaceFrom', 'PlaceTo'); + $links_place_to_refugee = Link::createLinks('PlaceFrom', 'RefugeeTo'); + $links_place_to_event = Link::createLinks('PlaceFrom', 'EventTo'); + + + // merge all links + $links = $links_refugee_to_refugee + ->merge($links_refugee_to_event) + ->merge($links_refugee_to_place) + ->merge($links_event_to_refugee) + ->merge($links_event_to_event) + ->merge($links_event_to_place) + ->merge($links_place_to_place) + ->merge($links_place_to_refugee) + ->merge($links_place_to_event); + + return view("links.index", compact('links')); } /** @@ -172,8 +192,11 @@ public function store(StoreLinkRequest $request) { * @return Response */ public function create($origin = null, - Refugee $refugee = null) { + Refugee $refugee = null, Event $event = null, Place $place = null) { $lists["refugees"] = Refugee::getAllBestDescriptiveValues(); + $lists["events"] = Event::getAllEventsNames(); + $lists["places"] = Place::getAllPlacesNames(); + $lists["all"] = $lists["refugees"] + $lists["events"] + $lists["places"]; $lists["relations"] = array_column(ListRelation::all()->toArray(), ListControl::where('name', "ListRelation")->first()->displayed_value, @@ -181,7 +204,9 @@ public function create($origin = null, return view("links.create", compact("lists", 'origin', - 'refugee')); + 'refugee', + 'event', + 'place')); } /** diff --git a/src/app/Http/Controllers/PlaceController.php b/src/app/Http/Controllers/PlaceController.php index 35866ad7..30e98ad9 100644 --- a/src/app/Http/Controllers/PlaceController.php +++ b/src/app/Http/Controllers/PlaceController.php @@ -7,6 +7,7 @@ use App\Models\Place; use \App\Http\Livewire\Forms\Coordinates; use \App\Http\Livewire\Forms\Area; +use App\Models\ApiLog; class PlaceController extends Controller { @@ -37,7 +38,9 @@ public function create() public function store(StorePlaceRequest $request) { + $log = ApiLog::createFromRequest($request, 'Place'); $place = $request->validated(); + $place['api_log'] = $log->id; $place['coordinates'] = Coordinates::encode($place['coordinates']); $place['area'] = Area::encode($place['area']); $place = Place::create($place); diff --git a/src/app/Models/Event.php b/src/app/Models/Event.php index 66b01d0c..ae50307c 100644 --- a/src/app/Models/Event.php +++ b/src/app/Models/Event.php @@ -61,4 +61,43 @@ public function persons() } return $persons_in_event; } + + public static function getAllEventsNames(){ + $events = Event::all(); + $events_name = []; + foreach ($events as $event){ + $events_name[$event->id] = $event->name; + } + return $events_name; + } + public function crew() { + return $this->hasOneThrough(Crew::class, + ApiLog::class, + "id", "id", + "api_log", + "crew_id"); + } + public function user() { + return $this->hasOneThrough(User::class, + ApiLog::class, + "id", "id", + "api_log", + "user_id"); + } + public function getRelationsAttribute() { + return [ + $this->fromRelation, + $this->toRelation, + ]; + } + public function toRelation() { + return $this->belongsToMany(ListRelation::class, + "links", "to", + "relation_id")->using(Link::class)->wherePivotNull("deleted_at")->withPivot("from")->withPivot("id"); + } + public function fromRelation() { + return $this->belongsToMany(ListRelation::class, + "links", "from", + "relation_id")->using(Link::class)->wherePivotNull("deleted_at")->withPivot("to")->withPivot("id"); + } } diff --git a/src/app/Models/Link.php b/src/app/Models/Link.php index 4e4ed4c0..4e7dad53 100644 --- a/src/app/Models/Link.php +++ b/src/app/Models/Link.php @@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Support\Facades\Auth; class Link extends Pivot @@ -59,16 +60,17 @@ class Link extends Pivot protected $encryptable = [ ]; - public static function handleApiRequest($relation) { + public static function handleApiRequest($relation) + { //update or create relation $link = Link::updateOrCreate( [ "from" => $relation["from"], - "to" => $relation["to"], + "to" => $relation["to"], "relation_id" => $relation["relation_id"], - "application_id"=>$relation["application_id"] + "application_id" => $relation["application_id"] ], [ "date" => request("date"), @@ -92,8 +94,9 @@ public static function handleApiRequest($relation) { } public static function relationExists($from, - $to, $relation_type, - $application_id) { + $to, $relation_type, + $application_id) + { $potential_link = self::where("application_id", $application_id)->where("from", $from)->where("to", @@ -108,28 +111,84 @@ public static function relationExists($from, * * @return mixed */ - public function getBestDescriptiveValueAttribute() { - return $this->refugeeFrom->bestDescriptiveValue." <-> ".$this->refugeeTo->bestDescriptiveValue; + public function getBestDescriptiveValueAttribute() + { + $fromValue = $this->refugeeFrom->bestDescriptiveValue + ?? $this->placeFrom->name + ?? $this->eventFrom->name + ?? null; + $toValue = $this->refugeeTo->bestDescriptiveValue + ?? $this->placeTo->name + ?? $this->eventTo->name + ?? null; + + if ($fromValue !== null && $toValue !== null) { + return "{$fromValue} <-> {$toValue}"; + } } - public function refugeeFrom() { + public + function refugeeFrom() + { return $this->belongsTo(Refugee::class, "from"); } - public function refugeeTo() { + public + function refugeeTo() + { return $this->belongsTo(Refugee::class, "to"); } + public + function eventFrom() + { + return $this->belongsTo(Event::class, + "from"); + } + + public + function eventTo() + { + return $this->belongsTo(Event::class, + "to"); + } + + public + function placeFrom() + { + return $this->belongsTo(Place::class, + "from"); + } + + public + function placeTo() + { + return $this->belongsTo(Place::class, + "to"); + } + + public + static function createLinks($relationFrom, $relationTo) + { + return self::whereRelation("$relationFrom.crew", 'crews.id', Auth::user()->crew->id) + ->whereRelation("$relationTo.crew", 'crews.id', Auth::user()->crew->id) + ->get(); + } + /** * @return BelongsTo */ - public function relation() { + public + function relation() + { return $this->belongsTo(ListRelation::class); } - public function crew() { + public + function crew() + { return $this->hasOneThrough(Crew::class, ApiLog::class, "id", "id", @@ -137,13 +196,13 @@ public function crew() { "crew_id"); } - - /** * Get from Id * @return mixed */ - public function getFromId() { + public + function getFromId() + { return $this->attributes["from"]; } @@ -151,11 +210,15 @@ public function getFromId() { * Get to Id * @return mixed */ - public function getToId() { + public + function getToId() + { return $this->attributes["to"]; } - public function getRelationWeight() { + public + function getRelationWeight() + { return ListRelation::find($this->getRelationId())->importance; } @@ -166,7 +229,9 @@ public function getRelationWeight() { * @param $relation * @return mixed */ - public function getRelationId() { + public + function getRelationId() + { return $this->attributes["relation"]; } @@ -174,13 +239,15 @@ public function getRelationId() { * Store the relation id accorting its key or its code * @param $value */ -/* - public function setRelationAttribute($value) { - $this->attributes["relation"] = ListRelation::getIdFromValue($value); - }*/ + /* + public function setRelationAttribute($value) { + $this->attributes["relation"] = ListRelation::getIdFromValue($value); + }*/ - public function getDateAttribute() { + public + function getDateAttribute() + { return Carbon::parse($this->attributes['date']); } - + } diff --git a/src/app/Models/Place.php b/src/app/Models/Place.php index bff174ba..aa2a2089 100644 --- a/src/app/Models/Place.php +++ b/src/app/Models/Place.php @@ -37,7 +37,7 @@ class Place extends Model * * @var array */ - protected $fillable = ['name', 'coordinates', 'description', 'area']; + protected $fillable = ['name', 'coordinates', 'description', 'area', 'api_log']; /** * The attributes that should be mutated to dates. @@ -45,4 +45,36 @@ class Place extends Model * @var array */ protected $dates = ['deleted_at']; + + public function api_log() + { + return $this->hasOne(ApiLog::class, 'id', 'apiLog_id'); + } + + public static function getAllPlacesNames() { + $places = self::all(); + $places_names = []; + foreach ($places as $place) { + $places_names[$place->id] = $place->name; + } + return $places_names; + } + public function crew() { + return $this->hasOneThrough(Crew::class, + ApiLog::class, + "id", "id", + "api_log", + "crew_id"); + } + public function toRelation() { + return $this->belongsToMany(ListRelation::class, + "links", "to", + "relation_id")->using(Link::class)->wherePivotNull("deleted_at")->withPivot("from")->withPivot("id"); + } + + public function fromRelation() { + return $this->belongsToMany(ListRelation::class, + "links", "from", + "relation_id")->using(Link::class)->wherePivotNull("deleted_at")->withPivot("to")->withPivot("id"); + } } diff --git a/src/database/factories/PlaceFactory.php b/src/database/factories/PlaceFactory.php index dd96a4b4..58413eb5 100644 --- a/src/database/factories/PlaceFactory.php +++ b/src/database/factories/PlaceFactory.php @@ -4,6 +4,8 @@ use App\Models\Place; use Illuminate\Database\Eloquent\Factories\Factory; +use App\Models\ApiLog; +use App\Models\User; class PlaceFactory extends Factory { @@ -11,6 +13,15 @@ class PlaceFactory extends Factory public function definition(): array { + $log["user_id"] = User::where("email", env("DEFAULT_EMAIL"))->first()->id; + $log["application_id"] = "seeder"; + $log["api_type"] = "seeder"; + $log["http_method"] = "POST"; + $log["model"] = "Event"; + $log["ip"] = "127.0.0.1"; + $log["crew_id"] = User::where("email", env("DEFAULT_EMAIL"))->first()->crew->id; + + $log = ApiLog::create($log); $coordinates = json_encode([ "lat" => $this->faker->latitude, @@ -34,6 +45,7 @@ public function definition(): array "coordinates" => $coordinates, "description" => $this->faker->realText, "area" => $area, + "api_log" => $log->id, ]; } } diff --git a/src/database/migrations/2024_07_19_091627_add_api_log_to_places.php b/src/database/migrations/2024_07_19_091627_add_api_log_to_places.php new file mode 100755 index 00000000..9712afdb --- /dev/null +++ b/src/database/migrations/2024_07_19_091627_add_api_log_to_places.php @@ -0,0 +1,32 @@ +foreignUuid("api_log"); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('places', function (Blueprint $table) { + $table->dropColumn('api_log'); + }); + } +}; diff --git a/src/resources/lang/en/event/show.php b/src/resources/lang/en/event/show.php index 7f957cb0..8dc194f0 100644 --- a/src/resources/lang/en/event/show.php +++ b/src/resources/lang/en/event/show.php @@ -13,8 +13,17 @@ 'stop_date' => 'Stop date', 'coordinates' => 'Coordinates', 'area' => 'Area', - 'listCoordinates' => 'List of coordinates', + 'number_of_polygons' => 'Number of polygons in the area', 'description' => 'Description', 'lat' => 'Latitude', 'long' => 'Longitude', + 'item_relations' => 'Item relations', + 'relations' => ':name relations', + 'view_relations_in_graph' => 'View relations in graph', + 'from' => 'From', + 'relation' => 'Relation', + 'to' => 'To', + 'add_to' => 'Add To', + 'add_from' => 'Add from', + 'edit'=> 'Edit', ]; diff --git a/src/resources/lang/en/person/show.php b/src/resources/lang/en/person/show.php index 054711d3..9ee661d4 100644 --- a/src/resources/lang/en/person/show.php +++ b/src/resources/lang/en/person/show.php @@ -13,4 +13,5 @@ 'to' => 'To', 'add_to' => 'Add To', 'add_from' => 'Add from', + 'edit'=> 'Edit', ]; diff --git a/src/resources/lang/en/place/show.php b/src/resources/lang/en/place/show.php index e104ab80..630ac8fe 100644 --- a/src/resources/lang/en/place/show.php +++ b/src/resources/lang/en/place/show.php @@ -12,4 +12,13 @@ 'area' => 'Area', 'number_of_polygons' => 'Number of polygons', ], + 'item_relations' => 'Item relations', + 'relations' => ':name relations', + 'view_relations_in_graph' => 'View relations in graph', + 'from' => 'From', + 'relation' => 'Relation', + 'to' => 'To', + 'add_to' => 'Add To', + 'add_from' => 'Add from', + 'edit'=> 'Edit', ]; diff --git a/src/resources/views/event/show.blade.php b/src/resources/views/event/show.blade.php index 49aaa429..84055395 100644 --- a/src/resources/views/event/show.blade.php +++ b/src/resources/views/event/show.blade.php @@ -1,3 +1,4 @@ +@php use App\Models\Link; @endphp @section('title', __('event/show.view_event_details', ['event_name' => $event->name])) @@ -116,8 +117,8 @@ class="px-6 py-3 bg-gray-50 text-left text-xs font-medium - @if($event->coordinates) - + @if($event->coordinates) +
@@ -131,7 +132,7 @@ class="px-6 py-3 bg-gray-50 text-left text-xs font-medium
- @endif + @endif @@ -144,14 +145,8 @@ class="px-6 py-3 bg-gray-50 text-left text-xs font-medium bg-white divide-y divide-gray-200"> @if($event->area) -
-
- - {{ __('event/show.listCoordinates') }} : {{ json_decode($event->area, true)['listCoordinates'] ?? ""}} - -
-
-
+ {{ __('event/show.number_of_polygons') }} : {{ count(json_decode($event->area, true)['polygons']) ?? ""}} +
@endif @@ -172,28 +167,154 @@ class="px-6 py-3 bg-gray-50 text-left text-xs font-medium @if($event->coordinates) -
-
-
-
- @map([ - 'lat' => json_decode($event->coordinates, true)['lat'], - 'lng' => json_decode($event->coordinates, true)['long'], - 'zoom' => 2, - 'markers' => [ - [ - 'lat' => json_decode($event->coordinates, true)['lat'], - 'lng' => json_decode($event->coordinates, true)['long'], - 'title' => $event->name, - ], - ] - ]) - @mapscripts +
+
+
+
+ @include('map.leaflet', [ + 'initialMarkers' => [ + ['lat' => json_decode($event->coordinates, true)['lat'], 'lng' => json_decode($event->coordinates, true)['long']] + ], + 'initialArea' => [json_decode($event->area, true)['polygons'] + ]]) +
-
@endif + @can("viewMenu", Link::class) +
+
+
+

+ {{ __('event/show.relation') }} +

+
+ + + + + + + + + + @if($event->relations) + @foreach($event->relations as $sided_relations) + @foreach($sided_relations as $link) + + + + + + + @endforeach + @endforeach + @endif + @if(Link::$quickAdd) + @can('create', Link::class) + + + + + + + + + + + + + + + + + + + @endcan + @endif +
{{ __('event/show.item_relation') }}
+ {{ __('event/show.from') }} + + {{ __('event/show.relation') }} + + {{ __('event/show.to') }} +
+ pivot->from)}}"> + @if($link->pivot->refugeeFrom) + {{$link->pivot->refugeeFrom->best_descriptive_value }} + @elseif($link->pivot->eventFrom) + {{$link->pivot->eventFrom->name}} + @elseif($link->pivot->placeFrom) + {{$link->pivot->placeFrom->name}} + @endif + + + {{ $link->name }} + {{$link->detail}} + + pivot->to)}}"> + @if($link->pivot->refugeeTo) + {{$link->pivot->refugeeTo->best_descriptive_value }} + @elseif($link->pivot->eventTo) + {{$link->pivot->eventTo->name}} + @elseif($link->pivot->placeTo) + {{$link->pivot->placeTo->name}} + @endif + + + pivot->id)}}"> + {{ __('event/show.edit') }} + +
+ id) }}"> + {{ $event->name }} + + + 'from', 'event' => $event]) }}" + class="bg-green-200 hover:bg-green-300 + text-black font-bold py-2 px-4 rounded"> + {{ __('event/show.add_to') }} + +
+ 'to', 'event' => $event]) }}" + class="bg-green-200 hover:bg-green-300 text-black + font-bold py-2 px-4 rounded"> + {{ __('event/show.add_from') }} + + + id) }}"> + {{ $event->name }} + +
+
+
+
+
+ @endcan
diff --git a/src/resources/views/links/create.blade.php b/src/resources/views/links/create.blade.php index e599fdfb..2bc310f4 100644 --- a/src/resources/views/links/create.blade.php +++ b/src/resources/views/links/create.blade.php @@ -28,7 +28,7 @@ class="bg-gray-200 hover:bg-gray-300 text-black font-bold py-2 px-4 rounded">{{ 'type' => 'select-dropdown', 'title' => __('links/create.item_1'), 'placeHolder' => __('links/create.select_item_1'), - 'associated_list' => $lists["refugees"], + 'associated_list' => $lists["all"], 'previous' => old($form_elem, $selected_value = (!empty($refugee) && !empty($origin) && $origin == "from") ? $refugee->id : $form_elem), ]) @@ -43,6 +43,7 @@ class="bg-gray-200 hover:bg-gray-300 text-black font-bold py-2 px-4 rounded">{{
+ @php($form_elem = "relation_id") @@ -81,8 +82,8 @@ class="bg-gray-200 hover:bg-gray-300 text-black font-bold py-2 px-4 rounded">{{ 'type' => 'select-dropdown', 'title' => __('links/create.item_2'), 'placeHolder' => __('links/create.select_item_2'), - 'associated_list' => $lists["refugees"], - 'previous' => old($form_elem, (!empty($refugee) && !empty($origin) && $origin == "to") ? + 'associated_list' => $lists["all"], + 'previous' => old($form_elem, (!empty($refugee) && !empty($event) && !empty($place) && !empty($origin) && $origin == "to") ? $refugee->id : $form_elem ), ]) @@ -113,7 +114,6 @@ class="bg-gray-200 hover:bg-gray-300 text-black font-bold py-2 px-4 rounded">{{ ])
-
+ @can("viewMenu", Link::class) +
+
+
+

+ {{ __('place/show.relation') }} +

+
+ + + + + + + + + + @if($place->relations) + @foreach($place->relations as $sided_relations) + @foreach($sided_relations as $link) + + + + + + + @endforeach + @endforeach + @endif + @if(Link::$quickAdd) + @can('create', Link::class) + + + + + + + + + + + + + + + + + + @endcan + @endif +
{{ __('place/show.item_relation') }}
+ {{ __('place/show.from') }} + + {{ __('place/show.relation') }} + + {{ __('place/show.to') }} +
+ pivot->from)}}"> + @if($link->pivot->refugeeFrom) + {{$link->pivot->refugeeFrom->best_descriptive_value }} + @elseif($link->pivot->eventFrom) + {{$link->pivot->eventFrom->name}} + @elseif($link->pivot->placeFrom) + {{$link->pivot->placeFrom->name}} + @endif + + + {{ $link->name }} + {{$link->detail}} + + pivot->to)}}"> + @if($link->pivot->refugeeTo) + {{$link->pivot->refugeeTo->best_descriptive_value }} + @elseif($link->pivot->eventTo) + {{$link->pivot->eventTo->name}} + @elseif($link->pivot->placeTo) + {{$link->pivot->placeTo->name}} + @endif + + + pivot->id)}}"> + {{ __('place/show.edit') }} + +
+ id) }}"> + {{ $place->name }} + + + 'from', 'place' => $place]) }}" + class="bg-green-200 hover:bg-green-300 + text-black font-bold py-2 px-4 rounded"> + {{ __('place/show.add_to') }} + +
+ 'to', 'place' => $place]) }}" + class="bg-green-200 hover:bg-green-300 text-black + font-bold py-2 px-4 rounded"> + {{ __('place/show.add_from') }} + + + id) }}"> + {{ $place->name }} + +
+
+
+
+
+ @endcan