Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
API calls added
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajeetsinh98 committed Aug 26, 2016
1 parent de09a7b commit 706dca3
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_DATABASE=HOMESTEAD
DB_USERNAME=secret
DB_PASSWORD=secret

CACHE_DRIVER=file
Expand Down
39 changes: 37 additions & 2 deletions app/Http/Controllers/ProblemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\DomCrawler\Form;
use Illuminate\Support\Facades\DB;

class ProblemController extends Controller
{
Expand Down Expand Up @@ -60,7 +61,13 @@ public function showAll()
public function showIndividualProblem($id)
{
$problemStatement = ProblemStatement::where('id',$id)->first();
return view('User.showIndividualProblem',compact('problemStatement'));
// return view('User.showIndividualProblem',compact('problemStatement'));
if(!$problemStatement)
{
$problemStatement = [];
}

return $problemStatement;
}

/*
Expand Down Expand Up @@ -123,7 +130,7 @@ public function uploadSubmission(Request $request)


}

/*
* Function to soft-delete any question(Won't be visible)
* */
Expand All @@ -146,4 +153,32 @@ public function recoverSoftDelete($id)
$problem->save();
return back();
}

public function showAllProblemsAPI($domainId)
{
$questions = ProblemStatement::where('domain',$domainId)->get();
return $questions;
}
public function returnSubmittedProblemsCount()
{
$technicalSubmissions = DB::table('submissions')
->join('problem_statements','problem_statements.id','=','submissions.problem_id')
->where('problem_statements.domain',1)
->where('submissions.user_id','=',Auth::user()->id)
->count();
$managementSubmissions = DB::table('submissions')
->join('problem_statements','problem_statements.id','=','submissions.problem_id')
->where('problem_statements.domain',2)
->where('submissions.user_id','=',Auth::user()->id)
->count();

$designSubmissions = DB::table('submissions')
->join('problem_statements','problem_statements.id','=','submissions.problem_id')
->where('problem_statements.domain',3)
->where('submissions.user_id','=',Auth::user()->id)
->count();
$returnJSONArray = array();
array_push($returnJSONArray,$technicalSubmissions,$managementSubmissions,$designSubmissions);
return $returnJSONArray;
}
}
21 changes: 11 additions & 10 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public function __construct()
$this->middleware('isAdmin', ['only' => ['showUsers','adminDashboard']]);

}



/*
* View User Profile
* */

public function viewProfile()
{
$user = Auth::user();
Expand Down Expand Up @@ -148,11 +148,11 @@ public function showUsers()
$users = User::all();
return view('User.Admin.showAllUsers',compact('users'));
}

/*
* Show all the submissions done by user
* */

public function viewUserSubmissions($id)
{
$user = User::where('id',$id)->first();
Expand Down Expand Up @@ -212,10 +212,11 @@ public function adminDashboard()
$managementRegistrations = DB::table('user_domains')->where('domain_id',2)->count();
$designRegistrations = DB::table('user_domains')->where('domain_id',3)->count();
$totalProblemStatements = ProblemStatement::all()->count();

$totalSubmissions = Submission::all()->count();
$checkedSubmissions = Submission::where('checked',1.00)->count();
$uncheckedSubmissions = $totalSubmissions-$checkedSubmissions;

return view('User.Admin.dashboard',compact('technicalRegistrations','managementRegistrations','designRegistrations','checkedSubmissions','uncheckedSubmissions'));
}

Expand All @@ -234,7 +235,7 @@ public function getShortlistedCandidates(Request $request)
$number = $request->number;
$people = User::where('domain',$domain)->orderBy('marks', 'desc')->take($number)->get();
return view('User.Admin.getShortlistedCandidates',compact('people'));

}
public function send($contactNumber)
{
Expand All @@ -250,7 +251,7 @@ public function send($contactNumber)
//Your message to send, Add URL encoding here.
$message = urlencode("Thank You for registering! You'll be notified when our portal will be live.");

//Define route
//Define route
$route = "transactional";
//Prepare you post parameters
$postData = array(
Expand Down Expand Up @@ -329,5 +330,5 @@ public function notifyUser(Request $request)
}
}
}
}

}
10 changes: 9 additions & 1 deletion app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@
* Guest Routes
* */

Route::post('/notify','UserController@notifyUser');
Route::post('/notify','UserController@notifyUser');

/*
*API Routes
*/

Route::get('/api/problems/{domainId}','ProblemController@showAllProblemsAPI');
Route::get('/api/user/problems/count','ProblemController@returnSubmittedProblemsCount');
// /problem/show/id - Individual Problem
5 changes: 3 additions & 2 deletions app/Submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Submission extends Model
{

/**
* The attributes that are mass assignable.
*
Expand All @@ -16,7 +16,7 @@ class Submission extends Model
protected $fillable = [
'problem_id','user_id','marks','updated_at','url'
];

public function user()
{
return $this->belongsTo('App\User');
Expand All @@ -25,4 +25,5 @@ public function problemStatement()
{
return $this->belongsTo('App\ProblemStatement');
}

}
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ body{
color: white;
}
.main-content{
margin-top: 0%;
margin-top: -5%;
padding: 3%;
}
.left-content, .right-content{
Expand Down Expand Up @@ -78,7 +78,16 @@ body{
}
.first-content,.third-content, .second-content{
height: 100vh;
margin-top: 0%;
margin-top: -5%;
}
.first-content form{
width: 50%;
margin-top: -10%;
margin-left: 27%;
}
#modal-trigger{
margin-top: -7%;
margin-left: 4%;
}
@media only screen and (max-device-width: 600px){
.links{
Expand Down
Binary file added public/uploads/submissions/1_1.pdf
Binary file not shown.
Binary file added public/uploads/submissions/1_2.pdf
Binary file not shown.
5 changes: 3 additions & 2 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<a href="#" data-to="third-content" data-number="2"><img src="images/Scroll Down.png"></a>
</div>
<div class="content">
<div class="text-center"><h3>Welcome to GDG-VIT Recruitments</h3></div>

<div class="first-content" id="first-content">
<div class="text-center"><h3>Welcome to GDG-VIT Recruitments</h3></div>
<div class="row"><div class="text-center"><img src="images/logo-big.png"></div></div>
<p style="padding: 10%;font-weight: 300;font-size: 110%;text-align: center">
If you would like to join <b>GDG VIT</b> you simply have
Expand Down Expand Up @@ -60,7 +61,7 @@
<img src="images/illustration.png">
</div>
</div>

<div class="modal" id="login-modal">
<div class="modal-content">
<a href="{{ url('/login') }}" style="color: white"><button class="custom-button">Login</button></a>
Expand Down

0 comments on commit 706dca3

Please sign in to comment.