Add: Delete course
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
bcc5d7af4b
commit
ef20eee81d
|
@ -17,20 +17,20 @@ class CourseController extends Controller
|
|||
{
|
||||
$request->persist($member);
|
||||
|
||||
return redirect()->route('member.index');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function update(Member $member, CourseMember $course, UpdateRequest $request): RedirectResponse
|
||||
{
|
||||
$request->persist($member, $course);
|
||||
|
||||
return redirect()->route('member.index');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function destroy(Member $member, CourseMember $course, DestroyRequest $request): RedirectResponse
|
||||
{
|
||||
$request->persist($member, $course);
|
||||
|
||||
return redirect()->route('member.index');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,12 @@ class CourseResource extends JsonResource
|
|||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'organizer' => $this->pivot->organizer,
|
||||
'event_name' => $this->pivot->event_name,
|
||||
'completed_at_human' => Carbon::parse($this->pivot->completed_at)->format('d.m.Y'),
|
||||
'completed_at' => $this->pivot->completed_at,
|
||||
'course_name' => $this->name,
|
||||
'organizer' => $this->organizer,
|
||||
'event_name' => $this->event_name,
|
||||
'completed_at_human' => Carbon::parse($this->completed_at)->format('d.m.Y'),
|
||||
'completed_at' => $this->completed_at,
|
||||
'course_name' => $this->course->name,
|
||||
'course_id' => $this->course->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Initialize;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class InitializeController extends Controller
|
||||
{
|
||||
|
@ -14,6 +14,6 @@ class InitializeController extends Controller
|
|||
public function store() {
|
||||
InitializeJob::dispatch(auth()->user());
|
||||
|
||||
return \Inertia::render('Initialize/Index');
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d348aea5f6bba6cf3eb8e2050a738817f281b4c3
|
||||
Subproject commit d96457dd338857306b6ffb14da5444b8cf08417a
|
|
@ -3,9 +3,10 @@
|
|||
<sidebar-header :links="indexLinks" @close="$emit('close')" @create="mode = 'create'; single = {}" title="Ausbildungen"></sidebar-header>
|
||||
|
||||
<form v-if="single" class="p-6 grid gap-4 justify-start" @submit.prevent="submit">
|
||||
<f-text id="nr" v-model="single.nr" label="Jahr" required></f-text>
|
||||
<f-select id="subscription_id" :options="subscriptions" v-model="single.subscription_id" label="Beitrag" required></f-select>
|
||||
<f-select id="status_id" :options="statuses" v-model="single.status_id" label="Status" required></f-select>
|
||||
<f-text id="completed_at" type="date" v-model="single.completed_at" label="Datum" required></f-text>
|
||||
<f-select id="course_id" :options="courses" v-model="single.course_id" label="Baustein" required></f-select>
|
||||
<f-text id="event_name" v-model="single.event_name" label="Veranstaltung" required></f-text>
|
||||
<f-text id="organizer" v-model="single.organizer" label="Veranstalter" required></f-text>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
</form>
|
||||
|
||||
|
@ -47,6 +48,7 @@ export default {
|
|||
},
|
||||
|
||||
props: {
|
||||
courses: {},
|
||||
value: {}
|
||||
},
|
||||
|
||||
|
@ -54,11 +56,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
remove(payment) {
|
||||
this.$inertia.delete(`/member/${this.value.id}/payment/${payment.id}`);
|
||||
},
|
||||
|
||||
accept(payment) {
|
||||
this.$inertia.patch(`/member/${this.value.id}/payment/${payment.id}`, { ...payment, status_id: 3 });
|
||||
this.$inertia.delete(`/member/${this.value.id}/course/${payment.id}`);
|
||||
},
|
||||
|
||||
openLink(link) {
|
||||
|
@ -73,23 +71,17 @@ export default {
|
|||
var _self = this;
|
||||
|
||||
this.mode === 'create'
|
||||
? this.$inertia.post(`/member/${this.value.id}/payment`, this.single, {
|
||||
? this.$inertia.post(`/member/${this.value.id}/course`, this.single, {
|
||||
onFinish() {
|
||||
_self.single = null;
|
||||
}
|
||||
})
|
||||
: this.$inertia.patch(`/member/${this.value.id}/payment/${this.single.id}`, this.single, {
|
||||
: this.$inertia.patch(`/member/${this.value.id}/course/${this.single.id}`, this.single, {
|
||||
onFinish() {
|
||||
_self.single = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
value: {},
|
||||
subscriptions: {},
|
||||
statuses: {},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Feature\Member;
|
||||
|
||||
use App\Course\Models\Course;
|
||||
use App\Course\Models\CourseMember;
|
||||
use App\Member\Member;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
@ -16,7 +18,7 @@ class IndexTest extends TestCase
|
|||
$this->withoutExceptionHandling();
|
||||
$this->login();
|
||||
|
||||
Member::factory()->defaults()->create(['firstname' => '::firstname']);
|
||||
Member::factory()->defaults()->has(CourseMember::factory()->for(Course::factory()), 'courses')->create(['firstname' => '::firstname']);
|
||||
$this->get('/member')->assertInertia('member/Index', ['firstname' => '::firstname'], 'data.data.0');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue