Skip to content

Commit

Permalink
feat(api, ui): add privacy policy update feature with landing page di…
Browse files Browse the repository at this point in the history
…splay
  • Loading branch information
farahamaliaa committed Dec 28, 2024
1 parent d72172d commit 7608e19
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 2 deletions.
8 changes: 8 additions & 0 deletions resources/views/admin/layouts/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@
<span class="hide-menu">Syarat & Ketentuan</span>
</a>
</li>
<li class="sidebar-item">
<a href="{{ route('admin.configuration.privacy-policy.index') }}" class="sidebar-link">
<div class="round-16 d-flex align-items-center justify-content-center">
<i class="ti ti-circle"></i>
</div>
<span class="hide-menu">Kebijakan Privasi</span>
</a>
</li>
</ul>
</li>
<li class="nav-small-cap">
Expand Down
138 changes: 138 additions & 0 deletions resources/views/admin/pages/configuration/privacy-policy.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
@extends('admin.layouts.app')

@section('style')
<style>
.btn-close {
--bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
background: transparent var(--bs-btn-close-bg) center/1em auto no-repeat;
}
.icon {
transition: transform 0.3s ease;
}
.toggle-btn[aria-expanded="true"] .icon {
transform: rotate(180deg);
}
</style>
@endsection

@section('content')
<div class="card position-relative overflow-hidden" style="background-color: #E8DEF3;">
<div class="card-body px-4 py-3">
<div class="row align-items-center">
<div class="col-9">
<h5 class="fw-semibold mb-8">Kebijakan Privasi</h5>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a class="text-muted " href="javascript:void(0)">Pengaturan kebijakan privasi di getskill</a>
</li>
</ol>
</nav>
</div>
<div class="col-3">
<div class="text-center mb-n1">
<img src="{{ asset('admin/dist/images/backgrounds/track-bg.png') }}" width="70px" alt=""
class="img-fluid mb-n3" />
</div>
</div>
</div>
</div>
</div>

<form action="#" enctype="multipart/form-data" id="update-form">
<div class="card">
<div class="card-header bg-white border-bottom">
<h5 class="mb-0">Info</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col col-md-12 form-group">
<label for="privacy_policy" class="form-label">Kebijakan privasi</label>
<textarea name="privacy_policy" id="privacy_policy" class="update-form" cols="30" rows="10"></textarea>
<div class="invalid-feedback"></div>
</div>
</div>
</div>
<div class="card-footer d-flex justify-content-end">
<button class="btn btn-primary">Update</button>
</div>
</div>
</form>
@endsection

@section('script')
<script>
$('#privacy_policy').summernote({
height: 200
});
</script>
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "{{ config('app.api_url') }}/api/privacy-policy",
dataType: "json",
success: function(response) {
$('#privacy_policy').summernote('code', response.data.privacy_policy);
},
error: function(xhr) {
console.log(xhr);
Swal.fire({
title: "Terjadi Kesalahan!",
text: "Tidak dapat memuat data modul.",
icon: "error"
});
}
});
$('#update-form').submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "{{ config('app.api_url') }}/api/privacy-policy?_method=PATCH",
data: new FormData(this),
headers: {
Authorization: 'Bearer ' + "{{ session('hummaclass-token') }}"
},
dataType: "json",
contentType: false,
processData: false,
success: function(response) {
Swal.fire({
title: "Sukses",
text: "Berhasil mengubah data.",
icon: "success"
});
},
error: function(response) {
if (response.status === 422) {
let errors = response.responseJSON.data;
$('.update-form .is-invalid').removeClass('is-invalid');
$('.update-form .invalid-feedback').text('');
$.each(errors, function(field, messages) {
$(`[name="${field}"]`).addClass('is-invalid');
$(`[name="${field}"]`).closest('.form-group').find(
'.invalid-feedback').text(messages[0]);
});
} else {
Swal.fire({
title: "Terjadi Kesalahan!",
text: "Ada kesalahan saat menyimpan data.",
icon: "error"
});
}
}
});
});
});
</script>
@endsection
5 changes: 3 additions & 2 deletions resources/views/user/layouts/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<div class="col-md-5">
<div class="footer__bottom-menu">
<ul class="list-wrap">
<li><a href="{{ route('terms-conditions.index') }}">Terms & Conditions</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a href="{{ route('terms-conditions.index') }}">Terms & Conditions</a></li>
<li><a href="{{ route('privacy-policy.index') }}">Privacy Policy</a></li>
</ul>
</div>
</div>
Expand All @@ -83,6 +83,7 @@
$('.detail-twitter').attr('href', response.data.twitter);
$('.detail-phone-number').html(response.data.phone_number);
$('.detail-email').attr('href', response.data.email);
$('#footer-description').html(response.data.description);
}
});
});
Expand Down
63 changes: 63 additions & 0 deletions resources/views/user/pages/privacy-policy/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@extends('user.layouts.app')

@section('content')
<!-- breadcrumb-area -->
<section class="breadcrumb__area breadcrumb__bg py-5" data-background="{{ asset('assets/img/bg/breadcrumb_bg.jpg') }}">
<div class="container">
<div class="row">
<div class="col-12">
<div class="breadcrumb__content">
<h3 class="title">Kebijakan Privasi</h3>
<nav class="breadcrumb">
<span property="itemListElement" typeof="ListItem">
<a href="/">Home</a>
</span>
<span class="breadcrumb-separator"><i class="fas fa-angle-right"></i></span>
<span property="itemListElement" typeof="ListItem">Privacy Policy</span>
</nav>
</div>
</div>
</div>
</div>
<div class="breadcrumb__shape-wrap">
<img src="assets/img/others/breadcrumb_shape01.svg" alt="img" class="alltuchtopdown">
<img src="assets/img/others/breadcrumb_shape02.svg" alt="img" data-aos="fade-right" data-aos-delay="300">
<img src="assets/img/others/breadcrumb_shape03.svg" alt="img" data-aos="fade-up" data-aos-delay="400">
<img src="assets/img/others/breadcrumb_shape04.svg" alt="img" data-aos="fade-down-left"
data-aos-delay="400">
<img src="assets/img/others/breadcrumb_shape05.svg" alt="img" data-aos="fade-left" data-aos-delay="400">
</div>
</section>
<!-- breadcrumb-area-end -->

<!-- contact-area -->
<section class="contact-area section-py-120">
<div class="container">
<div id="privacy_policy"></div>
</div>
</section>
<!-- contact-area-end -->
@endsection
@section('script')
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "{{ config('app.api_url') }}/api/privacy-policy",
dataType: "json",
success: function(response) {
$('#privacy_policy').html(response.data.privacy_policy);
},
error: function(xhr) {
console.log(xhr);
Swal.fire({
title: "Terjadi Kesalahan!",
text: "Tidak dapat memuat data modul.",
icon: "error"
});
}
});
});
</script>
@endsection
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
Route::get('contacts', fn() => view('user.pages.contacts.index'))->name('contacts.index');

Route::get('terms-conditions', fn() => view('user.pages.terms-conditions.index'))->name('terms-conditions.index');
Route::get('privacy-policy', fn() => view('user.pages.privacy-policy.index'))->name('privacy-policy.index');

Route::get('404', fn() => view('user.errors.404'))->name('404.index');

Expand Down Expand Up @@ -212,6 +213,7 @@
Route::get('header', fn() => view('admin.pages.configuration.header'))->name('header.index');
Route::get('faq', fn() => view('admin.pages.configuration.faq'))->name('faq.index');
Route::get('terms-conditions', fn() => view('admin.pages.configuration.terms-conditions'))->name('terms-conditions.index');
Route::get('privacy-policy', fn() => view('admin.pages.configuration.privacy-policy'))->name('privacy-policy.index');
});
});
Route::get('point-exchange-detail/{id}', fn($id) => view('user.pages.points-exchange.detail-point-exchange', compact('id')))->name('detail-point-exchange.index');
Expand Down

0 comments on commit 7608e19

Please sign in to comment.