added terms and privacy pages

This commit is contained in:
armiejean 2025-04-16 14:44:36 +08:00
parent dd93f5b42e
commit c96c4595c6
3 changed files with 161 additions and 11 deletions

View File

@ -1,14 +1,76 @@
@extends('layouts.app')
@section('page_title', 'About Us')
@section('page_title', 'Terms and Privacy')
@section('content')
<div class="card" style="min-height: 500px;">
<div class="card-header">
<i class="fa-solid fa-circle-info" style="color:gray;"> Terms and Privacy</i>
</div>
<div class="card-body">
<p>This is the Terms and Privacy page content.</p>
</div>
</div>
@php
$termsAndPrivacy = [
[
'id' => 1,
'title' => 'User Agreement',
'details' => 'Users must agree to use the platform responsibly and comply with all applicable laws.',
'type' => 'Terms'
],
[
'id' => 2,
'title' => 'Privacy Policy',
'details' => 'We collect personal data to improve services, with consent, and protect user information.',
'type' => 'Privacy'
],
[
'id' => 3,
'title' => 'Service Terms',
'details' => 'Details on how services are provided, including limitations and user obligations.',
'type' => 'Terms'
],
[
'id' => 4,
'title' => 'Data Protection',
'details' => 'Our commitment to GDPR compliance and secure data handling practices.',
'type' => 'Privacy'
],
[
'id' => 5,
'title' => 'Refund Policy',
'details' => 'Conditions under which refunds are issued for services or subscriptions.',
'type' => 'Terms'
],
[
'id' => 6,
'title' => 'Cookie Policy',
'details' => 'How we use cookies to enhance user experience and track site usage.',
'type' => 'Privacy'
]
];
@endphp
@include('components.table-component', [
'pageTitle' => 'Terms and Privacy',
'data' => $termsAndPrivacy,
'columns' => [
['name' => 'Title', 'key' => 'title', 'sortable' => true],
['name' => 'Details', 'key' => 'details', 'sortable' => true],
['name' => 'Type', 'key' => 'type', 'sortable' => true]
],
'allFields' => [
['name' => 'Title', 'key' => 'title', 'type' => 'text', 'required' => true],
['name' => 'Details', 'key' => 'details', 'type' => 'textarea', 'required' => true]
],
'actions' => ['edit', 'view', 'delete'],
'showAddButton' => true,
'addButtonUrl' => '/add-terms-and-privacy',
'showCheckboxes' => true,
'showBatchDelete' => true,
'showEditModal' => true,
'showViewModal' => true
])
<script>
const storedTerms = JSON.parse(sessionStorage.getItem('termsAndPrivacy') || '[]');
if (storedTerms.length > 0) {
tableConfig.data = [...tableConfig.data, ...storedTerms];
renderTable();
renderPagination();
}
</script>
@endsection

View File

@ -0,0 +1,84 @@
@extends('layouts.app')
@section('page_title', 'Add Terms and Privacy')
@section('content')
<div class="card-header border-0 bg-transparent py-2">
<h5 class="mb-0 fw-bold text-dark" style="font-size: 1.25rem;">Add Terms and Privacy</h5>
</div>
<div class="row justify-content-center">
<div class="card-body p-3">
<form id="addTermsAndPrivacyForm">
<div class="mb-3">
<label for="title" class="form-label">Title</label>
<input type="text" class="form-control" id="title" placeholder="Enter title" required>
</div>
<div class="mb-3">
<label for="details" class="form-label">Details</label>
<textarea class="form-control" id="details" rows="6" placeholder="Enter details" required></textarea>
</div>
<div class="mb-3">
<label for="type" class="form-label">Type</label>
<select class="form-select" id="type" required>
<option value="" disabled selected>Select type</option>
<option value="Terms">Terms</option>
<option value="Privacy">Privacy</option>
</select>
</div>
<div class="d-flex justify-content-end mt-3">
<button type="button" class="btn btn-outline-secondary me-2" style="margin-right:5px">Cancel</button>
<button type="submit" class="btn btn-primary">Add Terms and Privacy</button>
</div>
</form>
</div>
</div>
<style>
.card {
border-radius: 5px;
border: 1px solid #dee2e6;
}
.form-label {
font-size: 0.95rem;
}
.form-control,
.form-select,
textarea.form-control {
font-size: 0.9rem;
width: 100%;
}
</style>
<script>
document.getElementById('addTermsAndPrivacyForm').addEventListener('submit', function(e) {
e.preventDefault();
const title = document.getElementById('title').value;
const details = document.getElementById('details').value;
const type = document.getElementById('type').value;
if (!title || !details || !type) {
alert('Please fill out all required fields.');
return;
}
const newTerm = {
id: Date.now(),
title,
details,
type
};
let termsAndPrivacy = JSON.parse(sessionStorage.getItem('termsAndPrivacy') || '[]');
termsAndPrivacy.push(newTerm);
sessionStorage.setItem('termsAndPrivacy', JSON.stringify(termsAndPrivacy));
alert('Terms and Privacy added successfully!');
window.location.href = '/terms-and-privacy';
});
document.querySelector('.btn-outline-secondary').addEventListener('click', function() {
window.location.href = '/terms-and-privacy';
});
</script>
@endsection

View File

@ -115,3 +115,7 @@ Route::get('/add-top-up', function () {
Route::get('/add-card-types', function () {
return view('pages.add-card-types');
})->name('add-card-types');
Route::get('/add-terms-and-privacy', function () {
return view('pages.add-terms-and-privacy');
})->name('add-terms-and-privacy');