Skip to content

Commit

Permalink
Merge pull request #3 from maling-it/base/dev
Browse files Browse the repository at this point in the history
Buat Komponen dan model untk peta openlayer
  • Loading branch information
ahmadzulfadli authored Feb 17, 2024
2 parents 3c913c2 + 35f414f commit c1cf766
Show file tree
Hide file tree
Showing 23 changed files with 325 additions and 338 deletions.
19 changes: 19 additions & 0 deletions app/Http/Controllers/DeviceController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class DeviceController extends Controller
{
public function show($id)
{
$apiUrl = env('API_URL') . "/api/v1/device/{$id}";
$response = Http::get($apiUrl);

$device = $response->json();

return view('device.show', compact('device'));
}
}
26 changes: 26 additions & 0 deletions app/View/Components/AppLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class AppLayout extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('layouts.app');
}
}
32 changes: 32 additions & 0 deletions app/View/Components/MapTanahku.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
use Illuminate\Support\Facades\Http;

class MapTanahku extends Component
{
public $devices;

/**
* Create a new component instance.
*/
public function __construct()
{
$apiUrl = env('API_URL') . "/api/v1/device/all";
$response = Http::get($apiUrl);

$this->devices = $response->json()['data'];
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.map-tanahku');
}
}
13 changes: 13 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@

'name' => env('APP_NAME', 'Laravel'),

/*
|--------------------------------------------------------------------------
| Application API URL
|--------------------------------------------------------------------------
|
| This URL is used by the application to generate URLs for the API. You
| should set this to the root of your application so that it is used
| when running API requests.
|
*/

'api_url' => env('API_URL', 'https://api.tanahku.online'),

/*
|--------------------------------------------------------------------------
| Application Environment
Expand Down
1 change: 0 additions & 1 deletion database/.gitignore

This file was deleted.

44 changes: 0 additions & 44 deletions database/factories/UserFactory.php

This file was deleted.

32 changes: 0 additions & 32 deletions database/migrations/2014_10_12_000000_create_users_table.php

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions database/migrations/2019_08_19_000000_create_failed_jobs_table.php

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions database/seeders/DatabaseSeeder.php

This file was deleted.

27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.6.4",
"laravel-vite-plugin": "^1.0.0",
"vite": "^5.0.0"
}
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.6.4",
"laravel-vite-plugin": "^1.0.0",
"vite": "^5.0.0",
"ol": "^8.2.0"
},
"dependencies": {
"bootstrap": "5.3.2",
"halfmoon": "2.0.1"
}
}
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import "../../node_modules/ol/ol.css";

html,
body {
margin: 0;
height: 100%;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
14 changes: 13 additions & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
import './bootstrap';
// Import Halfmoon CSS
import "halfmoon/css/cores/halfmoon.cores.css";
import "halfmoon/css/halfmoon.min.css";

import './olmain';

// some script here
const popoverTriggerList = document.querySelectorAll(
"[data-bs-toggle='popover']"
);
const popoverList = [...popoverTriggerList].map(
popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)
);
Loading

0 comments on commit c1cf766

Please sign in to comment.