Skip to content

Commit

Permalink
feat: add mobile menu navigation to experimental settings
Browse files Browse the repository at this point in the history
feat: use browsers locale to set dates on the dashboard
  • Loading branch information
ellite authored Sep 29, 2024
1 parent 40593fd commit 1dbba18
Show file tree
Hide file tree
Showing 31 changed files with 421 additions and 156 deletions.
36 changes: 36 additions & 0 deletions endpoints/settings/mobile_navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require_once '../../includes/connect_endpoint.php';

if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
die(json_encode([
"success" => false,
"message" => translate('session_expired', $i18n)
]));
}

if ($_SERVER["REQUEST_METHOD"] === "POST") {
$postData = file_get_contents("php://input");
$data = json_decode($postData, true);

$mobile_nav = $data['value'];

$stmt = $db->prepare('UPDATE settings SET mobile_nav = :mobile_nav WHERE user_id = :userId');
$stmt->bindParam(':mobile_nav', $mobile_nav, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

if ($stmt->execute()) {
die(json_encode([
"success" => true,
"message" => translate("success", $i18n)
]));
} else {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
}
«

?>
11 changes: 10 additions & 1 deletion endpoints/subscriptions/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
$colorTheme = $settings['color_theme'];
}

$locale = isset($_COOKIE['user_locale']) ? $_COOKIE['user_locale'] : 'en_US';
$formatter = new IntlDateFormatter(
$locale,
IntlDateFormatter::MEDIUM,
IntlDateFormatter::NONE
);

if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {


Expand Down Expand Up @@ -146,7 +153,9 @@
$paymentMethodId = $subscription['payment_method_id'];
$print[$id]['currency_code'] = $currencies[$subscription['currency_id']]['code'];
$currencyId = $subscription['currency_id'];
$print[$id]['next_payment'] = date('M d, Y', strtotime($subscription['next_payment']));
$next_payment_timestamp = strtotime($subscription['next_payment']);
$formatted_date = $formatter->format($next_payment_timestamp);
$print[$id]['next_payment'] = $formatted_date;
$paymentIconFolder = (strpos($payment_methods[$paymentMethodId]['icon'], 'images/uploads/icons/') !== false) ? "" : "images/uploads/logos/";
$print[$id]['payment_method_icon'] = $paymentIconFolder . $payment_methods[$paymentMethodId]['icon'];
$print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name'];
Expand Down
50 changes: 25 additions & 25 deletions includes/footer.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
</main>
</main>

<div class="toast" id="errorToast">
<div class="toast-content">
<i class="fas fa-solid fa-x toast-icon error"></i>
<div class="message">
<span class="text text-1"><?= translate("error", $i18n) ?></span>
<span class="text text-2 errorMessage"></span>
</div>
<div class="toast" id="errorToast">
<div class="toast-content">
<i class="fas fa-solid fa-x toast-icon error"></i>
<div class="message">
<span class="text text-1"><?= translate("error", $i18n) ?></span>
<span class="text text-2 errorMessage"></span>
</div>
<i class="fa-solid fa-xmark close close-error"></i>
<div class="progress error"></div>
</div>
<i class="fa-solid fa-xmark close close-error"></i>
<div class="progress error"></div>
</div>

<div class="toast" id="successToast">
<div class="toast-content">
<i class="fas fa-solid fa-check toast-icon success"></i>
<div class="message">
<span class="text text-1"><?= translate("success", $i18n) ?></span>
<span class="text text-2 successMessage"></span>
</div>
<div class="toast" id="successToast">
<div class="toast-content">
<i class="fas fa-solid fa-check toast-icon success"></i>
<div class="message">
<span class="text text-1"><?= translate("success", $i18n) ?></span>
<span class="text text-2 successMessage"></span>
</div>
<i class="fa-solid fa-xmark close close-success"></i>
<div class="progress success"></div>
</div>
<i class="fa-solid fa-xmark close close-success"></i>
<div class="progress success"></div>
</div>

<?php
if (isset($db)) {
$db->close();
}
?>
<?php
if (isset($db)) {
$db->close();
}
?>

</body>
</body>

</html>
Loading

0 comments on commit 1dbba18

Please sign in to comment.