Esempio n. 1
0
 public function run()
 {
     $request_types = [["name" => "ownership"]];
     RequestType::truncate();
     foreach ($request_types as $request_type) {
         RequestType::create($request_type);
     }
 }
 public function getRequestTypeTest($request_type = '', $project_type = '')
 {
     $RequesType = new RequestType();
     $user_id = trim(Auth::user()->app_code);
     return Response::json($RequesType->getRequestType($request_type, $project_type, $user_id));
 }
Esempio n. 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $request_id (required)
  * @param $filing_type (required) values 'RFC', 'RFR' and 'QAC'
  * @param $action_type values 'edit' -> for viewing an empty or filled form, 
  *                            'update' -> for viewing newly saved request form
  * @return Response
  */
 public function edit($request_id, $filing_type, $action_type = 'edit')
 {
     if ($request_id) {
         $EASRequest = new EASRequest();
         $projects = new Project();
         $user_id = trim(Auth::user()->app_code);
         $data = [];
         $data['filing_type'] = $filing_type;
         $data['details'] = $EASRequest->getRequestDetails($request_id, $user_id);
         $data['signed'] = 0;
         $precedingLevel = $data['details']['user_approver']['rfcline_level'] - 1;
         $data['uneditable_fields'] = [];
         //Retrieve user granted projects
         $data['projects'] = $projects->getProjects($user_id, $data['filing_type'], '3');
         //Additional variables per request type, if any.
         if ($data['filing_type'] == 'RFR') {
             $RequestTypeApprover = new RequestTypeApprover();
             $data['granted_request_types'] = $RequestTypeApprover->getUserGrantedRequestTypes($user_id);
             if ($data['details']['re_nature'] == 'Forfeiture') {
                 $data['rfr_type'] = 'forfeiture';
                 $data['uneditable_fields']['rfc_ref_no'] = '1';
             } else {
                 $data['rfr_type'] = 'rfc';
                 $request_description = explode('-', $data['details']['re_nature']);
                 $data['default_req_reference'] = $data['details']['rfc_refno'] . ' : ' . $request_description[1];
                 $data['uneditable_fields']['project_type'] = '1';
                 $data['uneditable_fields']['lot_code'] = '1';
             }
         } else {
             if ($data['filing_type'] == 'RFC') {
                 $RequestType = new RequestType();
                 $data['req_refs'] = $RequestType->getRequestType('RFC');
             }
         }
         if ($action_type == 'update') {
             return view('request.edit', $data)->withErrors(['Request saved.']);
         }
         return view('request.edit', $data);
     }
     return Redirect::back()->withErrors(['Page not found.']);
 }