Skip to content

Commit

Permalink
Fixed issue #1985
Browse files Browse the repository at this point in the history
  • Loading branch information
shivendra-webkul committed Jan 22, 2025
1 parent baf5a3e commit 32403e4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 31 deletions.
4 changes: 4 additions & 0 deletions packages/Webkul/Admin/src/Resources/assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,8 @@

.tox .tox-toolbar__group:last-child button:hover {
@apply border-0 !bg-[#3389ec] text-white shadow-none;
}

.tox.tox-silver-sink.tox-tinymce-aux {
z-index: 99999;
}
68 changes: 37 additions & 31 deletions packages/Webkul/Admin/src/Resources/views/mail/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class="!font-normal"
<x-admin::modal
ref="toggleComposeModal"
position="bottom-right"
@toggle="removeTinyMCE"
>
<x-slot:header>
<h3 class="text-lg font-bold text-gray-800 dark:text-white">
Expand Down Expand Up @@ -379,6 +380,7 @@ class="w-[calc(100%-62px)]"
rules="required"
rows="8"
::value="draft.reply"
:tinymce="true"
:label="trans('admin::app.mail.index.mail.message')"
/>
Expand Down Expand Up @@ -434,19 +436,19 @@ class="primary-button"
<script type="module">
app.component('v-mail', {
template: '#v-mail-template',
data() {
return {
selectedMail: false,
showCC: false,
showBCC: false,
isStoring: false,
saveAsDraft: 0,
draft: {
id: null,
reply_to: [],
Expand All @@ -456,7 +458,7 @@ class="primary-button"
reply: '',
attachments: [],
},
backgroundColors: [
{
label: "@lang('admin::app.components.tags.index.aquarelle-red')",
Expand Down Expand Up @@ -486,53 +488,57 @@ class="primary-button"
],
};
},
mounted() {
const params = new URLSearchParams(window.location.search);
if (params.get('openModal')) {
this.$refs.toggleComposeModal.toggle();
}
},
methods: {
removeTinyMCE() {
tinymce?.remove?.();
},
truncatedReply(reply) {
const maxLength = 100;
if (reply.length > maxLength) {
return `${reply.substring(0, maxLength)}...`;
}
return reply;
},
toggleModal() {
this.draft.reply_to = [];
this.$refs.toggleComposeModal.toggle();
},
save(params, { resetForm, setErrors }) {
this.isStoring = true;
let formData = new FormData(this.$refs.mailForm);
formData.append('is_draft', this.saveAsDraft);
if (this.draft.id) {
formData.append('_method', 'PUT');
}
this.$axios.post(this.draft.id ? "{{ route('admin.mail.update', ':id') }}".replace(':id', this.draft.id) : '{{ route('admin.mail.store') }}', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then ((response) => {
this.$refs.datagrid.get();
this.$emitter.emit('add-flash', { type: 'success', message: response.data?.message });
resetForm();
})
.catch ((error) => {
Expand All @@ -543,34 +549,34 @@ class="primary-button"
}
}).finally(() => {
this.$refs.toggleComposeModal.close();
this.isStoring = false;
this.resetForm();
});
},
editModal(row) {
if(row.title == 'View') {
window.location.href = row.url;
return;
}
this.$axios.get(row.url)
.then(response => {
this.draft = response.data.data;
this.$refs.toggleComposeModal.toggle();
this.showCC = this.draft.cc.length > 0;
this.showBCC = this.draft.bcc.length > 0;
})
.catch(error => {});
},
resetForm() {
this.draft = {
id: null,
Expand Down

0 comments on commit 32403e4

Please sign in to comment.