committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 493 additions and 12 deletions
-
7.env.example
-
52app/Http/Controllers/UsersController.php
-
5app/Http/Requests/Users/UpdateRequest.php
-
36app/User.php
-
14app/UserMetadata.php
-
8config/leaflet.php
-
26database/factories/ModelFactory.php
-
36database/migrations/2021_04_04_215601_create_user_metadata_table.php
-
8resources/lang/en/address.php
-
3resources/lang/en/app.php
-
2resources/lang/en/user.php
-
8resources/lang/id/address.php
-
3resources/lang/id/app.php
-
2resources/lang/id/user.php
-
91resources/views/users/death.blade.php
-
51resources/views/users/edit.blade.php
-
5resources/views/users/partials/action-buttons.blade.php
-
10resources/views/users/partials/edit_death.blade.php
-
1routes/web.php
-
68tests/Feature/UsersProfileTest.php
-
69tests/Unit/UserTest.php
@ -0,0 +1,14 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class UserMetadata extends Model |
|||
{ |
|||
public $incrementing = false; |
|||
|
|||
protected $keyType = 'string'; |
|||
|
|||
protected $fillable = ['id', 'user_id', 'key', 'value']; |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
'zoom_level' => env('LEAFLET_MAP_ZOOM_LEVEL', 4), |
|||
'detail_zoom_level' => env('LEAFLET_MAP_DETAIL_ZOOM_LEVEL', 18), |
|||
'map_center_latitude' => env('LEAFLET_MAP_CENTER_LATITUDE', '-0.87887'), |
|||
'map_center_longitude' => env('LEAFLET_MAP_CENTER_LONGITUDE', '117.4863'), |
|||
]; |
|||
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Migrations\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
class CreateUserMetadataTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('user_metadata', function (Blueprint $table) { |
|||
$table->uuid('id')->primary(); |
|||
$table->uuid('user_id'); |
|||
$table->string('key')->index(); |
|||
$table->text('value')->nullable(); |
|||
$table->timestamps(); |
|||
|
|||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('user_metadata'); |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
'address' => 'Address', |
|||
'location_name' => 'Location Name', |
|||
'latitude' => 'Latitude', |
|||
'longitude' => 'Longitude', |
|||
]; |
|||
@ -0,0 +1,8 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
'address' => 'Alamat', |
|||
'location_name' => 'Nama Lokasi', |
|||
'latitude' => 'Latitude', |
|||
'longitude' => 'Longitude', |
|||
]; |
|||
@ -0,0 +1,91 @@ |
|||
@extends('layouts.user-profile') |
|||
|
|||
@section('subtitle', __('user.death')) |
|||
|
|||
@section('user-content') |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"> |
|||
@can('edit', $user) |
|||
{{ link_to_route('users.edit', __('app.edit'), [$user->id, 'tab' => 'death'], ['class' => 'pull-right']) }} |
|||
@endcan |
|||
<h3 class="panel-title">{{ __('user.death') }}</h3> |
|||
</div> |
|||
<table class="table"> |
|||
<tbody> |
|||
<tr> |
|||
<th>{{ __('address.location_name') }}</th> |
|||
<td>{{ $user->getMetadata('cemetery_location_name') }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>{{ __('address.address') }}</th> |
|||
<td>{{ $user->getMetadata('cemetery_location_address') }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>{{ __('user.dod') }}</th> |
|||
<td>{{ $user->dod ?: $user->yod }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>{{ __('user.age') }}</th> |
|||
<td> |
|||
@if ($user->age) |
|||
{!! $user->age_string !!} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">{{ __('user.cemetery_location') }}</h3></div> |
|||
@if ($mapCenterLatitude && $mapCenterLongitude) |
|||
<div class="panel-body"><div id="mapid"></div></div> |
|||
<div class="panel-footer"> |
|||
@php |
|||
$locationCoordinate = $mapCenterLatitude.','.$mapCenterLongitude.'/@'.$mapCenterLatitude.','.$mapCenterLongitude.','.$mapZoomLevel.'z'; |
|||
@endphp |
|||
{{ link_to( |
|||
'https://www.google.com/maps/place/'.$locationCoordinate, |
|||
__('app.open_in_google_map'), |
|||
['class' => 'btn btn-default btn-block', 'target' => '_blank'] |
|||
) }} |
|||
</div> |
|||
@else |
|||
<div class="panel-body">{{ __('app.data_not_available') }}</div> |
|||
@endif |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
|||
|
|||
@if ($mapCenterLatitude && $mapCenterLongitude) |
|||
@section('ext_css') |
|||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" |
|||
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" |
|||
crossorigin=""/> |
|||
|
|||
<style> |
|||
#mapid { height: 300px; }
|
|||
</style> |
|||
@endsection |
|||
|
|||
@section('script') |
|||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" |
|||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" |
|||
crossorigin=""></script> |
|||
|
|||
<script> |
|||
var mapCenter = [{{ $mapCenterLatitude }}, {{ $mapCenterLongitude }}]; |
|||
var map = L.map('mapid').setView(mapCenter, {{ $mapZoomLevel }}); |
|||
|
|||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' |
|||
}).addTo(map); |
|||
|
|||
var marker = L.marker(mapCenter).addTo(map); |
|||
</script> |
|||
@endsection |
|||
@endif |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue