public function PublishedProject()
 {
     $projects = Project::with(['createdBy', 'faculty', 'status'])->whereHas('status', function ($q) {
         $q->where('key', '=', 'published');
     })->get();
     return $projects;
 }
 /**
  * Get the homepage content and metadata.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     //Get the projects, eager load the project images and skills
     $projects = Project::with('images', 'skills')->get();
     //Check if the contact submission cookie has been set
     $contacted = $request->cookie('cconf') ? $request->cookie('cconf') : false;
     return view('public.home')->withContacted($contacted)->withProjects($projects);
 }
 /**
  * Show a specific project
  * @param $id
  * @return mixed
  */
 public function show($id)
 {
     // $project = Project::with('timers')->findOrFail($id);
     // This return the first project in the database, not the project with the $id.
     // Query methods (with, first, find, where, etc.) should be called from the facade (Project::)
     // not on the object ($project)
     // return $project->with('timers')->first();
     return Project::with('timers')->findOrFail($id);
 }
Example #4
0
 /**
  * Display a listing of the resource.
  * GET /projects
  *
  * @return Response
  */
 public function index($society)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['society'] = $society;
         $data['projects'] = Project::with('individual')->where('society_id', '=', $society)->orderBy('project')->get();
         return View::make('projects.index', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
 public function contract_gta($id)
 {
     $conType = "General Terms Agreement";
     $topics = Contracttopic::where('contract_type_id', 1)->orderBy('sort_order')->get();
     $project = Project::with('company.addresses')->where('id', $id)->first();
     $company = $project->company;
     $adc = ConsortiumGlobal::where('id', '1')->first();
     //dd($project);
     return view('contracts.contract', compact('conType', 'topics', 'project', 'company', 'adc'));
 }
Example #6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $indivs = Task::with('individual')->select('individual_id')->groupBy('individual_id')->get();
     foreach ($indivs as $ind) {
         if ($ind->individual->slack != "") {
             $society = $ind->individual->household->society->society . " Methodist Church";
             $otasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '<', $today)->orderBy('duedate')->get();
             $itasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '=', $today)->orderBy('duedate')->get();
             $projects = Project::with('task')->where('individual_id', '=', $ind->individual->id)->get();
             if (count($itasks) or count($otasks)) {
                 $msg = "Good morning, " . $ind->individual->firstname . "\n\nHere is a list of your overdue/upcoming project tasks:\n\n";
                 if (count($otasks)) {
                     $msg .= "*Overdue tasks*\n\n";
                 }
                 foreach ($otasks as $ot) {
                     $msg .= "_" . $ot->project->project . ":_ " . $ot->description . " (Due: *" . $ot->duedate . "*)\n";
                 }
                 $msg .= "\n";
                 if (count($itasks)) {
                     $msg .= "*Tasks due today*\n\n";
                 }
                 foreach ($itasks as $it) {
                     $msg .= $it->project->project . ": " . $it->description . "\n";
                 }
                 if (count($projects)) {
                     $msg .= "*Summary of your projects*\n\n";
                     foreach ($projects as $project) {
                         $tot = 0;
                         $ovd = 0;
                         foreach ($project->task as $task) {
                             if ($task->donedate == '') {
                                 if ($task->duedate < $today) {
                                     $ovd++;
                                 }
                                 $tot++;
                             }
                         }
                         if ($tot != 0) {
                             $msg .= $project->project . " [Total tasks: " . $tot . "] Overdue: " . round($ovd / $tot * 100) . "%\n";
                         } else {
                             $msg .= $project->project . " [No tasks set yet]\n";
                         }
                     }
                 }
                 $msg .= "\nThank you for the part you are playing in making this happen :)\n\n_" . $society . "_";
                 Helpers::slackmessage($msg, '@' . $ind->individual->slack);
             }
         }
     }
 }
Example #7
0
 public function welcome()
 {
     if (!Schema::hasTable('settings')) {
         $data['firsttime'] = "yes";
         return view('firsttime', $data)->with('okmessage', 'Please create a user before you can use Connexion');
     }
     $user = Auth::user();
     if ($user and $user->individual_id) {
         $today = date('d-m-Y');
         $data['tasks'] = Task::where('donedate', '=', '')->where('project_id', '<>', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['personal'] = Task::where('donedate', '=', '')->where('project_id', '=', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['individuals'] = Individual::orderBy('surname')->get();
         $data['projects'] = Project::with('undonetask')->where('individual_id', $user->individual_id)->orderBy('project')->get();
         $data['projectselect'] = Project::orderBy('project')->lists('project', 'id');
         $data['page_title'] = Helpers::getSetting('circuit_name') . " Circuit";
         $data['page_description'] = "Administrator home page";
         $socs = Permission::where('user_id', '=', $user->id)->select('society_id')->get();
         foreach ($socs as $soc) {
             $thissoc = Society::where('id', '=', $soc->society_id)->get();
             $dum['googleCalendarId'] = $thissoc[0]->society_calendar;
             $dum['color'] = $thissoc[0]->calendar_colour;
             $data['cals'][] = $dum;
         }
         $dum['googleCalendarId'] = Helpers::getSetting('circuit_calendar');
         $dum['color'] = 'black';
         $data['cals'][] = $dum;
         if (Helpers::is_online() and $user->googlecalendar != "") {
             $privatecal = new GoogleCalendar();
             $pcals = $privatecal->getTen($user->googlecalendar);
             foreach ($pcals as $pcal) {
                 $pcal['color'] = $user->calendar_colour;
                 $data['pcals'][] = $pcal;
             }
         } else {
             $data['pcals'] = array();
         }
         if (!count($socs)) {
             $soc = strtolower($user->individual->household->society->society);
             return redirect()->action('SocietiesController@show', $soc);
         } else {
             return view('home', $data);
         }
     } elseif ($user) {
         return view('shared.registered');
     } else {
         return view('landingwebpage');
     }
 }
 public function get($id)
 {
     $project = Project::with(['createdBy', 'faculty', 'status'])->find($id);
     return $project;
 }
 public function makeProOwner()
 {
     $input = Request::all();
     // project_id,id
     //chk login user is whether project owner or not
     $project = Project::with(['user', 'users'])->find($input['project_id']);
     if ($project) {
         $user = Auth::User()->id;
         $project = $project->toArray();
         $owner = false;
         if ($user == $project['user_id']) {
             $owner = true;
         }
         if (count($project['users']) > 0) {
             foreach ($project['users'] as &$us) {
                 if ($us['is_owner'] && $user == $us['user_id']) {
                     $owner = true;
                 }
             }
         }
         if ($owner) {
             $update = ProjectUser::where('id', $input['id'])->update(['is_owner' => 1]);
             if ($update) {
                 $message = 'Success.';
                 return Response()->json(ResponseManager::getResult($project, 10, $message));
             } else {
                 $message = 'Something went wrong. Please try again.';
                 return Response()->json(ResponseManager::getError('', 10, $message));
             }
         } else {
             $message = 'You are not authorize to do it.';
             return Response()->json(ResponseManager::getError('', 10, $message));
         }
     } else {
         $message = 'You are not authorize to do it.';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
Example #10
0
 public function get($id)
 {
     $project = Project::with($this->withArr)->find($id);
     return $project;
 }
Example #11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $proj_types = \App\Models\Project_Type::all();
     $projects = \App\Models\Project::with('project_type')->get();
     return view('admin.projects.viewAll', ['projects' => $projects, 'types' => $proj_types]);
 }
Example #12
0
Route::get('/logout', function () {
    \Illuminate\Support\Facades\Session::flush();
    return \Illuminate\Support\Facades\Redirect::to('/');
})->name('logout');
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $projects = \App\Models\Project::with('project_type')->get();
    $proj_types = \App\Models\Project_Type::all();
    $clients = \App\Models\Client::all();
    $quotes = \App\Models\Quote::all();
    return view('index', ['projects' => $projects, 'types' => $proj_types, 'quotes' => $quotes, 'clients' => $clients]);
});
Route::resource('messages', 'MessagesController');
Route::post('/sendMessage', ['as' => 'sendMessage', 'uses' => 'MessagesController@store']);
Route::group(['prefix' => 'admin', 'middleware' => 'admincheck'], function () {
    Route::resource('coverletters', 'CoverLettersController');
    Route::resource('project_type', 'ProjectTypesController');
    Route::resource('projects', 'ProjectsController');
    Route::resource('quote', 'QuotesController');
    Route::resource('settings', 'SettingsController');
    Route::resource('clients', 'ClientsController');
    //    Route::resource('messages', 'MessagesController');
 public function mobileIndex()
 {
     return Project::with(['logo', 'faculty'])->get();
 }
Example #14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $indivs = Task::with('individual')->select('individual_id')->groupBy('individual_id')->get();
     foreach ($indivs as $ind) {
         $society = $ind->individual->household->society->society . " Methodist Church";
         $otasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '<', $today)->orderBy('duedate')->get();
         $itasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '>', $today)->orderBy('duedate')->get();
         $projects = Project::with('task')->where('individual_id', '=', $ind->individual->id)->get();
         if (count($itasks) or count($otasks)) {
             $msg = "Good morning, " . $ind->individual->firstname . "<br><br>Here is a list of your overdue/upcoming project tasks:<br><br>";
             if (count($otasks)) {
                 $msg .= "Overdue tasks:<br><br>";
             }
             foreach ($otasks as $ot) {
                 $msg .= $ot->project->project . ": " . $ot->description . " (Due: " . $ot->duedate . ")<br>";
             }
             $msg .= "<br>";
             if (count($itasks)) {
                 $msg .= "Tasks due in the next week:<br><br>";
             }
             foreach ($itasks as $it) {
                 $todaydt = new DateTime($today);
                 $interval = $todaydt->diff($it->duedate);
                 if ($interval->format('%R%a') < 8) {
                     $msg .= $it->project->project . ": " . $it->description . " (Due: " . $it->duedate . ")<br>";
                 }
             }
             if (count($projects)) {
                 $msg .= "Summary of your projects:<br><br>";
                 foreach ($projects as $project) {
                     $tot = 0;
                     $ovd = 0;
                     foreach ($project->task as $task) {
                         if ($task->donedate == '') {
                             if ($task->duedate < $today) {
                                 $ovd++;
                             }
                             $tot++;
                         }
                     }
                     if ($tot != 0) {
                         $msg .= $project->project . " [Total tasks: " . $tot . "] Overdue: " . round($ovd / $tot * 100) . "%<br>";
                     } else {
                         $msg .= $project->project . " [No tasks set yet]<br>";
                     }
                 }
             }
             $msg .= "<br>Thank you for the part you are playing in making this happen :)<br><br>" . $society;
             $semail = $ind->individual->household->society->email;
             $name = $ind->individual->firstname . " " . $ind->individual->surname;
             $email = $ind->individual->email;
             $subject = "Project tasks weekly email from " . $society;
             Mail::queue('messages.message', array('msg' => $msg), function ($message) use($name, $email, $subject, $society, $semail) {
                 $message->from($semail, $society);
                 $message->to($email, $name);
                 $message->replyTo($semail);
                 $message->subject($subject);
             });
         }
     }
 }
Example #15
0
 public function listByUser($id)
 {
     $user = Auth::user();
     if ($user->all_companies) {
         $projects = Project::with($this->related)->get();
     } else {
         $projects = Project::with($this->related)->where('company_id', $user->company_id)->all();
     }
     foreach ($projects as $pro) {
         $cntParts = ProjectPart::where('project_id', $pro->id)->where('in_project', true)->count();
         $cntMarket = ProjectPart::where('project_id', $pro->id)->where('in_project', true)->where('can_sell', true)->count();
         $pro->in_market = $cntMarket;
         $pro->total_parts = $cntParts;
         if ($cntParts == 0) {
             $pro->percentage = 0;
         } else {
             $pro->percentage = $cntMarket / $cntParts;
         }
     }
     return $projects;
 }