From 997891bc4ac2d31ee0db497ae1772d16e6f9fd04 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 13 Nov 2022 17:03:05 +0530 Subject: [PATCH 01/32] Added Vue full calendar --- package.json | 10 +- resources/js/frontend/app.js | 18 +- .../frontend/components/ScheduleCalendar.vue | 22 ++ .../views/frontend/calendar/index.blade.php | 311 +--------------- .../frontend/calendar/index_old.blade.php | 338 ++++++++++++++++++ 5 files changed, 382 insertions(+), 317 deletions(-) create mode 100644 resources/js/frontend/components/ScheduleCalendar.vue create mode 100644 resources/views/frontend/calendar/index_old.blade.php diff --git a/package.json b/package.json index 1ff4fd3b..bc36488d 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,15 @@ "vue-template-compiler": "^2.6.10" }, "dependencies": { - "@fortawesome/fontawesome-free": "^5.12.1", - "font-awesome": "^4.7.0", - "bootstrap": "5.0.2", "@coreui/coreui": "^3.0.0", "@coreui/icons": "^1.0.1", + "@fortawesome/fontawesome-free": "^5.12.1", + "@fullcalendar/core": "^5.11.3", + "@fullcalendar/daygrid": "^5.11.3", + "@fullcalendar/interaction": "^5.11.3", + "@fullcalendar/vue": "^5.11.2", + "bootstrap": "5.0.2", + "font-awesome": "^4.7.0", "mix": "^0.0.1", "urix": "^0.1.0" } diff --git a/resources/js/frontend/app.js b/resources/js/frontend/app.js index 292587fa..b3f7c1f3 100644 --- a/resources/js/frontend/app.js +++ b/resources/js/frontend/app.js @@ -4,10 +4,10 @@ * building robust, powerful web applications using Vue and Laravel. */ -require('../bootstrap'); -require('../plugins'); +require("../bootstrap"); +require("../plugins"); -import Vue from 'vue'; +import Vue from "vue"; /** * The following block of code may be used to automatically register your @@ -20,7 +20,15 @@ import Vue from 'vue'; // const files = require.context('./', true, /\.vue$/i) // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) -Vue.component('example-component', require('./components/ExampleComponent.vue').default); +Vue.component( + "example-component", + require("./components/ExampleComponent.vue").default +); + +Vue.component( + "fullcalendar-component", + require("./components/ScheduleCalendar.vue").default +); /** * Next, we will create a fresh Vue application instance and attach it to @@ -29,5 +37,5 @@ Vue.component('example-component', require('./components/ExampleComponent.vue'). */ const app = new Vue({ - el: '#app', + el: "#app", }); diff --git a/resources/js/frontend/components/ScheduleCalendar.vue b/resources/js/frontend/components/ScheduleCalendar.vue new file mode 100644 index 00000000..943cf5fb --- /dev/null +++ b/resources/js/frontend/components/ScheduleCalendar.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/resources/views/frontend/calendar/index.blade.php b/resources/views/frontend/calendar/index.blade.php index 42fd5ccc..cd59cd1c 100644 --- a/resources/views/frontend/calendar/index.blade.php +++ b/resources/views/frontend/calendar/index.blade.php @@ -1,304 +1,7 @@ @extends('frontend.layouts.app') -@section('title', appName().' | '.$station->stationName ) +@section('title', appName() . ' | ' . $station->stationName) -@push('after-styles') - - -@endpush - -@push('after-scripts') - - - - - - - - -@endpush @section('content') @@ -323,16 +26,6 @@ function isAnOverlapEvent(eventStartDay, eventEndDay) {
-
-
-

Schedule Reservation - {{ $station->stationName }}

-
- -
-
-
-
-
-
+
@endsection diff --git a/resources/views/frontend/calendar/index_old.blade.php b/resources/views/frontend/calendar/index_old.blade.php new file mode 100644 index 00000000..42fd5ccc --- /dev/null +++ b/resources/views/frontend/calendar/index_old.blade.php @@ -0,0 +1,338 @@ +@extends('frontend.layouts.app') + +@section('title', appName().' | '.$station->stationName ) + +@push('after-styles') + + +@endpush + +@push('after-scripts') + + + + + + + + +@endpush + +@section('content') + + + +
+
+
+

Schedule Reservation - {{ $station->stationName }}

+
+ +
+
+
+
+
+
+
+@endsection From 000e9797786ff738360c4290306670ec4bce2efb Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 13 Nov 2022 20:14:16 +0530 Subject: [PATCH 02/32] Full Calendar updates --- .../Frontend/CalendarController.php | 30 +++++- app/Http/Kernel.php | 4 +- package.json | 1 + .../frontend/components/ScheduleCalendar.vue | 102 +++++++++++++++++- .../views/frontend/calendar/index.blade.php | 13 ++- routes/api.php | 12 +-- routes/frontend/reservations.php | 18 +++- 7 files changed, 159 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/Frontend/CalendarController.php b/app/Http/Controllers/Frontend/CalendarController.php index d1a07796..63abcaff 100644 --- a/app/Http/Controllers/Frontend/CalendarController.php +++ b/app/Http/Controllers/Frontend/CalendarController.php @@ -3,10 +3,12 @@ namespace App\Http\Controllers\Frontend; use App\Models\Reservation; +use Carbon\Carbon; use App\Models\Stations; use Illuminate\Http\Request; use App\Domains\Auth\Models\User; use App\Http\Controllers\Controller; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Session; class CalendarController extends Controller @@ -18,10 +20,11 @@ public function index(Stations $station) $events = array(); // Get all the reservations for that particular station - $bookings = Reservation::where('station_id', $station->id)->get(); + $bookings = Reservation::where('station_id', $station->id)->where('start_date', '>', Carbon::now()->subDays(8))->get(); foreach ($bookings as $booking) { $userVar = User::find($booking->user_id); + $events[] = [ 'id' => $booking->id, 'title' => 'Reservation made by ' . $userVar->email . ' for ' . $booking->E_numbers, @@ -35,6 +38,26 @@ public function index(Stations $station) return view('frontend.calendar.index', ['events' => $events, 'station' => $station, 'userLoggedin' => $userLoggedin]); } + public function list(Stations $station) + { + $events = array(); + $bookings = Reservation::where('station_id', $station->id)->where('start_date', '>', Carbon::now()->subDays(8))->get(); + + foreach ($bookings as $booking) { + $userVar = User::find($booking->user_id); + $events[] = [ + 'id' => $booking->id, + 'title' => 'Reservation made by ' . $userVar->email . ' for ' . $booking->E_numbers, + 'start' => $booking->start_date, + 'end' => $booking->end_date, + 'stationId' => $station->id, + 'auth' => $booking->user_id, + 'user' => Auth::id() + ]; + } + return response()->json($events); + } + public function store(Request $request) { @@ -79,7 +102,6 @@ public function store(Request $request) 'color' => $color ? $color : '', ]); - } else { // Print message return response()->json([ @@ -127,14 +149,12 @@ public function update(Request $request, $id) 'end_date' => $request->end_date, ]); return response()->json('Event updated'); - } public function destroy($id) { $booking = Reservation::find($id); - if (!$booking) { return response()->json([ 'error' => 'Unable to locate the event' @@ -145,4 +165,4 @@ public function destroy($id) return $id; } -} +} \ No newline at end of file diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 36e98dca..69bdd780 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -49,6 +49,8 @@ class Kernel extends HttpKernel EnsureFrontendRequestsAreStateful::class, 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, + \App\Http\Middleware\EncryptCookies::class, // <------- ADD THIS + \Illuminate\Session\Middleware\StartSession::class, // <------ ADD THIS ], 'admin' => [ @@ -116,4 +118,4 @@ class Kernel extends HttpKernel \Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Auth\Middleware\Authorize::class, ]; -} +} \ No newline at end of file diff --git a/package.json b/package.json index bc36488d..ebff6e39 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@fullcalendar/core": "^5.11.3", "@fullcalendar/daygrid": "^5.11.3", "@fullcalendar/interaction": "^5.11.3", + "@fullcalendar/timegrid": "^5.11.3", "@fullcalendar/vue": "^5.11.2", "bootstrap": "5.0.2", "font-awesome": "^4.7.0", diff --git a/resources/js/frontend/components/ScheduleCalendar.vue b/resources/js/frontend/components/ScheduleCalendar.vue index 943cf5fb..8e70e593 100644 --- a/resources/js/frontend/components/ScheduleCalendar.vue +++ b/resources/js/frontend/components/ScheduleCalendar.vue @@ -2,15 +2,108 @@ import FullCalendar from '@fullcalendar/vue' import dayGridPlugin from '@fullcalendar/daygrid' +import timeGridPlugin from '@fullcalendar/timegrid' import interactionPlugin from '@fullcalendar/interaction'; +import axios from "axios"; export default { components: { - FullCalendar // make the tag available + FullCalendar + }, + props: ['stationId','userId'], + mounted(){ + this.getEvents(); + console.log("StationId", this.stationId); + console.log("UserId", this.userId); + }, + methods: { + getEvents () { + axios.get('/sanctum/csrf-cookie').then(response => { + console.log(response); + axios.get(`${this.baseURL}/reservations/${this.stationId}/`) + .then(response => { + const data = response.data; + console.log(data); + + this.calendarOptions.events = data.map(data => { + const color = (data.auth == this.userId) ? '#435258' : '#3E9CC2'; + return { ...data, color: color }; + }); + }); + }); + }, + createReservation(data){ + // TODO: Create a reservation + console.log("create: ", data); + + }, + deleteReservation(data){ + console.log("delete: ", data); + + const event = data.event; + if (event.extendedProps.auth === this.userId) { + // TODO: Make a modal popup + if (confirm('Are you sure you want to delete this event?')) { + axios.delete(`${this.baseURL}/reservations/${event.id}`) + .then((resp) => { + alert('Deleted'); + }) + .then( ()=>{ + this.getEvents(); + }) + .catch((error) => { + alert(error.response.status); + }); + } + } else { + // TODO: Make a modal popup + alert("Permission Denied!", "You can not delete this event!", "warning"); + } + }, + updateReservation(data){ + // TODO: Update event + console.log("update: ", data); + } }, data() { return { - calendarPlugins: [dayGridPlugin, interactionPlugin] + baseURL: '', + calendarEvents: [], + calendarOptions: { + plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin], + initialView: 'timeGridWeek', + + events: this.calendarEvents, + + selectable: true, + selectHelper: true, + editable: true, + eventOverlap: false, + + height: "auto", + expandRows: true, + + allDaySlot: false, + firstDay: 0, // 0: Sunday + nowIndicator: true, + + slotMinTime:"08:00:00", + slotMaxTime:"19:00:00", + slotDuyration: "00:30:00", + + // dayClick: function (date, jsEvent, view) { }, + // eventRender: function eventRender(event, element, view) { }, + + select: function (event) { + + console.log("eventCreate: ", event); + }, + + eventResize: this.updateReservation, + eventDrop: this.updateReservation, + eventClick: this.deleteReservation, + // selectAllow: function (event) {} + } } } } @@ -18,5 +111,8 @@ export default { \ No newline at end of file diff --git a/resources/views/frontend/calendar/index.blade.php b/resources/views/frontend/calendar/index.blade.php index cd59cd1c..b54069ee 100644 --- a/resources/views/frontend/calendar/index.blade.php +++ b/resources/views/frontend/calendar/index.blade.php @@ -2,7 +2,6 @@ @section('title', appName() . ' | ' . $station->stationName) - @section('content')
- +
+
+

Schedule Reservation - {{ $station->stationName }}

+
+ +
+ +
+
+
+ @endsection diff --git a/routes/api.php b/routes/api.php index 266fbfc9..0f7bdbbd 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,20 +1,18 @@ 'api.'], function () { - includeRouteFiles(__DIR__.'/api/'); + includeRouteFiles(__DIR__ . '/api/'); }); Route::group(['prefix' => 'v1'], function () { // Throttle requests to 3 every 10 mins by each IP. This is to prevent the server from being flooded with requests. // It's only used by the CE FAQ site and Makerspace wiki anyway - Route::get('/locations', [LocationAPI::class,'index'])->middleware("throttle:3,10"); - -}); - - + Route::get('/locations', [LocationAPI::class, 'index'])->middleware("throttle:3,10"); +}); \ No newline at end of file diff --git a/routes/frontend/reservations.php b/routes/frontend/reservations.php index 6d3d19f0..9243a9b7 100644 --- a/routes/frontend/reservations.php +++ b/routes/frontend/reservations.php @@ -13,6 +13,18 @@ ->push(__('Reservations')); }); -Route::post('reservations', [CalendarController::class, 'store'])->name('calendar.store'); -Route::patch('reservations/update/{id}', [CalendarController::class, 'update'])->name('calendar.update'); -Route::delete('reservations/destroy/{id}', [CalendarController::class, 'destroy'])->name('calendar.destroy'); \ No newline at end of file +// Route::post('reservations', [CalendarController::class, 'store'])->name('calendar.store'); +// Route::patch('reservations/update/{id}', [CalendarController::class, 'update'])->name('calendar.update'); +// Route::delete('reservations/destroy/{id}', [CalendarController::class, 'destroy'])->name('calendar.destroy'); + + + +// TODO: Move into /api/ routes +Route::group(['prefix' => 'reservations'], function () { + Route::middleware(['auth'])->group(function () { + Route::get('/{station}/', [CalendarController::class, 'list'])->name('calendar.list'); + Route::post('/', [CalendarController::class, 'store'])->name('calendar.store'); + Route::patch('/{id}', [CalendarController::class, 'update'])->name('calendar.update'); + Route::delete('/{id}', [CalendarController::class, 'destroy'])->name('calendar.destroy'); + }); +}); \ No newline at end of file From d88354d4c27b63dd983ddda8b8e05f2014ca4e11 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 13 Nov 2022 20:34:49 +0530 Subject: [PATCH 03/32] Merge fixes --- .../Controllers/Frontend/CalendarController.php | 5 ----- app/Models/Stations.php | 12 +++--------- routes/frontend/reservations.php | 17 ++++++++++------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/Frontend/CalendarController.php b/app/Http/Controllers/Frontend/CalendarController.php index 6020c462..ef7a5f1a 100644 --- a/app/Http/Controllers/Frontend/CalendarController.php +++ b/app/Http/Controllers/Frontend/CalendarController.php @@ -29,10 +29,6 @@ public function index(Stations $station) // Get all the reservations for that particular station $bookings = Reservation::where('station_id', $station->id)->where('start_date', '>', Carbon::now()->subDays(8))->where('start_date', '>', Carbon::now()->subDays(8))->get(); - $color = null; - - - foreach ($bookings as $booking) { $userVar = User::find($booking->user_id); $events[] = [ @@ -42,7 +38,6 @@ public function index(Stations $station) 'end' => $booking->end_date, 'stationId' => $station->id, 'auth' => $booking->user_id, - 'color' => $color, ]; } diff --git a/app/Models/Stations.php b/app/Models/Stations.php index 7e8c7020..f323c2ed 100644 --- a/app/Models/Stations.php +++ b/app/Models/Stations.php @@ -9,11 +9,11 @@ class Stations extends Model { use HasFactory; - protected $fillable = ['stationName', 'description', 'thumb','capacity']; + protected $fillable = ['stationName', 'description', 'thumb', 'capacity']; public function inventoryCode() { - return sprintf("ST/%02d",$this->id); + return sprintf("ST/%02d", $this->id); } // Return the relative URL of the thumbnail @@ -22,10 +22,4 @@ public function thumbURL() if ($this->thumb != null) return '/img/stations/' . $this->thumb; return null; } - - public function inventoryCode() - { - return sprintf("ST/%03d", $this->id); - } - -} +} \ No newline at end of file diff --git a/routes/frontend/reservations.php b/routes/frontend/reservations.php index 27f17879..0258fece 100644 --- a/routes/frontend/reservations.php +++ b/routes/frontend/reservations.php @@ -55,11 +55,14 @@ ->push(__('Delete')); }); - // Destroy - Route::delete('reservation/destroy/{reservation}', [ReservationController::class, 'destroy']) - ->name('reservation.destroy'); - Route::post('reservations', [CalendarController::class, 'store'])->name('calendar.store'); - Route::patch('reservations/update/{id}', [CalendarController::class, 'update'])->name('calendar.update'); - Route::delete('reservations/destroy/{id}', [CalendarController::class, 'destroy'])->name('calendar.destroy'); -}); + // API Routes + + // TODO: Move into /api/ routes + Route::group(['prefix' => 'reservations'], function () { + Route::get('/{station}/', [CalendarController::class, 'list'])->name('calendar.list'); + Route::post('/', [CalendarController::class, 'store'])->name('calendar.store'); + Route::patch('/{id}', [CalendarController::class, 'update'])->name('calendar.update'); + Route::delete('/{id}', [CalendarController::class, 'destroy'])->name('calendar.destroy'); + }); +}); \ No newline at end of file From 10f1c7ba1e51767beaa21f773a44f0ed63565756 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 13 Nov 2022 20:59:23 +0530 Subject: [PATCH 04/32] A few merge issues were fixed --- .../Backend/ConsumableItemController.php | 12 +- .../Backend/EquipmentItemController.php | 4 +- .../Controllers/Backend/StationController.php | 14 +- .../backend/consumable/items/edit.blade.php | 251 +++++------------- .../backend/consumable/items/index.blade.php | 56 +--- .../backend/equipment/items/index.blade.php | 59 +--- 6 files changed, 80 insertions(+), 316 deletions(-) diff --git a/app/Http/Controllers/Backend/ConsumableItemController.php b/app/Http/Controllers/Backend/ConsumableItemController.php index 779175b4..d5eb3a9e 100644 --- a/app/Http/Controllers/Backend/ConsumableItemController.php +++ b/app/Http/Controllers/Backend/ConsumableItemController.php @@ -99,10 +99,8 @@ public function show(ConsumableItem $consumableItem) public function edit(ConsumableItem $consumableItem) { $types = ConsumableType::pluck('title', 'id'); - $this_item_location = ItemLocations::where('item_id', $consumableItem->inventoryCode())->get()[0]['location_id']; - // dd($this_item_location); $locations = Locations::pluck('location', 'id'); - return view('backend.consumable.items.edit', compact('types', 'consumableItem', 'locations', 'this_item_location')); + return view('backend.consumable.items.edit', compact('types', 'consumableItem', 'locations')); } /** @@ -131,18 +129,10 @@ public function update(Request $request, ConsumableItem $consumableItem) $data['thumb'] = $this->uploadThumb($consumableItem->thumbURL(), $request->thumb, "consumable_items"); } - $filtered_data = $data; unset($filtered_data['location']); $consumableItem->update($filtered_data); - - $this_item_location = ItemLocations::where('item_id', $consumableItem->inventoryCode())->get()[0]; - $new_location_data = [ - 'location_id' => $data['location'] - ]; - $this_item_location->update($new_location_data); - return redirect()->route('admin.consumable.items.index')->with('Success', 'Consumable was updated !'); } catch (\Exception $ex) { return abort(500); diff --git a/app/Http/Controllers/Backend/EquipmentItemController.php b/app/Http/Controllers/Backend/EquipmentItemController.php index 37c9ed26..a217f38f 100644 --- a/app/Http/Controllers/Backend/EquipmentItemController.php +++ b/app/Http/Controllers/Backend/EquipmentItemController.php @@ -23,8 +23,8 @@ class EquipmentItemController extends Controller */ public function index() { - //$equipment = EquipmentItem::orderBy('id', 'asc')->paginate(16); - return view('backend.equipment.items.index'); + $equipment = EquipmentItem::orderBy('id', 'asc')->paginate(16); + return view('backend.equipment.items.index', compact('equipment')); } /** diff --git a/app/Http/Controllers/Backend/StationController.php b/app/Http/Controllers/Backend/StationController.php index bec8bde9..dea2c805 100644 --- a/app/Http/Controllers/Backend/StationController.php +++ b/app/Http/Controllers/Backend/StationController.php @@ -24,8 +24,8 @@ class StationController extends Controller */ public function index() { - //$station = Stations::orderBy('id')->paginate(16); - return view('backend.station.index'); + $station = Stations::orderBy('id')->paginate(16); + return view('backend.station.index', compact('station')); } /** @@ -63,12 +63,10 @@ public function store(Request $request) $type = new Stations($data); $type->save(); return redirect()->route('admin.station.index')->with('Success', 'Station was created !'); - } catch (\Exception $ex) { //dd($ex); return abort(500); } - } /** @@ -77,7 +75,7 @@ public function store(Request $request) * @param int $id * @return Application|Factory|View|\Illuminate\Http\Response */ - + public function show(Stations $station) { return view('backend.station.show', compact('station')); @@ -117,11 +115,9 @@ public function update(Request $request, Stations $station) } $station->update($data); return redirect()->route('admin.station.index')->with('Success', 'Station was updated !'); - } catch (\Exception $ex) { return abort(500); } - } /** @@ -149,7 +145,6 @@ public function destroy(Stations $station) $station->delete(); return redirect()->route('admin.station.index')->with('Success', 'Station was deleted !'); - } catch (\Exception $ex) { return abort(500); } @@ -178,5 +173,4 @@ private function uploadThumb($currentURL, $newImage, $folder) return $imageName; } - -} +} \ No newline at end of file diff --git a/resources/views/backend/consumable/items/edit.blade.php b/resources/views/backend/consumable/items/edit.blade.php index 44e6984b..6420656b 100644 --- a/resources/views/backend/consumable/items/edit.blade.php +++ b/resources/views/backend/consumable/items/edit.blade.php @@ -50,197 +50,86 @@ + +
+ {!! Form::label('specifications', 'Specifications', ['class' => 'col-md-2 col-form-label']) !!} -
- {!! Form::select('location', $locations, $this_item_location, [ - 'class' => 'form-control', - 'required' => true, - 'placeholder' => '', - ]) !!} - @error('location') - {{ $message }} - @enderror +
+ {!! Form::textarea('specifications', $consumableItem->specifications, ['class' => 'form-control', 'rows' => 3]) !!} + @error('specifications') + {{ $message }} + @enderror +
-
- {{--
--}} - {{-- --}} - {{-- {!! Form::label('brand', 'Brand', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{-- --}} - {{-- {!! Form::label('productCode', 'Product Code', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::text('productCode', $consumableItem->productCode, ['class'=>'form-control']) !!} --}} - {{-- @error('productCode') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - {{--
--}} - - - {{-- --}} - {{--
--}} - {{-- {!! Form::label('description', 'Description', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::textarea('description', $consumableItem->description, ['class'=>'form-control', 'rows'=>3 ]) !!} --}} - {{-- @error('description') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - {{--
--}} - - -
- {!! Form::label('specifications', 'Specifications', ['class' => 'col-md-2 col-form-label']) !!} - -
- {!! Form::textarea('specifications', $consumableItem->specifications, ['class' => 'form-control', 'rows' => 3]) !!} - @error('specifications') - {{ $message }} - @enderror -
-
+ +
+ {!! Form::label('quantity', 'Quantity', ['class' => 'col-md-2 col-form-label']) !!} - {{-- --}} - {{--
--}} - {{-- {!! Form::label('instructions', 'Usage Instructions', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::textarea('instructions', $consumableItem->instructions, ['class'=>'form-control', 'rows'=>3 ]) !!} --}} - {{-- @error('instructions') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - {{--
--}} - - - - {{--
--}} - {{-- {!! Form::label('size', 'Size', ['class' => 'col-sm-2 form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::select('size', ['very small'=>'very small', 'small'=> 'small', 'medium'=> 'medium','regular'=>'regular', 'large'=>'large','very large'=> 'very large'], $consumableItem->size, ['class'=>'form-control']) !!} --}} - {{-- @error('size') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - {{--
--}} - - -
- {!! Form::label('quantity', 'Quantity', ['class' => 'col-md-2 col-form-label']) !!} - -
- {!! Form::number('quantity', $consumableItem->quantity, ['class' => 'form-control']) !!} - @error('quantity') - {{ $message }} - @enderror -
-
+
+ {!! Form::number('quantity', $consumableItem->quantity, ['class' => 'form-control']) !!} + @error('quantity') + {{ $message }} + @enderror +
+
- -
- {!! Form::label('price', 'Price (LKR)', ['class' => 'col-md-2 col-form-label']) !!} + +
+ {!! Form::label('price', 'Price (LKR)', ['class' => 'col-md-2 col-form-label']) !!} -
- {!! Form::number('price', $consumableItem->price, ['class' => 'form-control']) !!} - @error('price') - {{ $message }} - @enderror -
-
+
+ {!! Form::number('price', $consumableItem->price, ['class' => 'form-control']) !!} + @error('price') + {{ $message }} + @enderror +
+
- {{-- --}} - {{--
--}} - {{-- {!! Form::label('Available?', '', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!!Form::checkbox('isAvailable',1, ($consumableItem->isAvailable)?true:false); !!} --}} - {{-- @error('isAvailable') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - {{--
--}} - -
- {{-- {!! Form::label('isElectrical', 'Electrical?', ['class' => 'col-md-2 form-check-label']) !!} --}} - - {{--
--}} - {{-- {!!Form::checkbox('isElectrical',1, ($consumableItem->isElectrical)?true:false); !!} --}} - {{-- @error('isElectrical') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} - - {{-- --}} - {{-- {!! Form::label('powerRating', 'Power Rating (Watts)', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::number('powerRating', $consumableItem->powerRating, ['class'=>'form-control']) !!} --}} - {{-- @error('powerRating') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - {{--
--}} -
- {{-- FormFactor --}} -
- {!! Form::label('formFactor', 'Form factor', ['class' => 'col-md-2 col-form-label']) !!} - -
- {!! Form::text('formFactor', $consumableItem->formFactor, ['class' => 'form-control']) !!} - @error('formFactor') - {{ $message }} - @enderror -
-
+ {{-- FormFactor --}} +
+ {!! Form::label('formFactor', 'Form factor', ['class' => 'col-md-2 col-form-label']) !!} - {{-- datasheetURL --}} -
- {!! Form::label('datasheetURL', 'Datasheet URL', ['class' => 'col-md-2 col-form-label']) !!} +
+ {!! Form::text('formFactor', $consumableItem->formFactor, ['class' => 'form-control']) !!} + @error('formFactor') + {{ $message }} + @enderror +
+
-
- {!! Form::text('datasheetURL', $consumableItem->datasheetURL, ['class' => 'form-control']) !!} - @error('datasheetURL') - {{ $message }} - @enderror -
-
- {{--
--}} - {{-- --}}{{-- voltageRating --}} - {{-- {!! Form::label('voltageRating', 'Voltage Rating', ['class' => 'col-md-2 col-form-label']) !!} --}} - - {{--
--}} - {{-- {!! Form::text('voltageRating', $consumableItem->voltageRating, ['class'=>'form-control']) !!} --}} - {{-- @error('voltageRating') --}} - {{-- {{ $message }} --}} - {{-- @enderror --}} - - {{--
--}} - - {{--
--}} - - -
- {!! Form::label('thumb', 'Thumbnail', ['class' => 'col-md-2 col-form-label']) !!} - -
- - {!! Form::file('thumb', ['accept' => '.jpeg,.png,.jpg,.gif,.svg']) !!} (Max: 2MB, use square - image) - @error('thumb') - {{ $message }} - @enderror -
-
+ {{-- datasheetURL --}} +
+ {!! Form::label('datasheetURL', 'Datasheet URL', ['class' => 'col-md-2 col-form-label']) !!} + +
+ {!! Form::text('datasheetURL', $consumableItem->datasheetURL, ['class' => 'form-control']) !!} + @error('datasheetURL') + {{ $message }} + @enderror +
+
+ + +
+ {!! Form::label('thumb', 'Thumbnail', ['class' => 'col-md-2 col-form-label']) !!} + +
+ + {!! Form::file('thumb', ['accept' => '.jpeg,.png,.jpg,.gif,.svg']) !!} (Max: 2MB, use square + image) + @error('thumb') + {{ $message }} + @enderror +
+
- - - {!! Form::submit('Update', ['class' => 'btn btn-primary float-right']) !!} - + + + {!! Form::submit('Update', ['class' => 'btn btn-primary float-right']) !!} + - - {!! Form::close() !!} + + {!! Form::close() !!} @endsection diff --git a/resources/views/backend/consumable/items/index.blade.php b/resources/views/backend/consumable/items/index.blade.php index 861912c9..e127d7f7 100644 --- a/resources/views/backend/consumable/items/index.blade.php +++ b/resources/views/backend/consumable/items/index.blade.php @@ -32,60 +32,8 @@ @endif - {{--
--}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - {{-- --}} - {{-- --}} - {{-- @foreach ($consumables as $cm) --}} - - {{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- - - {{-- --}} - {{-- @endforeach --}} - {{--
TitleProduct Code
and Brand
CategoryPrice (LKR)Voltage RatingForm factorQuantitySize 
{{ $cm->title }}{{ $cm->productCode ?? 'N/A' }} ({{ $cm->brand ?? 'N/A' }}) --}} - {{-- @if ($cm->consumable_type() != null) --}} - {{-- --}} - {{-- {{ $cm->consumable_type['title'] }} --}} - {{-- --}} - {{-- @endif --}} - {{-- {{ $cm->formFactor }}{{ $cm->powerRating }}{{ $cm->quantity }} --}} - {{--
--}} - {{--
--}} - {{-- --}} - {{-- --}} - - - - - -
-
-
--}} - - {{-- {{ $consumables->links() }} --}} - {{--
--}} - - + + @endsection diff --git a/resources/views/backend/equipment/items/index.blade.php b/resources/views/backend/equipment/items/index.blade.php index 516c5cfa..192400d5 100644 --- a/resources/views/backend/equipment/items/index.blade.php +++ b/resources/views/backend/equipment/items/index.blade.php @@ -31,64 +31,7 @@ @endif -
- - - - - - - - - - - - - - @foreach ($equipment as $eq) - - - - - - - - - - - {{-- --}} - - {{-- --}} - {{-- @endforeach --}} - {{--
CodeTitleProduct Code
and Brand
QuantityCategoryPrice (LKR)Dimensions(cm)
W x L x H
Weight (g) 
{{ $eq->inventoryCode() }}{{ $eq->title }}{{ $eq->productCode ?? 'N/A' }} ({{ $eq->brand ?? 'N/A' }}){{ $eq->quantity }} - @if ($eq->equipment_type() != null) - - {{ $eq->equipment_type['title'] }} - - @endif - {{ $eq->price }}{{ $eq->width }} x {{ $eq->height }} x {{ $eq->length }}{{ $eq->weight }} --}} - {{--
--}} - {{--
--}} - {{-- --}} - {{-- --}} - - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{--
--}} - {{--
--}} - {{--
--}} - - {{-- {{ $equipment->links() }} --}} -
+ From 6666fcc521fa22361b50e3c95ff6bc880c2916be Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sat, 19 Nov 2022 11:47:40 +0530 Subject: [PATCH 05/32] Location checkbox updates --- .../livewire/locations-toggler.blade.php | 84 +++++-------------- 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/resources/views/livewire/locations-toggler.blade.php b/resources/views/livewire/locations-toggler.blade.php index 49c80867..68288d0f 100644 --- a/resources/views/livewire/locations-toggler.blade.php +++ b/resources/views/livewire/locations-toggler.blade.php @@ -1,62 +1,24 @@ -
- - - - - - - - -
- - - - - - - - - - - - - - - - -
+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
- - - From fdf541e67f2d4c36fd2fec0f8cffb8271cab7cc2 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Wed, 7 Dec 2022 00:56:27 +0530 Subject: [PATCH 06/32] Announcements Basic Setup --- .../Announcement/Models/Announcement.php | 20 ++++- .../Backend/AnnouncementController.php | 82 +++++++++++++++++++ .../Livewire/Backend/AnnouncementTable.php | 64 +++++++++++++++ .../announcements/index-table-row.blade.php | 45 ++++++++++ .../backend/announcements/index.blade.php | 38 +++++++++ .../component/items/index-table-row.blade.php | 29 +++---- .../views/backend/includes/sidebar.blade.php | 42 +++------- routes/backend/announcements.php | 63 ++++++++++++++ 8 files changed, 337 insertions(+), 46 deletions(-) create mode 100644 app/Http/Controllers/Backend/AnnouncementController.php create mode 100644 app/Http/Livewire/Backend/AnnouncementTable.php create mode 100644 resources/views/backend/announcements/index-table-row.blade.php create mode 100644 resources/views/backend/announcements/index.blade.php create mode 100644 routes/backend/announcements.php diff --git a/app/Domains/Announcement/Models/Announcement.php b/app/Domains/Announcement/Models/Announcement.php index 50bf50de..386a05b4 100644 --- a/app/Domains/Announcement/Models/Announcement.php +++ b/app/Domains/Announcement/Models/Announcement.php @@ -50,6 +50,24 @@ class Announcement extends Model 'enabled' => 'boolean', ]; + public static function areas() + { + return [ + 'frontend' => 'Frontend', + 'backend' => 'Backend' + ]; + } + + public static function types() + { + return [ + 'info' => 'Info', + 'danger' => 'Danger', + 'warning' => 'Warning', + 'success' => 'Success' + ]; + } + /** * Create a new factory instance for the model. * @@ -59,4 +77,4 @@ protected static function newFactory() { return AnnouncementFactory::new(); } -} +} \ No newline at end of file diff --git a/app/Http/Controllers/Backend/AnnouncementController.php b/app/Http/Controllers/Backend/AnnouncementController.php new file mode 100644 index 00000000..daacad94 --- /dev/null +++ b/app/Http/Controllers/Backend/AnnouncementController.php @@ -0,0 +1,82 @@ +sortable(), + Column::make("Type", "type") + ->sortable(), + Column::make("Message", "message") + ->searchable(), + Column::make("Enabled", "enabled") + ->searchable(), + Column::make("Start", "starts_at"), + Column::make("End", "ends_at"), + Column::make("Actions") + ]; + } + + public function query(): Builder + { + return Announcement::query() + ->when($this->getFilter('area'), fn ($query, $status) => $query->where('area', $status)) + ->when($this->getFilter('type'), fn ($query, $type) => $query->where('type', $type)); + } + + public function filters(): array + { + $type = ["" => "Any"]; + foreach (Announcement::types() as $key => $value) { + $type[$key] = $value; + } + $area = ["" => "Any"]; + foreach (Announcement::areas() as $key => $value) { + $area[$key] = $value; + } + + return [ + 'area' => Filter::make('Display Area') + ->select($area), + 'type' => Filter::make('Type') + ->select($type), + ]; + } + + public function rowView(): string + { + return 'backend.announcements.index-table-row'; + } +} \ No newline at end of file diff --git a/resources/views/backend/announcements/index-table-row.blade.php b/resources/views/backend/announcements/index-table-row.blade.php new file mode 100644 index 00000000..b170173c --- /dev/null +++ b/resources/views/backend/announcements/index-table-row.blade.php @@ -0,0 +1,45 @@ + + @if ($row->area == App\Domains\Announcement\Models\Announcement::TYPE_FRONTEND) + Frontend + @elseif($row->area == App\Domains\Announcement\Models\Announcement::TYPE_BACKEND) + Backend + @else + Both + @endif + + + + {{ App\Domains\Announcement\Models\Announcement::types()[$row->type] }} + + + + {{ $row->message }} + + + + {{ $row->enabled ? 'Enabled' : 'Disabled' }} + + + + {{ $row->starts_at }} + + + + {{ $row->ends_at }} + + + +
+
+ + + + + + +
+
+
diff --git a/resources/views/backend/announcements/index.blade.php b/resources/views/backend/announcements/index.blade.php new file mode 100644 index 00000000..35de947e --- /dev/null +++ b/resources/views/backend/announcements/index.blade.php @@ -0,0 +1,38 @@ +@extends('backend.layouts.app') + +@section('title', __('Component')) + +@section('breadcrumb-links') + {{-- @include('backend.inventory.includes.breadcrumb-links') --}} +@endsection + +@section('content') +
+ + + Announcements + + + @if ($logged_in_user->hasInventoryAccess()) + + + + + @endif + + + + @if (session('Success')) +
+ {{ session('Success') }} + +
+ @endif + + +
+
+
+@endsection diff --git a/resources/views/backend/component/items/index-table-row.blade.php b/resources/views/backend/component/items/index-table-row.blade.php index 000d9b4c..15c72d8d 100644 --- a/resources/views/backend/component/items/index-table-row.blade.php +++ b/resources/views/backend/component/items/index-table-row.blade.php @@ -1,9 +1,9 @@ - {{ $row->inventoryCode() }} + {{ $row->inventoryCode() }} - {{ $row->title }} + {{ $row->title }} @@ -11,7 +11,7 @@ - @if($row ->component_type() != null) + @if ($row->component_type() != null) {{ $row->component_type['title'] }} @@ -19,22 +19,19 @@ -
+ - \ No newline at end of file + diff --git a/resources/views/backend/includes/sidebar.blade.php b/resources/views/backend/includes/sidebar.blade.php index 7b39bd45..8bb5db89 100644 --- a/resources/views/backend/includes/sidebar.blade.php +++ b/resources/views/backend/includes/sidebar.blade.php @@ -42,6 +42,11 @@ class="c-sidebar-nav-dropdown {{ activeClass(Route::is('admin.auth.user.*') || R + +
  • + +
  • @endif @@ -129,53 +134,32 @@ class="c-sidebar-nav-dropdown {{ activeClass(Route::is('admin.auth.user.*') || R {{-- Stations --}}
  • - +
      - + @if ($logged_in_user->isMaintainer() || $logged_in_user->isAdmin() || $logged_in_user->isTechOfficer())
    • - +
    • - +
    • - +
    • @else -
    • - +
    • - +
    • - - @endif
    diff --git a/routes/backend/announcements.php b/routes/backend/announcements.php new file mode 100644 index 00000000..94f8733f --- /dev/null +++ b/routes/backend/announcements.php @@ -0,0 +1,63 @@ +group(function () { + + Route::get('/announcements', function () { + return view('backend.announcements.index'); + })->name('announcements.index') + ->breadcrumbs(function (Trail $trail) { + $trail->push(__('Home'), route('admin.dashboard')) + ->push(__('Announcements'), route('admin.announcements.index')); + }); + + // Create + Route::get('announcements/create', [AnnouncementController::class, 'create']) + ->name('announcements.create') + ->breadcrumbs(function (Trail $trail) { + $trail->push(__('Home'), route('admin.dashboard')) + ->push(__('Announcements'), route('admin.announcements.index')) + ->push(__('Create')); + }); + + // Store + Route::post('announcements', [AnnouncementController::class, 'store']) + ->name('annoncements.store'); + + // Show + Route::get('announcements/{annoucement}', [AnnouncementController::class, 'show']) + ->name('annoncements.show') + ->breadcrumbs(function (Trail $trail) { + $trail->push(__('Home'), route('admin.dashboard')) + ->push(__('Announcements'), route('admin.announcements.index')) + ->push(__('Show')); + }); + + // Edit + Route::get('announcements/edit/{annoucement}', [AnnouncementController::class, 'edit']) + ->name('annoncements.edit') + ->breadcrumbs(function (Trail $trail) { + $trail->push(__('Home'), route('admin.dashboard')) + ->push(__('Announcements'), route('admin.announcements.index')) + ->push(__('Edit')); + }); + + // Update + Route::put('announcements/{componentItem}', [AnnouncementController::class, 'update']) + ->name('annoncements.update'); + + // Delete + Route::get('announcements/delete/{componentItem}', [AnnouncementController::class, 'delete']) + ->name('annoncements.delete') + ->breadcrumbs(function (Trail $trail) { + $trail->push(__('Home'), route('admin.dashboard')) + ->push(__('Announcements'), route('admin.component.index')) + ->push(__('Delete')); + }); + + // Destroy + Route::delete('announcements/{componentItem}', [ComponentItemController::class, 'destroy']) + ->name('annoncements.destroy'); +}); \ No newline at end of file From e2dfa47e98bbe290faf64c96d36aba07dabbbf8f Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Wed, 7 Dec 2022 18:27:34 +0530 Subject: [PATCH 07/32] Discord Log Channel implementation --- composer.json | 1 + config/app.php | 3 +- config/discord-logger.php | 61 +++++++++++++++++++++++++++++++++++++++ config/logging.php | 9 +++++- 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 config/discord-logger.php diff --git a/composer.json b/composer.json index 4361544e..3e4690a4 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "laravel/ui": "^3.4", "laravelcollective/html": "^6.2", "livewire/livewire": "^2.10", + "marvinlabs/laravel-discord-logger": "^1.3", "rappasoft/laravel-livewire-tables": "^1.0", "rappasoft/lockout": "^3.0", "spatie/laravel-activitylog": "^3.14", diff --git a/config/app.php b/config/app.php index a5587716..13bad904 100644 --- a/config/app.php +++ b/config/app.php @@ -181,6 +181,7 @@ App\Providers\ObserverServiceProvider::class, App\Providers\RouteServiceProvider::class, + MarvinLabs\DiscordLogger\ServiceProvider::class ], /* @@ -237,4 +238,4 @@ 'Html' => Collective\Html\HtmlFacde::class, ], -]; +]; \ No newline at end of file diff --git a/config/discord-logger.php b/config/discord-logger.php new file mode 100644 index 00000000..a7a00d82 --- /dev/null +++ b/config/discord-logger.php @@ -0,0 +1,61 @@ + [ + 'name' => env('APP_NAME', 'Discord Logger'), + 'avatar_url' => null, + ], + + /** + * The converter to use to turn a log record into a discord message + * + * Bundled converters: + * - \MarvinLabs\DiscordLogger\Converters\SimpleRecordConverter::class + * - \MarvinLabs\DiscordLogger\Converters\RichRecordConverter::class + */ + 'converter' => \MarvinLabs\DiscordLogger\Converters\RichRecordConverter::class, + + /** + * If enabled, stacktraces will be attached as files. If not, stacktraces will be directly printed out in the + * message. + * + * Valid values are: + * + * - 'smart': when stacktrace is less than 2000 characters, it is inlined with the message, else attached as file + * - 'file': stacktrace is always attached as file + * - 'inline': stacktrace is always inlined with the message, truncated if necessary + */ + 'stacktrace' => 'smart', + + /* + * A set of colors to associate to the different log levels when using the `RichRecordConverter` + */ + 'colors' => [ + 'DEBUG' => 0x607d8b, + 'INFO' => 0x4caf50, + 'NOTICE' => 0x2196f3, + 'WARNING' => 0xff9800, + 'ERROR' => 0xf44336, + 'CRITICAL' => 0xe91e63, + 'ALERT' => 0x673ab7, + 'EMERGENCY' => 0x9c27b0, + ], + + /* + * A set of emojis to associate to the different log levels. Set to null to disable an emoji for a given level + */ + 'emojis' => [ + 'DEBUG' => ':beetle:', + 'INFO' => ':bulb:', + 'NOTICE' => ':wink:', + 'WARNING' => ':flushed:', + 'ERROR' => ':poop:', + 'CRITICAL' => ':imp:', + 'ALERT' => ':japanese_ogre:', + 'EMERGENCY' => ':skull:', + ], +]; diff --git a/config/logging.php b/config/logging.php index 1aa06aa3..4cc8cb44 100644 --- a/config/logging.php +++ b/config/logging.php @@ -62,6 +62,13 @@ 'level' => env('LOG_LEVEL', 'critical'), ], + 'discord' => [ + 'driver' => 'custom', + 'via' => MarvinLabs\DiscordLogger\Logger::class, + 'level' => 'debug', + 'url' => env('LOG_DISCORD_WEBHOOK_URL'), + ], + 'papertrail' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), @@ -102,4 +109,4 @@ ], ], -]; +]; \ No newline at end of file From 5f398fa440ac02300e99bb00d2539007662ddcb0 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sat, 8 Apr 2023 17:22:37 +0530 Subject: [PATCH 08/32] Calendar Updates --- .prettierrc.json | 6 + .tsconfig | 14 ++ package.json | 7 +- resources/js/frontend/app.js | 26 +-- .../frontend/components/ScheduleCalendar.vue | 174 +++++++++++++++++- 5 files changed, 204 insertions(+), 23 deletions(-) create mode 100644 .prettierrc.json create mode 100644 .tsconfig diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..ef58ff9d --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": true +} diff --git a/.tsconfig b/.tsconfig new file mode 100644 index 00000000..96067ed4 --- /dev/null +++ b/.tsconfig @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "system" + }, + "include": [ + "resources/js/frontend/components/*" + ], + "exclude": [ + "node_modules" + ], + "vueCompilerOptions": { + "target": "2.7" + } +} diff --git a/package.json b/package.json index ebff6e39..6204ddde 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@popperjs/core": "^2.11.5", "alpinejs": "^2.3.5", "axios": "^0.21.1", - "bootstrap": "5.0.2", + "bootstrap": "^5.0.2", "cross-env": "^7.0", "jquery": "^3.5.1", "laravel-mix": "^6.0.28", @@ -28,7 +28,7 @@ "sass": "^1.20.1", "sass-loader": "^8.0.0", "sweetalert2": "^9.8.2", - "vue": "^2.5.17", + "vue": "^2.7.14", "vue-loader": "^15.9.5", "vue-template-compiler": "^2.6.10" }, @@ -41,9 +41,10 @@ "@fullcalendar/interaction": "^5.11.3", "@fullcalendar/timegrid": "^5.11.3", "@fullcalendar/vue": "^5.11.2", - "bootstrap": "5.0.2", + "bootstrap-vue": "^2.23.1", "font-awesome": "^4.7.0", "mix": "^0.0.1", + "moment": "^2.29.4", "urix": "^0.1.0" } } diff --git a/resources/js/frontend/app.js b/resources/js/frontend/app.js index b3f7c1f3..680d929f 100644 --- a/resources/js/frontend/app.js +++ b/resources/js/frontend/app.js @@ -4,10 +4,12 @@ * building robust, powerful web applications using Vue and Laravel. */ -require("../bootstrap"); -require("../plugins"); +require('../bootstrap') +require('../plugins') -import Vue from "vue"; +import 'bootstrap-vue/dist/bootstrap-vue.css' +import BootstrapVue from 'bootstrap-vue' +import Vue from 'vue' /** * The following block of code may be used to automatically register your @@ -20,15 +22,17 @@ import Vue from "vue"; // const files = require.context('./', true, /\.vue$/i) // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) +Vue.use(BootstrapVue) + Vue.component( - "example-component", - require("./components/ExampleComponent.vue").default -); + 'example-component', + require('./components/ExampleComponent.vue').default +) Vue.component( - "fullcalendar-component", - require("./components/ScheduleCalendar.vue").default -); + 'fullcalendar-component', + require('./components/ScheduleCalendar.vue').default +) /** * Next, we will create a fresh Vue application instance and attach it to @@ -37,5 +41,5 @@ Vue.component( */ const app = new Vue({ - el: "#app", -}); + el: '#app', +}) diff --git a/resources/js/frontend/components/ScheduleCalendar.vue b/resources/js/frontend/components/ScheduleCalendar.vue index 8e70e593..bc9efdc5 100644 --- a/resources/js/frontend/components/ScheduleCalendar.vue +++ b/resources/js/frontend/components/ScheduleCalendar.vue @@ -32,10 +32,95 @@ export default { }); }); }, - createReservation(data){ - // TODO: Create a reservation - console.log("create: ", data); + createReservation(event){ + const moment = require('moment'); + console.log("create: ", event); + + const start_date = moment(event.startStr); + const end_date = moment(event.endStr); + const duration = moment.duration(end_date.diff(start_date)).asMinutes(); + + this.startTime = start_date.format("hh:mm A"); + this.endTime = end_date.format("hh:mm A"); + + if (duration > this.maxSlotDuration){ + alert(`Maximum scheduling duration is ${this.maxSlotDuration} minutes !`); + return false; + } + + // TODO: Avoid some tmie intervals like Nights and Mornings + + if (event.view.type == "timeGridWeek") { + this.$bvModal.show('schedule-modal') + } + + // if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && (!isAnOverlapEvent(start, end))) { + + // $('#bookingModal').modal('toggle'); + // $('#saveBtn').click(function () { + // var title = $('#title').val(); + // var start_date = $.fullCalendar.formatDate(start, "YYYY-MM-DD HH:mm:ss"); + // var end_date = $.fullCalendar.formatDate(end, "YYYY-MM-DD HH:mm:ss"); + // var loggedIn = @json($userLoggedin); + // var user = loggedIn['email']; + // var begin = moment(start).format('YYYY-MM-DD'); + + // // console.log(start, end); + // console.log(start_date, end_date); + + // // count hours + // const date1 = new Date(start_date); + // const date2 = new Date(end_date); + + // var ms = date2.getTime() - date1.getTime(); + // var d = moment.duration(ms); + // var m = d.asMinutes(); + + // const time_limit = 300; + + // console.log(ms, d, m); + + // // TODO: Validate the E Numbers + + // //Send to the database + // if (m < time_limit) { //limit maximum time + // $.ajax({ + // url: "{{ route('frontend.calendar.store') }}", + // type: "POST", + // dataType: 'json', + // data: { title, start_date, end_date, begin, m }, + // success: function (response) { + + // //fill the calendar when event is entered instantaneously + // $('#bookingModal').modal('hide') + // $('#calendar').fullCalendar('renderEvent', { + // 'title': response.title, + // 'start': response.start, + // 'end': response.end, + // 'color': response.color, + // 'auth': response.auth, + // }); + // swal("Done!", "Event Created!", "success"); + + // // TODO: This is a temporary fix. Find a better way to this + // refreshPage(); + // }, + // error: function (error) { + // if (error.responseJSON.errors) { + // $('#titleError').html(error.responseJSON.errors.title); + // } else { + // $('#bookingModal').modal('hide') + // swal("Denied!", "Can not make multiple reservations in a day!", "warning"); + // } + // console.log(error); + // }, + // }); + // } else { + // swal("Permission Denied!", "You can not exceed 4 hours!", "warning"); + // } + // }); + // } }, deleteReservation(data){ console.log("delete: ", data); @@ -63,11 +148,44 @@ export default { updateReservation(data){ // TODO: Update event console.log("update: ", data); + }, + showModal() { + this.$refs['schedule-modal'].show() + }, + hideModal() { + this.$refs[''].hide() + }, + setupEvent(bvModalEvent){ + console.log("Creating...."); + const {startTime, endTime, eNumbers, description} = this; + + axios.get('/sanctum/csrf-cookie').then(response => { + // console.log(response); + axios.post(`${this.baseURL}/reservations/${this.stationId}/`, + { startTime, endTime, eNumbers, description }) + .then(response => { + const data = response.data; + + if (response.status == 200){ + this.$bvModal.hide('schedule-modal'); + console.log(data); + }else{ + console.log(response.status, response.statusText); + } + }); + }); + + } }, data() { return { baseURL: '', + startTime: "", + endTime: "", + eNumbers: "", + description: "", + maxSlotDuration: 300, calendarEvents: [], calendarOptions: { plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin], @@ -94,11 +212,7 @@ export default { // dayClick: function (date, jsEvent, view) { }, // eventRender: function eventRender(event, element, view) { }, - select: function (event) { - - console.log("eventCreate: ", event); - }, - + select: this.createReservation, eventResize: this.updateReservation, eventDrop: this.updateReservation, eventClick: this.deleteReservation, @@ -113,6 +227,48 @@ export default { \ No newline at end of file From 3ffb0a8deef332d6a796c52cfae171a233bb5e70 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sat, 8 Apr 2023 18:24:00 +0530 Subject: [PATCH 09/32] Merge fix updates --- app/Http/Controllers/Frontend/CalendarController.php | 7 +++++++ routes/backend/consumables.php | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Frontend/CalendarController.php b/app/Http/Controllers/Frontend/CalendarController.php index d0ee2828..2e927a53 100644 --- a/app/Http/Controllers/Frontend/CalendarController.php +++ b/app/Http/Controllers/Frontend/CalendarController.php @@ -31,6 +31,12 @@ public function index(Stations $station) $bookings = Reservation::where('station_id', $station->id)->where('start_date', '>', Carbon::now()->subDays(8))->where('start_date', '>', Carbon::now()->subDays(8))->get(); foreach ($bookings as $booking) { + if ($booking->user_id != $userLoggedin['id']) { + $color = '#435258'; + } else { + $color = '#3E9CC2'; + } + $userVar = User::find($booking->user_id); $events[] = [ 'id' => $booking->id, @@ -39,6 +45,7 @@ public function index(Stations $station) 'end' => $booking->end_date, 'stationId' => $station->id, 'auth' => $booking->user_id, + 'color' => $color, ]; } diff --git a/routes/backend/consumables.php b/routes/backend/consumables.php index 2cb64e8f..389f2146 100644 --- a/routes/backend/consumables.php +++ b/routes/backend/consumables.php @@ -15,7 +15,6 @@ }); - //consumable Items -------------------------------------------------------------------- //consumable Items -------------------------------------------------------------------- //Index @@ -92,8 +91,6 @@ // Consumable Types ------------------------------------------------------------- - // Index - // Index Route::get('consumables/types', [ConsumableTypeController::class, 'index']) ->name('consumable.types.index') From 49819a1329381af038e16bab5612a700929989b9 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:31:11 +0530 Subject: [PATCH 10/32] Frontend view updates --- .github/workflows/laravel.yml | 3 +- .github/workflows/laravel_push.yml | 31 +++++++ app/Models/ComponentItem.php | 2 +- app/Models/ComponentType.php | 13 +-- app/Models/ConsumableItem.php | 2 +- app/Models/ConsumableType.php | 9 +- app/Models/EquipmentItem.php | 1 - app/Models/EquipmentType.php | 2 +- config/constants.php | 7 ++ .../component/types/index-table-row.blade.php | 21 +++-- .../backend/component/types/show.blade.php | 60 +++++++------ .../types/index-table-row.blade.php | 23 +++-- .../backend/consumable/types/show.blade.php | 45 +++++++--- .../frontend/component/category.blade.php | 55 +++++++----- .../views/frontend/component/index.blade.php | 85 ++++++++++++++----- .../views/frontend/component/item.blade.php | 46 ++++++---- .../frontend/consumable/category.blade.php | 56 +++++++----- .../views/frontend/consumable/index.blade.php | 53 +++++++----- .../views/frontend/consumable/item.blade.php | 34 ++++---- .../frontend/equipment/category.blade.php | 55 +++++++----- .../views/frontend/equipment/index.blade.php | 66 +++++++------- .../views/frontend/equipment/item.blade.php | 33 +++---- routes/frontend/component.php | 46 +++++----- routes/frontend/consumable.php | 55 ++++++------ routes/frontend/equipments.php | 53 ++++++------ .../Frontend/Homepage/HomepageTest.php | 13 --- 26 files changed, 503 insertions(+), 366 deletions(-) create mode 100644 .github/workflows/laravel_push.yml create mode 100644 config/constants.php diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 0b68909d..8a352661 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -1,10 +1,9 @@ name: Laravel -on: [push, pull_request] +on: [pull_request] jobs: laravel-tests: - runs-on: ubuntu-latest steps: diff --git a/.github/workflows/laravel_push.yml b/.github/workflows/laravel_push.yml new file mode 100644 index 00000000..3215a63d --- /dev/null +++ b/.github/workflows/laravel_push.yml @@ -0,0 +1,31 @@ +name: Laravel Push Test + +on: [push] + +jobs: + laravel-tests: + runs-on: ubuntu-latest + + steps: + - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e + with: + php-version: '8.0' + - uses: actions/checkout@v2 + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Create Database + run: | + mkdir -p database + touch database/database.sqlite + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: | + php artisan test -p --colors --debug \ No newline at end of file diff --git a/app/Models/ComponentItem.php b/app/Models/ComponentItem.php index c24dd84f..e46964aa 100644 --- a/app/Models/ComponentItem.php +++ b/app/Models/ComponentItem.php @@ -30,7 +30,7 @@ public function inventoryCode() public function thumbURL() { if ($this->thumb != null) return '/img/component_items/' . $this->thumb; - return null; + else return $this->component_type->thumbURL(); } // used to search diff --git a/app/Models/ComponentType.php b/app/Models/ComponentType.php index 4ab79888..edad696a 100644 --- a/app/Models/ComponentType.php +++ b/app/Models/ComponentType.php @@ -21,14 +21,17 @@ public function inventoryCode() public function thumbURL() { if ($this->thumb != null) return '/img/component_types/' . $this->thumb; - return null; + else if ($this->parent()->first() != null) { + return $this->parent()->first()->thumbURL(); + } else { + return config('constants.frontend.dummy_thumb'); + } } // Return the parent item of the current type or null public function parent() { - if ($this->parent_id !== null) return ComponentType::find($this->parent_id); - return null; + return $this->hasOne(ComponentType::class, "id", "parent_id"); } // Return the children item types of this item type @@ -40,7 +43,7 @@ public function children() // Return the items listed under this item type public function getItems() { - return $this->hasMany(EquipmentItem::class)->get(); + return $this->hasMany(ComponentItem::class)->get(); } /** @@ -71,4 +74,4 @@ public static function getFullTypeList() } return $types; } -} \ No newline at end of file +} diff --git a/app/Models/ConsumableItem.php b/app/Models/ConsumableItem.php index f0b9a550..1b854e2c 100644 --- a/app/Models/ConsumableItem.php +++ b/app/Models/ConsumableItem.php @@ -42,4 +42,4 @@ public function getSearchResult(): SearchResult $url ); } -} \ No newline at end of file +} diff --git a/app/Models/ConsumableType.php b/app/Models/ConsumableType.php index 2812d7f2..03ada7e8 100644 --- a/app/Models/ConsumableType.php +++ b/app/Models/ConsumableType.php @@ -27,18 +27,17 @@ public function inventoryCode() public function thumbURL() { if ($this->thumb != null) return '/img/consumable_types/' . $this->thumb; - else if ($this->parent() != null) { - return $this->parent()->thumbURL(); + else if ($this->parent()->first() != null) { + return $this->parent()->first()->thumbURL(); } else { - return null; + return config('constants.frontend.dummy_thumb'); } } // Return the parent item of the current type or null public function parent() { - if ($this->parent_id !== null) return ConsumableType::find($this->parent_id); - return null; + return $this->hasOne(ConsumableType::class, "id", "parent_id"); } // Return the children item types of this item type diff --git a/app/Models/EquipmentItem.php b/app/Models/EquipmentItem.php index 6f0ceaac..000ffdb0 100644 --- a/app/Models/EquipmentItem.php +++ b/app/Models/EquipmentItem.php @@ -43,4 +43,3 @@ public function getSearchResult(): SearchResult ); } } - diff --git a/app/Models/EquipmentType.php b/app/Models/EquipmentType.php index 5c3237eb..d011d2f9 100644 --- a/app/Models/EquipmentType.php +++ b/app/Models/EquipmentType.php @@ -25,7 +25,7 @@ public function thumbURL() else if ($this->parent()->first() != null) { return $this->parent()->first()->thumbURL(); } else { - return null; + return config('constants.frontend.dummy_thumb'); } } diff --git a/config/constants.php b/config/constants.php new file mode 100644 index 00000000..51218a21 --- /dev/null +++ b/config/constants.php @@ -0,0 +1,7 @@ + [ + 'dummy_thumb' => '/dummy/thumb.jpg', + ] +]; diff --git a/resources/views/backend/component/types/index-table-row.blade.php b/resources/views/backend/component/types/index-table-row.blade.php index 24f22e55..68ad7d45 100644 --- a/resources/views/backend/component/types/index-table-row.blade.php +++ b/resources/views/backend/component/types/index-table-row.blade.php @@ -7,9 +7,9 @@ - @if( $row->parent() !== null) - - {{ $row->parent()->title }} + @if ($row->parent()->first() !== null) + + {{ $row->parent()->first()->title }} @else N/A @@ -27,17 +27,16 @@ - \ No newline at end of file + diff --git a/resources/views/backend/component/types/show.blade.php b/resources/views/backend/component/types/show.blade.php index 60376e69..cc02b234 100644 --- a/resources/views/backend/component/types/show.blade.php +++ b/resources/views/backend/component/types/show.blade.php @@ -10,7 +10,7 @@
    - Component Types : Show {{ $componentType->title }} + Component Types : Show {{ $componentType->title }} @@ -20,12 +20,11 @@
    @@ -39,33 +38,46 @@ class="btn btn-danger btn-xs"> Parent Category - @if( $componentType->parent() !== null) - @if( $componentType->parent()->parent() !== null) - @if( $componentType->parent()->parent()->parent() !== null) - - {{ $componentType->parent()->parent()->parent()->title }} + @php + $level1 = $componentType->parent()->first(); + @endphp + @if ($level1 !== null) + + @php + $level2 = $level1->parent()->first(); + @endphp + + @if ($level2 !== null) + + @php + $level3 = $level2->parent()->first(); + @endphp + + @if ($level3 !== null) + + {{ $level3->title }} {{ ' > ' }} @endif - - {{ $componentType->parent()->parent()->title }} + + {{ $level2->title }} {{ ' > ' }} @endif - - {{ $componentType->parent()->title }} + + {{ $level1->title }} @else N/A @endif - - @if( $componentType->subtitle != "" ) - - Subtitle - {{ $componentType->subtitle }} - - @endif + + @if ($componentType->subtitle != '') + + Subtitle + {{ $componentType->subtitle }} + + @endif Description @@ -74,9 +86,9 @@ class="btn btn-danger btn-xs"> Thumbnail - @if( $componentType->thumb != null ) + @if ($componentType->thumb != null) {{ $componentType->title }} + class="img img-thumbnail"> @else [Not Available] @endif diff --git a/resources/views/backend/consumable/types/index-table-row.blade.php b/resources/views/backend/consumable/types/index-table-row.blade.php index b1dc941a..24a626c5 100644 --- a/resources/views/backend/consumable/types/index-table-row.blade.php +++ b/resources/views/backend/consumable/types/index-table-row.blade.php @@ -1,5 +1,5 @@ - {{$row->inventoryCode() }} + {{ $row->inventoryCode() }} @@ -7,9 +7,9 @@ - @if( $row->parent() !== null) - - {{ $row->parent()->title }} + @if ($row->parent()->first() !== null) + + {{ $row->parent()->first()->title }} @else N/A @@ -23,17 +23,16 @@ - \ No newline at end of file + diff --git a/resources/views/backend/consumable/types/show.blade.php b/resources/views/backend/consumable/types/show.blade.php index c9f6fdb2..7ab0f5c4 100644 --- a/resources/views/backend/consumable/types/show.blade.php +++ b/resources/views/backend/consumable/types/show.blade.php @@ -10,7 +10,7 @@
    - Consumable Types : Show {{ $consumableType->title }} + Consumable Types : Show {{ $consumableType->title }} @@ -20,12 +20,11 @@
    @@ -39,9 +38,33 @@ class="btn btn-danger btn-xs"> Parent Category - @if( $consumableType->parent() !== null) - - {{ $consumableType->parent()->title }} + @php + $level1 = $consumableType->parent()->first(); + @endphp + @if ($level1 !== null) + + @php + $level2 = $level1->parent()->first(); + @endphp + + @if ($level2 !== null) + + @php + $level3 = $level2->parent()->first(); + @endphp + + @if ($level3 !== null) + + {{ $level3->title }} + {{ ' > ' }} + @endif + + {{ $level2->title }} + {{ ' > ' }} + @endif + + + {{ $level1->title }} @else N/A @@ -59,9 +82,9 @@ class="btn btn-danger btn-xs"> Thumbnail - @if( $consumableType->thumb != null && $consumableType->thumb != "") + @if ($consumableType->thumb != null && $consumableType->thumb != '') {{ $consumableType->title }} + class="img img-thumbnail"> @else [Not Available] @endif diff --git a/resources/views/frontend/component/category.blade.php b/resources/views/frontend/component/category.blade.php index bce1fc26..45abff09 100644 --- a/resources/views/frontend/component/category.blade.php +++ b/resources/views/frontend/component/category.blade.php @@ -1,6 +1,6 @@ @extends('frontend.layouts.app') -@section('title', $componentType->title ) +@section('title', $componentType->title) @section('content')
    @@ -8,29 +8,45 @@

    {{ $componentType->title }}

    - @if($componentType->children()->count() != 0) + + @if ($componentType->children()->count() != 0)
    Sub-Categories
    - @foreach($componentType->children() as $category) - {{ $category->title }} - @endforeach -
    +
    + @foreach ($componentType->children() as $category) + + @endforeach +
    + + @if ($items->count() != 0) +
    + @endif @else - {{-- No sub categories available--}} + {{-- No sub categories available --}} @endif - @if($items->count() != 0) + @if ($items->count() != 0) +@endsection diff --git a/resources/views/frontend/component/index.blade.php b/resources/views/frontend/component/index.blade.php index 05253cd2..2a0f7913 100644 --- a/resources/views/frontend/component/index.blade.php +++ b/resources/views/frontend/component/index.blade.php @@ -4,31 +4,70 @@ @section('content')
    -
    -
    -

    Browse Components by Category

    +
    -
    -
      - @foreach($componentType as $type) - @if( $type->parent() == null ) -
    • - {{ $type->title }} - @if($type->children() != null) - - @endif -
    • +
      +
      +
      + @foreach ($componentType as $type) + @if ($type->parent()->count() == 0) + + @if ($type->children()->count() == 0) + + @foreach ($type->children() as $child) + @endforeach @endif - @endforeach -
    + @endif + @endforeach +
    +
    + + {{-- --}} + +
    +
    +

    Browse Components by Category

    + +
    +
      + @foreach ($componentType as $type) + @if ($type->parent() == null) +
    • + {{ $type->title }} + @if ($type->children() != null) + + @endif +
    • + @endif + @endforeach +
    +
    -
    -@endsection \ No newline at end of file + @endsection diff --git a/resources/views/frontend/component/item.blade.php b/resources/views/frontend/component/item.blade.php index 6dda859e..8a5131fc 100644 --- a/resources/views/frontend/component/item.blade.php +++ b/resources/views/frontend/component/item.blade.php @@ -14,32 +14,42 @@
    - @if ($componentItem->thumb != null) - {{ $componentItem->title }} - @else - {{-- TODO: Add a default image --}} - [Not Available] - @endif - + {{ $componentItem->title }}
    -

    {{ $componentItem->title }}
    - - {{ $componentItem->inventoryCode() }} -
    -
    -

    +
    +
    +

    {{ $componentItem->title }}
    + + {{ $componentItem->inventoryCode() }} + +

    +
    +
    + @if ( + $logged_in_user != null && + ($logged_in_user->isAdmin() || + $logged_in_user->isLecturer() || + $logged_in_user->isTechOfficer() || + $logged_in_user->isMaintainer())) + + + @endif +
    +
    -
    +
    +
    Category - : @if ($componentItem->component_type->parent() != null) + : @if ($componentItem->component_type->parent()->first() != null) - {{ $componentItem->component_type->parent()->title }} + href="{{ route('frontend.component.category', $componentItem->component_type->parent()->first()) }}"> + {{ $componentItem->component_type->parent()->first()->title }} > @endif diff --git a/resources/views/frontend/consumable/category.blade.php b/resources/views/frontend/consumable/category.blade.php index 0f0c79ae..581c7a57 100644 --- a/resources/views/frontend/consumable/category.blade.php +++ b/resources/views/frontend/consumable/category.blade.php @@ -1,6 +1,6 @@ @extends('frontend.layouts.app') -@section('title', $consumableType->title ) +@section('title', $consumableType->title) @section('content')
    @@ -8,32 +8,47 @@

    {{ $consumableType->title }}

    - @if($consumableType->children()->count() != 0) + @if ($consumableType->children()->count() != 0)
    Sub-Categories
    - @foreach($consumableType->children() as $category) - {{ $category->title }} - @endforeach -
    +
    + @foreach ($consumableType->children() as $category) + + @endforeach +
    + + @if ($items->count() != 0) +
    + @endif @else - {{-- No sub categories available--}} + {{-- No sub categories available --}} @endif - @if($items->count() != 0) + @if ($items->count() != 0) +@endsection diff --git a/resources/views/frontend/consumable/index.blade.php b/resources/views/frontend/consumable/index.blade.php index fc8f75ac..daaecbc8 100644 --- a/resources/views/frontend/consumable/index.blade.php +++ b/resources/views/frontend/consumable/index.blade.php @@ -4,30 +4,39 @@ @section('content')
    -
    -
    -

    Browse Consumables by Category

    +
    -
    -
      -
    • All
    • - @foreach($consumableTypes as $type) - @if( $type->parent() == null ) -
    • - {{ $type->title }} - @if($type->children() != null) - - @endif -
    • +
      +
      +
      + @foreach ($consumableTypes as $type) + @if ($type->parent()->count() == 0) + + @if ($type->children()->count() == 0) + + @foreach ($type->children() as $child) + @endforeach @endif - @endforeach -
    + @endif + @endforeach
    diff --git a/resources/views/frontend/consumable/item.blade.php b/resources/views/frontend/consumable/item.blade.php index fa1efd43..f2b90645 100644 --- a/resources/views/frontend/consumable/item.blade.php +++ b/resources/views/frontend/consumable/item.blade.php @@ -14,31 +14,26 @@
    - @if ($consumableItem->thumbURL() != null) - {{ $consumableItem->title }} - @else - {{-- TODO: Add a default image --}} - [Not Available] - @endif + {{ $consumableItem->title }}
    -
    -
    +
    +

    {{ $consumableItem->title }}
    {{ $consumableItem->inventoryCode() }} -

    - @if ($logged_in_user != null && - ($logged_in_user->isAdmin() || - $logged_in_user->isLecturer() || - $logged_in_user->isTechOfficer() || - $logged_in_user->isMaintainer())) + @if ( + $logged_in_user != null && + ($logged_in_user->isAdmin() || + $logged_in_user->isLecturer() || + $logged_in_user->isTechOfficer() || + $logged_in_user->isMaintainer())) @@ -46,15 +41,16 @@ class="btn btn-info btn-xs">
    -
    +
    +
    - @foreach($orders as $order) - + @foreach ($orders as $order) - + + + - - - - - @if($order->picked_date!=NULL) - + + + @if ($order->picked_date != null) + @else - + @endif - - + + - @if($order->returned_date!=NULL) - + @if ($order->returned_date != null) + @else - @if ($order->dueDays()<=0) - + @if ($order->dueDays() <= 0) + @else - + @endif @endif - - + + @endforeach -
    Category - : @if ($consumableItem->consumable_type->parent() != null) + : @if ($consumableItem->consumable_type->parent()->first() != null) - {{ $consumableItem->consumable_type->parent()->title }} + href="{{ route('frontend.consumable.category', $consumableItem->consumable_type->parent()->first()) }}"> + {{ $consumableItem->consumable_type->parent()->first()->title }} > @endif diff --git a/resources/views/frontend/equipment/category.blade.php b/resources/views/frontend/equipment/category.blade.php index 64ae0af9..605e2a2f 100644 --- a/resources/views/frontend/equipment/category.blade.php +++ b/resources/views/frontend/equipment/category.blade.php @@ -1,6 +1,6 @@ @extends('frontend.layouts.app') -@section('title', $equipmentType->title ) +@section('title', $equipmentType->title) @section('content')
    @@ -8,36 +8,48 @@

    {{ $equipmentType->title }}

    - @if($equipmentType->children()->count() != 0) + @if ($equipmentType->children()->count() != 0)
    Sub-Categories
    - @foreach($equipmentType->children() as $category) - {{ $category->title }} - @endforeach -
    +
    + @foreach ($equipmentType->children() as $category) + + @endforeach +
    + + @if ($items->count() != 0) +
    + @endif @else - {{-- No sub categories available--}} + {{-- No sub categories available --}} @endif - @if($items->count() != 0) + @if ($items->count() != 0)
    - @foreach($items as $item) + @foreach ($items as $item) @endforeach @@ -46,14 +58,13 @@
    {{ $items->links() }}
    + @elseif ($items->count() == 0 && $equipmentType->children()->count() == 0) +

    No items listed under this category yet

    + @else + {{-- No items available --}} + @endif - @elseif ($items->count() == 0 && $equipmentType->children()->count() == 0) -

    No items listed under this category yet

    - @else - {{-- No items available--}} - @endif - -
    +
    @endsection diff --git a/resources/views/frontend/equipment/index.blade.php b/resources/views/frontend/equipment/index.blade.php index f0467239..5957a9e7 100644 --- a/resources/views/frontend/equipment/index.blade.php +++ b/resources/views/frontend/equipment/index.blade.php @@ -4,43 +4,39 @@ @section('content')
    -
    -
    -

    Browse Equipments by Category

    - -
    -
      -
    • All
    • - {{-- Level 1 --}} - @foreach($eqTypes as $type) - @if( $type->parent() ) -
    • - {{ $type->title }} - @if($type->children() != null) -
        - {{-- Level 2 --}} - @foreach($type->children() as $child) -
      • - {{ $child->title }} - @if($child->children() != null) -
          - {{-- Level 3 --}} - @foreach($child->children() as $child2) -
        • - {{ $child2->title }} -
        • - @endforeach -
        - @endif +
        +
        +

        Browse Equipments by Category

        +
        + +
        -
      • - @endforeach -
      - @endif -
    • +
      +
      +
      + @foreach ($eqTypes as $type) + @if ($type->parent()->count() == 0) + + @if ($type->children()->count() == 0) + + @foreach ($type->children() as $child) + @endforeach @endif - @endforeach -
    + @endif + @endforeach
    diff --git a/resources/views/frontend/equipment/item.blade.php b/resources/views/frontend/equipment/item.blade.php index 0003e821..a5d04530 100644 --- a/resources/views/frontend/equipment/item.blade.php +++ b/resources/views/frontend/equipment/item.blade.php @@ -14,32 +14,25 @@
    - @if ($equipmentItem->thumbURL() != null) - {{ $equipmentItem->title }} - @else - {{-- TODO: Add a default image --}} - [Not Available] - @endif - + {{ $equipmentItem->title }}
    - -
    -
    +
    +

    {{ $equipmentItem->title }}
    {{ $equipmentItem->inventoryCode() }} -

    - @if ($logged_in_user != null && - ($logged_in_user->isAdmin() || - $logged_in_user->isLecturer() || - $logged_in_user->isTechOfficer() || - $logged_in_user->isMaintainer())) + @if ( + $logged_in_user != null && + ($logged_in_user->isAdmin() || + $logged_in_user->isLecturer() || + $logged_in_user->isTechOfficer() || + $logged_in_user->isMaintainer())) @@ -49,8 +42,8 @@ class="btn btn-warning btn-xs">
    - -
    +
    +
    @@ -59,7 +52,7 @@ class="btn btn-warning btn-xs"> {{ $equipmentItem->equipment_type->parent()->first()->title }} - + > @endif diff --git a/routes/frontend/component.php b/routes/frontend/component.php index 5d0d5d51..becb8398 100644 --- a/routes/frontend/component.php +++ b/routes/frontend/component.php @@ -28,20 +28,16 @@ $trail->parent('frontend.index') ->push(__('Components'), route('frontend.component.index')); - if ($componentType->parent() != null) { - // Only look upto two parents for now + if ($componentType->parent()->first() != null) { + // Level 1 + $level1 = $componentType->parent()->first(); - if ($componentType->parent()->parent() != null) { - $trail->push($componentType->parent()->parent()->title, route( - 'frontend.component.category', - $componentType->parent()->parent() - )); + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.component.category', $level2)); } - - $trail->push($componentType->parent()->title, route( - 'frontend.component.category', - $componentType->parent() - )); + $trail->push($level1->title, route('frontend.component.category', $level1)); } $trail->push($componentType->title); }); @@ -53,22 +49,22 @@ ->push(__('Components'), route('frontend.component.index')); if ($componentItem->component_type() != null) { - // Only look upto one parents for now - $type = $componentItem->component_type; + $level0 = $componentItem->component_type; - if ($type->parent() != null) { - $trail->push($type->parent()->title, route( - 'frontend.component.category', - $type->parent() - )); - } + if ($level0->parent()->first() != null) { + // Level 1 + $level1 = $level0->parent()->first(); - $trail->push($type->title, route( - 'frontend.component.category', - $type - )); + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.component.category', $level2)); + } + $trail->push($level1->title, route('frontend.component.category', $level1)); + } + $trail->push($level0->title, route('frontend.component.category', $level0)); } $trail->push($componentItem->title); }); -}); \ No newline at end of file +}); diff --git a/routes/frontend/consumable.php b/routes/frontend/consumable.php index 6885bf71..2b18d951 100644 --- a/routes/frontend/consumable.php +++ b/routes/frontend/consumable.php @@ -14,52 +14,55 @@ }); Route::get('/all', [ConsumableView::class, 'index_all']) - ->name('consumable.index.all') - ->breadcrumbs(function (Trail $trail) { - $trail->parent('frontend.index') - ->push(__('Consumables'), route('frontend.consumable.index')) - ->push(__('All'), route('frontend.consumable.index.all')); - }); - + ->name('consumable.index.all') + ->breadcrumbs(function (Trail $trail) { + $trail->parent('frontend.index') + ->push(__('Consumables'), route('frontend.consumable.index')) + ->push(__('All'), route('frontend.consumable.index.all')); + }); + Route::get('/category/{consumableType}', [ConsumableView::class, 'viewCategory']) ->name('consumable.category') ->breadcrumbs(function (Trail $trail, ConsumableType $consumableType) { $trail->parent('frontend.index') ->push(__('Consumables'), route('frontend.consumable.index')); - if ($consumableType->parent() != null) { - // Only look upto two parents for now + if ($consumableType->parent()->first() != null) { + // Level 1 + $level1 = $consumableType->parent()->first(); - if ($consumableType->parent()->parent() != null) { - $trail->push($consumableType->parent()->parent()->title, route('frontend.consumable.category', - $consumableType->parent()->parent())); + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.consumable.category', $level2)); } - - $trail->push($consumableType->parent()->title, route('frontend.consumable.category', - $consumableType->parent())); + $trail->push($level1->title, route('frontend.consumable.category', $level1)); } $trail->push($consumableType->title); }); Route::get('/item/{consumableItem}', [ConsumableView::class, 'viewItem']) ->name('consumable.item') - ->breadcrumbs(function (Trail $trail,ConsumableItem $consumableItem) { + ->breadcrumbs(function (Trail $trail, ConsumableItem $consumableItem) { $trail->parent('frontend.index') ->push(__('Consumables'), route('frontend.consumable.index')); - if ($consumableItem->consumable_type() != null) { - // Only look upto one parents for now - $type = $consumableItem->consumable_type; - if ($type->parent() != null) { - $trail->push($type->parent()->title, route('frontend.consumable.category', - $type->parent())); - } + if ($consumableItem->consumable_type != null) { + $level0 = $consumableItem->consumable_type; + if ($level0->parent()->first() != null) { + // Level 1 + $level1 = $level0->parent()->first(); - $trail->push($type->title, route('frontend.consumable.category', - $type)); + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.consumable.category', $level2)); + } + $trail->push($level1->title, route('frontend.consumable.category', $level1)); + } + $trail->push($level0->title, route('frontend.consumable.category', $level0)); } $trail->push($consumableItem->title); }); - }); diff --git a/routes/frontend/equipments.php b/routes/frontend/equipments.php index bbe7088d..bb8ccaf2 100644 --- a/routes/frontend/equipments.php +++ b/routes/frontend/equipments.php @@ -23,25 +23,24 @@ Route::get('/category/{equipmentType}', [EquipmentView::class, 'viewCategory']) ->name('equipment.category') - ->breadcrumbs(function (Trail $trail, EquipmentType $equipmentType) { - $trail->parent('frontend.index') - ->push(__('Equipment'), route('frontend.equipment.index')); + ->breadcrumbs( + function (Trail $trail, EquipmentType $equipmentType) { + $trail->parent('frontend.index') + ->push(__('Equipment'), route('frontend.equipment.index')); - if ($equipmentType->first()->parent_id() != null) { - if ($equipmentType->parent()->first()->parent_id() != null) { - if ($equipmentType->parent()->parent()->parent()->first()->parent_id() != null) { - $trail->push($equipmentType->parent()->parent()->parent()->title, route('frontend.equipment.category', - $equipmentType->parent()->parent()->parent())); + if ($equipmentType->parent()->first() != null) { + // Level 1 + $level1 = $equipmentType->parent()->first(); + + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.equipment.category', $level2)); } - $trail->push($equipmentType->parent()->parent()->title, route('frontend.equipment.category', - $equipmentType->parent()->parent())); + $trail->push($level1->title, route('frontend.equipment.category', $level1)); } - $trail->push($equipmentType->parent()->title, route('frontend.equipment.category', - $equipmentType->parent())); + $trail->push($equipmentType->title); } - - $trail->push($equipmentType->title); - } ); Route::get('/item/{equipmentItem}', [EquipmentView::class, 'viewItem']) @@ -50,25 +49,23 @@ $trail->parent('frontend.index') ->push(__('Equipments'), route('frontend.equipment.index')); - if ($equipmentItem->equipment_type() != null) { - $type = $equipmentItem->equipment_type; + $level0 = $equipmentItem->equipment_type; + + if ($level0->parent()->first() != null) { + // Level 1 + $level1 = $level0->parent()->first(); - if ($type->first()->parent_id() != null) { - if ($type->parent()->first()->parent_id() != null) { - if ($type->parent()->parent()->first()->parent_id() != null) { - $trail->push($type->parent()->parent()->parent()->title, route('frontend.equipment.category', - $type->parent()->parent()->parent())); - } - $trail->push($type->parent()->parent()->title, route('frontend.equipment.category', - $type->parent()->parent())); + if ($level1->parent()->first() != null) { + // // Level 2 + $level2 = $level1->parent()->first(); + $trail->push($level2->title, route('frontend.equipment.category', $level2)); } - $trail->push($type->parent()->title, route('frontend.equipment.category', - $type->parent())); + $trail->push($level1->title, route('frontend.equipment.category', $level1)); } + $trail->push($level0->title, route('frontend.equipment.category', $level0)); } $trail->push($equipmentItem->title); }); - }); diff --git a/tests/Feature/Frontend/Homepage/HomepageTest.php b/tests/Feature/Frontend/Homepage/HomepageTest.php index 8bbb0a54..4603963a 100644 --- a/tests/Feature/Frontend/Homepage/HomepageTest.php +++ b/tests/Feature/Frontend/Homepage/HomepageTest.php @@ -52,17 +52,4 @@ public function homepage_has_link_to_consumables() $response->assertSee("/consumables"); } - /** @test */ - public function components_shows_categories(){ - $response = $this->get('/components'); - $categoryTitle = ComponentType::inRandomOrder()->first()->title; - $response->assertSee($categoryTitle); - } - - /** @test */ - public function equipment_shows_categories(){ - $response = $this->get('/equipment'); - $categoryTitle = EquipmentType::inRandomOrder()->first()->title; - $response->assertSee($categoryTitle); - } } From 8185cf99f54908c0f5f702acedeeacf3d16e72ac Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:39:11 +0530 Subject: [PATCH 11/32] Fix --- tests/Feature/Frontend/Consumables/ConsumableTest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/Feature/Frontend/Consumables/ConsumableTest.php b/tests/Feature/Frontend/Consumables/ConsumableTest.php index fa0d1512..889b0cc0 100644 --- a/tests/Feature/Frontend/Consumables/ConsumableTest.php +++ b/tests/Feature/Frontend/Consumables/ConsumableTest.php @@ -36,14 +36,6 @@ public function anyone_can_access_consumable_item() $this->get('/consumables/item/' . $consumable->id)->assertOk(); } - /** @test */ - public function consumables_shows_categories() - { - $response = $this->get('/consumables'); - $categoryTitle = ConsumableType::inRandomOrder()->first()->title; - $response->assertSee($categoryTitle); - } - /** @test */ public function consumables_shows_multiple_locations() { From 330e2f4992b5a130fb608e24812a6462605619fc Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:41:34 +0530 Subject: [PATCH 12/32] Added Git pre-push unit testing --- .githooks/pre-push | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100644 index 00000000..caf340f3 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,3 @@ +echo "Git hook executing: pre-commit actions" + +php artisan test -p \ No newline at end of file From 97190fc047deb05281576a89a91ad74dcc93c59e Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:47:53 +0530 Subject: [PATCH 13/32] Readme update --- Notepad.txt | 0 README.md | 59 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 24 deletions(-) delete mode 100644 Notepad.txt diff --git a/Notepad.txt b/Notepad.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/README.md b/README.md index 47748bd9..a3f5d574 100644 --- a/README.md +++ b/README.md @@ -22,28 +22,32 @@ Laravel Boilerplate provides you with a massive head start on any size web appli [Click here for the official documentation](http://laravel-boilerplate.com) ## Team of Developers -- [Nuwan Jaliyagoda](http://github.com/NuwanJ) + +- [Nuwan Jaliyagoda](http://github.com/NuwanJ) ### Sprint 2A -- [Tharmapalan Thanujan](http://github.com/thanujan96) -- [Madhushan Ramalingam](https://github.com/DrMadhushan) -- [Thilini Madushani](http://github.com/Thilini98) + +- [Tharmapalan Thanujan](http://github.com/thanujan96) +- [Madhushan Ramalingam](https://github.com/DrMadhushan) +- [Thilini Madushani](http://github.com/Thilini98) ### Sprint 3A -- [Ishan Fernando](https://github.com/ishanfdo18098) -- [Adeepa Fernando](https://github.com/NipunFernando) -- [Ridma Jayasundara ](https://github.com/ridmajayasundara) + +- [Ishan Fernando](https://github.com/ishanfdo18098) +- [Adeepa Fernando](https://github.com/NipunFernando) +- [Ridma Jayasundara ](https://github.com/ridmajayasundara) ### Sprint 3B -- [Sadia Jameel](https://github.com/SaadiaJameel) -- [Sakuni Nimnadi](https://github.com/SakuniJayasinghe) -- [Thamish Wanduragala](https://github.com/Thamish99) + +- [Sadia Jameel](https://github.com/SaadiaJameel) +- [Sakuni Nimnadi](https://github.com/SakuniJayasinghe) +- [Thamish Wanduragala](https://github.com/Thamish99) ### Sprint 3C -- [Karan R.](https://github.com/rasathuraikaran) -- [Gowsigan A.](https://github.com/AnnalingamGowsigan) -- [Muthuni De Alwis](https://github.com/muthuni-dealwis) +- [Karan R.](https://github.com/rasathuraikaran) +- [Gowsigan A.](https://github.com/AnnalingamGowsigan) +- [Muthuni De Alwis](https://github.com/muthuni-dealwis) ## Useful Commands and Instructions @@ -51,11 +55,12 @@ You need to install Wamp server and run it before following commands. Please make sure you already created database user account. #### Install Dependencies + ``` // Install PHP dependencies composer install -// If you received mmap() error, use this command +// If you received mmap() error, use this command // php -d memory_limit=-1 /usr/local/bin/composer install // Update PHP dependencies @@ -78,6 +83,9 @@ php artisan migrate // Reset the database and seed the data php artisan migrate:fresh --seed +// Prepare webhook for unit testing +git config --local core.hooksPath .githooks + ``` #### Serve in the local environment @@ -92,6 +100,7 @@ php artisan serve --host=0.0.0.0 --port=8000 // To work with Vue components npm run watch ``` + #### Run all above commands from bash script ``` @@ -103,6 +112,7 @@ chmod +x Start.sh ``` #### Cache and optimization + ``` // Remove dev dependencies composer install --optimize-autoloader --no-dev @@ -116,7 +126,8 @@ php artisan route:clear php artisan view:clear ``` -#### Maintenance related commands +#### Maintenance related commands + ``` php artisan down --message="{Message}" --retry=60 php artisan up @@ -144,12 +155,12 @@ php artisan test -p #### Resource Routes -| Verb | URI | Action | Route Name | -|:-----------|:---------------------------------|:---------|:-----------------------| -| GET | /photos/{photo}/comments | index | photos.comments.index | -| GET | /photos/{photo}/comments/create | create | photos.comments.create | -| POST | /photos/{photo}/comments | store | photos.comments.store | -| GET | /comments/{comment} | show | comments.show | -| GET | /comments/{comment}/edit | edit | comments.edit | -| PUT/PATCH | /comments/{comment} | update | comments.update | -| DELETE | /comments/{comment} | destroy | comments.destroy | +| Verb | URI | Action | Route Name | +| :-------- | :------------------------------ | :------ | :--------------------- | +| GET | /photos/{photo}/comments | index | photos.comments.index | +| GET | /photos/{photo}/comments/create | create | photos.comments.create | +| POST | /photos/{photo}/comments | store | photos.comments.store | +| GET | /comments/{comment} | show | comments.show | +| GET | /comments/{comment}/edit | edit | comments.edit | +| PUT/PATCH | /comments/{comment} | update | comments.update | +| DELETE | /comments/{comment} | destroy | comments.destroy | From 985ecde61521eb06046788ff94a3404f7cda0696 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:52:06 +0530 Subject: [PATCH 14/32] Git CI pipeline updates --- .githooks/pre-push | 2 ++ .github/workflows/laravel.yml | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index caf340f3..6e73b4d5 100644 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -1,3 +1,5 @@ +#! /bin/bash + echo "Git hook executing: pre-commit actions" php artisan test -p \ No newline at end of file diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 0b68909d..1e855f81 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -1,10 +1,9 @@ name: Laravel -on: [push, pull_request] +on: [pull_request] jobs: laravel-tests: - runs-on: ubuntu-latest steps: @@ -12,18 +11,24 @@ jobs: with: php-version: '8.0' - uses: actions/checkout@v2 + - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Generate key run: php artisan key:generate + - name: Directory Permissions run: chmod -R 777 storage bootstrap/cache + - name: Create Database run: | mkdir -p database touch database/database.sqlite + - name: Execute tests (Unit and Feature tests) via PHPUnit env: DB_CONNECTION: sqlite From 1e00e7a26b85b4f9aeb1cfc5f674a4f1f0c10a4f Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Sun, 30 Apr 2023 00:54:37 +0530 Subject: [PATCH 15/32] Removed unused GUI test --- tests/Feature/Frontend/ComponentTest.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/Feature/Frontend/ComponentTest.php b/tests/Feature/Frontend/ComponentTest.php index f80b23a2..40ab6d5e 100644 --- a/tests/Feature/Frontend/ComponentTest.php +++ b/tests/Feature/Frontend/ComponentTest.php @@ -36,19 +36,12 @@ public function anyone_can_access_component_item() $this->get('/components/item/' . $component->id)->assertOk(); } - /** @test */ - public function components_shows_categories() - { - $response = $this->get('/components'); - $categoryTitle = ComponentType::inRandomOrder()->first()->title; - $response->assertSee($categoryTitle); - } - /** @test */ public function components_shows_single_location() { $component = ComponentItem::factory()->create(); - ItemLocations::factory()->create([ + ItemLocations::factory()->create( + [ 'item_id' => $component->inventoryCode(), 'location_id' => 1, ] @@ -75,6 +68,4 @@ public function components_shows_multiple_locations() $location2 = Locations::where('id', 2)->first(); $this->get('/components/item/' . $item->id)->assertSee($location1->location)->assertSee($location2->location); } - - } From 23ab4eb3b88a996906c72e448c95f80d54c222b9 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Mon, 1 May 2023 15:49:50 +0530 Subject: [PATCH 16/32] Dummy image --- public/dummy/thumb.jpg | Bin 0 -> 2840 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/dummy/thumb.jpg diff --git a/public/dummy/thumb.jpg b/public/dummy/thumb.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9f09b7857af6e461fbd5a5fbb38328036c2be16f GIT binary patch literal 2840 zcmex=E*8A72xWwP-bbMsiRO>nwXPW zQmJ68U}?a`@c%Z0GXoPNBM3nOGb=L)u(7Z(v$C_Xvx6`PCpRYt2NwrBI~Ok(7dH zkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1D_3pWyk+aQ z?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhqkDtFl{$gZc zhIk9^Gc(W@jG>S*VU^ESk Xrh(BkFq#HN)4*sNATbT_|Gx Date: Mon, 1 May 2023 16:09:56 +0530 Subject: [PATCH 17/32] Backend UI updates --- .../Backend/ConsumableItemController.php | 4 ++-- .../Backend/ConsumableTypeController.php | 8 ++----- .../Backend/EquipmentItemController.php | 4 ++-- .../Backend/EquipmentTypeController.php | 11 ++-------- .../Livewire/Backend/EquipmentItemTable.php | 6 +++--- app/Models/ComponentType.php | 12 ++--------- app/Models/ConsumableType.php | 21 +++++++++++++++++++ app/Models/EquipmentType.php | 12 ++++++++++- 8 files changed, 45 insertions(+), 33 deletions(-) diff --git a/app/Http/Controllers/Backend/ConsumableItemController.php b/app/Http/Controllers/Backend/ConsumableItemController.php index a5a9427b..d39d5a9b 100644 --- a/app/Http/Controllers/Backend/ConsumableItemController.php +++ b/app/Http/Controllers/Backend/ConsumableItemController.php @@ -34,7 +34,7 @@ public function index() */ public function create() { - $types = ConsumableType::pluck('title', 'id'); + $types = ConsumableType::getFullTypeList(); $locations = Locations::pluck('location', 'id'); return view('backend.consumable.items.create', compact('types', 'locations')); } @@ -98,7 +98,7 @@ public function show(ConsumableItem $consumableItem) */ public function edit(ConsumableItem $consumableItem) { - $types = ConsumableType::pluck('title', 'id'); + $types = ConsumableType::getFullTypeList(); $locations = Locations::pluck('location', 'id'); return view('backend.consumable.items.edit', compact('types', 'consumableItem', 'locations')); } diff --git a/app/Http/Controllers/Backend/ConsumableTypeController.php b/app/Http/Controllers/Backend/ConsumableTypeController.php index cbda9931..41fd2b4f 100644 --- a/app/Http/Controllers/Backend/ConsumableTypeController.php +++ b/app/Http/Controllers/Backend/ConsumableTypeController.php @@ -27,7 +27,7 @@ public function index() */ public function create() { - $types = ConsumableType::pluck('title', 'id'); + $types = ConsumableType::getFullTypeList(); return view('backend.consumable.types.create', compact('types')); } @@ -56,7 +56,6 @@ public function store(Request $request) $type->save(); return redirect()->route('admin.consumable.types.index')->with('Success', 'ConsumableType was created !'); - } catch (\Exception $ex) { return abort(500, "Error 222"); } @@ -81,7 +80,7 @@ public function show(ConsumableType $consumableType) */ public function edit(ConsumableType $consumableType) { - $types = ConsumableType::pluck('title', 'id'); + $types = ConsumableType::getFullTypeList(); return view('backend.consumable.types.edit', compact('consumableType', 'types')); } @@ -109,7 +108,6 @@ public function update(Request $request, ConsumableType $consumableType) $consumableType->update($data); return redirect()->route('admin.consumable.types.index')->with('Success', 'ConsumableType was updated !'); - } catch (\Exception $ex) { return abort(500); } @@ -140,7 +138,6 @@ public function destroy(ConsumableType $consumableType) $consumableType->delete(); return redirect()->route('admin.consumable.types.index')->with('Success', 'ConsumableType was deleted !'); - } catch (\Exception $ex) { return abort(500); } @@ -169,5 +166,4 @@ private function uploadThumb($currentURL, $newImage, $folder): string return $imageName; } - } diff --git a/app/Http/Controllers/Backend/EquipmentItemController.php b/app/Http/Controllers/Backend/EquipmentItemController.php index 358d18d0..53148b72 100644 --- a/app/Http/Controllers/Backend/EquipmentItemController.php +++ b/app/Http/Controllers/Backend/EquipmentItemController.php @@ -34,7 +34,7 @@ public function index() */ public function create() { - $types = EquipmentType::pluck('title', 'id'); + $types = EquipmentType::getFullTypeList(); $locations = Locations::pluck('location', 'id'); return view('backend.equipment.items.create', compact('types', 'locations')); } @@ -112,7 +112,7 @@ public function show(EquipmentItem $equipmentItem) */ public function edit(EquipmentItem $equipmentItem) { - $types = EquipmentType::pluck('title', 'id'); + $types = EquipmentType::getFullTypeList(); //$this_item_location = ItemLocations::where('item_id', $equipmentItem->inventoryCode())->get(); //if ($this_item_location->count() > 0) { // $this_item_location = $this_item_location->first()->location_id; diff --git a/app/Http/Controllers/Backend/EquipmentTypeController.php b/app/Http/Controllers/Backend/EquipmentTypeController.php index a1034ede..626073f1 100644 --- a/app/Http/Controllers/Backend/EquipmentTypeController.php +++ b/app/Http/Controllers/Backend/EquipmentTypeController.php @@ -31,9 +31,7 @@ public function index() */ public function create() { - // TODO: Generate hierarchical list - $types = EquipmentType::pluck('title', 'id'); - + $types = EquipmentType::getFullTypeList(); return view('backend.equipment.types.create', compact('types')); } @@ -61,7 +59,6 @@ public function store(Request $request) $type = new EquipmentType($data); $type->save(); return redirect()->route('admin.equipment.types.index')->with('Success', 'EquipmentType was created !'); - } catch (\Exception $ex) { return abort(500, "Error 222"); } @@ -86,9 +83,7 @@ public function show(EquipmentType $equipmentType) */ public function edit(EquipmentType $equipmentType) { - // TODO: Generate hierarchical list - $types = EquipmentType::pluck('title', 'id'); - + $types = EquipmentType::getFullTypeList(); return view('backend.equipment.types.edit', compact('equipmentType', 'types')); } @@ -116,7 +111,6 @@ public function update(Request $request, EquipmentType $equipmentType) $equipmentType->update($data); return redirect()->route('admin.equipment.types.index')->with('Success', 'EquipmentType was updated !'); - } catch (\Exception $ex) { return abort(500); } @@ -149,7 +143,6 @@ public function destroy(EquipmentType $equipmentType) $equipmentType->delete(); return redirect()->route('admin.equipment.types.index')->with('Success', 'EquipmentType was deleted !'); - } catch (\Exception $ex) { dd($ex); return abort(500); diff --git a/app/Http/Livewire/Backend/EquipmentItemTable.php b/app/Http/Livewire/Backend/EquipmentItemTable.php index 8aade517..400c4110 100644 --- a/app/Http/Livewire/Backend/EquipmentItemTable.php +++ b/app/Http/Livewire/Backend/EquipmentItemTable.php @@ -57,11 +57,11 @@ public function filters(): array // Level 2 if ($value->children()->count() > 0) { foreach ($value->children() as $l) { - $categories[$l->id] = $l->getFullCategoryType(); + $categories[$l->id] = $l->getFullEquipmentType(); // Level 3 if ($l->children()->count() > 0) { foreach ($l->children() as $ll) { - $categories[$ll->id] = $ll->getFullCategoryType(); + $categories[$ll->id] = $ll->getFullEquipmentType(); } } } @@ -79,4 +79,4 @@ public function rowView(): string return 'backend.equipment.items.index-table-row'; } -} +} \ No newline at end of file diff --git a/app/Models/ComponentType.php b/app/Models/ComponentType.php index edad696a..021269d4 100644 --- a/app/Models/ComponentType.php +++ b/app/Models/ComponentType.php @@ -46,20 +46,12 @@ public function getItems() return $this->hasMany(ComponentItem::class)->get(); } - /** - * Get the parent component type - */ - public function getParent() - { - return $this->hasOne(ComponentType::class, "id", "parent_id"); - } - public function getFullComponentType() { $item = $this; $title = $item->title; - while (!($item->getParent()->first() == NULL)) { - $item = $item->getParent()->first(); + while (!($item->parent()->first() == NULL)) { + $item = $item->parent()->first(); $title = $item->title . " > " . $title; } return $title; diff --git a/app/Models/ConsumableType.php b/app/Models/ConsumableType.php index 03ada7e8..ac4d9d48 100644 --- a/app/Models/ConsumableType.php +++ b/app/Models/ConsumableType.php @@ -51,4 +51,25 @@ public function getItems() { return $this->hasMany(ConsumableType::class)->get(); } + + public function getFullConsumableType() + { + $item = $this; + $title = $item->title; + while (!($item->parent()->first() == NULL)) { + $item = $item->parent()->first(); + $title = $item->title . " > " . $title; + } + return $title; + } + + public static function getFullTypeList() + { + $typeList = ConsumableType::all(); + $types = array(); + foreach ($typeList as $type) { + $types[$type->id] = $type->getFullConsumableType(); + } + return $types; + } } diff --git a/app/Models/EquipmentType.php b/app/Models/EquipmentType.php index d011d2f9..53608f65 100644 --- a/app/Models/EquipmentType.php +++ b/app/Models/EquipmentType.php @@ -48,7 +48,17 @@ public function children() return EquipmentType::where('parent_id', $this->id)->get(); } - public function getFullCategoryType() + public static function getFullTypeList() + { + $typeList = EquipmentType::all(); + $types = array(); + foreach ($typeList as $type) { + $types[$type->id] = $type->getFullEquipmentType(); + } + return $types; + } + + public function getFullEquipmentType() { $item = $this; $fullTitle = $this->title; From 78839233225e8b048ddf8d624aff5e543905f053 Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Mon, 1 May 2023 16:36:12 +0530 Subject: [PATCH 18/32] Bug fix --- .../views/frontend/component/index.blade.php | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/resources/views/frontend/component/index.blade.php b/resources/views/frontend/component/index.blade.php index 2a0f7913..e1f64c4d 100644 --- a/resources/views/frontend/component/index.blade.php +++ b/resources/views/frontend/component/index.blade.php @@ -39,35 +39,5 @@ @endforeach - - {{-- --}} - -
    -
    -

    Browse Components by Category

    - -
    - -
    -
    -
    @endsection From 6acd3cd96eb63e1f32ec65e453b3718be8c7affe Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Mon, 1 May 2023 16:37:48 +0530 Subject: [PATCH 19/32] item_thumbnail.jpg update --- config/constants.php | 2 +- public/dummy/{thumb.jpg => item_thumbnail.jpg} | Bin 2 files changed, 1 insertion(+), 1 deletion(-) rename public/dummy/{thumb.jpg => item_thumbnail.jpg} (100%) diff --git a/config/constants.php b/config/constants.php index 51218a21..d042b127 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,6 +2,6 @@ return [ 'frontend' => [ - 'dummy_thumb' => '/dummy/thumb.jpg', + 'dummy_thumb' => '/dummy/item_thumbnail.jpg', ] ]; diff --git a/public/dummy/thumb.jpg b/public/dummy/item_thumbnail.jpg similarity index 100% rename from public/dummy/thumb.jpg rename to public/dummy/item_thumbnail.jpg From cf0353df5605e718e9652be026247728cc6212cf Mon Sep 17 00:00:00 2001 From: Nuwan Jaliyagoda Date: Mon, 1 May 2023 17:18:36 +0530 Subject: [PATCH 20/32] Basic changes --- app/Helpers/Global/GeneralHelper.php | 8 +- .../Frontend/User/DashboardController.php | 2 +- .../views/backend/includes/header.blade.php | 4 +- .../views/frontend/includes/nav.blade.php | 81 +- resources/views/frontend/index.blade.php | 4 +- ...dashboard.blade.php => overview.blade.php} | 17 +- routes.txt | 1628 +++++++++-------- routes/backend/admin.php | 12 - routes/frontend/user.php | 7 +- routes/web.php | 10 +- 10 files changed, 870 insertions(+), 903 deletions(-) rename resources/views/frontend/user/{dashboard.blade.php => overview.blade.php} (61%) delete mode 100644 routes/backend/admin.php diff --git a/app/Helpers/Global/GeneralHelper.php b/app/Helpers/Global/GeneralHelper.php index 839253e7..989e5d05 100644 --- a/app/Helpers/Global/GeneralHelper.php +++ b/app/Helpers/Global/GeneralHelper.php @@ -2,7 +2,7 @@ use Carbon\Carbon; -if (! function_exists('appName')) { +if (!function_exists('appName')) { /** * Helper to grab the application name. * @@ -14,7 +14,7 @@ function appName() } } -if (! function_exists('carbon')) { +if (!function_exists('carbon')) { /** * Create a new Carbon instance from a time. * @@ -29,7 +29,7 @@ function carbon($time) } } -if (! function_exists('homeRoute')) { +if (!function_exists('homeRoute')) { /** * Return the route to the "home" page depending on authentication/authorization status. * @@ -43,7 +43,7 @@ function homeRoute() } if (auth()->user()->isUser()) { - return 'frontend.user.dashboard'; + return 'frontend.user.overview'; } } diff --git a/app/Http/Controllers/Frontend/User/DashboardController.php b/app/Http/Controllers/Frontend/User/DashboardController.php index b58b9c6f..8aa6b3c9 100644 --- a/app/Http/Controllers/Frontend/User/DashboardController.php +++ b/app/Http/Controllers/Frontend/User/DashboardController.php @@ -12,6 +12,6 @@ class DashboardController */ public function index() { - return view('frontend.user.dashboard'); + return view('frontend.user.overview'); } } diff --git a/resources/views/backend/includes/header.blade.php b/resources/views/backend/includes/header.blade.php index 47df8293..e3d4042e 100644 --- a/resources/views/backend/includes/header.blade.php +++ b/resources/views/backend/includes/header.blade.php @@ -43,9 +43,9 @@ class="c-header-nav-link dropdown-toggle" - + - User Dashboard + User Overview diff --git a/resources/views/frontend/includes/nav.blade.php b/resources/views/frontend/includes/nav.blade.php index 3bf96e9c..8d7b04dd 100644 --- a/resources/views/frontend/includes/nav.blade.php +++ b/resources/views/frontend/includes/nav.blade.php @@ -1,27 +1,19 @@
    Category
    --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - - {{-- @foreach($componentTypes as $type)--}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} + - {{-- --}} - {{-- @endforeach--}} - {{--
    TitleParent CategorySubtitleDescription 
    {{ $type->title }}--}} - {{-- @if( $type->parent() !== null)--}} - {{-- --}} - {{-- {{ $type->parent()->title }}--}} - {{-- --}} - {{-- @else--}} - {{-- N/A--}} - {{-- @endif--}} - {{-- {{ $type->subtitle ?? 'N/A' }}{{ $type->description }}--}} - {{--
    --}} - {{--
    --}} - {{-- --}} - {{-- --}} - - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{--
    --}} - {{--
    --}} - {{--
    --}} - {{-- {{ $componentTypes->links() }}--}} - {{--
    --}}
    diff --git a/resources/views/backend/consumable/items/edit-location.blade.php b/resources/views/backend/consumable/items/edit-location.blade.php index b7853faf..da8b74ec 100644 --- a/resources/views/backend/consumable/items/edit-location.blade.php +++ b/resources/views/backend/consumable/items/edit-location.blade.php @@ -14,17 +14,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif

    Change locations for {{ $consumableItem->title }}

    @@ -37,10 +29,7 @@ class="close" @endforeach
    - Back + Back
    diff --git a/resources/views/backend/consumable/items/index.blade.php b/resources/views/backend/consumable/items/index.blade.php index c875f10d..91029439 100644 --- a/resources/views/backend/consumable/items/index.blade.php +++ b/resources/views/backend/consumable/items/index.blade.php @@ -25,12 +25,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif diff --git a/resources/views/backend/consumable/types/index.blade.php b/resources/views/backend/consumable/types/index.blade.php index 0ddee7b9..10cbc22e 100644 --- a/resources/views/backend/consumable/types/index.blade.php +++ b/resources/views/backend/consumable/types/index.blade.php @@ -14,74 +14,22 @@
    @if ($logged_in_user->hasInventoryAccess()) - - - + + + + @endif @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif - -{{--
    --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - - {{-- @foreach($consumableTypes as $type)--}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}}{{-- --}} - {{-- --}} - {{-- --}} + - {{-- --}} - {{-- @endforeach--}} - {{--
    TitleParent CategorySubtitleDescription 
    {{ $type->title }}--}} - {{-- @if( $type->parent() !== null)--}} - {{-- --}} - {{-- {{ $type->parent()->title }}--}} - {{-- --}} - {{-- @else--}} - {{-- N/A--}} - {{-- @endif--}} - {{-- {{ $type->subtitle ?? 'N/A' }}{{ $type->description }}--}} - {{--
    --}} - {{--
    --}} - {{-- --}} - {{-- --}} - - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{--
    --}} - {{--
    --}} - {{--
    --}} - {{-- {{ $consumableTypes->links() }}--}} - {{--
    --}}
    diff --git a/resources/views/backend/equipment/items/edit-location.blade.php b/resources/views/backend/equipment/items/edit-location.blade.php index 514f829f..a3644320 100644 --- a/resources/views/backend/equipment/items/edit-location.blade.php +++ b/resources/views/backend/equipment/items/edit-location.blade.php @@ -14,23 +14,23 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif

    Change locations for {{ $equipmentItem->title }}

      - @foreach($locations as $i => $loc) - @include('backend.partials.location-hierarchy-for-edit-location', ['location' => $loc , 'itemModel' => $equipmentItem]) + @foreach ($locations as $i => $loc) + @include('backend.partials.location-hierarchy-for-edit-location', [ + 'location' => $loc, + 'itemModel' => $equipmentItem, + ]) @endforeach

    - Back + Back
    -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/backend/equipment/items/index.blade.php b/resources/views/backend/equipment/items/index.blade.php index 192400d5..8b98d630 100644 --- a/resources/views/backend/equipment/items/index.blade.php +++ b/resources/views/backend/equipment/items/index.blade.php @@ -23,12 +23,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif diff --git a/resources/views/backend/equipment/types/index.blade.php b/resources/views/backend/equipment/types/index.blade.php index ae35db22..db2bcd73 100644 --- a/resources/views/backend/equipment/types/index.blade.php +++ b/resources/views/backend/equipment/types/index.blade.php @@ -14,76 +14,22 @@
    @if ($logged_in_user->hasInventoryAccess()) - - - + + + + @endif @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif - - -{{--
    --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- @foreach($equipmentTypes as $equipmentType)--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}}{{-- --}} -{{-- --}} -{{-- --}} + -{{-- --}} -{{-- @endforeach--}} -{{--
    CodeTitleParent CategoryDescription 
    {{ $equipmentType->inventoryCode() }}{{ $equipmentType->title }}--}} -{{-- @if( $equipmentType->parent() !== null)--}} -{{-- --}} -{{-- {{ $equipmentType->parent()->title }}--}} -{{-- --}} -{{-- @else--}} -{{-- N/A--}} -{{-- @endif--}} -{{-- {{ $equipmentType->subtitle ?? 'N/A' }}{{ $equipmentType->description }}--}} -{{--
    --}} -{{--
    --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{--
    --}} -{{--
    --}} -{{--
    --}} -{{-- {{ $equipmentTypes->links() }}--}} -{{--
    --}}
    diff --git a/resources/views/backend/jobs/student/index.blade.php b/resources/views/backend/jobs/student/index.blade.php index 397f5087..98bbc424 100644 --- a/resources/views/backend/jobs/student/index.blade.php +++ b/resources/views/backend/jobs/student/index.blade.php @@ -14,84 +14,21 @@ @if ($logged_in_user->hasAllAccess()) - + + @endif @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif -{{--
    --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @foreach($jobs as $job)--}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} - -{{-- --}} -{{-- @endforeach--}} -{{--
    IDStatusMachineMaterialSupervisor 
    Job #{{ $job->id }}{{ \App\Models\JobRequests::job_status()[$job->status] }}--}} -{{-- @if($job->machine_info() != null)--}} -{{-- --}} -{{-- {{ $job->machine_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->material_info() != null)--}} -{{-- --}} -{{-- {{ $job->material_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->supervisor_info() != null)--}} -{{-- {{ $job->supervisor_info['name'] }}--}} -{{-- @endif--}} -{{-- --}} -{{--
    --}} -{{-- @if ($job->status == 'PENDING')--}} -{{-- --}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{--
    --}} -{{--
    --}} - -{{--
    --}}
    diff --git a/resources/views/backend/jobs/supervisor/index.blade.php b/resources/views/backend/jobs/supervisor/index.blade.php index 637e0f25..997c2b97 100644 --- a/resources/views/backend/jobs/supervisor/index.blade.php +++ b/resources/views/backend/jobs/supervisor/index.blade.php @@ -14,117 +14,20 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif

    Waiting for Supervisor Approval

    - - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - - {{-- @foreach($jobs as $job)--}} - {{-- @if($job->status == 'WAITING_SUPERVISOR_APPROVAL')--}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{-- --}} - - {{-- --}} - - {{-- --}} - {{-- @endif--}} - {{-- @endforeach--}} - {{--
    IDStatusMachineMaterialStudent 
    Job #{{ $job->id }}{{ \App\Models\JobRequests::job_status()[$job->status] }}--}} - {{-- @if($job->machine_info() != null)--}} - {{-- --}} - {{-- {{ $job->machine_info['title'] }}--}} - {{-- --}} - {{-- @endif--}} - {{-- --}} - {{-- @if($job->material_info() != null)--}} - {{-- --}} - {{-- {{ $job->material_info['title'] }}--}} - {{-- --}} - {{-- @endif--}} - {{-- --}} - {{-- @if($job->student_info() != null)--}} - {{-- {{ $job->student_info['name'] }}--}} - {{-- @endif--}} - {{-- --}} - {{--
    --}} - {{-- --}} - {{-- --}} - {{-- --}} - {{--
    --}} - {{--
    --}} - +

    Pending Fabrication

    - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- @foreach($jobs as $job)--}} -{{-- @if($job->status == 'PENDING_FABRICATION')--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} - -{{-- --}} -{{-- @endif--}} -{{-- @endforeach--}} -{{--
    IDStatusMachineMaterialStudent 
    Job #{{ $job->id }}{{ \App\Models\JobRequests::job_status()[$job->status] }}--}} -{{-- @if($job->machine_info() != null)--}} -{{-- --}} -{{-- {{ $job->machine_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->material_info() != null)--}} -{{-- --}} -{{-- {{ $job->material_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->student_info() != null)--}} -{{-- {{ $job->student_info['name'] }}--}} -{{-- @endif--}} -{{-- --}} -{{--  --}} -{{--
    --}} +
    diff --git a/resources/views/backend/jobs/technical-officer/index.blade.php b/resources/views/backend/jobs/technical-officer/index.blade.php index 776ed160..7b3f3b5d 100644 --- a/resources/views/backend/jobs/technical-officer/index.blade.php +++ b/resources/views/backend/jobs/technical-officer/index.blade.php @@ -15,71 +15,13 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif
    - - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- @foreach($jobs as $job)--}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} - -{{-- --}} -{{-- @endforeach--}} -{{--
    IDStatusMachineMaterialSupervisor 
    Job #{{ $job->id }}{{ \App\Models\JobRequests::job_status()[$job->status] }}--}} -{{-- @if($job->machine_info() != null)--}} -{{-- --}} -{{-- {{ $job->machine_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->material_info() != null)--}} -{{-- --}} -{{-- {{ $job->material_info['title'] }}--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- @if($job->supervisor_info() != null)--}} -{{-- {{ $job->supervisor_info['name'] }}--}} -{{-- @endif--}} -{{-- --}} -{{--
    --}} -{{-- @if ($job->status == 'PENDING_FABRICATION')--}} -{{-- --}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- --}} -{{--
    --}} -{{--
    --}} - +
    diff --git a/resources/views/backend/layouts/app.blade.php b/resources/views/backend/layouts/app.blade.php index ddb72357..d7b63fef 100644 --- a/resources/views/backend/layouts/app.blade.php +++ b/resources/views/backend/layouts/app.blade.php @@ -25,9 +25,14 @@ - {{-- --}} + + + + diff --git a/resources/views/backend/machines/edit-location.blade.php b/resources/views/backend/machines/edit-location.blade.php index 4ffcb394..2afe33ba 100644 --- a/resources/views/backend/machines/edit-location.blade.php +++ b/resources/views/backend/machines/edit-location.blade.php @@ -14,23 +14,24 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif +

    Change locations for {{ $machines->title }}

      - @foreach($locations as $i => $loc) - @include('backend.partials.location-hierarchy-for-edit-location', ['location' => $loc , 'itemModel' => $machines]) + @foreach ($locations as $i => $loc) + @include('backend.partials.location-hierarchy-for-edit-location', [ + 'location' => $loc, + 'itemModel' => $machines, + ]) @endforeach

    - Back + Back
    -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/backend/machines/index.blade.php b/resources/views/backend/machines/index.blade.php index d340f034..639d18f6 100644 --- a/resources/views/backend/machines/index.blade.php +++ b/resources/views/backend/machines/index.blade.php @@ -15,80 +15,21 @@ @if ($logged_in_user->hasInventoryAccess()) - + + @endif @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif -{{--
    --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- @foreach($machines as $machine)--}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- @endforeach--}} -{{--
    TitleTypeBuild Capacity (W x L x H)StatusLifespan 
    {{ $machine->title }}{{ \App\Models\Machines::types()[$machine->type] }}--}} -{{-- @if($machine->build_width != null && $machine->build_length != null && $machine->build_height!= null )--}} -{{-- {{ $machine->build_width }} x {{ $machine->build_length }}--}} -{{-- x {{ $machine->build_height }} mm--}} -{{-- @else--}} -{{-- N/A--}} -{{-- @endif--}} -{{-- {{ \App\Models\Machines::availabilityOptions()[$machine->status] }}{{ $machine->lifespanString() }}--}} -{{--
    --}} -{{--
    --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{--
    --}} -{{--
    --}} -{{--
    --}} - -{{-- {{ $machines->links() }}--}} -{{--
    --}} +
    diff --git a/resources/views/backend/orders/index.blade.php b/resources/views/backend/orders/index.blade.php index a25e2fcb..56af5d11 100644 --- a/resources/views/backend/orders/index.blade.php +++ b/resources/views/backend/orders/index.blade.php @@ -12,7 +12,7 @@ Orders -{{-- + {{-- @if ($logged_in_user->hasInventoryAccess()) @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif
    @@ -50,68 +47,66 @@ class="card-header-action"
     
    {{ $order->id }}{{ $order->id }}{{ $order->user->name }}{{ $order->user->name }} @foreach ($order->componentItems as $item) -
  • {{$item->title}}
  • - @endforeach +
  • {{ $item->title }}
  • + @endforeach
    @foreach ($order->componentItems as $item) -
  • {{$item->pivot->quantity}}
  • - @endforeach +
  • {{ $item->pivot->quantity }}
  • + @endforeach
    {{ $order->status }}{{ $order->ordered_date }}{{ $order->returned_date }}{{ $order->status }}{{ $order->ordered_date }}{{ $order->returned_date }}Not Picked upNot Picked up{{ $order->due_date_to_return }}{{ $order->dueDays() }}{{ $order->due_date_to_return }}{{ $order->dueDays() }}{{ $order->returned_date }}{{ $order->returned_date }}Not ReturnedNot ReturnedNot ReturnedNot Returned
    +
    {{ $orders->links() }}
    diff --git a/resources/views/backend/raw_materials/edit-location.blade.php b/resources/views/backend/raw_materials/edit-location.blade.php index 12df90f5..2f6e98f7 100644 --- a/resources/views/backend/raw_materials/edit-location.blade.php +++ b/resources/views/backend/raw_materials/edit-location.blade.php @@ -14,23 +14,23 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif

    Change locations for {{ $rawMaterials->title }}

      - @foreach($locations as $i => $loc) - @include('backend.partials.location-hierarchy-for-edit-location', ['location' => $loc , 'itemModel' => $rawMaterials]) + @foreach ($locations as $i => $loc) + @include('backend.partials.location-hierarchy-for-edit-location', [ + 'location' => $loc, + 'itemModel' => $rawMaterials, + ]) @endforeach

    - Back + Back
    -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/backend/raw_materials/index.blade.php b/resources/views/backend/raw_materials/index.blade.php index 971997b4..d0623a27 100644 --- a/resources/views/backend/raw_materials/index.blade.php +++ b/resources/views/backend/raw_materials/index.blade.php @@ -15,70 +15,21 @@ @if ($logged_in_user->hasInventoryAccess()) - + + @endif @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif -{{--
    --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @foreach($raw_materials as $cm)--}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- @endforeach--}} -{{--
    TitleColorQuantityAvailability 
    {{ $cm->title }}{{ $cm->color }}{{ $cm->quantity }} {{ $cm->unit }}{{ $cm->availability }}--}} -{{--
    --}} -{{--
    --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{--
    --}} -{{--
    --}} -{{--
    --}} - -{{-- {{ $raw_materials->links() }}--}} -{{--
    --}}
    diff --git a/resources/views/backend/reservation/index.blade.php b/resources/views/backend/reservation/index.blade.php index 2b949e8f..92eeb765 100644 --- a/resources/views/backend/reservation/index.blade.php +++ b/resources/views/backend/reservation/index.blade.php @@ -16,12 +16,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif
    @@ -37,18 +34,18 @@   - @foreach($reservation as $res) + @foreach ($reservation as $res) - + - @if($res->res_info() != null) + @if ($res->res_info() != null) {{ $res->res_info['name'] }} @endif - @if($res->st_info() != null) + @if ($res->st_info() != null) {{ $res->st_info['stationName'] }} @endif @@ -57,21 +54,21 @@ {{ $res->duration }} {{ $res->E_numbers }} - @if($res->status == "approved") + @if ($res->status == 'approved') Approved - @elseif($res->status == "rejected") - Rejected + @elseif($res->status == 'rejected') + Rejected @else - Pending + Pending @endif - +
    @@ -87,4 +84,4 @@ class="btn btn-info btn-xs">
    -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/backend/reservation/user/index.blade.php b/resources/views/backend/reservation/user/index.blade.php index 1adb71e5..09cda1f7 100644 --- a/resources/views/backend/reservation/user/index.blade.php +++ b/resources/views/backend/reservation/user/index.blade.php @@ -6,7 +6,7 @@ @include('backend.reservation.user.breadcrumb-links') @endsection -@section('content') +@section('content')
    @@ -15,11 +15,8 @@ @if ($logged_in_user->hasAllAccess()) - + + @endif @@ -27,19 +24,13 @@ class="card-header-action" @if (session('Success')) -
    + {{ session('Success') }} - -
    + @elseif(session('Error')) -
    + {{ session('Error') }} - -
    + @endif @@ -55,40 +46,39 @@ class="card-header-action" - @foreach($reservation as $res) + @foreach ($reservation as $res) - - + + - @if($res->st_info() != null) - {{ $res->st_info['stationName'] }} - @endif + @if ($res->st_info() != null) + {{ $res->st_info['stationName'] }} + @endif {{ $res->start_date }} {{ $res->end_date }} {{ $res->duration }} {{ $res->E_numbers }} - + @@ -101,4 +91,4 @@ class="btn btn-danger btn-xs">
    -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/backend/search/index.blade.php b/resources/views/backend/search/index.blade.php index f44a1163..194a93a8 100644 --- a/resources/views/backend/search/index.blade.php +++ b/resources/views/backend/search/index.blade.php @@ -19,12 +19,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif @if (!empty($status)) @@ -35,13 +32,13 @@

    Search for Equipment, Components, Consumables, Machines and Raw Material

    - {{ Form::open(array('route' => 'admin.search.results')) }} + {{ Form::open(['route' => 'admin.search.results']) }}
    - {!! Form::text('keywords', '', ['class' => 'form-control'] ) !!} + {!! Form::text('keywords', '', ['class' => 'form-control']) !!}
    - {!! Form::submit('Search', ['class'=>'btn btn-primary float-right btn-150']) !!} + {!! Form::submit('Search', ['class' => 'btn btn-primary float-right btn-150']) !!}
    {{ Form::close() }} @@ -50,4 +47,3 @@
    @endsection - diff --git a/resources/views/backend/search/results.blade.php b/resources/views/backend/search/results.blade.php index 467af015..815d9e00 100644 --- a/resources/views/backend/search/results.blade.php +++ b/resources/views/backend/search/results.blade.php @@ -18,38 +18,31 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif - {{--

    Search

    --}} - {{-- TODO: Add a back button or give an option to change the search text like in Google --}} - - You are searching for '{{$keywords}}'.
    - There are {{ $searchResults->count() }} results. - - @if($searchResults->count() == 0) -
    Please check your spellings - @endif -

    - @foreach($searchResults->groupByType() as $type => $modelSearchResults) -{{--

    {{ $type }}

    --}} - - - @foreach($modelSearchResults as $searchResult) - - @endforeach + {{--

    Search

    --}} + {{-- TODO: Add a back button or give an option to change the search text like in Google --}} + + You are searching for '{{ $keywords }}'.
    + There are {{ $searchResults->count() }} results. + + @if ($searchResults->count() == 0) +
    Please check your spellings + @endif +

    + @foreach ($searchResults->groupByType() as $type => $modelSearchResults) + @foreach ($modelSearchResults as $searchResult) + @endforeach + @endforeach
    @endsection - diff --git a/resources/views/backend/search/reverseIndex.blade.php b/resources/views/backend/search/reverseIndex.blade.php index b834db2b..b997b8bd 100644 --- a/resources/views/backend/search/reverseIndex.blade.php +++ b/resources/views/backend/search/reverseIndex.blade.php @@ -17,12 +17,9 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif @if (!empty($status)) @@ -30,13 +27,17 @@ {{ $status }}
    @endif - {{ Form::open(array('route' => 'admin.search.reverse.results')) }} + {{ Form::open(['route' => 'admin.search.reverse.results']) }}
    - {!! Form::select('location', $locations, null, ['class'=>'form-control', 'required'=>true, 'placeholder' => '']) !!} + {!! Form::select('location', $locations, null, [ + 'class' => 'form-control', + 'required' => true, + 'placeholder' => '', + ]) !!}
    - {!! Form::submit('Search', ['class'=>'btn btn-primary float-right btn-150']) !!} + {!! Form::submit('Search', ['class' => 'btn btn-primary float-right btn-150']) !!}
    {{ Form::close() }} diff --git a/resources/views/backend/search/reverseResults.blade.php b/resources/views/backend/search/reverseResults.blade.php index 6cabcad3..20414be9 100644 --- a/resources/views/backend/search/reverseResults.blade.php +++ b/resources/views/backend/search/reverseResults.blade.php @@ -18,17 +18,14 @@ @if (session('Success')) -
    + {{ session('Success') }} - -
    + @endif {{-- TODO: Add a back button or give an option to change the dropdown location like in Google --}} -

    Items at {{$locationName}}

    +

    Items at {{ $locationName }}

    @if (!empty($status))