Skip to content

Commit

Permalink
feat: frontend draft for tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Oct 3, 2023
1 parent 6593503 commit 0229e56
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 19 deletions.
20 changes: 20 additions & 0 deletions app/Http/Controllers/TaskController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class TaskController extends Controller
{
/**
*
* Show the application task dashboard.
* @return \Illuminate\Http\Response
*
*/
public function index()
{
return view('tasks.index');
}

}
10 changes: 10 additions & 0 deletions resources/sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@ $transition-collapse: height 0.15s ease !default;
// Dropdowns
$dropdown-font-size: 0.85rem;
$dropdown-border-color: $border-color;

// Relative position values
$position-values: (
0: 0,
25: 25%,
40: 40%,
50: 50%,
75: 75%,
100: 100%
);
5 changes: 5 additions & 0 deletions resources/sass/navs/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
margin: 0 0 1rem;
}

.badge{
font-size: 0.7rem !important;
border-radius: 50%;
}

.nav-item {

// Accordion
Expand Down
8 changes: 8 additions & 0 deletions resources/views/layouts/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<span>Dashboard</span></a>
</li>

<li class="nav-item {{ Route::is('tasks') ? 'active' : '' }}">
<a class="nav-link" href="{{ route('tasks') }}">
<i class="fas fa-fw fa-list"></i>
<span>Tasks</span>
<span class="badge text-bg-danger">3</span>
</a>
</li>

@can('view', \App\Models\Booking::class)
<li class="nav-item {{ Route::is('booking*') ? 'active' : '' }}">
<a class="nav-link" href="{{ route('booking') }}">
Expand Down
5 changes: 4 additions & 1 deletion resources/views/layouts/topbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@
</li>

<li class="nav-item dropdown d-lg-none">
<button class="nav-link" id="sidebar-button">
<button class="nav-link position-relative" id="sidebar-button">
<i class="fas fa-bars"></i>
<span class="position-absolute top-40 start-75 translate-middle p-1 bg-danger border border-light rounded-circle">
<span class="visually-hidden">New alerts</span>
</span>
</button>
</li>

Expand Down
100 changes: 100 additions & 0 deletions resources/views/tasks/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@extends('layouts.app')

@section('title', 'Tasks')
@section('title-flex')
<div>
<i class="fas fa-filter"></i>&nbsp;Filter:&nbsp;
<a class="btn btn-sm btn-primary" href="">Open</a>
<a class="btn btn-sm btn-outline-primary" href="">Sent</a>
<a class="btn btn-sm btn-outline-primary" href="">Archived</a>
</div>
@endsection

@section('header')
@vite(['resources/sass/bootstrap-table.scss', 'resources/js/bootstrap-table.js'])
@endsection

@section('content')

<div class="row">
<div class="col-xl-12 col-md-12 mb-12">
<div class="card shadow mb-4">
<div class="card-header bg-primary py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 fw-bold text-white">Tasks</h6>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-sm table-hover table-leftpadded mb-0" width="100%" cellspacing="0"
data-toggle="table"
data-pagination="true"
data-filter-control="true"
data-page-size="15"
data-page-list=[10,15,25,50]
data-sort-reset="true">
<thead class="table-light">
<tr>
<th>Task #</th>
<th>Type</th>
<th>Regarding</th>
<th>Request</th>
<th>From</th>
<th>Actions</th>
</tr>
</thead>
<tbody>

<tr>
<td>14</td>
<td><i class="fas fa-circle-arrow-up"></i> Rating Upgrade</td>
<td>Sara Student (1000241)</td>
<td>
<a href="#" style="text-decoration: underline;">Grant S1 theoretical exam for Sara Student (1000241) <i class="fas fa-arrow-up-right-from-square"></i></a>
</td>
<td>John Doe (10000010)</td>

<td>
<a href="" class="btn btn-sm btn-outline-success"><i class="fas fa-check"></i> Complete</a>
<a href="" class="btn btn-sm btn-outline-danger"><i class="fas fa-xmark"></i> Decline</a>
</td>
</tr>

<tr>
<td>15</td>
<td><i class="fas fa-key"></i> Theoretical Exam Access</td>
<td>Sara Student (1000241)</td>
<td>
<a href="#" style="text-decoration: underline;">Upgrade Sara Student (1000241) to S1 <i class="fas fa-arrow-up-right-from-square"></i></a>
</td>
<td>John Doe (10000010)</td>

<td>
<a href="" class="btn btn-sm btn-outline-success"><i class="fas fa-check"></i> Complete</a>
<a href="" class="btn btn-sm btn-outline-danger"><i class="fas fa-xmark"></i> Decline</a>
</td>
</tr>

<tr>
<td>15</td>
<td><i class="fas fa-message"></i> Custom Memo</td>
<td>Sara Student (1000241)</td>
<td>
Could you please add MAE to this student's training?
</td>
<td>John Doe (10000010)</td>

<td>
<a href="" class="btn btn-sm btn-outline-success"><i class="fas fa-check"></i> Complete</a>
<a href="" class="btn btn-sm btn-outline-danger"><i class="fas fa-xmark"></i> Decline</a>
</td>
</tr>

</tbody>
</table>
</div>
</div>
</div>
</div>

</div>

@endsection
89 changes: 71 additions & 18 deletions resources/views/training/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,16 @@
@endforeach
</h6>

@if(\Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_REPORT_TYPE]) || \Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_EXAMINATION_TYPE]))
<button class="btn btn-light btn-icon dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-link"></i> Create
</button>
<div class="dropdown">
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_REPORT_TYPE])
<button class="dropdown-item" id="getOneTimeLinkReport">Report one-time link</button>
@endif
@can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_EXAMINATION_TYPE])
<button class="dropdown-item" id="getOneTimeLinkExam">Examination one-time link</button>
@endif
</div>
<button class="btn btn-light btn-icon dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-hand"></i> Request
</button>
<div class="dropdown">
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<button class="dropdown-item" data-bs-toggle="modal" data-bs-target="#exampleModal"><i class="fas fa-key"></i> Theoretical Exam Token</button>
<button class="dropdown-item"><i class="fas fa-circle-arrow-up"></i> Rating Upgrade</button>
<button class="dropdown-item"><i class="fas fa-message"></i> Custom Memo</button>
</div>
@endif
</div>
</div>
<div class="card-body">
<dl class="copyable">
Expand Down Expand Up @@ -395,27 +390,39 @@
Training Reports
</h6>

@if($training->status >= \App\Helpers\TrainingStatus::PRE_TRAINING->value && $training->status <= \App\Helpers\TrainingStatus::AWAITING_EXAM->value)
@if(
\Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_REPORT_TYPE]) ||
\Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_EXAMINATION_TYPE]) ||
($training->status >= \App\Helpers\TrainingStatus::PRE_TRAINING->value && $training->status <= \App\Helpers\TrainingStatus::AWAITING_EXAM->value)
)
<div class="dropdown" style="display: inline;">
<button class="btn btn-light btn-icon dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus"></i> Add
<i class="fas fa-plus"></i> Create
</button>

<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@can('create', [\App\Models\TrainingReport::class, $training])
@if($training->status >= \App\Helpers\TrainingStatus::PRE_TRAINING->value)
<a class="dropdown-item" href="{{ route('training.report.create', ['training' => $training->id]) }}">Training Report</a>
<a class="dropdown-item" href="{{ route('training.report.create', ['training' => $training->id]) }}"><i class="fas fa-file"></i> Training Report</a>
@endif
@else
<a class="dropdown-item disabled" href="#"><i class="fas fa-lock"></i>&nbsp;Training Report</a>
@endcan

@can('create', [\App\Models\TrainingExamination::class, $training])
@if($training->status == \App\Helpers\TrainingStatus::AWAITING_EXAM->value)
<a class="dropdown-item" href="{{ route('training.examination.create', ['training' => $training->id]) }}">Exam Report</a>
<a class="dropdown-item" href="{{ route('training.examination.create', ['training' => $training->id]) }}"><i class="fas fa-file"></i> Exam Report</a>
@endif
@else
<a class="dropdown-item disabled" href="#"><i class="fas fa-lock"></i>&nbsp;Exam Report</a>
@endcan

@can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_REPORT_TYPE])
<button class="dropdown-item" id="getOneTimeLinkReport"><i class="fas fa-link"></i> Report one-time link</button>
@endif
@can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_EXAMINATION_TYPE])
<button class="dropdown-item" id="getOneTimeLinkExam"><i class="fas fa-link"></i> Examination one-time link</button>
@endif
</div>
</div>
@endif
Expand Down Expand Up @@ -621,6 +628,52 @@
</div>
</div>

<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Request</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">

<div class="alert alert-primary">
<i class="fas fa-key"></i> Theoretical Exam Token for <b>S1 rating</b>
</div>

<div class="mt-3">
<label class="form-label" for="user">Send request to</label>
<input
id="user"
class="form-control"
type="text"
name="user"
list="userList"
value=""
>

<datalist id="userList">
<option value="1">Simo Pitikanenen</option>
<option value="2">Christian Kovanenne</option>
<option value="3">Daniel Lange</option>
</datalist>

<div>
<span class="badge text-bg-primary"><i class="fas fa-bolt"></i> Christian Kovanen</span>
<span class="badge text-bg-primary"><i class="fas fa-bolt"></i> Simo Pierkannana</span>
<span class="badge text-bg-primary"><i class="fas fa-bolt"></i> Daniel Laaaange</span>
<span class="badge text-bg-primary"><i class="fas fa-bolt"></i> Krister Larsen</span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success">Send request</button>
</div>
</div>
</div>
</div>


@endsection

Expand Down
5 changes: 5 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Http\Controllers\OneTimeLinkController;
use App\Http\Controllers\ReportController;
use App\Http\Controllers\SweatbookController;
use App\Http\Controllers\TaskController;
use App\Http\Controllers\TrainingActivityController;
use App\Http\Controllers\TrainingController;
use App\Http\Controllers\TrainingExaminationController;
Expand Down Expand Up @@ -187,4 +188,8 @@
Route::patch('/vote/{id}', 'update')->name('vote.update');
Route::get('/vote/{id}', 'show')->name('vote.show');
});

Route::controller(TaskController::class)->group(function () {
Route::get('/tasks', 'index')->name('tasks');
});
});

0 comments on commit 0229e56

Please sign in to comment.