Skip to content

Commit a9b51ac

Browse files
Event page functionalities added
2 parents 74405c5 + f63db23 commit a9b51ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4205
-517
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

app/Event_Attending.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class Event_Attending extends Model
88
{
99
//
10+
protected $table='event_attendings';
1011

1112

1213
public function role(){

app/Http/Controllers/EventController.php

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Event_Attending;
6+
use App\Language;
7+
use App\User;
58
use Illuminate\Http\Request;
69
use App\Event;
10+
use App\Location;
11+
use App\Role;
12+
713

814
class EventController extends Controller
915
{
@@ -13,7 +19,97 @@ public function showDetails($name){
1319

1420
$event=Event::where('name', $name)->get()->first();
1521

16-
return view('event', compact('event'));
22+
$loc_id=$event->loc_id;
23+
$locations=Location::where('id', $loc_id)->get();
24+
25+
foreach($locations as $location){
26+
$location_name=$location->name;
27+
}
28+
29+
$lang_id=$event->lang_id;
30+
$languages=Language::where('id', $lang_id)->get();
31+
32+
foreach($languages as $language){
33+
$language_name=$language->name;
34+
}
35+
36+
//organizer info
37+
38+
$organizer_roles=Role::where('title', 'organizer')->get(); /*where('project/event', 'event')->*/
39+
$organizer_role_id=null;
40+
41+
foreach($organizer_roles as $organizer_role){
42+
$organizer_role_id=$organizer_role->id;
43+
}
44+
45+
$event_id=$event->id;
46+
47+
$event_attendings=Event_Attending::where('event_id', $event_id)->get();
48+
49+
foreach($event_attendings as $event_attending){
50+
if($event_attending->role_id==$organizer_role_id){
51+
$organizer_id=$event_attending->user_id;
52+
}
53+
}
54+
55+
$organizers=User::where('id', $organizer_id)->get();
56+
57+
foreach ($organizers as $organiser){
58+
$organizer_name=$organiser->name;
59+
$organizer_surname=$organiser->surname;
60+
$organizer_position=$organiser->position;
61+
}
62+
63+
64+
// all event attendees
65+
66+
$attendee_roles=Role::where('title', 'attendee')->get(); /*where('project/event', 'event')->*/
67+
$attendee_role_id=null;
68+
69+
foreach($attendee_roles as $attendee_role){
70+
$attendee_role_id=$attendee_role->id;
71+
}
72+
73+
$attendees=Event_Attending::where('event_id', $event->id)->where('role_id', $attendee_role_id)->get();
74+
75+
76+
return view('event', compact('event', 'location_name', 'language_name', 'organizer_name', 'organizer_surname', 'organizer_position', 'attendees'));
77+
}
78+
79+
public function editEvent(){
80+
81+
}
82+
83+
public function goingOnEvent(Request $request){
84+
85+
$user_id=$request['id'];
86+
$event_name = $request['event'];
87+
88+
$events=Event::where('name', $event_name)->get();
89+
foreach ($events as $event) {
90+
91+
$event_id=$event->id;
92+
93+
}
94+
95+
$user=User::findOrFail($user_id);
96+
$user_clicked_name=$user->name;
97+
$user_clicked_surname=$user->surname;
98+
$user_clicked_position=$user->position;
99+
100+
101+
$role=Role::where('title', 'attendee')->get()->first();
102+
103+
104+
// event attendings
105+
106+
$event_attendings=Event_Attending::where('user_id', $user_id)->where('event_id', $event_id)->get();
107+
108+
if($event_attendings->isEmpty()){
109+
Education::create(['event_id' => $event_id, 'role_id'=> $role->id, 'user_id'=>$user->id]);
110+
111+
}
112+
17113

18114

19115

app/Http/Controllers/HRController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class HRController extends Controller
1414
function returnView(){
1515
return view("hrnewuser");
1616
}
17+
1718
function sendMail(Request $request){
1819

1920
$user = new User();

database/migrations/2018_03_13_131759_create_event_attendings_table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public function up()
2020
$table->integer('role_id')->unsigned();
2121
$table->integer('user_id')->unsigned();
2222

23-
$table->foreign('event_id')->references('id')->on('events');
24-
$table->foreign('role_id')->references('id')->on('roles');
25-
$table->foreign('user_id')->references('id')->on('users');
23+
$table->foreign('event_id')->references('id')->on('events')->onDelete('restrict');
24+
$table->foreign('role_id')->references('id')->on('roles')->onDelete('restrict');
25+
$table->foreign('user_id')->references('id')->on('users')->onDelete('restrict');
2626

2727
$table->timestamps();
2828
});

public/css/app.css

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3820,6 +3820,7 @@ body, html {
38203820
padding: 1%;
38213821
}
38223822
#login_form input {
3823+
display: inline-block;
38233824
width: 70%;
38243825
height: 8%;
38253826
padding: 10px 10px 10px 25px;
@@ -3849,6 +3850,13 @@ body, html {
38493850
color: #fff;
38503851
}
38513852

3853+
.invalid-feedback {
3854+
color: white !important;
3855+
font-size: 1.1rem;
3856+
text-decoration: none;
3857+
font-weight: normal;
3858+
}
3859+
38523860
.section_title {
38533861
background-color: #025284;
38543862
color: white;
@@ -3873,15 +3881,29 @@ body, html {
38733881
.main_content_section .details_section p {
38743882
color: black;
38753883
}
3884+
.main_content_section .details_section textarea {
3885+
color: black;
3886+
background: none;
3887+
border: none;
3888+
outline: none;
3889+
resize: none;
3890+
overflow: hidden;
3891+
transition: all 0.9s ease;
3892+
}
38763893
.main_content_section .details_section .details_div {
3877-
height: 150px;
3894+
height: 170px;
38783895
background-color: #025284;
38793896
color: white;
38803897
padding-left: 10px !important;
38813898
}
38823899
.main_content_section .details_section .details_div h6:first-child {
38833900
padding-top: 10px;
38843901
}
3902+
.main_content_section .details_section .details_div input {
3903+
background: none;
3904+
border: none;
3905+
color: white;
3906+
}
38853907

38863908
.profile_img {
38873909
border-radius: 50%;
@@ -4275,7 +4297,7 @@ body, html {
42754297
}
42764298

42774299
.timeline_vertical:before {
4278-
top: 50px;
4300+
top: 20px;
42794301
bottom: 50px;
42804302
position: absolute;
42814303
content: " ";
@@ -4296,25 +4318,25 @@ body, html {
42964318
}
42974319

42984320
#tml_crcl_1 {
4299-
top: 145px;
4321+
top: 100px;
43004322
}
43014323

43024324
#tml_crcl_2 {
4303-
top: 365px;
4325+
top: 325px;
43044326
}
43054327

43064328
#tml_crcl_3 {
4307-
top: 585px;
4329+
top: 555px;
43084330
}
43094331

43104332
#tml_crcl_4 {
4311-
top: 805px;
4333+
top: 760px;
43124334
}
43134335

43144336
.horizontal_line_left, .horizontal_line_right {
43154337
position: absolute;
43164338
top: 50%;
4317-
border-top: 1px solid #07dd85;
4339+
border-top: 1.5px solid #07dd85;
43184340
width: 60px;
43194341
}
43204342

@@ -4326,6 +4348,13 @@ body, html {
43264348
right: -40px;
43274349
}
43284350

4351+
.timeline_vertical .event_date_right {
4352+
margin-top: 3%;
4353+
}
4354+
.timeline_vertical .event_date_left {
4355+
margin-top: 3%;
4356+
}
4357+
43294358
.home_section {
43304359
margin-top: 80px;
43314360
margin-left: 0;
@@ -4370,6 +4399,7 @@ body, html {
43704399
}
43714400
.home_section .left_section {
43724401
margin-bottom: 30px;
4402+
position: relative;
43734403
}
43744404
.home_section .left_section .see_more_btn {
43754405
background-color: #07dd85;
@@ -4397,6 +4427,7 @@ body, html {
43974427
height: 200px;
43984428
margin-bottom: 20px;
43994429
display: table;
4430+
position: absolute;
44004431
}
44014432
.home_section .left_section .event_date_left h6, .home_section .left_section .event_date_right h6 {
44024433
display: table-cell;
@@ -4420,6 +4451,9 @@ body, html {
44204451
padding-right: 2%;
44214452
display: inline-block;
44224453
}
4454+
.left_section .container {
4455+
position: relative;
4456+
}
44234457

44244458
#msg {
44254459
bottom: -70px;
@@ -4573,9 +4607,10 @@ body, html {
45734607
}
45744608

45754609
.modal-footer .allgood {
4576-
color: #07dd85;
4610+
color: #07dd85 !important;
45774611
}
4578-
.modal-footer .notallgood {
4612+
4613+
.notallgood {
45794614
color: red;
45804615
}
45814616

@@ -4653,7 +4688,7 @@ body, html {
46534688
box-shadow: 0 10px 30px 0 rgba(46, 61, 73, 0.8);
46544689
}
46554690

4656-
#project_new_footer .allgood {
4691+
.allgood {
46574692
color: #025284;
46584693
}
46594694

public/js/events_add_new_event.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$(document).ready(function () {
2+
3+
4+
$('#add_new_event_form').submit(function (e) {
5+
e.preventDefault();
6+
e.stopPropagation();
7+
8+
var forma = $('#add_new_event_form');
9+
10+
$.ajax({
11+
url: '/events',
12+
type: 'POST',
13+
data: forma.serialize(),
14+
15+
success: function (data) {
16+
$('.event_saved').addClass('allgood').text('Event successfully created.').show().delay(2000).fadeOut(1000);
17+
document.getElementById('add_new_event_form').reset();
18+
19+
},
20+
error: function (data) {
21+
$('.event_saved').addClass('notallgood').text('An error has occurred.').show().delay(2000).fadeOut(1000);
22+
23+
}
24+
25+
});
26+
27+
28+
});
29+
});

public/js/going_button.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$(document).ready(function(){
2+
3+
$('.going_btn').click(function(){
4+
var event_name=$('#event').text();
5+
var user_clicked=1;
6+
$.ajax({
7+
url:'/event/' + event_name,
8+
type:PUT,
9+
data:[id:user_clicked, event:event_name],
10+
11+
success: function (data) {
12+
13+
},
14+
15+
error: function(data){
16+
17+
}
18+
19+
20+
21+
});
22+
23+
});
24+
25+
26+
});

public/js/home_add_new_review.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
$(document).ready(function () {
2+
3+
$.ajaxSetup({
4+
headers: {
5+
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
6+
}
7+
});
8+
9+
$('#review_form').submit(function (e) {
10+
e.preventDefault();
11+
e.stopPropagation();
12+
13+
var description = $('#description').val();
14+
var project_event_select = $('#project_event_select').val();
15+
16+
$.ajax({
17+
url: '/home',
18+
type: 'POST',
19+
data: {project_event_select: project_event_select, description: description},
20+
success: function (data) {
21+
$('#review_sent').addClass('allgood').text('Your review has been saved!').show().delay(2000).fadeOut(1000);
22+
document.getElementById('review_form').reset();
23+
},
24+
error: function (data) {
25+
$('#review_sent').addClass('notallgood').text('You have to pick project/event and enter your note!').show().delay(2000).fadeOut(1000);
26+
27+
}
28+
});
29+
});
30+
});

0 commit comments

Comments
 (0)