예제 #1
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $activeJobs = $this->currentUser()->activeJobs()->with('customer', 'guitars', 'items')->get();
     $availableJobs = Jobs::available()->orderBy('due_at')->orderBy('id', 'desc')->with('customer', 'guitars', 'items')->get();
     return view('dashboard', compact('activeJobs', 'availableJobs'));
 }
예제 #2
0
 /**
  * Display a listing of staffs
  *
  * @return \Response
  */
 public function index($id)
 {
     $job = Jobs::findOrFail($id);
     return \Response::json($job->staff);
 }
예제 #3
0
 public function anyData(Request $request)
 {
     $page = $request->input('page', 'active');
     $jobs = Jobs::page($page)->with('customer', 'guitars', 'staff', 'items')->select('*')->get();
     return Datatables::of($jobs)->editColumn('items', function ($model) {
         $presenter = $this->getPresenterClass($model);
         return $model->items ? $presenter->items_list : '-';
     })->editColumn('guitars', function ($model) {
         $presenter = $this->getPresenterClass($model);
         return $model->guitars ? $presenter->guitar_list : '-';
     })->editColumn('customer', function ($model) {
         return $model->customer ? $model->customer->full_name : '-';
     })->editColumn('staff', function ($model) {
         $presenter = $this->getPresenterClass($model);
         return $model->staff ? $presenter->staff_list : '-';
     })->editColumn('due_at', function ($model) {
         return $model->due_at && $model->due_at !== '-0001-11-30 00:00:00' ? $model->due_at->format('jS M H:i') : '';
     })->editColumn('created_at', function ($model) {
         return $model->created_at && $model->created_at !== '-0001-11-30 00:00:00' ? $model->created_at->format('jS M H:i') : '';
     })->make(true);
 }
예제 #4
0
 /**
  * Remove the specified guitar from storage.
  *
  * @param null $job_id
  * @param $guitar_id
  * @return Response
  * @internal param int $id
  */
 public function destroy($job_id = null, $guitar_id)
 {
     if ($job_id) {
         $job = Jobs::findOrFail($job_id);
         if ($job->guitars->contains($guitar_id)) {
             $job->guitars()->detach($guitar_id);
         }
     }
     return \Response::json(['status' => 'removed']);
 }
예제 #5
0
 Route::resource('tasks', 'TasksController');
 Route::resource('services', 'ServicesController');
 Route::resource('customers', 'CustomersController');
 Route::post('parts/multi', 'PartsController@multi');
 Route::post('services/multi', 'ServicesController@multi');
 Route::post('customers/multi', 'CustomersController@multi');
 Route::post('tasks/multi', 'TasksController@multi');
 Route::post('jobs/update-timers', 'JobsController@updateTimers');
 Route::get('jobs/{id}/changelog', 'JobsController@changelog');
 Route::get('tasks/{task}/completed/{completed}', 'TasksController@completed');
 Route::get('staff', function () {
     return \NodenDb\User::all();
 });
 Route::group(['prefix' => 'calender'], function () {
     Route::get('/jobs', function () {
         return Jobs::active()->get()->values();
     });
     Route::get('/tasks', function () {
         return Tasks::where('task_user_id', auth()->id())->orWhere('Scope', 'Everyone')->todo()->get()->values();
     });
     Route::get('/events/public', function () {
         return Events::recent()->pub()->get()->values();
     });
     Route::get('/events/private', function () {
         return Events::recent()->pri()->get()->values();
     });
 });
 Route::group(['prefix' => 'messages'], function () {
     Route::get('/', ['as' => 'messages', 'uses' => 'MessagesController@index']);
     Route::get('create', ['as' => 'messages.create', 'uses' => 'MessagesController@create']);
     Route::post('/', ['as' => 'messages.store', 'uses' => 'MessagesController@store']);
예제 #6
0
 public function index()
 {
     $overdueJobs = Jobs::overdue()->orderBy('due_at')->with('customer', 'guitars', 'items')->get();
     $tasks = Tasks::todo()->orderBy('due_at')->with('assigned', 'creator')->get();
     return view('admin.index', compact('overdueJobs', 'tasks'));
 }