data never send to php file with axios - php

hello i have a problem with sending data
i have a form that send data to a php file to insert it in data base.
signup.js
import { useState } from "react";
import axios from "axios";
const Signup =()=>{
const [cin,setCIN]=useState()
const [name,setName]=useState()
const [lastname,setLastname]=useState()
const [adress,setAdress]=useState()
const [tele,setTele]=useState()
const [email,setEmail]=useState()
const [pass,setPass]=useState()
const [re_pass,setRepass]=useState()
function Valide(e){
e.preventDefault();
if(pass===re_pass){
let data=new FormData()
data.append("cin",cin)
data.append("nom",name)
data.append("prenom",lastname)
data.append("email",email)
data.append("tele",tele)
data.append("adress",adress)
data.append("pass_word",pass)
axios({
method: 'post',
url:'http://localhost/projet_stage/src/PHP/register.php',
data: data,
config: { headers: { 'Content-Type': 'multipart/form-data' } }
})
.then(function (response) {
//handle success
console.log(response)
})
.catch(function (response) {
//handle error
console.log(response)
});
} else{
alert("Password mismatch")
}
}
function handleCIN(e){
setCIN(e.target.value)
}
function handleName(e){
setName(e.target.value)
}
function handleLastname(e){
setLastname(e.target.value)
}
function handleEmail(e){
setEmail(e.target.value)
}
function handlePass(e){
setPass(e.target.value)
}
function handleRepass(e){
setRepass(e.target.value)
}
function handleAdress(e){
setAdress(e.target.value)
}
function handleTele(e){
setTele(e.target.value)
}
return (
<section class="vh-100 bg-image"
style={{backgroundImage: "url('https://mdbcdn.b-cdn.net/img/Photos/new-templates/search-box/img4.webp');"}}>
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style={{borderRadius: "15px"}}>
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Create an account</h2>
<div class="form-outline mb-4">
<input value={cin} name={"cin"} onChange={(e)=>handleCIN(e)} type="text" id="form3Example1ck" class="form-control form-control-lg" />
<label class="form-label" >cin</label>
</div>
<div class="form-outline mb-4">
<input value={name} name={"nom"} onChange={(e)=>handleName(e)} type="text" id="form3Example1cg" class="form-control form-control-lg" />
<label class="form-label" >nom</label>
</div>
<div class="form-outline mb-4">
<input value={lastname} name={"prenom"} onChange={(e)=>handleLastname(e)} type="text" id="form3Example2cg" class="form-control form-control-lg" />
<label class="form-label" >prenom</label>
</div>
<div class="form-outline mb-4">
<input value={adress} name={"adress"} onChange={(e)=>handleAdress(e)} type="text" id="form3Example2cm" class="form-control form-control-lg" />
<label class="form-label" >adress</label>
</div>
<div class="form-outline mb-4">
<input value={tele} name={"tele"} onChange={(e)=>handleTele(e)} type="text" id="form3Example2cl" class="form-control form-control-lg" />
<label class="form-label" >téle</label>
</div>
<div class="form-outline mb-4">
<input value={email} name={"email"} onChange={(e)=>handleEmail(e)} type="email" id="form3Example3cg" class="form-control form-control-lg" />
<label class="form-label">Your Email</label>
</div>
<div class="form-outline mb-4">
<input value={pass} name={"password"} onChange={(e)=>handlePass(e)} type="password" id="form3Example4cg" class="form-control form-control-lg" />
<label class="form-label" >Password</label>
</div>
<div class="form-outline mb-4">
<input value={re_pass} name={"re_password"} onChange={(e)=>handleRepass(e)} type="password" id="form3Example4cdg" class="form-control form-control-lg" />
<label class="form-label" >Repeat your password</label>
</div>
<div class="form-check d-flex justify-content-center mb-5">
<input class="form-check-input me-2" type="checkbox" value="" id="form2Example3cg" />
<label class="form-check-label" for="form2Example3g">
I agree all statements in <u>Terms of service</u>
</label>
</div>
<div class="d-flex justify-content-center">
<button type="button" name={"valide"} onClick={(e)=>Valide(e)}
class="btn btn-success btn-block btn-lg gradient-custom-4 text-body">Register</button>
</div>
<p class="text-center text-muted mt-5 mb-0">Have already an account? <a href="#!"
class="fw-bold text-body"><u>Login here</u></a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>)
}
export default Signup;
when i submit the form the the php file insert a user with empty values that mean every think work but the data never send to php file .
register.php
require './server/connect.php';
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'], '/'));
if(isset($_POST["valide"])){
$cin = $_POST["cin"];
$name = $_POST["nom"];
$prenom = $_POST["prenom"];
$adres = $_POST["adress"];
$tele = $_POST["tele"];
$email = $_POST["email"];
$password = $_POST["password"];
}
$sql = "INSERT INTO user
(cin,nom,prenom,email,télé,
adress,pass_word,statut)
VALUES ('$cin','$name','$prenom','$email','$tele',
'$adres','$password','guest')";
if($db->query($sql)){
echo "workd";
}
?>
when show the data in the console i find a empty object i dont know whay???
CONSOLE.LOG:
also:

Related

How to preserve the data in an array after submit on another form

everyone,
First of all, I'm sorry the question is a bit confusing.
The problem is this: I posted another question a few days ago (this one), about an exercise that our teacher has given us and it's a bit tricky, to put it some way, the job consists of saving data collected from a form (several data, in fact), in a array, and then be able to modify them without deleting the other data in the array.
As I said in the previous post, the bad thing is that we can't use sessions, databases, files, or localstorage.
Note: I am doing it all in one page, because it is the best way to preserve the data that I have found.
He told us that the trick was to use json_encode() to pass the data in a hidden input, so far everything is ok, thanks to the answer in the previous post, I managed to get to save more than one user as long as the NID is not already inside the array, but in the part where we have to update the data is where everything gets complicated. To update the data, the first thing I do is ask for the NID of the person to modify with a select/option, but when I submit the select, it deletes the data of the users that I had added in the $agenda variable.
I'm sure the problem is with the isset(), but I've been doing this exercise for a week and I can't think of anything new.
This is the code of index.php:
<?php
require_once './controllers/modules.php';
if(!isset($_POST['hiddenInputUpdate'])) {
$newAgenda = [];
} else {
$newAgenda = decodeData();
updateData($newAgenda);
}
if(!isset($_POST['hiddenInputReg'])) {
$agenda = [];
} else {
$agenda = decodeData();
addData($agenda);
}
print('<pre>'.print_r($agenda, true).'</pre>');
?>
<div class="container-panel">
<main>
<div id="add-contact" class="section-content">
<div class="top">
<div class="left">
<h1>Añadir contactos</h1>
<div class="date">
<input type="date" name="date" id="date">
</div>
</div>
<div class="right">
<div class="theme-toggler">
<span class="material-icons-sharp active">light_mode</span>
<span class="material-icons-sharp">dark_mode</span>
</div>
</div>
</div>
<div>
<form action='' method="POST" class="w-75 form-register" id="regForm">
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regNid" required/>
<label for="regNid">DNI</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regName" required/>
<label for="regName">Nombre</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regSurname" required/>
<label for="regSurname">Apellidos</label>
</div>
<div class="form-floating mb-4">
<input type="email" class="form-control form-control-lg" name="regEmail" required/>
<label for="regEmail">Email</label>
</div>
<div class="form-floating mb-4">
<input type="tel" class="form-control form-control-lg" name="regTel" required/>
<label for="regTel">Teléfono</label>
</div>
<div class="form-floating mb-4">
<input type="date" class="form-control form-control-lg" name="regBirth" required/>
<label for="regBirth">Fecha de nacimiento</label>
</div>
<div class="d-flex justify-content-center">
<input type="hidden" name="hiddenInputReg" value='<?php echo encodeData($agenda); ?>'>
<button type="submit" name="regSubmit" class="btn btn-success btn-block btn-lg gradient-custom-4 text-body">Registrar</button>
</div>
</form>
</div>
</div>
<div id="update-contact" class="section-content">
<div class="top">
<div class="left">
<h1>Actualizar contactos</h1>
<div class="date">
<input type="date" name="date" id="date">
</div>
</div>
<div class="right">
<div class="theme-toggler">
<span class="material-icons-sharp active">light_mode</span>
<span class="material-icons-sharp">dark_mode</span>
</div>
</div>
</div>
<div>
<form class="w-25 my-5" action="" method="POST" id="getNidForm">
<select class="form-select form-select-lg mb-3" aria-label=".form-select-lg example" name="getNid">
<?php
if(isset($agenda)){
echo '
<option value="noSel" selected>Selecciona un DNI</option>
';
foreach($agenda as $key => $value) {
echo '
<option value='.$key.'>'.$key.'</option>
';
}
} else {
echo '
<option value="noSel" selected>No hay DNIs</option>
';
}
?>
</select>
<button type="submit" name="getNidSubmit" class="btn btn-success btn-block btn-lg gradient-custom-4 text-body">Seleccionar</button>
</form>
<?php
if(isset($_POST['getNid']) && !empty($_POST['getNid'])) {
if($_POST['getNid'] !== 'noSel') {
echo '
<form class="my-5" action="" method="POST" id="updForm">
<div class="form-group">
<h2 class="heading">Registrar</h2>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateNid" value="'.$_POST['getNid'].'">
<label for="updateNid">DNI</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateName">
<label for="updateName">Nombre</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateSurname">
<label for="updateSurname">Apellidos</label>
</div>
<div class="form-floating mb-4">
<input type="email" class="form-control form-control-lg" name="updateEmail">
<label for="updateEmail">Email</label>
</div>
<div class="form-floating mb-4">
<input type="tel" class="form-control form-control-lg" name="updatePhone">
<label for="updatePhone">Phone</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateBirth"/>
<label for="updateBirth">Fecha de nacimiento</label>
</div>
<div class="mb-4" style="width: 22rem;">
<label for="registerPic">Selecciona una foto<span class="text-danger">*</span></label>
<input type="file" class="form-control form-control-lg" name="updateFile" />
</div>
</div>
<div class="form-group">
<div class="grid">
<button type="submit" class="btn btn-primary" name="sub-update" value="update">Actualizar</button>
<input type="hidden" name="hiddenInputUpdate" value='.encodeData($newAgenda).'>
</div>
</div>
</form>
';
}
}
?>
</div>
</div>
</main>
</div>
And this is the modules.php:
<?php
function getLocalTime() {
date_default_timezone_set('Atlantic/Canary');
return date("d-m-Y H:i:s a");
}
function encodeData($data) {
return json_encode($data);
}
function decodeData() {
return json_decode($_POST['hiddenInputReg'], true);
}
function cleanData($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function addData(&$data) {
$date = getLocalTime();
if(!in_array($_POST['regNid'], $data) || empty($data)) {
$data[$_POST['regNid']]['nombre'] = cleanData($_POST['regName']);
$data[$_POST['regNid']]['apellidos'] = cleanData($_POST['regSurname']);
$data[$_POST['regNid']]['correo'] = cleanData($_POST['regEmail']);
$data[$_POST['regNid']]['telefono'] = cleanData($_POST['regTel']);
$data[$_POST['regNid']]['fechaNacimiento'] = cleanData($_POST['regBirth']);
$data[$_POST['regNid']]['fechaInsercion'] = $date;
$data[$_POST['regNid']]['bloqueado'] = false;
$data[$_POST['regNid']]['ficheros'] = [];
return;
}
return;
}
function updateData(&$data) {
if(!in_array($_POST['regNid'], $data) || empty($data)) {
$data[$_POST['regNid']]['nombre'] = cleanData($_POST['regName']);
$data[$_POST['regNid']]['apellidos'] = cleanData($_POST['regSurname']);
$data[$_POST['regNid']]['correo'] = cleanData($_POST['regEmail']);
$data[$_POST['regNid']]['telefono'] = cleanData($_POST['regTel']);
$data[$_POST['regNid']]['fechaNacimiento'] = cleanData($_POST['regBirth']);
$data[$_POST['regNid']]['ficheros'] = $_FILES['updateFile']['name'];
return;
}
return;
}
?>
Note: I haven't used the updateDate() function yet, but I preferred to add it to the post just in case.
To summarize, what I want to achieve is to keep the data added with the #regForm even if I submit on the #getNidForm or the #updForm .
In the end it was as simple as passing the data in each form with the same hidden input of #regForm; you also need to change the conditions (the isset()) taking into account the submit button (regSubmit, updSubmit or blockSubmit) since each of them use different functions, such as addData, updateData or setBlock.
In case someone has the same problem and has the same vetoes as me, I leave the final code here:
if(!isset($_POST['hiddenInputReg'])) {
$agenda = [];
} else {
$agenda = decodeData();
if(isset($_POST['regSubmit'])) {
addData($agenda);
}
else if(isset($_POST['updSubmit'])) {
updateData($agenda);
}
else if(isset($_POST['blockSubmit'])) {
setBlock($agenda);
}
}
print('<pre>'.print_r($agenda, true).'</pre>');
?>
<div class="container-panel">
<main>
<div id="add-contact" class="section-content">
<div class="top">
<div class="left">
<h1>Añadir contactos</h1>
<div class="date">
<input type="date" name="date" id="date">
</div>
</div>
<div class="right">
<div class="theme-toggler">
<span class="material-icons-sharp active">light_mode</span>
<span class="material-icons-sharp">dark_mode</span>
</div>
</div>
</div>
<div>
<form action='' method="POST" class="w-75 form-register" id="regForm">
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regNid" required/>
<label for="regNid">DNI</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regName" required/>
<label for="regName">Nombre</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="regSurname" required/>
<label for="regSurname">Apellidos</label>
</div>
<div class="form-floating mb-4">
<input type="email" class="form-control form-control-lg" name="regEmail" required/>
<label for="regEmail">Email</label>
</div>
<div class="form-floating mb-4">
<input type="tel" class="form-control form-control-lg" name="regTel" required/>
<label for="regTel">Teléfono</label>
</div>
<div class="form-floating mb-4">
<input type="date" class="form-control form-control-lg" name="regBirth" required/>
<label for="regBirth">Fecha de nacimiento</label>
</div>
<div class="d-flex justify-content-center">
<input type="hidden" name="hiddenInputReg" value='<?php echo htmlspecialchars(encodeData($agenda)); ?>'>
<button type="submit" name="regSubmit" class="btn btn-block btn-lg gradient-custom-4 text-body custom-btn">Registrar</button>
</div>
</form>
</div>
</div>
<div id="update-contact" class="section-content">
<div class="top">
<div class="left">
<h1>Actualizar contactos</h1>
<div class="date">
<input type="date" name="date" id="date">
</div>
</div>
<div class="right">
<div class="theme-toggler">
<span class="material-icons-sharp active">light_mode</span>
<span class="material-icons-sharp">dark_mode</span>
</div>
</div>
</div>
<div>
<form class="w-25 my-5" action="" method="POST" id="getNidForm">
<select class="form-select form-select-lg mb-3" aria-label=".form-select-lg example" name="getNid">
<?php
if(isset($agenda)){
echo '
<option value="noSel" selected disabled>Selecciona un DNI</option>
';
foreach($agenda as $key => $value) {
echo '
<option value='.$key.'>'.$key.'</option>
';
}
} else {
echo '
<option value="noSel" selected disabled>No hay DNIs</option>
';
}
?>
</select>
<input type="hidden" name="hiddenInputReg" value='<?php echo htmlspecialchars(encodeData($agenda)); ?>'>
<button type="submit" name="getNidSubmit" class="btn btn-block btn-lg gradient-custom-4 text-body custom-btn">Seleccionar</button>
</form>
<?php
if(isset($_POST['getNid'])) {
foreach($agenda as $key => $val) {
if($_POST['getNid'] === $key) {
echo '
<form class="my-5" action="" method="POST" enctype="multipart/form-data" id="updForm">
<div class="form-group">
<h2 class="heading">Registrar</h2>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateNid" value="'.$key.'">
<label for="updateNid">DNI</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateName" value="'.$agenda[$key]['nombre'].'">
<label for="updateName">Nombre</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateSurname" value="'.$agenda[$key]['apellidos'].'">
<label for="updateSurname">Apellidos</label>
</div>
<div class="form-floating mb-4">
<input type="email" class="form-control form-control-lg" name="updateEmail" value="'.$agenda[$key]['correo'].'">
<label for="updateEmail">Email</label>
</div>
<div class="form-floating mb-4">
<input type="tel" class="form-control form-control-lg" name="updatePhone" value="'.$agenda[$key]['telefono'].'">
<label for="updatePhone">Phone</label>
</div>
<div class="form-floating mb-4">
<input type="text" class="form-control form-control-lg" name="updateBirth" value="'.$agenda[$key]['fechaNacimiento'].'">
<label for="updateBirth">Fecha de nacimiento</label>
</div>
<div class="mb-4" style="width: 22rem;">
<label for="updateFile">Selecciona una foto<span class="text-danger">*</span></label>
<input type="file" class="form-control form-control-lg" name="updateFile"/>
</div>
</div>
<div class="form-group">
<div class="grid">
<input type="hidden" name="hiddenInputReg" value="'.htmlspecialchars(encodeData($agenda)).'">
<button type="submit" class="btn custom-btn" name="updSubmit" value="update">Actualizar</button>
</div>
</div>
</form>
';
}
}
}
?>
</div>
</div>
</main>
</div>
Here is the modules.php:
<?php
function getLocalTime($mode) {
date_default_timezone_set('Atlantic/Canary');
if($mode === 'datetime') {
return date("d-m-Y H:i:s a");
}
return date("d/m/Y");
}
function encodeData($data) {
return json_encode($data);
}
function decodeData() {
return json_decode($_POST['hiddenInputReg'], true);
}
function cleanData($data) {
$data = trim($data);
$data = stripslashes($data);
// $data = htmlspecialchars($data);
return $data;
}
function addData(&$data) {
$date = getLocalTime('datetime');
if(!in_array($_POST['regNid'], $data) || empty($data)) {
$data[$_POST['regNid']]['nombre'] = cleanData($_POST['regName']);
$data[$_POST['regNid']]['apellidos'] = cleanData($_POST['regSurname']);
$data[$_POST['regNid']]['correo'] = cleanData($_POST['regEmail']);
$data[$_POST['regNid']]['telefono'] = cleanData($_POST['regTel']);
$data[$_POST['regNid']]['fechaNacimiento'] = cleanData($_POST['regBirth']);
$data[$_POST['regNid']]['fechaInsercion'] = $date;
$data[$_POST['regNid']]['bloqueado'] = false;
$data[$_POST['regNid']]['ficheros'] = [];
}
return;
}
function updateData(&$data) {
$data[$_POST['updateNid']]['nombre'] = cleanData($_POST['updateName']);
$data[$_POST['updateNid']]['apellidos'] = cleanData($_POST['updateSurname']);
$data[$_POST['updateNid']]['correo'] = cleanData($_POST['updateEmail']);
$data[$_POST['updateNid']]['telefono'] = cleanData($_POST['updatePhone']);
$data[$_POST['updateNid']]['fechaNacimiento'] = cleanData($_POST['updateBirth']);
$data[$_POST['updateNid']]['ficheros'][] = cleanData($_FILES['updateFile']['name']);
}
function setBlock(&$data) {
$data[$_POST['block']]['bloqueado'] = !$data[$_POST['block']]['bloqueado'];
}
?>
There may be some trash code out there (some print or some unnecessary part), since I just solved it, I preferred to directly upload what I had.
The key, in addition to putting the hiddenInputReg in the other forms or in the table, which is where the data is changed, was to call the htmlspecialchars() function, wrapping the encodeData() of the hiddenInputReg; in theory, not adding this function in the "updSubmit()" form (which is in an echo) caused the $agenda array data look as "null" at the updateData() function, surely because of the quotes, with the htmlspecialchars() it solved it for me, I also put it in the other encodeData() just in case, but I think that deleting all except in the echos, it should work without problem.

how to solve Call to a member function update() on null on laravel 8?

I am getting this kind of error call to member function update on null(). shown my code below please anyone can solve
all are the things are fine when am getting to the image file update in that time am getting this error.
here is my controller code
////
function user_update(Request $request){
$user= User::findOrFail($request->id)->update([
'name'=>$request->name,
'email'=>$request->email,
'address'=>$request->address,
'nationality'=>$request->nationality,
'date_of_birth'=>$request->date_of_birth,
'father_name'=>$request->father_name,
'mother_name'=>$request->mother_name,
'gender'=>$request->gender,
'n_photo'=>$request->n_photo,
]);
if ($request->hasFile('n_photo')) {
$photo_upload = $request ->n_photo;
$photo_extension = $photo_upload -> getClientOriginalExtension();
$photo_name = "toletx_auth_image_". $user . "." . $photo_extension;
Image::make($photo_upload)->resize(452,510)->save(base_path('public/uploads/auth/'.$photo_name),100);
User::find($user)->update([
'n_photo' => $photo_name,
]);
}
return back()->with('success','User information have been successfully Updated.');
}
///////my blade file
<form method="POST" action="{{ route('user_update') }}" enctype="multipart/form-data">
#csrf
<div class="form-group row">
<input type="text" name="id" value="{{$list->id}}">
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">User name</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->name}}" name="name" placeholder="Location" type="text" >
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Email</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->email}}" name="email" placeholder="Location" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Mobile Number</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->phone}}" name="phone" placeholder="Location" type="text" >
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Address</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" value="{{$list->address}}" name="address" placeholder="Location" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Nationality</label>
<div class="col-sm-12 col-md-10">
<input class="form-control" name="nationality" value="{{$list->nationality}}" placeholder="nationality" type="numeric">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Date of birth</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="Birth Date" name="date_of_birth" value="{{$list->date_of_birth}}">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Father Name</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="Father name" name="father_name" value="{{$list->father_name}}">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Mother Name</label>
<div class="col-sm-12 col-md-10">
<input type="text" class="form-control" placeholder="mother name" name="mother_name" value="{{$list->mother_name}}">
</div>
</div>
<div class="form-group">
<div class="form-group form-float">
<div class="card">
<div class="body">
<input type="file" class="dropify" name="n_photo" >
<img src="{{ asset('uploads/auth') }}/{{ $list->n_photo }}" alt="">
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Update</button>
You've got 2 main problems with this code:
User::find($user)->update(['n_photo' => $photo_name]);
First of all, the correct syntax would be to use $user->id, not $user:
User::find($user->id)->update(['n_photo' => $photo_name]);
Second, that is super redundant; $user is already the result of User::find(), so you're doubling up for no reason.
To fix your issue, simply adjust your code to:
$user->update(['n_photo' => $photo_name]);
Just spacing issue please check these two lines
//Before // Wrong
$photo_upload = $request ->n_photo;
$photo_extension = $photo_upload -> getClientOriginalExtension();
//After //Correct
$photo_upload = $request->n_photo;
$photo_extension = $photo_upload->getClientOriginalExtension();
function user_update(Request $request){
$photo_name = '';
$user= User::findOrFail($request->id);
if ($request->hasFile('n_photo')) {
$photo_upload = $request->n_photo;
$photo_extension = $photo_upload->getClientOriginalExtension();
$photo_name = "toletx_auth_image_". $user . "." . $photo_extension
Image::make($photo_upload)->resize(452,510)->save(base_path('public/uploads/auth/'.$photo_name),100);
}
$user->update([
'name'=>$request->name,
'email'=>$request->email,
'address'=>$request->address,
'nationality'=>$request->nationality,
'date_of_birth'=>$request->date_of_birth,
'father_name'=>$request->father_name,
'mother_name'=>$request->mother_name,
'gender'=>$request->gender,
'n_photo'=>$photo_name,
]);
}
return back()->with('success','User information have been successfully Updated.');
}

Googlemap location based on IP address is not showing in laravel project

am trying to show google map in one section of my form, which i want to load locations based on IP Address, but when i tried locations are not loading based on ip address.What is the issue
#extends('user.layout.app')
#section('content')
<script src="{{ url('js/user/location.js') }}"></script>
<div class="container-fluid add-location">
<div class="row">
<div class="col-md-12">
<div class="card">
<form method="post" action="{{ route('locationstore') }}" name="locationadd" id="locationadd" enctype="multipart/form-data" novalidate>
{{ csrf_field() }}
<div class="card-header">
<h4 class="card-title"> Add My Location </h4>
</div>
#if(!empty($errors->all()))
<div class="row"> #foreach ($errors->all() as $error)
<div class="col-lg-12">
<div class="alert alert-danger"> <span>{{ $error }}</span> </div>
</div>
#endforeach </div>
<div class="row geolocationerror hide">
<div class="col-lg-12">
<div class="alert alert-danger"> <span>location not found</span> </div>
</div>
</div>
#endif
<div class="card-content">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6">
<div class="form-group">
<label class="control-label">Location Name
<star>*</star>
</label>
<input id="location_name" name="location_name" class="controls form-control" type="text" placeholder="Location Name" value="{{ old('location_name') }}">
#if ($errors->has('location_name')) <span class="help-block"> {{ $errors->first('location_name') }} </span> #endif </div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6">
<div class="form-group">
<label class="control-label">Clinics
<star>*</star>
</label>
<select class="selectpicker" data-style="btn-info btn-fill btn-block" id="clinic_id" name="clinic_id">
#foreach($clinics as$clinic)
<option value="{!! $clinic->clinicID !!}" id="{!! $clinic->clinicID !!}">{!! $clinic->clinicName !!}</option>
#endforeach
</select>
#if ($errors->has('category_id')) <span class="help-block"> {{ $errors->first('category_id') }} </span> #endif </div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6">
<div class="form-group">
<label class="control-label">Address Line 1
<star>*</star>
</label>
<input type="text" placeholder="Address Line 1" class="form-control geoaddress" id="address_1" name="address_1" value="">
</div>
<div class="form-group">
<label class="control-label">Address Line 2 </label>
<input type="text" placeholder="Address Line 2" class="form-control geoaddress" id="address_2" name="address_2" value="">
</div>
<div class="form-group">
<label class="control-label">City
<star>*</star>
</label>
<input type="text" placeholder="City" class="form-control geoaddress" id="city" name="city" value="">
</div>
<div class="form-group">
<label class="control-label">State
<star>*</star>
</label>
<input type="text" placeholder="State" class="form-control geoaddress" id="state" name="state" value="">
<input type="hidden" id="state_code" name="state_code" value="" class="hidden-validation">
<input type="hidden" id="formatted_address" name="formatted_address" value="" class="hidden-validation">
<input type="hidden" id="latitude" name="latitude" value="" class="hidden-validation">
<input type="hidden" id="longitude" name="longitude" value="" class="hidden-validation">
</div>
<div class="form-group">
<label class="control-label">Country
<star>*</star>
</label>
<input type="text" placeholder="Country" class="form-control geoaddress" id="country" name="country" value="">
</div>
<div class="form-group">
<label class="control-label">Zip
<star>*</star>
</label>
<input type="text" placeholder="Zip" class="form-control geoaddress" id="zip" name="zip" value="">
</div>
<div class="form-group">
<label class="control-label">Phone Number
<star>*</star>
</label>
<input type="text" placeholder="Phone Number" class="form-control geoaddress" id="phone" name="phone" onkeypress="return isNumber(event)">
</div>
<div class="form-group">
<label class="control-label">Website
<star>*</star>
</label>
<input type="text" placeholder="Website" class="form-control" id="website" name="website" >
<span class="text-info"><strong>[ex. http://www.website.com]</strong></span> </div>
<div class="form-group">
<label class="control-label">Location Email
<star>*</star>
</label>
<input type="text" placeholder="Reports Email" class="form-control" id="reports_email" name="reports_email">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6">
<div class="form-group hide">
<label class="control-label">Location
<star>*</star>
</label>
<input id="pac-input" name="location" class="controls form-control" type="text" placeholder="Search Box">
<!-- <div id="map" height="1000" width="1000"></div> -->
</div>
<h4 >Preview</h4>
<div class="form-group">
<div id="regularMap" class="map"></div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="clear"></div>
<div class="col-xs-12 col-sm-12 col-md-6">
</div>
<div class="clear"></div>
<div class="col-xs-12 col-sm-12 col-md-12 form-action">
<button type="submit" class="btn btn-fill btn-info">Submit</button>
Cancel </div>
<div class="clear"></div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="{{ asset('js/bootstrap-selectpicker.js')}}"></script>
<script>
$(document).ready(function(){
{{-- custom.initSmallGoogleMaps('41.31', '-72.92'); --}}
var map = new google.maps.Map(document.getElementById('regularMap'), {
zoom: 16,
center: new google.maps.LatLng(41.31,-72.92),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
myMarker = new google.maps.Marker({
position: new google.maps.LatLng(41.31, -72.92),
draggable: true
});
map.setCenter(myMarker.position);
myMarker.setMap(map);
google.maps.event.addListener(myMarker, 'dragend', function(evt) {
document.getElementById("latitude").value = evt.latLng.lat();
document.getElementById("longitude").value = evt.latLng.lng();
});
$('#locationadd').submit(function(event) {
var formatted_address = $('#formatted_address').val();
var latitude = $('#latitude').val();
var longitude = $('#longitude').val();
if(formatted_address == '' && !isFloat(latitude) && !isFloat(longitude))
{
getLocation();
}
});
$('.geoaddress').blur(function(){
getLocation();
})
function isFloat(n){
return Number(n) === n && n % 1 !== 0;
}
function getLocation(){
var address_1 = $('#address_1').val();
var address_2 = $('#address_2').val();
var city = $('#city').val();
var state = $('#state').val();
var country = $('#country').val();
var zip = $('#zip').val();
if(address_1 != '' && city != '' && state != '' && country != '' && zip != '' ){
var finalAdd = address_1+'+'+address_2+'+'+city+'+'+state+'+'+country+'+'+zip;
var formatted_address = address_1+' '+address_2+' '+city+' '+state+' '+country+' '+zip;
$.ajax({
url : 'https://maps.googleapis.com/maps/api/geocode/json?address='+finalAdd+'&key=MY_KEY',
type: 'GET',
success : function(data){
if(data.results.length >0){
var places = data.results;
document.getElementById("latitude").value = places[0].geometry.location.lat;
document.getElementById("longitude").value = places[0].geometry.location.lng;
document.getElementById("formatted_address").value = formatted_address;
document.getElementById("pac-input").value = places[0].formatted_address;
for (var i = 0, len = places[0].address_components.length; i < len; i++) {
var ac = places[0].address_components[i];
if (ac.types.indexOf("administrative_area_level_1") >= 0) {
document.getElementById("state_code").value = ac.short_name;
document.getElementById("state").value = ac.long_name;
}
}
var newLatLang = new google.maps.LatLng(places[0].geometry.location.lat, places[0].geometry.location.lng);
map.panTo(newLatLang);
myMarker.setPosition(newLatLang);
custom.getTimeZone(places[0].geometry.location.lat, places[0].geometry.location.lng);
}else{
document.getElementById("latitude").value = '';
document.getElementById("longitude").value = '';
document.getElementById("formatted_address").value = '';
$.scrollTo($('#geolocationerror'), 1000);
$('#geolocationerror').show();
event.preventDefault();
event.preventDefault();
}
}
});
}
}
});
</script>
{!! $validator !!}
#endsection
Please not that i have added correct API key, which i have added in .env file. Now the locations are only showing based on values provided in State,Zip,location name values etc.
I want maps get loaded based on the IP adddress

Uploading image with another form text input in codeigniter?

i'm have confusing problem about uploading image in multiple input text like registration page. i found solution but the image is not save to database or folder.
please help me all...
my admin.php view
<script>
//upload img
$('#form').ajaxForm({
//uploadimg is my form id
dataType: 'json',
success: processJson
});
function processJson(data) {
if(data.msg=="success"){
alert('Upload sukses.');
}
else{
alert('Upload gagal.');
}
}
function add_edulibs()
{
save_method = 'add';
$('#form')[0].reset(); // reset form on modals
$('.form-group').removeClass('has-error'); // clear error class
$('.help-block').empty(); // clear error string
$('#modal_form').modal('show'); // show bootstrap modal
$('.modal-title').text('Tambah Data'); // Set Title to Bootstrap modal title
}
function edit_edulibs(id)
{
save_method = 'update';
$('#form')[0].reset(); // reset form on modals
$('.form-group').removeClass('has-error'); // clear error class
$('.help-block').empty(); // clear error string
//Ajax Load data from ajax
$.ajax({
url : "<?php echo site_url('edulibs/ajax_edit/')?>/" + id,
type: "GET",
dataType: "JSON",
success: function(data)
{
$('[name="id"]').val(data.id);
$('[name="nama"]').val(data.nama);
$('[name="nim"]').val(data.nim);
$('[name="pembimbing"]').val(data.pembimbing);
$('[name="subyek"]').val(data.subyek);
$('[name="judul"]').val(data.judul);
$('[name="tanggal"]').datepicker('update',data.tanggal);
$('[name="alamat"]').val(data.alamat);
$('[name="kontak"]').val(data.kontak);
$('[name="email"]').val(data.email);
$('[name="penerbit"]').val(data.penerbit);
$('[name="file_upload"]').val(data.gambar);
$('#modal_form').modal('show'); // show bootstrap modal when complete loaded
$('.modal-title').text('Edit Data'); // Set title to Bootstrap modal title
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error mendapatkan data');
}
});
}
</script>
<div class="modal fade" id="modal_form" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">Kelola Data</h3>
</div>
<div class="modal-body form">
<form action="<?php echo base_url('edulibs/do_upload/')?>" method="post" enctype="multipart/form-data" id="form" class="form-horizontal">
<input type="hidden" value="" name="id"/>
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">Nama</label>
<div class="col-md-9">
<input name="nama" placeholder="Nama Lengkap" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">NIM</label>
<div class="col-md-9">
<input name="nim" placeholder="Nomor Induk Mahasiswa" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Pembimbing</label>
<div class="col-md-9">
<input name="pembimbing" placeholder="Nama Pembimbing" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Subyek</label>
<div class="col-md-9">
<input name="subyek" placeholder="Subyek" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Judul</label>
<div class="col-md-9">
<textarea name="judul" placeholder="Judul Karya Tulis" class="form-control"></textarea>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Tanggal Terbit</label>
<div class="col-md-9">
<input name="tanggal" placeholder="Tahun-Bulan-Hari" class="form-control datepicker" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Alamat</label>
<div class="col-md-9">
<textarea name="alamat" placeholder="Alamat Lengkap" class="form-control"></textarea>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Kontak</label>
<div class="col-md-9">
<input name="kontak" placeholder="Nomor Kontak" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Email</label>
<div class="col-md-9">
<input name="email" placeholder="Alamat e-mail" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Penerbit</label>
<div class="col-md-9">
<input name="penerbit" placeholder="Nama Penerbit" class="form-control" type="text">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Foto</label>
<div class="col-md-9">
<input type="file" name="file_upload" />
<span class="help-block"></span>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" id="btnSave" onclick="save()" class="btn btn-primary">Simpan</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Batalkan</button>
</div>
My edulibs.php controller
public function admin()
{
$this->load->view('admin');
}
function do_upload(){
$config['upload_path'] = "./uploads/foto/";
$config['allowed_types'] = 'gif|jpg|png|JPEG';
$config['file_name'] = url_title($this->input->post('file_upload'));
$this->upload->initialize($config);
if(!$this->upload->do_upload('file_upload'))
{
echo $this->upload->display_errors();
}
else{
$data = array(
'gambar'=>$this->upload->file_name
);
$this->edulib_model->insert($data,'edulib');
}
}
My edulib_model.php
public function save($data)
{
$this->db->insert($this->table, $data);
return $this->db->insert_id();
}
public function insert($data,$table){
$this->db->insert($data,$table);
}

Populate ng-model - Value not working AngularJS

I have an AngularJS front end for a new internal web portal I am building. Using value={{data.Param}} I have successfully gotten my get and create requests to work via Slim PHP. Now however I am trying to create a PUT request and I am running into an issue.
This is the current code for my "Update /PUT" page.
request-edit.html
<div class="jumbotron text-center">
<form class="form-horizontal" role="form">
<div class="form-group">
<div class="text-center">
<h1>{{ header }}</h1>
<br/>
<h3>{{ request.Header }}</h3>
<br/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Id:</label>
<div class="col-sm-3">
<input name="id" class="form-control" type="text" value="{{request.ID}}" disabled />
</div>
<label class="col-sm-3 control-label">Date:</label>
<div class="col-sm-3">
<input type="text" class="form-control" value="{{ request.Date_Submitted }}" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Change Initiator:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{request.Change_Initiator}}" ng-model="request.changeInitiator"/>
</div>
<label class="col-sm-3 control-label">Risk Level:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Risk_Level }}" ng-model="request.riskLevel" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">CI Details:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Change_Initiator_id }}" ng-model="request.changeInitiatorId" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Requestor:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Requestor }}" ng-model="request.requestor" />
</div>
<label class="col-sm-3 control-label">Systems Affected:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Systems_Affected }}" ng-model="request.systemsAffected" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Implemented By:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Implemented_By }}" ng-model="request.implementationBy" />
</div>
<label class="col-sm-3 control-label">Implementation Date:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Implementation_Date }}" ng-model="request.implementationDate" bs-datepicker/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Close Date:</label>
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="{{ request.Close_Date }}" ng-model="request.closeDate" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Work to be Performed:</label>
<div class="col-sm-3">
<textarea name="request.description" ng-model="request.workToBePerformed" placeholder="{{ request.Work_to_be_performed }}" ></textarea>
</div>
<label class="col-sm-3 control-label">Backout Plan:</label>
<div class="col-sm-3">
<textarea name="request.description" ng-model="request.backoutPlan" placeholder="{{ request.Backout_Plan }}" ></textarea>
</div>
</div>
<div class="form-group">
<button class="update" ng:click="updateRequest()">Save Edits</button>
<button class="approve" ng:click="approveRequest()">Approve</button>
</div>
</form>
<div class="form-group">
<a href="#/requests" class="btn btn-default pull-right">
<span class="glyphicon glyphicon-arrow-left"></span> Back
</a>
</div>
</div>
My confusion in with ng-model, value and placeholders. Currently all my data populates in the form, but when the user goes to update the page they have to re-fill out every box or else blank data will be pushed. I understand the Placeholder does not actually fill in the data - however I have been un-able to use both ng-model and value on the same input field.
My top two fields populate using value just fine, but I do not want people to edit the date or ID. My other fields show the correct data in a temp form using placeholder but do not populate using ng-model. Additionally when my user goes to make the update the ng-model DOES function.
So in short my current issue is that ng-model does not display the original data- but does push it correctly. This causes my users to have to re-type all the data everytime or else the record will be updated with null values.
Below is the rest of my logic for review.
app.js
var app = angular.module('changeControlApp', [
'ngRoute',
'ngResource'
]);
//This configures the routes and associates each route with a view and a controller
app.config(function($routeProvider, $locationProvider) {
//$locationProvider.html5Mode(true);
$routeProvider
.when('/', {templateUrl: 'app/partials/request-list.html', controller: 'viewController' })
.when('/requests', {templateUrl: 'app/partials/request-list.html', controller: 'viewController' })
.when('/requests/create', {templateUrl: 'app/partials/request-create.html', controller: 'createRequestController' })
.when('/settings', {templateUrl: 'app/partials/settings.html', controller: 'settingsController'})
.when('/requests/:id', {templateUrl: 'app/partials/request-view.html', controller: 'viewRequestController' })
.when('/requests/edit/:id', {templateUrl: 'app/partials/request-edit.html', controller: 'editRequestController' })
.otherwise({ redirectTo: '/' });
});
app.controller('editRequestController', function($scope, $location, $route, $routeParams, $resource) {
$scope.header = 'Edit Change Request';
// Update User details
var request_Id = $routeParams.id;
if (request_Id) {
var Request = $resource(('http://pdgrosit02v/changeRequest/app/api/requests/'+ request_Id));
$scope.request = Request.get();
}
$scope.updateRequest = function() {
var RequestPut = $resource(('http://pdgrosit02v/changeRequest/app/api/requests/'+ request_Id), {}, { update: { method: 'PUT'}} );
RequestPut.update($scope.request, function() {
// success
$location.path('/requests');
}, function() {
// error
console.log(error);
});
}
});
And the Slim file
index.php
<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
use Slim\Slim;
$app = new Slim();
//$paramValue = $app->request->params('paramName');
$app->get('/requests', 'getRequests');
$app->get('/requests/:id', 'getRequest');
$app->post('/requests/create', 'addRequest');
$app->put('/requests/:id', 'updateRequest');
$app->run();
function updateRequest($id) {
$request = Slim::getInstance()->request()->getBody();
$data = json_decode($request, true);
$sql = "UPDATE change_request SET Change_Initiator=:changeInitiator, Change_Initiator_id=:changeInitiatorId, Risk_Level=:riskLevel, Requestor=:requestor, Work_to_be_performed=:workToBePerformed, Backout_Plan=:backoutPlan, Backout_Time=:backoutTime, Implementation_Date=:implementationDate, Header=:title, Systems_Affected=:systemsAffected, Implemented_By=:implementationBy WHERE ID=$id";
//$sql = "UPDATE change_request SET Change_Initiator=:changeInitiator WHERE ID=$id";
try {
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindValue(":changeInitiator", $data['changeInitiator']);
$stmt->bindParam(":changeInitiatorId", $data['changeInitiatorId']);
$stmt->bindParam(":riskLevel", $data['riskLevel']);
$stmt->bindParam(":requestor", $data['requestor']);
$stmt->bindParam(":workToBePerformed", $data['workToBePerformed']);
$stmt->bindParam(":backoutPlan", $data['backoutPlan']);
$stmt->bindParam(":backoutTime", $data['backoutTime']);
$stmt->bindParam(":implementationDate", $data['implementationDate']);
$stmt->bindParam(":title", $data['title']);
$stmt->bindParam(":systemsAffected", $data['systemsAffected']);
$stmt->bindParam(":implementationBy", $data['implementationBy']);
$stmt->execute();
$db = null;
echo json_encode($data);
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
I figured out the issue, turns out Value and ng-model conflict and I had to modify my form to get the data correctly.
I removed all value commands and replaced them with ng-model="data.keyvalue". I was confused before as I thought you needed to use {{}} when referencing things off the scope.
I also added form validation for updating - new code below
request-edit.html
<div class="jumbotron text-center">
<form class="form-horizontal" role="form" name="requestEditForm" ng-submit="updateRequest()">
<div class="form-group">
<div class="text-center">
<h1>{{ header }}</h1>
<br/>
<h3>Title of request:</h3>
<input name="title" id="title" class="form-control" type="text" ng-model="request.Header" />
<br/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Id:</label>
<div class="col-sm-3">
<input name="id" class="form-control" type="text" value="{{request.ID}}" disabled />
</div>
<label class="col-sm-3 control-label">Date Submitted:</label>
<div class="col-sm-3">
<input type="text" class="form-control" value="{{ request.Date_Submitted }}" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Change Initiator:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Change_Initiator" name="changeInitiator" id="changeInitiator" />
<span class="error" ng-show="requestEditForm.changeInitiator.$error.required && requestEditForm.changeInitiator.$dirty">Title is required</span>
</div>
<label class="col-sm-3 control-label">Risk Level:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Risk_Level" name="riskLevel" id="riskLevel" required/>
<span class="error" ng-show="requestEditForm.riskLevel.$error.required && requestEditForm.riskLevel.$dirty">Risk Level is required</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">CI Details:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Change_Initiator_id" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Requestor:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Requestor" />
</div>
<label class="col-sm-3 control-label">Systems Affected:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Systems_Affected" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Implemented By:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Implemented_By" />
</div>
<label class="col-sm-3 control-label">Implementation Date:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Implementation_Date" bs-datepicker/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Close Date:</label>
<div class="col-sm-3">
<input type="text" class="form-control" ng-model="request.Close_Date" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Work to be Performed:</label>
<div class="col-sm-3">
<textarea name="request.description" ng-model="request.Work_to_be_performed"></textarea>
</div>
<label class="col-sm-3 control-label">Backout Plan:</label>
<div class="col-sm-3">
<textarea name="request.description" ng-model="request.Backout_Plan"></textarea>
</div>
</div>
<div class="form-group">
<button class="submit">Save Edits</button>
<button class="approve" ng:click="approveRequest()">Approve</button>
</div>
</form>
<div class="form-group">
<a href="#/requests" class="btn btn-default pull-right">
<span class="glyphicon glyphicon-arrow-left"></span> Back
</a>
</div>
</div>

Categories