public function verificatorCredit($id) { $credit = CreditRequest::where('user_id', $id)->first(); $locations = Location::where('id', $credit->location)->first(); $variables = General_variables::all(); $data = $this->prepareData($this->data); $message = []; $countCredit = 0; if ($variables[0]->value < $data['data_credit']) { $countCredit++; } else { $message = $message + ['data_credit' => 'no superado datacredito']; } if ($variables[1]->value < $data['data_monthly']) { $countCredit++; } else { $message = $message + ['data_monthly' => 'no superado datos mensuales']; } if ($variables[2]->value < $data['value_monthly']) { $countCredit++; } else { $message = $message + ['value_monthly' => 'no superado el valor mensual']; } if ($variables[2]->value < $data['value_monthly']) { $countCredit++; } else { $message = $message + ['value_monthly' => 'no superado el valor mensual']; } if (isset($data['reference1']) or isset($data['reference2'])) { $countCredit++; } else { $message = $message + ['reference' => 'no tienen ninguna referencia confirmada']; } if (isset($data['files'])) { $countCredit++; } else { $message = $message + ['files' => 'Los archivos no estan correctos']; } if (strtolower($locations->name) == "medellin") { if ($data['fenalco'] > 0) { $countCredit++; } else { $message = $message + ['fenalco' => 'Fenalco no fue superado']; } if ($countCredit == 7) { return ['return' => true]; } else { return $message + ['accept' => '1']; } } else { if ($countCredit == 6) { return ['return' => true]; } else { return $message + ['accept' => '1']; } } }
public function userShow($id) { $user = User::find($id); $credits = CreditRequest::where('user_id', $id)->get(); $locations = ['0' => 'Sin region'] + Location::all()->lists('name', 'id'); $extracts = Extract::where('nit', $user->identification_card)->get(); $points = Point::all(); $vencidos = 0; $debe = 0; foreach ($extracts as $extract) { $vencidos += intval($extract->dias_vencidos); $debe += intval($extract->saldo_credito_diferido); } if ($user->location) { $location = Location::where('id', $user->location)->first(); } else { $location['name'] = 'No asignada'; } $disabled = Auth::user()->roles_id == 3 ? 'disabled' : ''; return View::make('back.user', compact('user', 'credits', 'location', 'locations', 'extracts', 'vencidos', 'debe', 'points', 'disabled')); }
public function showCreditRequest($id) { $user = User::find($id); $locations = Location::where('id', $user->CreditRequest->location)->first(); $point = Point::where('id', $user->CreditRequest->point)->first(); $images = explode(",", $user->CreditRequest->files); $priority = $user->CreditRequest->priority; return View::make('back.acceptCredit', compact('user', 'credit', 'images', 'locations', 'point', 'priority')); }