Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $types = Type::get();
     $heading = 'Types of Services / Events';
     return view('admin.types', array('types' => $types, 'heading' => $heading));
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     // eager loading of related table
     $default_items = DefaultItem::with('type')->orderBy('type_id')->orderBy('seq_no');
     if ($request->has('filterby') && $request->has('filtervalue') && $request->filterby == 'type') {
         $default_items->where('type_id', $request->filtervalue);
     }
     // get list of Event Types
     $types = Type::get();
     $heading = 'Manage Default Event Items';
     return view($this->view_all, array('heading' => $heading, 'default_items' => $default_items->get(), 'types' => $types));
 }
Пример #3
0
 /**
  * PLAN DETAILS form
  *
  * @param  int  $id
  * @param  int  $new_item_id    indicates a newly inserted item 
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // find a single plan by ID
     $plan = Plan::with(['items' => function ($query) {
         $query->withTrashed()->orderBy('seq_no');
     }])->find($id);
     if ($plan) {
         // get list of service types
         $types = Type::get();
         // get list of users
         $users = User::orderBy('first_name')->get();
         // get list of trashed items (if any)
         $trashedItemsCount = Item::onlyTrashed()->where('plan_id', $id)->count();
         // check if a new item was just now inserted (used for highlighing in the view)
         $newest_item_id = 0;
         if (session()->has('newest_item_id')) {
             $newest_item_id = session()->get('newest_item_id');
             session()->forget('newest_item_id');
         }
         // get service times from plan dates
         $plan->start = Carbon::instance($plan->date)->toTimeString();
         // for backwards compatibility, we allowed for null as end date
         if ($plan->date_end) {
             $plan->end = Carbon::instance($plan->date_end)->toTimeString();
         } else {
             $plan->end = "23:59";
         }
         return view($this->view_one, array('plan' => $plan, 'types' => $types, 'users' => $users, 'versionsEnum' => json_decode(env('BIBLE_VERSIONS')), 'newest_item_id' => $newest_item_id, 'trashedItemsCount' => $trashedItemsCount));
     }
     flashError('Plan with id "' . $id . '" not found');
     return \Redirect::route($this->view_idx);
 }