-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api, ui): add privacy policy update feature with landing page di…
…splay
- Loading branch information
1 parent
d72172d
commit 7608e19
Showing
5 changed files
with
214 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
resources/views/admin/pages/configuration/privacy-policy.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters