firstcommit
This commit is contained in:
0
resources/js/app.js
Normal file
0
resources/js/app.js
Normal file
20
resources/js/backend/app.js
Normal file
20
resources/js/backend/app.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import Alpine from 'alpinejs';
|
||||
|
||||
window.Alpine = Alpine;
|
||||
|
||||
Alpine.start();
|
||||
|
||||
import "./loader";
|
||||
import "./displayUploadedImage";
|
||||
import "./sweetAlertDelete";
|
||||
import "./repeater";
|
||||
import "./mapDisplay";
|
||||
import "./create_tagify";
|
||||
import "./edit_tagify";
|
||||
import "./snow_theme";
|
||||
import "./textarea_content_display";
|
||||
import "./generate_slug";
|
||||
|
||||
|
||||
|
||||
|
23
resources/js/backend/create_tagify.js
Normal file
23
resources/js/backend/create_tagify.js
Normal file
@@ -0,0 +1,23 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const allActivitiesElement = document.querySelector('.all-activities');
|
||||
if (allActivitiesElement) {
|
||||
const rawTotalData = JSON.parse(allActivitiesElement.dataset.totalActivities);
|
||||
const activityNames = rawTotalData.map(activity => activity.name);
|
||||
|
||||
(function () {
|
||||
const createTagifyInput = document.querySelector('#TagifyActivityList');
|
||||
if (createTagifyInput) {
|
||||
new Tagify(createTagifyInput, {
|
||||
whitelist: activityNames,
|
||||
maxTags: 10,
|
||||
dropdown: {
|
||||
maxItems: 20,
|
||||
classname: '',
|
||||
enabled: 0,
|
||||
closeOnSelect: false
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
}
|
||||
});
|
9
resources/js/backend/deleteModal.js
Normal file
9
resources/js/backend/deleteModal.js
Normal file
@@ -0,0 +1,9 @@
|
||||
$(document).ready(function () {
|
||||
$('.btn-delete').on('click', function () {
|
||||
var action = $(this).data('action');
|
||||
var name = $(this).data('name');
|
||||
$(".name").html(name);
|
||||
$(".form-delete").attr("action", action);
|
||||
$(".deleteModal").modal("show");
|
||||
})
|
||||
});
|
48
resources/js/backend/displayUploadedImage.js
Normal file
48
resources/js/backend/displayUploadedImage.js
Normal file
@@ -0,0 +1,48 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const fileInput = document.querySelector(".input-file");
|
||||
const uploadedImage = document.querySelector(".show-image");
|
||||
const resetButton = document.querySelector(".image-reset");
|
||||
|
||||
// Check if the necessary elements exist before proceeding
|
||||
if (fileInput && uploadedImage && resetButton) {
|
||||
const resetImage = uploadedImage.src;
|
||||
|
||||
fileInput.addEventListener("change", function () {
|
||||
if (fileInput.files && fileInput.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
uploadedImage.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(fileInput.files[0]);
|
||||
}
|
||||
});
|
||||
|
||||
resetButton.addEventListener("click", function () {
|
||||
fileInput.value = null;
|
||||
uploadedImage.src = resetImage;
|
||||
});
|
||||
}
|
||||
|
||||
const secondaryInput = document.querySelector(".input-secondary");
|
||||
const uploadedSecondary = document.querySelector(".show-secondary");
|
||||
const resetSecondaryButton = document.querySelector(".secondary-reset");
|
||||
|
||||
if (secondaryInput && uploadedSecondary && resetSecondaryButton) {
|
||||
const resetSecondaryImage = uploadedSecondary.src;
|
||||
|
||||
secondaryInput.addEventListener("change", function () {
|
||||
if (secondaryInput.files && secondaryInput.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
uploadedSecondary.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(secondaryInput.files[0]);
|
||||
}
|
||||
});
|
||||
|
||||
resetSecondaryButton.addEventListener("click", function () {
|
||||
secondaryInput.value = null;
|
||||
uploadedSecondary.src = resetSecondaryImage;
|
||||
});
|
||||
}
|
||||
});
|
31
resources/js/backend/edit_tagify.js
Normal file
31
resources/js/backend/edit_tagify.js
Normal file
@@ -0,0 +1,31 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const allActivitiesElement = document.querySelector('.all-activities');
|
||||
if (allActivitiesElement) {
|
||||
const totalActivitiesData = JSON.parse(allActivitiesElement.dataset.totalActivities);
|
||||
const activityNames = totalActivitiesData.map(activity => activity.name);
|
||||
|
||||
const destinationActivitiesElement = document.querySelector('.destination-activities');
|
||||
if (destinationActivitiesElement) {
|
||||
const destinationActivitiesRawData = JSON.parse(destinationActivitiesElement.dataset.destinationActivities);
|
||||
const destinationActivitiesName = destinationActivitiesRawData.map(activity => activity.name);
|
||||
|
||||
// Initialize Tagify for Create Form
|
||||
const editTagifyInput = document.querySelector('#TagifyActivityList');
|
||||
if (editTagifyInput) {
|
||||
const editTagify = new Tagify(editTagifyInput, {
|
||||
whitelist: activityNames,
|
||||
maxTags: 10,
|
||||
dropdown: {
|
||||
maxItems: 20,
|
||||
classname: '',
|
||||
enabled: 0,
|
||||
closeOnSelect: false
|
||||
}
|
||||
});
|
||||
|
||||
// Set the initial value for the edit form field
|
||||
editTagify.addTags(destinationActivitiesName);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
17
resources/js/backend/generate_slug.js
Normal file
17
resources/js/backend/generate_slug.js
Normal file
@@ -0,0 +1,17 @@
|
||||
document.addEventListener('alpine:init', () => {
|
||||
function slugify(string) {
|
||||
return string.toLowerCase().replace(/\s+/g, '-');
|
||||
}
|
||||
|
||||
function generateSlug() {
|
||||
return {
|
||||
title: '',
|
||||
slug: '',
|
||||
updateSlug() {
|
||||
this.slug = slugify(this.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Alpine.data('generateSlug', generateSlug);
|
||||
});
|
16
resources/js/backend/loader.js
Normal file
16
resources/js/backend/loader.js
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
// The alpine:init event listener is triggered when Alpine.js initializes on the webpage.
|
||||
document.addEventListener('alpine:init', () => {
|
||||
// Inside the callback function, Alpine.data() is used to define a new Alpine.js component named "loader."
|
||||
Alpine.data('loader', () => ({
|
||||
loading: true,
|
||||
showLoader() {
|
||||
this.loading = true;
|
||||
document.body.classList.add('backdrop');
|
||||
},
|
||||
hideLoader() {
|
||||
this.loading = false;
|
||||
document.body.classList.remove('backdrop');
|
||||
}
|
||||
}));
|
||||
});
|
24
resources/js/backend/mapDisplay.js
Normal file
24
resources/js/backend/mapDisplay.js
Normal file
@@ -0,0 +1,24 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// Check if the mapInput class exists
|
||||
const mapInput = document.querySelector(".mapInput");
|
||||
if (mapInput) {
|
||||
const mapContainer = document.querySelector(".mapContainer");
|
||||
const mapCancel = document.querySelector(".map_cancel");
|
||||
|
||||
//Load map if iframe data exists
|
||||
if (mapInput.value) {
|
||||
mapContainer.innerHTML = mapInput.value;
|
||||
}
|
||||
|
||||
//Load iframe on input map data
|
||||
mapInput.addEventListener("input", function () {
|
||||
//Show map inside div
|
||||
mapContainer.innerHTML = mapInput.value;
|
||||
});
|
||||
|
||||
//Load default if click cancel button
|
||||
mapCancel.addEventListener("click", function () {
|
||||
mapContainer.innerHTML = mapInput.value;
|
||||
});
|
||||
}
|
||||
});
|
16
resources/js/backend/repeater.js
Normal file
16
resources/js/backend/repeater.js
Normal file
@@ -0,0 +1,16 @@
|
||||
$(document).ready(function() {
|
||||
if ($('.repeater').length > 0) {
|
||||
$('.repeater').repeater({
|
||||
show: function () {
|
||||
// This function is called when the "Add" button is clicked
|
||||
// You can add any additional logic here
|
||||
return $(this).slideDown();
|
||||
},
|
||||
});
|
||||
|
||||
// Disable form submission when clicking the "Add" button
|
||||
$('.repeater').on('click', '[data-repeater-create]', function () {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
66
resources/js/backend/snow_theme.js
Normal file
66
resources/js/backend/snow_theme.js
Normal file
@@ -0,0 +1,66 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// Full Toolbar
|
||||
// --------------------------------------------------------------------
|
||||
const fullToolbar = [
|
||||
[
|
||||
{
|
||||
font: []
|
||||
},
|
||||
{
|
||||
size: []
|
||||
}
|
||||
],
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
[
|
||||
{
|
||||
color: []
|
||||
},
|
||||
{
|
||||
background: []
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
script: 'super'
|
||||
},
|
||||
{
|
||||
script: 'sub'
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
header: '1'
|
||||
},
|
||||
{
|
||||
header: '2'
|
||||
},
|
||||
'blockquote',
|
||||
'code-block'
|
||||
],
|
||||
[
|
||||
{
|
||||
list: 'ordered'
|
||||
},
|
||||
{
|
||||
list: 'bullet'
|
||||
},
|
||||
{
|
||||
indent: '-1'
|
||||
},
|
||||
{
|
||||
indent: '+1'
|
||||
}
|
||||
],
|
||||
|
||||
];
|
||||
const fullEditor = new Quill('.full-editor', {
|
||||
bounds: '#full-editor',
|
||||
placeholder: 'Type Something...',
|
||||
modules: {
|
||||
formula: true,
|
||||
toolbar: fullToolbar
|
||||
},
|
||||
theme: 'snow'
|
||||
});
|
||||
})
|
23
resources/js/backend/sweetAlertDelete.js
Normal file
23
resources/js/backend/sweetAlertDelete.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
document.querySelectorAll('.deleteBtn').forEach(function (button) {
|
||||
button.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var formId = e.target.closest('form').id;
|
||||
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: 'You won\'t be able to revert this!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
document.getElementById(formId).submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
15
resources/js/backend/textarea_content_display.js
Normal file
15
resources/js/backend/textarea_content_display.js
Normal file
@@ -0,0 +1,15 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
var mainTextarea = document.getElementById('mainTextarea');
|
||||
var editorTextarea = document.getElementById('editorTextarea');
|
||||
|
||||
// If exist then copy from main_textarea to editor_testarea
|
||||
if (mainTextarea && editorTextarea) {
|
||||
editorTextarea.value = mainTextarea.value;
|
||||
}
|
||||
|
||||
// Hide the original textarea
|
||||
if (mainTextarea) {
|
||||
mainTextarea.style.display = 'none';
|
||||
}
|
||||
});
|
32
resources/js/bootstrap.js
vendored
Normal file
32
resources/js/bootstrap.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
||||
/**
|
||||
* Echo exposes an expressive API for subscribing to channels and listening
|
||||
* for events that are broadcast by Laravel. Echo and event broadcasting
|
||||
* allows your team to easily build robust real-time web applications.
|
||||
*/
|
||||
|
||||
// import Echo from 'laravel-echo';
|
||||
|
||||
// import Pusher from 'pusher-js';
|
||||
// window.Pusher = Pusher;
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: import.meta.env.VITE_PUSHER_APP_KEY,
|
||||
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
|
||||
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
|
||||
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
|
||||
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
|
||||
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
|
||||
// enabledTransports: ['ws', 'wss'],
|
||||
// });
|
15
resources/js/frontend/app.js
Normal file
15
resources/js/frontend/app.js
Normal file
@@ -0,0 +1,15 @@
|
||||
//-- Import Apline
|
||||
import Alpine from 'alpinejs';
|
||||
window.Alpine = Alpine;
|
||||
Alpine.start();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user