add handicap mgmt

This commit is contained in:
glmdev 2019-02-10 03:40:12 -06:00
parent 310d1da6f2
commit ed20b0346e
3 changed files with 75 additions and 35 deletions

View File

@ -2,6 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="32d5efaa-a329-4d17-ae1e-897afa4db3d0" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/resources/views/lot/manageone.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/lot/manageone.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" />
@ -18,8 +19,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="198" column="24" selection-start-line="198" selection-start-column="24" selection-end-line="198" selection-end-column="24" />
<state relative-caret-position="331">
<caret line="187" column="33" lean-forward="true" selection-start-line="187" selection-start-column="33" selection-end-line="187" selection-end-column="33" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>
@ -27,6 +28,18 @@
</provider>
</entry>
</file>
<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="210">
<caret line="14" lean-forward="true" selection-start-line="14" selection-end-line="14" />
<folding>
<element signature="e#23#62#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/resources/views/device/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
@ -39,8 +52,8 @@
<file pinned="false" current-in-tab="false">
<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" />
<state relative-caret-position="466">
<caret line="56" lean-forward="true" selection-start-line="56" selection-end-line="56" />
<folding>
<element signature="e#1014#1076#0#HTML" expanded="true" />
<element signature="e#1260#1322#0#HTML" expanded="true" />
@ -87,6 +100,11 @@
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>firebase_id</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -111,8 +129,8 @@
<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$/resources/views/device/add.blade.php" />
<option value="$PROJECT_DIR$/resources/views/lot/manageone.blade.php" />
<option value="$PROJECT_DIR$/routes/web.php" />
</list>
</option>
@ -369,12 +387,12 @@
<option name="presentableId" value="Default" />
<updated>1549706447395</updated>
<workItem from="1549706448757" duration="961000" />
<workItem from="1549723735384" duration="35629000" />
<workItem from="1549723735384" duration="38920000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="36590000" />
<option name="totallyTimeSpent" value="39881000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="27" width="1920" height="1053" extended-state="6" />
@ -468,13 +486,6 @@
</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">
@ -517,16 +528,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/ParkingLot.php">
<provider selected="true" editor-type-id="text-editor">
<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">
@ -548,17 +549,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/lot/manageone.blade.php">
<entry file="file://$PROJECT_DIR$/app/ParkingLot.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" />
<state relative-caret-position="210">
<caret line="14" lean-forward="true" selection-start-line="14" selection-end-line="14" />
<folding>
<element signature="e#1014#1076#0#HTML" expanded="true" />
<element signature="e#1260#1322#0#HTML" expanded="true" />
<element signature="e#23#62#0#PHP" expanded="true" />
</folding>
</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="-29">
<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/device/add.blade.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="296">
@ -566,10 +573,21 @@
</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="466">
<caret line="56" lean-forward="true" selection-start-line="56" selection-end-line="56" />
<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="341">
<caret line="198" column="24" selection-start-line="198" selection-start-column="24" selection-end-line="198" selection-end-column="24" />
<state relative-caret-position="331">
<caret line="187" column="33" lean-forward="true" selection-start-line="187" selection-start-column="33" selection-end-line="187" selection-end-column="33" />
<folding>
<element signature="e#7#26#0#PHP" expanded="true" />
</folding>

View File

@ -45,15 +45,16 @@
const csrf = document.createElement('input')
csrf.type = "hidden"
ids.name = "_token"
ids.value = "{{ csrf_token() }}"
csrf.name = "_token"
csrf.value = "{{ csrf_token() }}"
form.appendChild(ids)
form.appendChild(csrf)
document.appendChild(form)
document.body.appendChild(form)
// console.log(form)
form.submit()
console.log(handicap_ids)
}
</script>
<br><button class="btn btn-success" onclick="submit_handicap()">Save Changes</button>

View File

@ -183,6 +183,27 @@ Route::get('/lot/manage/{id}', function(\Illuminate\Http\Request $request, $id){
return view('lot.manageone', ['lot' => $lot, 'stalls' => $stalls, 'thruid' => $id]);
});
Route::post('/lot/manage/{id}', function(\Illuminate\Http\Request $request, $id){
// dd($request->get('handicaps'));
$lot = ParkingLot::find($id);
$handicaps = json_decode($request->get('handicaps'));
$db = new FirestoreClient();
$stalls_docref = $db->collection('lots')->document($lot->firebase_id)->collection('stalls');
$docs = $stalls_docref->documents();
foreach( $docs as $doc ){
if ( $doc->exists()){
$data = $stalls_docref->document($doc->id())->snapshot()->data();
$data['handicap'] = (in_array($doc->id(), $handicaps));
$stalls_docref->document($doc->id())->set($data);
}
}
return redirect(url('/lot/manage/'.$id));
});
Route::get('/device/add', function(){
return view('device.add');
});