Loading app/Http/Controllers/SecuritySheets/SecuritySheetController.php +7 −4 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ namespace App\Http\Controllers\SecuritySheets; use App\Models\User; use Illuminate\Http\Request; use App\Models\DivingSession; use App\Models\DivingLocation; use App\Http\Controllers\Controller; Loading @@ -30,10 +29,14 @@ public function __construct(){ * @return string|\View what to display on the page (what the strategy returns) */ public function generate(string $ds_code){ $html = self::callPdfBuilderView($ds_code); $html = self::callView($ds_code, 'securitySheet.pdf'); return $this->strategy->generatePdf($html, $ds_code); } public function edit(string $ds_code){ return self::callView($ds_code, 'securitySheet.edit'); } /** * Sets the strategy for the security sheet and returns this instance. * @param $strategy the strategy Loading @@ -49,7 +52,7 @@ public function setStrategy(SecuritySheetStrategy $strategy){ * @param $ds_code the code of the diving session * @return string the HTML code */ private function callPdfBuilderView(string $ds_code){ private function callView(string $ds_code, string $viewName){ $dive = DivingSession::find($ds_code); $director = User::find($dive->US_ID_CAR_DIRECT); Loading @@ -69,7 +72,7 @@ private function callPdfBuilderView(string $ds_code){ ]; } return view('securitySheet.pdf', [ return view($viewName, [ 'dive' => $dive, 'director' => $director, 'surfaceSecurity' => $surfaceSecurity, Loading public/js/securitySheets/edit.js 0 → 100644 +43 −0 Original line number Diff line number Diff line // DOM Elements const observationField = document.getElementById('observation-field'); const startTimes = document.getElementsByClassName('dg-start'); const endTimes = document.getElementsByClassName('dg-end'); const expectedTimes = document.getElementsByClassName('dg-exp-time'); const actualTimes = document.getElementsByClassName('dg-act-time'); const expectedDepths = document.getElementsByClassName('dg-exp-dep'); const actualDepths = document.getElementsByClassName('dg-act-dep'); const inputsElement = gatherInputsElement(); const generateButton = document.getElementById('button'); const diveId = document.getElementById('divingSessionId').getAttribute('content'); generateButton.addEventListener('click', generate); function generate(){ let group = { 'start' : startTimes[5].value, 'end' : endTimes[5].value, 'exp-time' : expectedTimes[5].value, 'act-time' : actualTimes[5].value, 'exp-dep' : expectedDepths[5].value, 'act-dep' : actualDepths[5].value }; console.log(JSON.stringify(group)); } function gatherInputsElement(){ let elements = []; Array.prototype.push.apply(elements, startTimes); Array.prototype.push.apply(elements, endTimes); Array.prototype.push.apply(elements, expectedTimes); Array.prototype.push.apply(elements, actualTimes); Array.prototype.push.apply(elements, expectedDepths); Array.prototype.push.apply(elements, actualDepths); console.log(elements.length); return elements; } No newline at end of file resources/views/components/security-sheets/cell.blade.php 0 → 100644 +3 −0 Original line number Diff line number Diff line <td class="border-2 border-solid border-black" colspan="{{$colspan ?? ''}}"> {{$slot}} </td> No newline at end of file resources/views/components/security-sheets/divers-header.blade.php 0 → 100644 +3 −0 Original line number Diff line number Diff line <tr class="bg-[#D8D8D8]"> {{$slot}} </tr> No newline at end of file resources/views/components/security-sheets/diving-group-table.blade.phpdeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <table > <colgroup> <col width="135"> <col width="225"> <col width="125"> <col width="220"> </colgroup> <!-- Table's header --> <tr class="diving-group-header"><td colspan="4"><strong> PALANQUEE n° {{$groupNum}} </strong></td></tr> {{$slot}} </table> No newline at end of file Loading
app/Http/Controllers/SecuritySheets/SecuritySheetController.php +7 −4 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ namespace App\Http\Controllers\SecuritySheets; use App\Models\User; use Illuminate\Http\Request; use App\Models\DivingSession; use App\Models\DivingLocation; use App\Http\Controllers\Controller; Loading @@ -30,10 +29,14 @@ public function __construct(){ * @return string|\View what to display on the page (what the strategy returns) */ public function generate(string $ds_code){ $html = self::callPdfBuilderView($ds_code); $html = self::callView($ds_code, 'securitySheet.pdf'); return $this->strategy->generatePdf($html, $ds_code); } public function edit(string $ds_code){ return self::callView($ds_code, 'securitySheet.edit'); } /** * Sets the strategy for the security sheet and returns this instance. * @param $strategy the strategy Loading @@ -49,7 +52,7 @@ public function setStrategy(SecuritySheetStrategy $strategy){ * @param $ds_code the code of the diving session * @return string the HTML code */ private function callPdfBuilderView(string $ds_code){ private function callView(string $ds_code, string $viewName){ $dive = DivingSession::find($ds_code); $director = User::find($dive->US_ID_CAR_DIRECT); Loading @@ -69,7 +72,7 @@ private function callPdfBuilderView(string $ds_code){ ]; } return view('securitySheet.pdf', [ return view($viewName, [ 'dive' => $dive, 'director' => $director, 'surfaceSecurity' => $surfaceSecurity, Loading
public/js/securitySheets/edit.js 0 → 100644 +43 −0 Original line number Diff line number Diff line // DOM Elements const observationField = document.getElementById('observation-field'); const startTimes = document.getElementsByClassName('dg-start'); const endTimes = document.getElementsByClassName('dg-end'); const expectedTimes = document.getElementsByClassName('dg-exp-time'); const actualTimes = document.getElementsByClassName('dg-act-time'); const expectedDepths = document.getElementsByClassName('dg-exp-dep'); const actualDepths = document.getElementsByClassName('dg-act-dep'); const inputsElement = gatherInputsElement(); const generateButton = document.getElementById('button'); const diveId = document.getElementById('divingSessionId').getAttribute('content'); generateButton.addEventListener('click', generate); function generate(){ let group = { 'start' : startTimes[5].value, 'end' : endTimes[5].value, 'exp-time' : expectedTimes[5].value, 'act-time' : actualTimes[5].value, 'exp-dep' : expectedDepths[5].value, 'act-dep' : actualDepths[5].value }; console.log(JSON.stringify(group)); } function gatherInputsElement(){ let elements = []; Array.prototype.push.apply(elements, startTimes); Array.prototype.push.apply(elements, endTimes); Array.prototype.push.apply(elements, expectedTimes); Array.prototype.push.apply(elements, actualTimes); Array.prototype.push.apply(elements, expectedDepths); Array.prototype.push.apply(elements, actualDepths); console.log(elements.length); return elements; } No newline at end of file
resources/views/components/security-sheets/cell.blade.php 0 → 100644 +3 −0 Original line number Diff line number Diff line <td class="border-2 border-solid border-black" colspan="{{$colspan ?? ''}}"> {{$slot}} </td> No newline at end of file
resources/views/components/security-sheets/divers-header.blade.php 0 → 100644 +3 −0 Original line number Diff line number Diff line <tr class="bg-[#D8D8D8]"> {{$slot}} </tr> No newline at end of file
resources/views/components/security-sheets/diving-group-table.blade.phpdeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <table > <colgroup> <col width="135"> <col width="225"> <col width="125"> <col width="220"> </colgroup> <!-- Table's header --> <tr class="diving-group-header"><td colspan="4"><strong> PALANQUEE n° {{$groupNum}} </strong></td></tr> {{$slot}} </table> No newline at end of file