Compare commits
No commits in common. "72503d7fe25ed211e73b32f55b2aee6fb2d94009" and "0ed667d59459e1167402b03b6ca5941d3b43792d" have entirely different histories.
72503d7fe2
...
0ed667d594
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* 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,69 +12,15 @@ namespace App\Entity;
|
|||
class AddressBookEntry
|
||||
{
|
||||
public function __construct(
|
||||
private int $owner,
|
||||
private int $userid,
|
||||
private string $first,
|
||||
private string $last,
|
||||
private string $street,
|
||||
private string $zip,
|
||||
private string $city,
|
||||
private string $phone,
|
||||
private int $userid = 0,
|
||||
private string $nick,
|
||||
)
|
||||
{
|
||||
// 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;
|
||||
|
@ -104,4 +50,14 @@ 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