Compare commits
2 Commits
0ed667d594
...
72503d7fe2
Author | SHA1 | Date |
---|---|---|
tracer | 72503d7fe2 | |
tracer | 3f4653b81f |
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2022. Micha Espey <tracer@24unix.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
*/
|
||||
|
||||
function addAddress(url) {
|
||||
location.href = url
|
||||
}
|
||||
|
||||
function editAddress(id) {
|
||||
console.log("editButon")
|
||||
if (document.getElementById('edit_button_' + id).value === 'Save') {
|
||||
// save
|
||||
console.log("save")
|
||||
const url = "/address/update";
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
id: id,
|
||||
owner: document.getElementById('owner_' + id).value,
|
||||
first: document.getElementById('first_' + id).value,
|
||||
last: document.getElementById('last_' + id).value,
|
||||
street: document.getElementById('street_' + id).value,
|
||||
zip: document.getElementById('zip_' + id).value,
|
||||
city: document.getElementById('city_' + id).value,
|
||||
phone: document.getElementById('phone_' + id).value,
|
||||
})
|
||||
})
|
||||
.then(
|
||||
response => response.text() // .json(), etc.
|
||||
// same as function(response) {return response.text();}
|
||||
).then(
|
||||
html => console.log(html)
|
||||
);
|
||||
|
||||
document.getElementById('first_' + id).disabled = true
|
||||
document.getElementById('last_' + id).disabled = true
|
||||
document.getElementById('street_' + id).disabled = true
|
||||
document.getElementById('zip_' + id).disabled = true
|
||||
document.getElementById('city_' + id).disabled = true
|
||||
document.getElementById('phone_' + id).disabled = true
|
||||
|
||||
document.getElementById('edit_button_' + id).value = 'Edit'
|
||||
} else {
|
||||
//switch to edit
|
||||
console.log("switch to edit")
|
||||
document.getElementById('first_' + id).disabled = false
|
||||
document.getElementById('last_' + id).disabled = false
|
||||
document.getElementById('street_' + id).disabled = false
|
||||
document.getElementById('zip_' + id).disabled = false
|
||||
document.getElementById('city_' + id).disabled = false
|
||||
document.getElementById('phone_' + id).disabled = false
|
||||
|
||||
document.getElementById('edit_button_' + id).value = 'Save'
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAddress() {
|
||||
}
|
|
@ -12,15 +12,69 @@ namespace App\Entity;
|
|||
class AddressBookEntry
|
||||
{
|
||||
public function __construct(
|
||||
private int $userid,
|
||||
private int $owner,
|
||||
private string $first,
|
||||
private string $last,
|
||||
private string $nick,
|
||||
private string $street,
|
||||
private string $zip,
|
||||
private string $city,
|
||||
private string $phone,
|
||||
private int $userid = 0,
|
||||
)
|
||||
{
|
||||
// empty body
|
||||
}
|
||||
|
||||
public function getOwner(): int
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setOwner(int $owner): void
|
||||
{
|
||||
$this->owner = $owner;
|
||||
}
|
||||
|
||||
public function getStreet(): string
|
||||
{
|
||||
return $this->street;
|
||||
}
|
||||
|
||||
public function setStreet(string $street): void
|
||||
{
|
||||
$this->street = $street;
|
||||
}
|
||||
|
||||
public function getZip(): string
|
||||
{
|
||||
return $this->zip;
|
||||
}
|
||||
|
||||
public function setZip(string $zip): void
|
||||
{
|
||||
$this->zip = $zip;
|
||||
}
|
||||
|
||||
public function getCity(): string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
public function setCity(string $city): void
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
public function getPhone(): string
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
public function setPhone(string $phone): void
|
||||
{
|
||||
$this->phone = $phone;
|
||||
}
|
||||
|
||||
public function getUserid(): int
|
||||
{
|
||||
return $this->userid;
|
||||
|
@ -50,14 +104,4 @@ class AddressBookEntry
|
|||
{
|
||||
$this->last = $last;
|
||||
}
|
||||
|
||||
public function getNick(): string
|
||||
{
|
||||
return $this->nick;
|
||||
}
|
||||
|
||||
public function setNick(string $nick): void
|
||||
{
|
||||
$this->nick = $nick;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue