Rename products to wishes
This commit is contained in:
parent
9cbab6c929
commit
63d936acaf
14 changed files with 98 additions and 98 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate cache for product
|
* Generate cache for wish
|
||||||
*
|
*
|
||||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,7 @@ require '../../index.php';
|
||||||
|
|
||||||
switch ($_SERVER['REQUEST_METHOD']) {
|
switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
case 'GET':
|
case 'GET':
|
||||||
$cache = new EmbedCache($_GET['product_url']);
|
$cache = new EmbedCache($_GET['wish_url']);
|
||||||
$info = $cache->get(true);
|
$info = $cache->get(true);
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
|
|
|
@ -18,7 +18,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
if (isset($_GET['table'])) {
|
if (isset($_GET['table'])) {
|
||||||
if ('all' === $_GET['table']) {
|
if ('all' === $_GET['table']) {
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'products',
|
'wishes',
|
||||||
'wishlists',
|
'wishlists',
|
||||||
'users',
|
'users',
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* products.php
|
* wishes.php
|
||||||
*
|
*
|
||||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
*/
|
*/
|
||||||
|
@ -17,17 +17,17 @@ require '../../index.php';
|
||||||
|
|
||||||
switch ($_SERVER['REQUEST_METHOD']) {
|
switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
case 'POST':
|
case 'POST':
|
||||||
if (isset($_POST['wishlist_id'], $_POST['product_url'])) {
|
if (isset($_POST['wishlist_id'], $_POST['wish_url'])) {
|
||||||
/**
|
/**
|
||||||
* Insert New Product
|
* Insert New Wish
|
||||||
*/
|
*/
|
||||||
$database->query('INSERT INTO `products`
|
$database->query('INSERT INTO `wishes`
|
||||||
(
|
(
|
||||||
`wishlist`,
|
`wishlist`,
|
||||||
`url`
|
`url`
|
||||||
) VALUES ('
|
) VALUES ('
|
||||||
. $_POST['wishlist_id'] . ',
|
. $_POST['wishlist_id'] . ',
|
||||||
"' . $_POST['product_url'] . '"
|
"' . $_POST['wish_url'] . '"
|
||||||
)
|
)
|
||||||
;');
|
;');
|
||||||
|
|
||||||
|
@ -41,23 +41,23 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
parse_str(file_get_contents("php://input"), $_PUT);
|
parse_str(file_get_contents("php://input"), $_PUT);
|
||||||
|
|
||||||
if (isset($_PUT['productID'], $_PUT['productStatus'])) {
|
if (isset($_PUT['wish_id'], $_PUT['wish_status'])) {
|
||||||
/**
|
/**
|
||||||
* Update Product Status
|
* Update Wish Status
|
||||||
*/
|
*/
|
||||||
$database->query('UPDATE `products`
|
$database->query('UPDATE `wishes`
|
||||||
SET `status` = "' . $_PUT['productStatus'] . '"
|
SET `status` = "' . $_PUT['wish_status'] . '"
|
||||||
WHERE `id` = ' . $_PUT['productID'] . '
|
WHERE `id` = ' . $_PUT['wish_id'] . '
|
||||||
;');
|
;');
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
} elseif (isset($_PUT['product_url_current'], $_PUT['product_url_proposed'])) {
|
} elseif (isset($_PUT['wish_url_current'], $_PUT['wish_url_proposed'])) {
|
||||||
/**
|
/**
|
||||||
* Update Product URL
|
* Update Wish URL
|
||||||
*/
|
*/
|
||||||
$database->query('UPDATE `products`
|
$database->query('UPDATE `wishes`
|
||||||
SET `url` = "' . $_PUT['product_url_proposed'] . '"
|
SET `url` = "' . $_PUT['wish_url_proposed'] . '"
|
||||||
WHERE `url` = "' . $_PUT['product_url_current'] . '"
|
WHERE `url` = "' . $_PUT['wish_url_current'] . '"
|
||||||
;');
|
;');
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
|
@ -67,9 +67,9 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
case 'DELETE':
|
case 'DELETE':
|
||||||
parse_str(file_get_contents("php://input"), $_DELETE);
|
parse_str(file_get_contents("php://input"), $_DELETE);
|
||||||
|
|
||||||
if (isset($_DELETE['productID'])) {
|
if (isset($_DELETE['wish_id'])) {
|
||||||
$database->query('DELETE FROM `products`
|
$database->query('DELETE FROM `wishes`
|
||||||
WHERE `id` = ' . $_DELETE['productID'] . '
|
WHERE `id` = ' . $_DELETE['wish_id'] . '
|
||||||
;');
|
;');
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
|
@ -20,8 +20,8 @@ $(function() {
|
||||||
$.fn.api.settings.api = {
|
$.fn.api.settings.api = {
|
||||||
'get wishlists' : '/src/api/wishlists.php',
|
'get wishlists' : '/src/api/wishlists.php',
|
||||||
'delete wishlist' : '/src/api/wishlists.php',
|
'delete wishlist' : '/src/api/wishlists.php',
|
||||||
'update product status': '/src/api/products.php',
|
'update wish status': '/src/api/wishes.php',
|
||||||
'delete product' : '/src/api/products.php',
|
'delete wish' : '/src/api/wishes.php',
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Default callbacks */
|
/** Default callbacks */
|
||||||
|
|
|
@ -11,8 +11,8 @@ $(function() {
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
showStatistic(
|
showStatistic(
|
||||||
$('#products .value'),
|
$('#wishes .value'),
|
||||||
response.data.products.count,
|
response.data.wishes.count,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
showStatistic(
|
showStatistic(
|
||||||
|
|
|
@ -31,7 +31,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit to Product
|
* Commit to Wish
|
||||||
*/
|
*/
|
||||||
$(document).on('click', '.ui.button.commit', function() {
|
$(document).on('click', '.ui.button.commit', function() {
|
||||||
var button = $(this);
|
var button = $(this);
|
||||||
|
@ -55,14 +55,14 @@ $(function() {
|
||||||
],
|
],
|
||||||
onApprove: function() {
|
onApprove: function() {
|
||||||
/**
|
/**
|
||||||
* Update product status
|
* Update wish status
|
||||||
*/
|
*/
|
||||||
button.api({
|
button.api({
|
||||||
action: 'update product status',
|
action: 'update wish status',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: {
|
data: {
|
||||||
productID: card.data('id'),
|
wish_id: card.data('id'),
|
||||||
productStatus: 'unavailable'
|
wish_status: 'unavailable'
|
||||||
},
|
},
|
||||||
on: 'now',
|
on: 'now',
|
||||||
onSuccess: function(response, element, xhr) {
|
onSuccess: function(response, element, xhr) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ $(function () {
|
||||||
|
|
||||||
$('.wishlist-share').attr('href', '/?wishlist=' + wishlists[wishlistIndex].hash);
|
$('.wishlist-share').attr('href', '/?wishlist=' + wishlists[wishlistIndex].hash);
|
||||||
|
|
||||||
$('.button.wishlist-product-add').removeClass('disabled');
|
$('.button.wishlist-wish-add').removeClass('disabled');
|
||||||
$('.button.wishlist-share').removeClass('disabled');
|
$('.button.wishlist-share').removeClass('disabled');
|
||||||
$('.wishlist-delete button').removeClass('disabled');
|
$('.wishlist-delete button').removeClass('disabled');
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ $(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('.button.wishlist-product-add').addClass('disabled');
|
$('.button.wishlist-wish-add').addClass('disabled');
|
||||||
$('.button.wishlist-share').addClass('disabled');
|
$('.button.wishlist-share').addClass('disabled');
|
||||||
$('.wishlist-delete button').addClass('disabled');
|
$('.wishlist-delete button').addClass('disabled');
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,14 @@ $(function () {
|
||||||
function generateCacheCard(card) {
|
function generateCacheCard(card) {
|
||||||
card = $(card);
|
card = $(card);
|
||||||
|
|
||||||
var href = card.find('.content [href]').prop('href');
|
var href = card.find('.content [href]').prop('href');
|
||||||
var product_id = card.data('id');
|
var wish_id = card.data('id');
|
||||||
var refresh = card.find('button.refresh');
|
var refresh = card.find('button.refresh');
|
||||||
|
|
||||||
card.addClass('loading');
|
card.addClass('loading');
|
||||||
card.attr('data-cache', true);
|
card.attr('data-cache', true);
|
||||||
|
|
||||||
fetch('/src/api/cache.php?product_id=' + product_id + '&product_url=' + href, {
|
fetch('/src/api/cache.php?wish_id=' + wish_id + '&wish_url=' + href, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
|
@ -311,7 +311,7 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete Product
|
* Delete Wish
|
||||||
*/
|
*/
|
||||||
$(document).on('click', '.ui.button.delete', function () {
|
$(document).on('click', '.ui.button.delete', function () {
|
||||||
var button = $(this);
|
var button = $(this);
|
||||||
|
@ -322,7 +322,7 @@ $(function () {
|
||||||
modalDefault
|
modalDefault
|
||||||
.modal({
|
.modal({
|
||||||
title: 'Really delete?',
|
title: 'Really delete?',
|
||||||
content: '<p>Would you really like to delete to this product? It will be gone forever.</p>',
|
content: '<p>Would you really like to delete to this wish? It will be gone forever.</p>',
|
||||||
class: 'tiny',
|
class: 'tiny',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
|
@ -337,13 +337,13 @@ $(function () {
|
||||||
buttonApprove.addClass('loading');
|
buttonApprove.addClass('loading');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete product
|
* Delete wish
|
||||||
*/
|
*/
|
||||||
button.api({
|
button.api({
|
||||||
action: 'delete product',
|
action: 'delete wish',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
data: {
|
data: {
|
||||||
productID: card.data('id'),
|
wish_id: card.data('id'),
|
||||||
},
|
},
|
||||||
on: 'now',
|
on: 'now',
|
||||||
onSuccess: function () {
|
onSuccess: function () {
|
||||||
|
@ -352,7 +352,7 @@ $(function () {
|
||||||
$('body').toast({
|
$('body').toast({
|
||||||
class: 'success',
|
class: 'success',
|
||||||
showIcon: 'check',
|
showIcon: 'check',
|
||||||
message: 'Product successfully deleted.'
|
message: 'Wish successfully deleted.'
|
||||||
});
|
});
|
||||||
|
|
||||||
wishlistsRefresh();
|
wishlistsRefresh();
|
||||||
|
@ -374,25 +374,25 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add product
|
* Add wish
|
||||||
*/
|
*/
|
||||||
$(document).on('click', '.button.wishlist-product-add', function () {
|
$(document).on('click', '.button.wishlist-wish-add', function () {
|
||||||
var modalWishlistProductAdd = $('.ui.modal.wishlist-product-add');
|
var modalWishlistWishAdd = $('.ui.modal.wishlist-wish-add');
|
||||||
|
|
||||||
modalWishlistProductAdd.find('[name="wishlist_id"]').val($('.ui.dropdown.wishlists').dropdown('get value'));
|
modalWishlistWishAdd.find('[name="wishlist_id"]').val($('.ui.dropdown.wishlists').dropdown('get value'));
|
||||||
modalWishlistProductAdd.find('.primary.approve.button').addClass('disabled');
|
modalWishlistWishAdd.find('.primary.approve.button').addClass('disabled');
|
||||||
|
|
||||||
modalWishlistProductAdd
|
modalWishlistWishAdd
|
||||||
.modal({
|
.modal({
|
||||||
onApprove: function (button) {
|
onApprove: function (button) {
|
||||||
button.addClass('loading');
|
button.addClass('loading');
|
||||||
|
|
||||||
var form = $('.ui.form.wishlist-product-fetch');
|
var form = $('.ui.form.wishlist-wish-fetch');
|
||||||
var formData = new URLSearchParams();
|
var formData = new URLSearchParams();
|
||||||
formData.append('wishlist_id', form.find('input[name="wishlist_id"]').val());
|
formData.append('wishlist_id', form.find('input[name="wishlist_id"]').val());
|
||||||
formData.append('product_url', form.find('input[name="product_url"]').val());
|
formData.append('wish_url', form.find('input[name="wish_url"]').val());
|
||||||
|
|
||||||
fetch('/src/api/products.php', {
|
fetch('/src/api/wishes.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
@ -402,12 +402,12 @@ $(function () {
|
||||||
$('body').toast({
|
$('body').toast({
|
||||||
class: 'success',
|
class: 'success',
|
||||||
showIcon: 'check',
|
showIcon: 'check',
|
||||||
message: 'Product successfully added.'
|
message: 'Wish successfully added.'
|
||||||
});
|
});
|
||||||
|
|
||||||
wishlistsRefresh();
|
wishlistsRefresh();
|
||||||
|
|
||||||
modalWishlistProductAdd.modal('hide');
|
modalWishlistWishAdd.modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
button.removeClass('loading');
|
button.removeClass('loading');
|
||||||
|
@ -420,20 +420,20 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Fetch */
|
/** Fetch */
|
||||||
$(document).on('submit', '.wishlist-product-fetch', function (event) {
|
$(document).on('submit', '.wishlist-wish-fetch', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var form = $(event.currentTarget);
|
var form = $(event.currentTarget);
|
||||||
var href = form.find('[name="product_url"]').val();
|
var href = form.find('[name="wish_url"]').val();
|
||||||
|
|
||||||
var elementModalAdd = $('.ui.modal.wishlist-product-add');
|
var elementModalAdd = $('.ui.modal.wishlist-wish-add');
|
||||||
var elementButtons = elementModalAdd.find('.actions .button');
|
var elementButtons = elementModalAdd.find('.actions .button');
|
||||||
var elementImage = elementModalAdd.find('.image img');
|
var elementImage = elementModalAdd.find('.image img');
|
||||||
|
|
||||||
form.addClass('loading');
|
form.addClass('loading');
|
||||||
elementButtons.addClass('disabled');
|
elementButtons.addClass('disabled');
|
||||||
|
|
||||||
fetch('/src/api/cache.php?product_url=' + href, {
|
fetch('/src/api/cache.php?wish_url=' + href, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
|
@ -452,7 +452,7 @@ $(function () {
|
||||||
* URL
|
* URL
|
||||||
*/
|
*/
|
||||||
if (info.url && info.url !== href) {
|
if (info.url && info.url !== href) {
|
||||||
var elementModalFetch = $('.ui.modal.wishlist-product-fetch');
|
var elementModalFetch = $('.ui.modal.wishlist-wish-fetch');
|
||||||
|
|
||||||
elementModalFetch.find('input.current').val(href);
|
elementModalFetch.find('input.current').val(href);
|
||||||
elementModalFetch.find('input.proposed').val(info.url);
|
elementModalFetch.find('input.proposed').val(info.url);
|
||||||
|
@ -465,12 +465,12 @@ $(function () {
|
||||||
closable: false,
|
closable: false,
|
||||||
onApprove: function (buttonFetch) {
|
onApprove: function (buttonFetch) {
|
||||||
var formData = new URLSearchParams();
|
var formData = new URLSearchParams();
|
||||||
formData.append('product_url_current', href);
|
formData.append('wish_url_current', href);
|
||||||
formData.append('product_url_proposed', info.url);
|
formData.append('wish_url_proposed', info.url);
|
||||||
|
|
||||||
buttonFetch.addClass('loading');
|
buttonFetch.addClass('loading');
|
||||||
|
|
||||||
fetch('/src/api/products.php', {
|
fetch('/src/api/wishes.php', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
|
|
@ -69,22 +69,22 @@ class User
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of products for a given wishlist.
|
* Returns a list of wishes for a given wishlist.
|
||||||
*
|
*
|
||||||
* @param int $wishlist
|
* @param int $wishlist
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getProducts(int $wishlist): array
|
public function getWishes(int $wishlist): array
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$products = $database->query(
|
$wishes = $database->query(
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM products
|
FROM wishes
|
||||||
WHERE wishlist = ' . $wishlist . ';'
|
WHERE wishlist = ' . $wishlist . ';'
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
|
|
||||||
return $products;
|
return $wishes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Wishlist
|
||||||
private string $hash;
|
private string $hash;
|
||||||
|
|
||||||
public array $data;
|
public array $data;
|
||||||
public array $products = array();
|
public array $wishes = array();
|
||||||
|
|
||||||
public bool $exists = false;
|
public bool $exists = false;
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ class Wishlist
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Products
|
* Get Wishes
|
||||||
*/
|
*/
|
||||||
$this->products = $database->query('SELECT *
|
$this->wishes = $database->query('SELECT *
|
||||||
FROM `products`
|
FROM `wishes`
|
||||||
WHERE `wishlist` = ' . $this->id . ';')
|
WHERE `wishlist` = ' . $this->id . ';')
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
}
|
}
|
||||||
|
@ -70,11 +70,11 @@ class Wishlist
|
||||||
$exclude = isset($options['exclude']) ? $options['exclude'] : array();
|
$exclude = isset($options['exclude']) ? $options['exclude'] : array();
|
||||||
|
|
||||||
if ($exclude) {
|
if ($exclude) {
|
||||||
$products = array_filter($this->products, function ($product) use ($exclude) {
|
$wishes = array_filter($this->wishes, function ($wish) use ($exclude) {
|
||||||
return !in_array($product['status'], $exclude);
|
return !in_array($wish['status'], $exclude);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$products = $this->products;
|
$wishes = $this->wishes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,15 +83,15 @@ class Wishlist
|
||||||
$userIsCurrent = isset($_SESSION['user']) && $this->data['user'] === $_SESSION['user']['id'];
|
$userIsCurrent = isset($_SESSION['user']) && $this->data['user'] === $_SESSION['user']['id'];
|
||||||
$cardIndex = 0;
|
$cardIndex = 0;
|
||||||
|
|
||||||
if (!empty($products)) { ?>
|
if (!empty($wishes)) { ?>
|
||||||
<div class="ui three column doubling stackable grid">
|
<div class="ui three column doubling stackable grid">
|
||||||
<?php foreach ($products as $product) {
|
<?php foreach ($wishes as $wish) {
|
||||||
$cache = new EmbedCache($product['url']);
|
$cache = new EmbedCache($wish['url']);
|
||||||
$info = $cache->get(false);
|
$info = $cache->get(false);
|
||||||
$exists = $cache->exists() ? 'true' : 'false';
|
$exists = $cache->exists() ? 'true' : 'false';
|
||||||
?>
|
?>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="ui fluid card stretch" data-id="<?= $product['id'] ?>" data-index="<?= $cardIndex ?>" data-cache="<?= $exists ?>">
|
<div class="ui fluid card stretch" data-id="<?= $wish['id'] ?>" data-index="<?= $cardIndex ?>" data-cache="<?= $exists ?>">
|
||||||
<div class="overlay"></div>
|
<div class="overlay"></div>
|
||||||
|
|
||||||
<div class="image">
|
<div class="image">
|
||||||
|
|
|
@ -51,9 +51,9 @@ $page->navigation();
|
||||||
|
|
||||||
<div class="ui stackable statistics">
|
<div class="ui stackable statistics">
|
||||||
|
|
||||||
<div class="statistic" id="products">
|
<div class="statistic" id="wishes">
|
||||||
<div class="value">N. A.</div>
|
<div class="value">N. A.</div>
|
||||||
<div class="label">Products</div>
|
<div class="label">Wishes</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="statistic" id="wishlists">
|
<div class="statistic" id="wishlists">
|
||||||
|
|
|
@ -135,9 +135,9 @@ switch ($step) {
|
||||||
$database->query('CREATE INDEX `idx_hash` ON `wishlists` (`hash`);');
|
$database->query('CREATE INDEX `idx_hash` ON `wishlists` (`hash`);');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Products
|
* Wishes
|
||||||
*/
|
*/
|
||||||
$database->query('CREATE TABLE `products` (
|
$database->query('CREATE TABLE `wishes` (
|
||||||
`id` int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
`id` int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
`wishlist` int NOT NULL,
|
`wishlist` int NOT NULL,
|
||||||
`url` VARCHAR(255) NOT NULL,
|
`url` VARCHAR(255) NOT NULL,
|
||||||
|
|
|
@ -80,7 +80,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
|
||||||
|
|
||||||
/** Current version is below 0.3.0 */
|
/** Current version is below 0.3.0 */
|
||||||
if (-1 === version_compare($options->version, '0.3.0')) {
|
if (-1 === version_compare($options->version, '0.3.0')) {
|
||||||
$database->query('ALTER TABLE `products`
|
$database->query('ALTER TABLE `wishes`
|
||||||
ADD `status` VARCHAR(32) NOT NULL AFTER `url`
|
ADD `status` VARCHAR(32) NOT NULL AFTER `url`
|
||||||
;');
|
;');
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ $page->navigation();
|
||||||
/**
|
/**
|
||||||
* Warn the wishlist creator
|
* Warn the wishlist creator
|
||||||
*/
|
*/
|
||||||
if (isset($user->id) && $user->id === intval($wishlist->data['user']) && !empty($wishlist->products)) { ?>
|
if (isset($user->id) && $user->id === intval($wishlist->data['user']) && !empty($wishlist->wishes)) { ?>
|
||||||
<div class="ui icon warning message wishlist-own">
|
<div class="ui icon warning message wishlist-own">
|
||||||
<i class="exclamation triangle icon"></i>
|
<i class="exclamation triangle icon"></i>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -42,7 +42,7 @@ $page->navigation();
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
You are viewing your own wishlist!
|
You are viewing your own wishlist!
|
||||||
You will be able to see which products have already been bought for you.
|
You will be able to see which wishes have already been bought for you.
|
||||||
Don't you want to be surprised?
|
Don't you want to be surprised?
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -69,7 +69,7 @@ $page->navigation();
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<h2 class="ui header">Products</h2>
|
<h2 class="ui header">Wishes</h2>
|
||||||
|
|
||||||
<div class="wishlist-cards">
|
<div class="wishlist-cards">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -36,9 +36,9 @@ $page->navigation();
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<a class="ui small labeled icon button wishlist-product-add disabled">
|
<a class="ui small labeled icon button wishlist-wish-add disabled">
|
||||||
<i class="add icon"></i>
|
<i class="add icon"></i>
|
||||||
Add a product
|
Add a wish
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="ui small labeled icon button wishlist-share disabled" target="_blank">
|
<a class="ui small labeled icon button wishlist-share disabled" target="_blank">
|
||||||
|
@ -68,7 +68,7 @@ $page->navigation();
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="ui header">Products</h2>
|
<h2 class="ui header">Wishes</h2>
|
||||||
|
|
||||||
<div class="ui primary progress">
|
<div class="ui primary progress">
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
|
@ -122,25 +122,25 @@ $page->navigation();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Wishlist: Add a product -->
|
<!-- Wishlist: Add a wish -->
|
||||||
<div class="ui modal wishlist-product-add">
|
<div class="ui modal wishlist-wish-add">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Add a product
|
Add a wish
|
||||||
</div>
|
</div>
|
||||||
<div class="image content">
|
<div class="image content">
|
||||||
<div class="ui medium image">
|
<div class="ui medium image">
|
||||||
<img src="/src/assets/img/no-image.svg" loading="lazy" />
|
<img src="/src/assets/img/no-image.svg" loading="lazy" />
|
||||||
</div>
|
</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<div class="ui header">Product</div>
|
<div class="ui header">Wish</div>
|
||||||
<p>Fill out the below fields to add your new product.</p>
|
<p>Fill out the below fields to add your new wish.</p>
|
||||||
|
|
||||||
<form class="ui form wishlist-product-fetch" method="post">
|
<form class="ui form wishlist-wish-fetch" method="post">
|
||||||
<input type="hidden" name="wishlist_id" />
|
<input type="hidden" name="wishlist_id" />
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>URL</label>
|
<label>URL</label>
|
||||||
<input type="url" name="product_url" />
|
<input type="url" name="wish_url" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input class="ui button" type="submit" value="Fetch" />
|
<input class="ui button" type="submit" value="Fetch" />
|
||||||
|
@ -157,14 +157,14 @@ $page->navigation();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Wishlist: Add a product (fetch) -->
|
<!-- Wishlist: Add a wish (fetch) -->
|
||||||
<div class="ui small modal wishlist-product-fetch">
|
<div class="ui small modal wishlist-wish-fetch">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Incorrect URL
|
Incorrect URL
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<div class="ui header">Product URLs</div>
|
<div class="ui header">Wish URLs</div>
|
||||||
<p>The URL you have entered does not seem quite right. Would you like to update it with the one I found?</p>
|
<p>The URL you have entered does not seem quite right. Would you like to update it with the one I found?</p>
|
||||||
|
|
||||||
<div class="ui form urls">
|
<div class="ui form urls">
|
||||||
|
|
Loading…
Reference in a new issue