management updates

This commit is contained in:
glmdev 2019-02-10 00:09:56 -06:00
parent 1c9c41ab8c
commit 90f97a5453
15 changed files with 605 additions and 87 deletions

View File

@ -4,18 +4,8 @@
<list default="true" id="32d5efaa-a329-4d17-ae1e-897afa4db3d0" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/ParkingLot.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/ParkingLot.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549731408.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549731519.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549733132.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549733192.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549733258.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549734106.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549734284.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549734518.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549734642.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549735133.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/img/references/1549735264.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/lot/add.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/lot/add.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/css/app.css" beforeDir="false" afterPath="$PROJECT_DIR$/public/css/app.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/home.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/home.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -29,29 +19,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
<caret line="40" column="87" selection-start-line="40" selection-start-column="87" selection-end-line="40" selection-end-column="87" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/selectstalls.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="811">
<caret line="63" column="57" selection-start-line="63" selection-start-column="57" selection-end-line="63" selection-end-column="57" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/routes/web.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="69" column="29" selection-start-line="69" selection-start-column="29" selection-end-line="69" selection-end-column="29" />
<state relative-caret-position="326">
<caret line="162" column="4" selection-start-line="162" selection-start-column="4" selection-end-line="162" selection-end-column="4" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>
@ -60,37 +32,41 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/welcome.blade.php">
<entry file="file://$PROJECT_DIR$/resources/views/lot/manageone.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236">
<caret line="83" column="31" selection-start-line="83" selection-start-column="31" selection-end-line="83" selection-end-column="31" />
<state relative-caret-position="401">
<caret line="53" column="41" selection-start-line="53" selection-start-column="41" selection-end-line="53" selection-end-column="41" />
<folding>
<element signature="e#1014#1076#0#HTML" expanded="true" />
<element signature="e#1260#1322#0#HTML" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<entry file="file://$PROJECT_DIR$/public/css/app.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="110" selection-start-line="8" selection-start-column="110" selection-end-line="8" selection-end-column="110" />
<state relative-caret-position="473">
<caret line="10" column="29" selection-start-line="10" selection-start-column="29" selection-end-line="10" selection-end-column="29" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/layouts/plain.blade.php">
<entry file="file://$PROJECT_DIR$/resources/views/device/get.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="371">
<caret line="29" column="18" selection-start-line="29" selection-start-column="18" selection-end-line="29" selection-end-column="18" />
<state relative-caret-position="270">
<caret line="18" column="31" lean-forward="true" selection-start-line="18" selection-start-column="31" selection-end-line="18" selection-end-column="31" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/layouts/app.blade.php">
<entry file="file://$PROJECT_DIR$/resources/views/home.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="26" column="61" selection-start-line="26" selection-start-column="61" selection-end-line="26" selection-end-column="61" />
<state relative-caret-position="270">
<caret line="18" column="111" lean-forward="true" selection-start-line="18" selection-start-column="111" selection-end-line="18" selection-end-column="111" />
</state>
</provider>
</entry>
@ -104,15 +80,6 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/auth/register.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="59" column="115" selection-start-line="59" selection-start-column="115" selection-end-line="59" selection-end-column="115" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
@ -123,7 +90,6 @@
<list>
<option value="$PROJECT_DIR$/database/migrations/2019_02_09_145854_create_parking_lots_table.php" />
<option value="$PROJECT_DIR$/resources/views/layouts/app.blade.php" />
<option value="$PROJECT_DIR$/resources/views/home.blade.php" />
<option value="$PROJECT_DIR$/resources/views/layouts/plain.blade.php" />
<option value="$PROJECT_DIR$/database/migrations/2019_02_09_164457_add_reference_image_to_parking_lots.php" />
<option value="$PROJECT_DIR$/resources/views/selectstalls.blade.php" />
@ -132,7 +98,16 @@
<option value="$PROJECT_DIR$/database/migrations/2019_02_09_200020_add_columns_to_parking_lots.php" />
<option value="$PROJECT_DIR$/resources/views/lot/add.blade.php" />
<option value="$PROJECT_DIR$/database/migrations/2019_02_09_205355_add_name_to_parking_lots.php" />
<option value="$PROJECT_DIR$/resources/views/lot/selectrefs.blade.php" />
<option value="$PROJECT_DIR$/database/migrations/2019_02_10_025544_add_ref_coords_to_parking_lots.php" />
<option value="$PROJECT_DIR$/app/ParkingLot.php" />
<option value="$PROJECT_DIR$/resources/views/lot/success.blade.php" />
<option value="$PROJECT_DIR$/resources/views/home.blade.php" />
<option value="$PROJECT_DIR$/resources/views/device/add.blade.php" />
<option value="$PROJECT_DIR$/resources/views/device/get.blade.php" />
<option value="$PROJECT_DIR$/resources/views/lot/manage.blade.php" />
<option value="$PROJECT_DIR$/public/css/app.css" />
<option value="$PROJECT_DIR$/resources/views/lot/manageone.blade.php" />
<option value="$PROJECT_DIR$/routes/web.php" />
</list>
</option>
@ -312,6 +287,13 @@
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="auth" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="laravel" type="b2602c69:ProjectViewProjectNode" />
<item name="laravel" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="device" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="laravel" type="b2602c69:ProjectViewProjectNode" />
<item name="laravel" type="462c0819:PsiDirectoryNode" />
@ -319,6 +301,13 @@
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="layouts" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="laravel" type="b2602c69:ProjectViewProjectNode" />
<item name="laravel" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="lot" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="laravel" type="b2602c69:ProjectViewProjectNode" />
<item name="laravel" type="462c0819:PsiDirectoryNode" />
@ -340,8 +329,9 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources/views/layouts" />
<recent name="$PROJECT_DIR$/resources/views/device" />
<recent name="$PROJECT_DIR$/resources/views/lot" />
<recent name="$PROJECT_DIR$/resources/views/layouts" />
<recent name="$PROJECT_DIR$/resources/views" />
</key>
</component>
@ -374,18 +364,18 @@
<option name="presentableId" value="Default" />
<updated>1549706447395</updated>
<workItem from="1549706448757" duration="961000" />
<workItem from="1549723735384" duration="19529000" />
<workItem from="1549723735384" duration="34314000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="20490000" />
<option name="totallyTimeSpent" value="35275000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="27" width="1920" height="1053" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2524013" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2524013" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="npm" order="2" side_tool="true" />
<window_info id="Favorites" order="3" side_tool="true" />
@ -400,7 +390,7 @@
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="11" visible="true" weight="0.32972974" />
<window_info active="true" anchor="bottom" id="Terminal" order="11" visible="true" weight="0.32972974" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@ -421,13 +411,6 @@
<entry file="file://$PROJECT_DIR$/app/User.php">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/home.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="91" selection-start-line="16" selection-start-column="91" selection-end-line="16" selection-end-column="91" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/img/references/1549728481.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
@ -452,13 +435,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/welcome.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236">
<caret line="83" column="31" selection-start-line="83" selection-start-column="31" selection-end-line="83" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
@ -473,6 +449,13 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2019_02_09_205355_add_name_to_parking_lots.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/layouts/app.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
@ -480,6 +463,20 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/selectstalls.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="241">
<caret line="25" column="29" selection-start-line="25" selection-start-column="29" selection-end-line="25" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/welcome.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="766">
<caret line="83" column="31" selection-start-line="83" selection-start-column="31" selection-end-line="83" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="83">
@ -487,31 +484,87 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/selectstalls.blade.php">
<entry file="file://$PROJECT_DIR$/resources/views/lot/selectrefs.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="811">
<caret line="63" column="57" selection-start-line="63" selection-start-column="57" selection-end-line="63" selection-end-column="57" />
<state relative-caret-position="570">
<caret line="38" column="48" selection-start-line="38" selection-start-column="48" selection-end-line="38" selection-end-column="48" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2019_02_09_205355_add_name_to_parking_lots.php">
<entry file="file://$PROJECT_DIR$/database/migrations/2019_02_10_025544_add_ref_coords_to_parking_lots.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" />
<state relative-caret-position="210">
<caret line="16" column="43" lean-forward="true" selection-start-line="16" selection-start-column="43" selection-end-line="16" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/success.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="72" lean-forward="true" selection-start-line="16" selection-start-column="72" selection-end-line="16" selection-end-column="72" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/home.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="111" lean-forward="true" selection-start-line="18" selection-start-column="111" selection-end-line="18" selection-end-column="111" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/device/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="29" lean-forward="true" selection-start-line="17" selection-start-column="29" selection-end-line="17" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="110" selection-start-line="8" selection-start-column="110" selection-end-line="8" selection-end-column="110" />
<state relative-caret-position="203">
<caret line="21" column="36" lean-forward="true" selection-start-line="21" selection-start-column="36" selection-end-line="21" selection-end-column="36" />
<folding>
<element signature="e#23#62#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/device/get.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="31" lean-forward="true" selection-start-line="18" selection-start-column="31" selection-end-line="18" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/manage.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="31" column="51" selection-start-line="31" selection-start-column="51" selection-end-line="31" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/css/app.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="473">
<caret line="10" column="29" selection-start-line="10" selection-start-column="29" selection-end-line="10" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/manageone.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="401">
<caret line="53" column="41" selection-start-line="53" selection-start-column="41" selection-end-line="53" selection-end-column="41" />
<folding>
<element signature="e#1014#1076#0#HTML" expanded="true" />
<element signature="e#1260#1322#0#HTML" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/web.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="69" column="29" selection-start-line="69" selection-start-column="29" selection-end-line="69" selection-end-column="29" />
<state relative-caret-position="326">
<caret line="162" column="4" selection-start-line="162" selection-start-column="4" selection-end-line="162" selection-end-column="4" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>

View File

@ -3,10 +3,11 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Google\Cloud\Firestore\FirestoreClient;
class ParkingLot extends Model
{
protected $fillable = [ 'firebase_id', 'stall_coordinates', 'reference_image', 'number_of_columns', 'name' ];
protected $fillable = [ 'firebase_id', 'stall_coordinates', 'reference_image', 'number_of_columns', 'name', 'ref_coords' ];
public function get_coordinates(){
return json_decode( $this->stall_coordinates );
@ -16,4 +17,31 @@ class ParkingLot extends Model
$this->stall_coordinates = json_encode( $coordinates );
$this->save();
}
public static function getFB(){
$db = new FirestoreClient();
$documents = $db->collection('lots')->documents();
$docarr = [];
foreach( $documents as $doc ){
if ( $doc->exists() ){
array_push($docarr, ['id' => $doc->id(), 'data'=>$db->collection('lots')->document($doc->id())->collection('info')->document('lotInfo')->snapshot()->data()]);
}
};
return $docarr;
}
public static function getFBbyID($id){
$db = new FirestoreClient();
$documents = $db->collection('lots')->documents();
foreach( $documents as $doc ){
if ( $doc->exists() && $doc->id() === (string) "Lot".$id ){
return ['id' => $doc->id(), 'data'=>$db->collection('lots')->document($doc->id())->collection('info')->document('lotInfo')->snapshot()->data()];
}
};
return null;
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRefCoordsToParkingLots extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('parking_lots', function (Blueprint $table) {
$table->longText('ref_coords');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('parking_lots', function (Blueprint $table) {
//
});
}
}

4
public/css/app.css vendored

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,90 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Create New Device Configuration</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form method="POST" action="{{ url('/device/add') }}" enctype="multipart/form-data">
@csrf
<div class="form-group row">
<label for="code" class="col-md-4 col-form-label text-md-right">{{ __('Activation Code') }}</label>
<div class="col-md-6">
<input id="code" type="text" class="form-control{{ $errors->has('code') ? ' is-invalid' : '' }}" name="code" value="{{ old('code') }}" placeholder="0pva5gq4" required autofocus>
@if ($errors->has('code'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('code') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="camera" class="col-md-4 col-form-label text-md-right">{{ __('Camera Device Stream') }}</label>
<div class="col-md-6">
<input id="camera" type="text" class="form-control{{ $errors->has('camera') ? ' is-invalid' : '' }}" name="camera" value="{{ old('camera') }}" placeholder="/dev/video0" required>
@if ($errors->has('camera'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('camera') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="lotid" class="col-md-4 col-form-label text-md-right">{{ __('Lot ID (Firebase)') }}</label>
<div class="col-md-6">
<input id="lotid" type="text" class="form-control{{ $errors->has('lotid') ? ' is-invalid' : '' }}" name="lotid" value="{{ old('lotid') }}" placeholder="Lot15" required>
@if ($errors->has('lotid'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('lotid') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="ehat" class="col-md-4 col-form-label text-md-right">{{ __('Ê Threshold') }}</label>
<div class="col-md-6">
<input id="ehat" type="text" class="form-control{{ $errors->has('ehat') ? ' is-invalid' : '' }}" name="ehat" value="{{ old('ehat') }}" placeholder="10" required>
@if ($errors->has('ehat'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('ehat') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Create Lot') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,25 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Device Configuration: {{ $device['id'] }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
@foreach( $device['data'] as $key=>$val)
<b>{{ $key }}</b>: {{ $val }}<br>
@endforeach
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -15,6 +15,8 @@
@endif
<a href="{{ url('/lot/add') }}" class="btn btn-success">Add New Lot</a>
<a href="{{ url('/lot/manage') }}" class="btn btn-warning">Manage Lots</a>
<a href="{{ url('/device/add') }}" class="btn btn-success">Create New Device Config</a>
</div>
</div>
</div>

View File

@ -0,0 +1,46 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Manage Registered Lots</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<div class="table">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Firebase ID</th>
<th scope="col">Name</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
@foreach( $lots as $lot )
<tr>
<th scope="row">{{ $lot['data']['lotID'] }}</th>
<td>{{ $lot['id'] }}</td>
<td>{{ $lot['data']['name'] }}</td>
<td>
<a href="{{ url('/lot/manage/'.$lot['data']['lotID']) }}" class="btn btn-sm btn-success">Manage</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Manage Parking Lot</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<h3>Manage Handicap</h3>
<div class="container" id="stalls">
@foreach( $stalls as $stallgroup )
<div class="row">
@foreach( $stallgroup as $stall )
@if( $stall['data']['handicap'] )
<button onclick="$(this).toggleClass('handicap-btn')" class="btn btn-default stall-btn handicap-btn" id="{{ $stall['id'] }}" style="margin: 10px; padding-top: 10px; padding-bottom: 10px;">{{ $stall['id'] }}</button>
@else
<button onclick="$(this).toggleClass('handicap-btn')" class="btn btn-default stall-btn" id="{{ $stall['id'] }}" style="margin: 10px; padding-top: 10px; padding-bottom: 10px;">{{ $stall['id'] }}</button>
@endif
@endforeach
</div>
@endforeach
</div>
<script>
function submit_handicap(){
const handicap_ids = []
$('.handicap-btn').each(function(k, e){
handicap_ids.push(e.id)
})
const form = document.createElement('form')
form.method = "POST";
form.action = "{{ url('/lot/manage/'.$thruid) }}";
const ids = document.createElement('input')
ids.type = "hidden"
ids.name = "handicaps"
ids.value = JSON.stringify(handicap_ids)
const csrf = document.createElement('input')
csrf.type = "hidden"
ids.name = "_token"
ids.value = "{{ csrf_token() }}"
form.appendChild(ids)
form.appendChild(csrf)
document.appendChild(form)
form.submit()
console.log(handicap_ids)
}
</script>
<br><button class="btn btn-success" onclick="submit_handicap()">Save Changes</button>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,64 @@
@extends('layouts.plain')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<h2 class="card-header">Select the Parking Stall Reference Location</h2>
<h4>{{ $lot->reference_image }}</h4><br>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<img src="{{ asset('img/references/'.$lot->reference_image) }}" alt="" id="lotimage">
<script>
const jc = Jcrop.attach('lotimage',{
shadeColor: 'red',
multi: false
});
console.log(jc.active.pos)
</script>
<br>
<script>
function submit_coordinates(){
const crops = []
jc.crops.forEach((crop) => {
const coords = crop.pos
crops.push(coords)
})
console.log(crops)
const form = document.createElement('form')
form.method = "POST"
form.action = "{{ url('/lot/reference/'.$lot->id) }}"
const coords_element = document.createElement('input')
coords_element.name = "coords"
coords_element.value = JSON.stringify(crops)
form.appendChild(coords_element)
const csrf_element = document.createElement('input')
csrf_element.type = "hidden"
csrf_element.name = "_token"
csrf_element.value = "{{ csrf_token() }}"
form.appendChild(csrf_element)
document.body.appendChild(form)
form.submit()
}
</script>
<button onclick="submit_coordinates()">Submit</button>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,27 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<p>
<b>The new lot was created successfully.</b>
</p>
<p>
<a href="{{ url('/home') }}" class="btn btn-success">Take me home!</a>
</p>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -40,9 +40,10 @@ Route::post('/lot/post', function(\Illuminate\Http\Request $request) {
$lot_object = new ParkingLot([
'firebase_id' => 'Lot',
'stall_coordinates' => '',
'ref_coords' => '',
'reference_image' => $name,
'number_of_columns' => $request->get('numcols'),
'name' => $request->get('name')
'name' => $request->get('name'),
]);
$lot_object->save();
@ -122,5 +123,86 @@ Route::post('/lot/generate', function(\Illuminate\Http\Request $request){
echo $request->get('coords');
return redirect(url('/lot/reference/'.$lot_object->id));
});
Route::get('/lot/reference/{id}', function($id){
$lot_object = ParkingLot::find($id);
return view('lot.selectrefs', ['lot'=>$lot_object]);
});
Route::post('/lot/reference/{id}', function(\Illuminate\Http\Request $request, $id){
$lot_object = ParkingLot::find($id);
$lot_object->ref_coords = $request->get('coords');
$lot_object->save();
$db = new FirestoreClient();
$doc_ref = $db->collection('lots')->document($lot_object->firebase_id)->collection('info')->document('lotInfo');
$doc_ref_base = $doc_ref->snapshot()->data();
$doc_ref_base['reference_coords'] = $lot_object->ref_coords;
$doc_ref->set($doc_ref_base);
return redirect(url('/lot/success'));
});
Route::get('/lot/success', function(){
return view('lot.success');
});
Route::get('/lot/manage', function(\Illuminate\Http\Request $request){
// dd(ParkingLot::getFB());
return view('lot.manage', ['lots' => ParkingLot::getFB()]);
});
Route::get('/lot/manage/{id}', function(\Illuminate\Http\Request $request, $id){
$lot = ParkingLot::getFBbyID($id);
$db = new FirestoreClient();
$doc_ref = $db->collection('lots')->document($lot['id'])->collection('stalls')->documents();
$stalls = [];
foreach( $doc_ref as $stall ){
array_push($stalls, ['id' => $stall->id(), 'data' => $stall->data()]);
}
usort($stalls, function($a, $b){
return $a['data']['locationY'] <=> $b['data']['locationY'];
});
$stalls = array_chunk($stalls, (int) $lot['data']['columns']);
foreach($stalls as $key=>$stall_grp ){
usort($stall_grp, function($a, $b) {
return $a['data']['locationX'] <=> $b['data']['locationX'];
});
$stalls[$key] = $stall_grp;
}
return view('lot.manageone', ['lot' => $lot, 'stalls' => $stalls, 'thruid' => $id]);
});
Route::get('/device/add', function(){
return view('device.add');
});
Route::post('/device/add', function(\Illuminate\Http\Request $request){
$db = new FirestoreClient();
$ref = $db->collection('configurations')->document(str_replace(' ', '-', $request->get('code')));
$ref->set([
'activation' => str_replace(' ', '-', $request->get('code')),
'e_hat' => $request->get('ehat'),
'lot_id' => $request->get('lotid'),
'stream' => $request->get('camera'),
]);
return redirect(url('/device/get/'.str_replace(' ', '-', $request->get('code'))));
});
Route::get('/device/get/{code}', function ($code) {
$db = new FirestoreClient();
$ref = $db->collection('configurations')->document($code)->snapshot();
return view('device.get', ['device' => ['id' => $ref->id(), 'data' => $ref->data()]]);
});