Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit()
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         if (isset($_GET['test_id'])) {
             $test_id = $_GET['test_id'];
             $eval_id = NULL;
         } else {
             if (isset($_GET['evaluation'])) {
                 $eval_id = $_GET['evaluation'];
                 $test_id = NULL;
             } else {
                 $test_id = NULL;
                 $eval_id = NULL;
             }
         }
         $org = \Ermtool\Organization::where('id', $_GET['org'])->value('name');
         $org_id = \Ermtool\Organization::where('id', $_GET['org'])->value('id');
         //obtenemos stakeholders de la misma organización
         $stakes = DB::table('stakeholders')->join('organization_stakeholder', 'organization_stakeholder.stakeholder_id', '=', 'stakeholders.id')->where('organization_stakeholder.organization_id', '=', $_GET['org'])->select('stakeholders.id', DB::raw('CONCAT(name, " ", surnames) AS full_name'))->orderBy('name')->lists('full_name', 'id');
         $issue = \Ermtool\Issue::find($_GET['id']);
         //vemos si es que tiene plan de accion
         $action_plan = NULL;
         $action_plan = DB::table('action_plans')->where('issue_id', '=', $_GET['id'])->select('id', 'stakeholder_id', 'description', 'final_date', 'status')->first();
         //vemos si es hallazgo de proceso, organización, u otro
         if ($issue['process_id'] != NULL) {
             $processes = \Ermtool\Process::where('processes.status', 0)->join('subprocesses', 'subprocesses.process_id', '=', 'processes.id')->join('organization_subprocess', 'organization_subprocess.subprocess_id', '=', 'subprocesses.id')->where('organization_subprocess.organization_id', '=', $_GET['org'])->lists('processes.name', 'processes.id');
             $process_selected = $issue->process_id;
             if (Session::get('languaje') == 'en') {
                 return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'processes' => $processes, 'process_selected' => $process_selected, 'action_plan' => $action_plan, 'test_id' => $test_id, 'kind' => $_GET['kind']]);
             } else {
                 return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'processes' => $processes, 'process_selected' => $process_selected, 'action_plan' => $action_plan, 'test_id' => $test_id, 'kind' => $_GET['kind']]);
             }
         } else {
             if ($issue['organization_id'] != NULL) {
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'org_id' => $_GET['org'], 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 } else {
                     return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'org_id' => $_GET['org'], 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 }
             } else {
                 if (!isset($_GET['kind'])) {
                     if (Session::get('languaje') == 'en') {
                         return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => NULL]);
                     } else {
                         return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => NULL]);
                     }
                 }
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 } else {
                     return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         $orgs_selected = array();
         $subproceso = \Ermtool\Subprocess::find($id);
         $procesos = \Ermtool\Process::where('status', 0)->lists('name', 'id');
         //obtenemos organizaciones del subproceso
         $orgs = DB::table('organization_subprocess')->where('subprocess_id', '=', $id)->select('organization_id')->get();
         $i = 0;
         foreach ($orgs as $org) {
             $orgs_selected[$i] = $org->organization_id;
             $i += 1;
         }
         //Seleccionamos subprocesos que pueden ser padres
         $subprocesos = \Ermtool\Subprocess::where('subprocess_id', NULL)->where('status', 0)->where('id', '<>', $id)->lists('name', 'id');
         $organizaciones = \Ermtool\Organization::where('status', 0)->lists('name', 'id');
         if (Session::get('languaje') == 'en') {
             return view('en.datos_maestros.subprocesos.edit', ['procesos' => $procesos, 'subprocesos' => $subprocesos, 'subproceso' => $subproceso, 'organizaciones' => $organizaciones, 'orgs_selected' => $orgs_selected]);
         } else {
             return view('datos_maestros.subprocesos.edit', ['procesos' => $procesos, 'subprocesos' => $subprocesos, 'subproceso' => $subproceso, 'organizaciones' => $organizaciones, 'orgs_selected' => $orgs_selected]);
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         $proceso = \Ermtool\Process::find($id);
         $combobox = \Ermtool\Process::where('id', '<>', $id)->lists('name', 'id');
         if (Session::get('languaje') == 'en') {
             return view('en.datos_maestros.procesos.edit', ['proceso' => $proceso, 'procesos' => $combobox]);
         } else {
             return view('datos_maestros.procesos.edit', ['proceso' => $proceso, 'procesos' => $combobox]);
         }
     }
 }