Skip to content

Commit

Permalink
create table fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
theory-of-evrth committed Oct 29, 2024
1 parent 949818e commit 9496a02
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 68 deletions.
2 changes: 1 addition & 1 deletion timeliner/app/Http/Controllers/TimelineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function store(Request $request)
{
\App\Models\Timeline::create($request->all());
// TODO solve mass assignement problem
return redirect()->route('timeline.timelinelist')->with('success','Timeline created successfully.');
return redirect()->route('home')->with('success','Timeline created successfully.');
}
}
6 changes: 6 additions & 0 deletions timeliner/app/Models/Timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@
class Timeline extends Model
{
use HasFactory;

protected $fillable = [
'name',
'private',
'description',
];
}
2 changes: 1 addition & 1 deletion timeliner/resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<h1>Timeliner</h1>
<p class="lead">Timeliner dashboard. Here you can access view timelines available to you, whether public or yours.</p>

@include("timeline.timelinelist", $timelines)
@include("timeline.partials.timelinelist", $timelines)

</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions timeliner/resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,21 @@
</header>
@endisset

<!-- Page Content -->
<main>
{{ $slot }}
</main>

<!-- Page Content -
<main class="container mt-3">
<!-- $slot -->
$slot
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
@yield('content')
</main>
-->
</div>

<!-- Bootstrap JS -->
Expand Down
64 changes: 0 additions & 64 deletions timeliner/resources/views/timeline/create.blade.php

This file was deleted.

70 changes: 70 additions & 0 deletions timeliner/resources/views/timeline/createtimeline.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Create timeline') }}
</h2>
</x-slot>


<!-- TODO fixe timeline.store -->
<form action="{{ route("timeline.store") }}" method="POST">
@csrf

<div class="row">
<div class="col-12 col-lg-6 offset-0 offset-lg-3">
<div class="card">
<div class="card-header">
Nouveau timeline
</div>
<div class="card-body">
<div class="form-row">
<div class="form-group col-12">
<label for="inputTitle">Titre</label>
<input type="text" name="name" class="form-control" id="inputTitle">
</div>
<div class="form-group col-12">
<!-- TODO accecpt only people that are in the database -->
<!-- TODO accecpt several people -->
<label for="inputDescription">Description</label>
<input type="text" name="description" class="form-control" id="inputDescription">
</div>

<div class="form-group col-12">
<!-- TODO accecpt only people that are in the database -->
<!-- TODO accecpt several people -->
<label for="inputStatus">Status (public/private)</label>
<input type="text" name="private" class="form-control" id="inputStatus">
</div>
<!--
<div class="row mt-3">
<div class="form-group col-6">
<label for="selectStartDate">Date de départ</label>
<input type="date" name="startDate" value="{{date('d/m/y')}}" class="form-control" id="selectStartDate">
</div>
<div class="form-group col-6">
<label for="selectEndDate">Date de fin</label>
<input type="date" name="endDate" value="{{date('d/m/y')}}" class="form-control" id="selectEndDate">
</div>
</div>
-->
<div class="form-group col-6">
<!-- TODO button 'Ajouter' redirect to the detail of the newly created timeline -->
<button class="btn btn-primary" href={{ route('timeline.create') }} type="submit" class="btn btn-primary mt-3">Ajouter</button>
</div>
</div>
</div>
</div>
@if ($errors->any())
<div class="alert alert-danger mt-3 col-12">
<strong>Whoops!</strong> Il y a un problème avec vos entrées.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
</form>
</x-app-layout>

0 comments on commit 9496a02

Please sign in to comment.