File size: 2,133 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@extends('panel.layout.settings')
@section('title', __('Thumbnail System'))
@section('titlebar_actions', '')

@section('settings')

    <div class="row">
        <div class="col-md-12">
            <div class="mb-3">
                <label class="form-check form-switch">
                    <input
                        class="form-check-input"
                        id="image_thumbnail"
                        name="image_thumbnail"
                        type="checkbox"
                        onchange="updateSetting(this.checked ? 1 : 0 );"
                        {{ setting('image_thumbnail') == 1 ? 'checked' : '' }}
                    >
                    <span class="form-check-label">{{ __('Enable Thumbnail System') }}</span>
                </label>
            </div>
        </div>
        {{-- purge thumbnails --}}
        <div class="col-md-12">
            <div class="my-3">
                <label class="form-label">{{ __('Purge Thumbnails') }}
                    <x-info-tooltip text="{{ __('Delete all images thumbnails.') }}" />
                </label>
                <button
                    class="btn btn-danger w-96"
                    onclick="purgeThumbnails();"
                >{{ __('Purge') }}</button>
            </div>
        </div>
    </div>
@endsection

@push('script')
    <script>
        function purgeThumbnails() {
            $.ajax({
                url: '{{ route('dashboard.admin.settings.thumbnail.purge') }}',
                type: 'POST',
                success: function(response) {
                    toastr.success("{{ __('Thumbnails purged successfully') }}");
                }
            });
        }

        function updateSetting(value) {
            $.ajax({
                url: '{{ route('dashboard.admin.settings.thumbnail.save') }}',
                type: 'POST',
                data: {
                    image_thumbnail: value,
                },
                success: function(response) {
                    toastr.success("{{ __('Settings updated successfully') }}");
                }
            });
        }
    </script>
@endpush