fixed ckeditor change bug

pull/44/head
A1Gard 5 months ago
parent 5dd4f3b03d
commit 82504300cd

@ -59,7 +59,7 @@ class ProductController extends XController
$product->excerpt = $request->input('excerpt');
$product->stock_status = $request->input('stock_status');
$product->price = $request->input('price',0);
$product->buy_price = $request->input('bye_price',0);
$product->buy_price = $request->input('buy_price',0);
if (!$request->has('quantity')) {
$product->price = $request->input('price',0);

@ -1,7 +1,8 @@
document.addEventListener('readystatechange',function () {
window.addEventListener('load',function () {
let dirx = 'ltr';
let editors = {};
document.querySelectorAll('.ckeditorx')?.forEach(function (el) {
CKEDITOR.replace(el.getAttribute('name'), {
editors[el.getAttribute('name')] = CKEDITOR.replace(el.getAttribute('name'), {
filebrowserUploadUrl: xupload,
filebrowserUploadMethod: 'form',
contentsLangDirection: dirx,
@ -10,6 +11,8 @@ document.addEventListener('readystatechange',function () {
// WIP: need font and color like website
CKEDITOR.addCss('.cke_editable { background-color: #212529; color: white }');
editors[el.getAttribute('name')].on('change', function (evt) {
el.value = evt.editor.getData();
});
});
});

@ -98,6 +98,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (res.data.link !== undefined) {
this.setAttribute('action', res.data.link);
}
$toast.info(res.data.message);
if (document.querySelector('#price-amount').value.trim() !== '') {
window.location.reload();
}

@ -31,7 +31,7 @@
{{__('Base price')}}
</label>
<currency-input name="price" xid="price" @error('price')
<currency-input xname="price" xid="price" @error('price')
:err="true" @enderror :xvalue="{{old('price',$item->price??null)}}"></currency-input>
</div>
</div>
@ -41,14 +41,14 @@
{{__('Purchase price')}}
</label>
<currency-input name="buy_price" xid="buy_price" @error('buy_price')
<currency-input xname="buy_price" xid="buy_price" @error('buy_price')
:err="true" @enderror :xvalue="{{old('buy_price',$item->buy_price??0)}}"></currency-input>
</div>
</div>
<div class="col-lg-4 mt-3">
<div class="form-group">
<label for="categoryId">
{{__('Main product category')}}1
{{__('Main product category')}}
</label>
{{-- data-url="{{route('props.list','')}}/"--}}

Loading…
Cancel
Save