master
glmdev 5 years ago
parent 4277fa580c
commit ffcdf95908

@ -2,9 +2,20 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="32d5efaa-a329-4d17-ae1e-897afa4db3d0" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/resources/views/lot/add.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/welcome.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/welcome.blade.php" afterDir="false" />
<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$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -22,7 +33,7 @@
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
<caret line="40" column="87" lean-forward="true" selection-start-line="40" selection-start-column="87" selection-end-line="40" selection-end-column="87" />
<caret line="40" column="87" selection-start-line="40" selection-start-column="87" selection-end-line="40" selection-end-column="87" />
</state>
</provider>
</entry>
@ -30,7 +41,7 @@
<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="371">
<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>
@ -39,8 +50,8 @@
<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="341">
<caret line="81" column="33" lean-forward="true" selection-start-line="81" selection-start-column="33" selection-end-line="81" selection-end-column="33" />
<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" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>
@ -60,8 +71,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="1" selection-start-line="18" selection-start-column="1" selection-end-line="18" selection-end-column="1" />
<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>
</provider>
</entry>
@ -84,20 +95,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<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>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/lot/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="101" selection-start-line="16" selection-start-column="101" selection-end-line="16" selection-end-column="101" />
<state relative-caret-position="83">
<caret line="34" column="129" selection-start-line="34" selection-start-column="129" selection-end-line="34" selection-end-column="129" />
</state>
</provider>
</entry>
@ -122,13 +124,15 @@
<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/lot/add.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$/app/ParkingLot.php" />
<option value="$PROJECT_DIR$/resources/views/selectstalls.blade.php" />
<option value="$PROJECT_DIR$/resources/views/welcome.blade.php" />
<option value="$PROJECT_DIR$/.env" />
<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$/app/ParkingLot.php" />
<option value="$PROJECT_DIR$/routes/web.php" />
</list>
</option>
@ -370,18 +374,18 @@
<option name="presentableId" value="Default" />
<updated>1549706447395</updated>
<workItem from="1549706448757" duration="961000" />
<workItem from="1549723735384" duration="11855000" />
<workItem from="1549723735384" duration="19529000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="12816000" />
<option name="totallyTimeSpent" value="20490000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="27" width="1920" height="1053" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2524013" />
<window_info active="true" 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" />
@ -396,7 +400,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 active="true" anchor="bottom" id="Terminal" order="11" visible="true" weight="0.32972974" />
<window_info 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" />
@ -424,23 +428,9 @@
</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">
<caret line="26" column="61" selection-start-line="26" selection-start-column="61" selection-end-line="26" selection-end-column="61" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/img/references/1549728481.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="101" selection-start-line="16" selection-start-column="101" selection-end-line="16" selection-end-column="101" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/auth/register.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
@ -462,38 +452,66 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<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="270">
<caret line="18" column="1" selection-start-line="18" selection-start-column="1" selection-end-line="18" selection-end-column="1" />
<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>
<entry file="file://$PROJECT_DIR$/database/migrations/2019_02_09_200020_add_columns_to_parking_lots.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="18" column="5" lean-forward="true" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
</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">
<caret line="26" column="61" selection-start-line="26" selection-start-column="61" selection-end-line="26" selection-end-column="61" />
</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">
<caret line="34" column="129" selection-start-line="34" selection-start-column="129" selection-end-line="34" selection-end-column="129" />
</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="371">
<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>
<entry file="file://$PROJECT_DIR$/resources/views/welcome.blade.php">
<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="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="450">
<caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
<caret line="40" column="87" lean-forward="true" selection-start-line="40" selection-start-column="87" selection-end-line="40" selection-end-column="87" />
<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>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/web.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="341">
<caret line="81" column="33" lean-forward="true" selection-start-line="81" selection-start-column="33" selection-end-line="81" selection-end-column="33" />
<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" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>

@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class ParkingLot extends Model
{
protected $fillable = [ 'firebase_id', 'stall_coordinates', 'reference_image' ];
protected $fillable = [ 'firebase_id', 'stall_coordinates', 'reference_image', 'number_of_columns', 'name' ];
public function get_coordinates(){
return json_decode( $this->stall_coordinates );

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

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

@ -31,6 +31,20 @@
</div>
</div>
<div class="form-group row">
<label for="numcols" class="col-md-4 col-form-label text-md-right">{{ __('Number of Reference Columns') }}</label>
<div class="col-md-6">
<input id="numcols" type="text" class="form-control{{ $errors->has('numcols') ? ' is-invalid' : '' }}" name="numcols" value="{{ old('numcols') }}" required autofocus>
@if ($errors->has('numcols'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('numcols') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="image" class="col-md-4 col-form-label text-md-right">{{ __('Reference Image') }}</label>

@ -38,11 +38,15 @@ Route::post('/lot/post', function(\Illuminate\Http\Request $request) {
// $this->save();
$lot_object = new ParkingLot([
'firebase_id' => str_replace(' ', '-', $request->get('name')),
'firebase_id' => 'Lot',
'stall_coordinates' => '',
'reference_image' => $name
'reference_image' => $name,
'number_of_columns' => $request->get('numcols'),
'name' => $request->get('name')
]);
$lot_object->save();
$lot_object->firebase_id = 'Lot'.$lot_object->id;
$lot_object->save();
return view('selectstalls', [ 'image_name' => $name, 'lot_id' => $lot_object->id ]);
@ -54,6 +58,35 @@ Route::post('/lot/generate', function(\Illuminate\Http\Request $request){
$lot_object->stall_coordinates = $request->get('coords');
$lot_object->save();
$coordgroup = json_decode($request->get('coords'));
$coordarrs = [];
foreach( $coordgroup as $group ){
array_push($coordarrs, ['x'=>$group->x, 'y'=>$group->y, 'w'=>$group->w, 'h'=>$group->h]);
}
// var_dump($coordarrs);
usort($coordarrs, function($a, $b){
return $a['y'] <=> $b['y'];
});
// var_dump($coordarrs);
$coordarrs_chunks = array_chunk($coordarrs, $lot_object->number_of_columns);
foreach($coordarrs_chunks as $key=>$chunk ){
usort($chunk, function($a, $b) {
return $a['x'] <=> $b['x'];
});
$coordarrs_chunks[$key] = $chunk;
}
$stall_coords_1D = call_user_func_array('array_merge', $coordarrs_chunks);
$lot_object->stall_coordinates = json_encode($stall_coords_1D);
// dd([$coordarrs_chunks, $stall_coords_1D]);
$db = new FirestoreClient();
$doc_ref = $db->collection('lots')->document($lot_object->firebase_id);
@ -65,20 +98,22 @@ Route::post('/lot/generate', function(\Illuminate\Http\Request $request){
'lotID' => $lot_object->id,
'refImage' => $lot_object->reference_image,
'tableLayout' => '',
'columns' => $lot_object->number_of_columns,
'name' => $lot_object->name
]);
$coords = json_decode($lot_object->stall_coordinates);
// $coords = json_decode($lot_object->stall_coordinates);
$stall_no = 1;
foreach ($coords as $coord){
foreach ($stall_coords_1D as $coord){
$doc_ref = $db->collection('lots')->document($lot_object->firebase_id)->collection('stalls')->document('Stall-'.$stall_no);
$doc_ref->set([
'handicap' => false,
'locationX' => $coord->x,
'locationY' => $coord->y,
'locationX' => $coord['x'],
'locationY' => $coord['y'],
'open' => true,
'passID' => 0,
'width' => $coord->w,
'height' => $coord->h,
'width' => $coord['w'],
'height' => $coord['h'],
'stall' => $stall_no,
]);

Loading…
Cancel
Save