@@ -1083,6 +1147,7 @@
watch: {
reload_loaded_content_type(new_value, old_value) {
if (new_value !== undefined) {
+
const formData = new FormData();
formData.append("type", new_value);
formData.append("_token", "{{csrf_token()}}");
@@ -1099,6 +1164,10 @@
else
this.loaded_content_type = data.content ;
});
+
+
+ this.refresh_loaded_content();
+
}
}
},
@@ -1110,28 +1179,30 @@
var content = this.contents[this.selected_page]?.find(
(block) => block.id === this.selected_unique_id
)?.fields?.content;
- const formData = new FormData();
- formData.append("type", content.type);
- formData.append("selected_ids", [content.selected_ids]);
- formData.append("items_count", content.items_count);
- formData.append("view_type", content.view_type);
- formData.append("paginate", content.paginate);
- formData.append("design_columns", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_columns);
- formData.append("id", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.id);
- formData.append("design_text_alignment", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_text_alignment);
- formData.append("design_min_height", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_min_height);
- formData.append("_token", "{{csrf_token()}}");
+ if(content != null){
+ const formData = new FormData();
+ formData.append("type", content.type);
+ formData.append("selected_ids", [content.selected_ids]);
+ formData.append("items_count", content.items_count);
+ formData.append("view_type", content.view_type);
+ formData.append("paginate", content.paginate);
+ formData.append("design_columns", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_columns);
+ formData.append("id", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.id);
+ formData.append("design_text_alignment", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_text_alignment);
+ formData.append("design_min_height", this.contents[this.selected_page]?.find((block) => block.id === this.selected_unique_id)?.fields?.design_min_height);
+ formData.append("_token", "{{csrf_token()}}");
- fetch('{{route('admin.data.load')}}', {
- method: 'post',
- body: formData,
- }).then((response) => {
- return response.json();
- }).then((data) => {
- this.contents[this.selected_page].find(
- (block) => block.id === this.selected_unique_id
- ).fields.content.rendered_html = data.html;
- });
+ fetch('{{route('admin.data.load')}}', {
+ method: 'post',
+ body: formData,
+ }).then((response) => {
+ return response.json();
+ }).then((data) => {
+ this.contents[this.selected_page].find(
+ (block) => block.id === this.selected_unique_id
+ ).fields.content.rendered_html = data.html;
+ });
+ }
},
template_editor:function(unique_id,type,options={}){
@@ -1505,7 +1576,8 @@
//var sortable = Sortable.create(document.getElementById('response-contaienr'));
},
change_aside_view: function(type){
-
+ document.getElementById('builder-aside').classList.remove('aside-closed');
+
if(type=="edit_component"){
document.querySelectorAll('.aside-wedgit').forEach(element => {
element.style.display = 'none';
@@ -1648,6 +1720,10 @@
}).catch(error => {
alert("Oops! There was a problem submitting your form");
});
+ },
+ aside_toggle: function(){
+ document.getElementById('site-main-container').classList.toggle('full-width');
+ document.getElementById('builder-aside').classList.toggle('aside-closed');
}
},
created: function(){
@@ -1657,4 +1733,5 @@
app.mount('#builder-main-container');
+
@endsection