Uname:Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 14.225.216.240  /  Your IP : 216.73.216.26
Web Server : nginx/1.20.1
System : Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64
User : taidh ( 1001)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/pts/st/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/pts/st/assets/pts.js
(function ($) {
    $.ajaxSetup({
        headers: {
            "X-CSRF-TOKEN": jQuery('meta[name="_token"]').attr("content"),
        },
    });
    const locale = jQuery('meta[name="_locale"]').attr("content");
    const localeVI = 'vi';
	const thousandsSeparator = localeVI == locale ? '.' : ',';
	const decimalSeparator = localeVI == locale ? ',' : '.';
    if (typeof jQuery.fn.formValidation === 'function') {
        jQuery('form').each(function () {
            jQuery(this).formValidation({
                framework: "bootstrap",
            });
        });
        jQuery('.btn-save').on('click', function (e) {
            e.preventDefault();
            const form = jQuery('form[name="form"]');
            var valid = form.data("formValidation").isValid();
            if (valid == null) {
                var formValidate = form.data("formValidation").validate();
                valid = formValidate.isValid();
            }
            if (valid) {
                jQuery('button, a.btn').addClass('disabled');
                jQuery('button[type=submit]').hide();
                jQuery('button.btn-loading').show();
                form[0].submit();
            }
        });
    }
    jQuery.fn.ptsSelect2 = () => {
        if (typeof jQuery.fn.select2 === 'function') {
            jQuery('select.select2:not(.s2-load-more)').select2();

            
        }
    }
    jQuery.fn.ptsNumber = () => {
        if (typeof jQuery.fn.inputFilter === 'function') {
            jQuery('.only-numbers')
                .inputFilter(function(value) {
                    return /^\d*$/.test(value);
                }).bind('blur', function () {
                    jQuery(this).val(jQuery(this).val().replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator));
                });

            jQuery('.qty')
                .inputFilter(function(value) {
                    if (localeVI == locale) {
                        return /^-?\d*[,]?\d{0,4}$/.test(value);
                    }
                    return /^-?\d*[.]?\d{0,4}$/.test(value);
                })
                .bind('blur', function () {
                    let temp = jQuery(this).val();
                    let $arr = temp.split(decimalSeparator);
                    let qty = $arr[0].replace(/\B(?=(\d{3})+(?!\d))/g,thousandsSeparator);
                    const decimal = $arr[1] ?? '';
                    if (decimal.trim() != '') qty += decimalSeparator + decimal;
                    jQuery(this).val(qty);
                });

            jQuery('.point')
                .inputFilter(function(value) {
                    if (localeVI == locale) {
                        return /^-?\d*[,]?\d{0,2}$/.test(value);
                    }
                    return /^-?\d*[.]?\d{0,2}$/.test(value);
                }).bind('blur', function () {
                    jQuery(this).val(jQuery(this).val().replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator));
                });

            jQuery('.tax-code')
                .inputFilter(function(value) {
                    if (localeVI == locale) {
                        return /^-?\d*[,]?\d{0,3}$/.test(value);
                    }
                    return /^-?\d*[.]?\d{0,3}$/.test(value);
                })
                .bind('blur', function () {
                    let temp = jQuery(this).val();
                    let $arr = temp.split(decimalSeparator);
                    let qty = $arr[0].replace(/\B(?=(\d{3})+(?!\d))/g,thousandsSeparator);
                    const decimal = $arr[1] ?? '';
                    if (decimal.trim() != '') qty += decimalSeparator + decimal;
                    jQuery(this).val(qty);
                });

            jQuery('.currency')
                .inputFilter(function(value) {
                    if (localeVI == locale) {
                        return /^\d*[,]?\d{0,2}$/.test(value);
                    }
                    return /^\d*[.]?\d{0,2}$/.test(value);
                }).bind('blur', function () {
                    jQuery(this).val(jQuery(this).val().replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator));
                });
        }
    }
    jQuery.fn.ptsColorPicker = () => {
        if (typeof jQuery.fn.colorpicker === 'function') {
            jQuery('.pts-colorpicker').colorpicker()
                .on('colorpickerChange', function(event) {
                    const id = jQuery(this).attr("data-colorpicker-id");
                    let color = '#e9ecef';
                    if (event?.color) color = event.color.toString();
                    jQuery(`#fa-square-${id}`).css('color', color);
                });
        }
    }
    jQuery.fn.ptsTag = () => {
        if (typeof jQuery.fn.tagit === 'function') {
            jQuery('.tag-it').each(function () {
                const $this = jQuery(this);
                const val = $this.val();
                const placeHolder = $this.attr('placeholder');
                const tagLimit = $this.attr('data-tag-limit');
                $this.tagit({
                    placeholderText: placeHolder || '',
                    availableTags: val,
                    allowSpaces: true,
                    tagLimit: tagLimit
                }).on('change',function () {
                    const $form = $this.closest('form');
                    $form.formValidation('revalidateField', $this.attr('name'));
                });
            });
        }
    }
    jQuery.fn.ptsDate = () => {
        if (typeof jQuery.fn.datetimepicker === 'function') {
            const dateFormat = localeVI == locale ? 'DD/MM/YYYY' : 'MM/DD/YYYY';

            jQuery('.datepicker').datetimepicker({
                format: dateFormat,
                useCurrent: false,
            });

            jQuery('.datepicker').on('change.datetimepicker',(e)=>{
                e.preventDefault();
                if (e.date) {
                    jQuery(e.target).datetimepicker('hide');
                }
                const $current = $(e.currentTarget).find('input').attr('name');
                $('.datepicker').each(function (_i, elem) {
                    let $this = $(elem);
                    let $name = $this.find('input').attr('name');
                    if ($current != $name) {
                        let $form = $this.closest('form');
                        $form.formValidation('revalidateField', `${$name}`);
                    }
                });
            });

            jQuery('.datetimepicker').datetimepicker({
                format: `${dateFormat} HH:mm:00`,
                useCurrent: false,
                use24hours: true,
                icons: {time: 'far fa-clock' },
            });

            jQuery('.datetimepicker').on('change.datetimepicker',(e)=>{
                e.preventDefault();
                if (e.date) {
                    jQuery(e.target).datetimepicker('hide');
                }
            });

            jQuery(".timepicker").datetimepicker({
                format: 'HH:mm:00',
                use24hours: true,
                autoClose: true,
            });
        }
    }
    jQuery.fn.ptsEditor = () => {
        let uploadURL = window.location.origin + '/dropzone';
        if (typeof jQuery.fn.summernote === 'function') {
            const editorSummaryHeight = jQuery('.editor-summary').data('height') || 300;
            $('.editor-summary').summernote({
                height: editorSummaryHeight,
                toolbar: [
                    ['font', ['bold', 'italic', 'underline', 'clear']],
                    ['color', ['color']],
                    ['para', ['ul', 'ol', 'paragraph']],
                    ['view', ['codeview', 'help']]
                ]
            });
            $('.editor').summernote({
                height: 400,
                toolbar: [
                    ['style', ['style']],
                    ['font', ['bold', 'italic', 'underline', 'clear']],
                    ['color', ['color']],
                    ['para', ['ul', 'ol', 'paragraph']],
                    ['table', ['table']],
                    ['insert', ['link', 'picture', 'video']],
                    ['view', ['codeview', 'help']]
                ],
                callbacks: {
                    onImageUpload: function (files) {
                        var $editor = $(this);
                        let $file = files[0];
                        let $body = new FormData();
                        $body.append('file', $file, $file.name);
                        $body.append('editor', true);

                        jQuery.ajax({
                            url: uploadURL,
                            type: 'post',
                            contentType: false,
                            processData: false,
                            data: $body,
                            success: function (response) {
                                $editor.summernote('insertImage', response.url);
                            },
                            error: function (response) {
                                // failure(response.responseText);
                            }
                        });
                    }
                },
            });
        }
        if ( typeof(tinyMCE) != 'undefined' )
        {

            // if (uploadURL.indexOf('admin') < 0) {
            // 	uploadURL += '/admin';
            // }
            uploadURL += '/dropzone';
            const editorSummaryHeight = jQuery('.editor-summary').data('height') || 300;
            tinymce.init({
                selector: '.editor-summary',
                height: editorSummaryHeight,
                menubar: true,
                statusbar: true,
                branding: false,
                link_quicklink: true,
                link_context_toolbar: true,
                extended_valid_elements: ""
                +"div[itemscope|itemprop|itemtype|align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
                +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
                +"|onmouseout|onmouseover|onmouseup|style|title],"
                +"h3[itemprop|id],"
                +"i[class|style],"
                +"img[style|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|loading=lazy],i[class|style]",
                plugins: [
                    "autosave",
                    "image code",
                    "advlist autolink lists link charmap",
                    "searchreplace visualblocks fullscreen",
                    "insertdatetime table contextmenu paste wordcount",
                    "toc"
                ],
                toolbar: 'restoredraft | styleselect | forecolor | bold italic underline alignleft aligncenter alignright alignjustify | link image toc bullist numlist outdent indent',
                lists_indent_on_tab: true,
                toc_header: "div",
                toc_depth: 5,
                formats: {
                    underline: {inline: 'u'}
                },
                image_title: true,
                entity_encoding: 'raw',
                /* without images_upload_url set, Upload tab won't show up*/
                images_upload_url: uploadURL,
                /* we override default upload handler to simulate successful upload*/
                images_upload_handler: function (blobInfo, success, failure) {
                    var body = new FormData();
                    body.append('file', blobInfo.blob());
                    body.append('editor', true);
                    try {
                        jQuery.ajax({
                            url: uploadURL,
                            type: 'post',
                            contentType: false,
                            processData: false,
                            data: body,
                            success: function(response) {
                                success(response.url)
                            },
                            error: function(response) {
                                failure(response.responseText);
                            }
                        });
                    } catch (e) {
                        failure(e?.message);
                    }
                },
                images_upload_credentials: true,
                init_instance_callback: function(editor) {
                    editor.on('keyup', function(e) {
                        var id = editor.id;
                        var content = editor.getContent({format: 'text'});
                        $('#' + id).val(content);

                        var formTextEditor = $('#' + id).closest('form');
                        var field = $('#' + id).attr('name');
                        $(formTextEditor).formValidation('revalidateField', field);
                    });
                }
            });

            tinymce.init({
                selector: '.editor',
                height: 500,
                menubar: true,
                statusbar: true,
                branding: false,
                link_quicklink: true,
                link_context_toolbar: true,
                extended_valid_elements: ""
                +"div[itemscope|itemprop|itemtype|align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
                +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
                +"|onmouseout|onmouseover|onmouseup|style|title],"
                +"h3[itemprop|id],"
                +"i[class|style],"
                +"img[style|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|loading=lazy],",
                plugins: [
                    "autosave",
                    "image code",
                    "advlist autolink lists link charmap",
                    "searchreplace visualblocks fullscreen",
                    "insertdatetime media table contextmenu paste imagetools wordcount",
                    "toc"
                ],
                toolbar: 'restoredraft | styleselect | forecolor | bold italic underline alignleft aligncenter alignright alignjustify | link image toc bullist numlist outdent indent',
                lists_indent_on_tab: true,
                toc_header: "div",
                toc_depth: 5,
                formats: {
                    underline: {inline: 'u'}
                },
                image_title: true,
                entity_encoding: 'raw',
                /* without images_upload_url set, Upload tab won't show up*/
                images_upload_url: uploadURL,
                /* we override default upload handler to simulate successful upload*/
                images_upload_handler: function (blobInfo, success, failure) {
                    var body = new FormData();
                    body.append('file', blobInfo.blob());
                    body.append('editor', true);
                    try {
                        jQuery.ajax({
                            url: uploadURL,
                            type: 'post',
                            contentType: false,
                            processData: false,
                            data: body,
                            success: function(response) {
                                success(response.url)
                            },
                            error: function(response) {
                                failure(response.responseText);
                            }
                        });
                    }catch(e) {
                        failure(e?.message);
                    }
                },
                images_upload_credentials: true,
                init_instance_callback: function(editor) {
                    editor.on('keyup', function(e) {
                        var id = editor.id;
                        var content = editor.getContent({format: 'text'});
                        $('#' + id).val(content);

                        var formTextEditor = $('#' + id).closest('form');
                        var field = $('#' + id).attr('name');
                        $(formTextEditor).formValidation('revalidateField', field);
                    });
                }
            });
        }
    }
    jQuery.fn.ptsDate();
    jQuery.fn.ptsSelect2();
    jQuery.fn.ptsNumber();
    jQuery.fn.ptsColorPicker();
    jQuery.fn.ptsTag();
    jQuery.fn.ptsEditor();
    jQuery.fn.uuidv4 = () => {
        return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
            (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
        );
    }
    jQuery.fn.numberFormat = (number) => {
        number = _.toNumber(number);
        var nstr = number.toString();
        nstr += '';
        const x = nstr.split('.');
        let x1 = x[0];
        const x2 = x.length > 1 ? decimalSeparator + x[1] : '';
        const rgx = /(\d+)(\d{3})/;

        while (rgx.test(x1))
            x1 = x1.replace(rgx, '$1' + thousandsSeparator + '$2');

        return x1 + x2;
    }
    jQuery.fn.cleanNo = ($string) => {
        if (_.isEmpty($string)) return 0;
        let $val = 0;
        if (localeVI == locale) {
            $val = $string.replace(/\./g, '');
            $val = $val.toString().replace(',','.');
        } else {
            $val = $string.replace(/,(?=\d{3})/g, '');
        }
        return _.toNumber($val);
    }
    jQuery.fn.debounce = (func, wait, immediate) => {
        var timeout;
        return function() {
            var context = this, args = arguments;
            var later = function() {
                timeout = null;
                if (!immediate) func.apply(context, args);
            };
            var callNow = immediate && !timeout;
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
            if (callNow) func.apply(context, args);
        };
    }
    /*
	 * Password/ Text
	 */
	jQuery('body').on('click','button.pwd-text',function (e) {
		e.preventDefault();
		const $this = jQuery(this);
		const $fieldId = $this.data('field-id');
		const $icText = $this.data('icon-text');
		const $icPwd = $this.data('icon-pwd');
		const $input = jQuery(`input#${$fieldId}`);
		const $type = $input.attr('type');
		if ($type == 'password') {
			jQuery('input.pwd').attr('type', 'text');
			jQuery('button.pwd-text').find('i').removeClass($icPwd).addClass($icText);
		} else {
			jQuery('input.pwd').attr('type', 'password');
			jQuery('button.pwd-text').find('i').removeClass($icText).addClass($icPwd);
		}
		return false;
	});
    jQuery.fn.ptsModal = () => {
        // delete data
        jQuery('body').on('click', '.btn-delete, .delete-confirmation', function (e) {
            e.preventDefault();
            const $url = jQuery(this).attr('data-url');
            if ($url.trim() !== '') {
                jQuery('#modalConfirmationDelete form').attr('action', $url);
                jQuery('#modalConfirmationDelete').modal('show');
            }
        });

        // restore data
        jQuery('body').on('click', '.btn-status, .status-confirmation', function (e) {
            e.preventDefault();
            const url = jQuery(this).attr("data-url");
            if (!_.isEmpty(url)) {
                jQuery("#modalConfirmationStatus form").attr("action", url);
                jQuery("#modalConfirmationStatus").modal("show");
            }
        });

        // locked data
        jQuery('body').on('click', '.btn-locked, .locked-confirmation', function (e) {
            e.preventDefault();
            const url = jQuery(this).attr('data-url');
            if (jQuery.trim(url) !== '') {
                jQuery('#modalConfirmationLockedData form').attr('action', url);
                jQuery('#modalConfirmationLockedData').modal('show');
            }
        });

        // unlock data
        jQuery('body').on('click', '.btn-unlock, .unlock-confirmation', function (e) {
            e.preventDefault();
            const url = jQuery(this).attr('data-url');
            if (jQuery.trim(url) !== '') {
                jQuery('#modalConfirmationUnlockData form').attr('action', url);
                jQuery('#modalConfirmationUnlockData').modal('show');
            }
        });
    }
    jQuery.fn.ptsModal();
    /*
	 * Check username/ email available?
	 */
	jQuery('body').on('blur','.check-available', function (e) {
		e.preventDefault();
		const $this = jQuery(this);
		const val = $this.val();
        const field = $this.attr('data-field');
        const url = $this.attr('data-url');
		$this.removeClass('is-valid').removeClass('is-invalid');
		if (jQuery.trim(val) != '' && (url ?? '') != '') {
			let obj = {};
            obj[`${field}`] = val;

			jQuery.ajax({
				type: 'POST',
				url: url,
				data: obj,
				success: function (_response) {
					$this.addClass('is-valid');
				},
				error: function () {
					$this.addClass('is-invalid');
				}
			});
		}
		return false;
	});
    /**
     * Expand/ Collapse
     */
    jQuery('body').on('click','.expandable', function(e) {
        e.preventDefault();
        const id = jQuery(this).data('id');
        const faMinus = jQuery(this).data('fa-minus');
        const faPlus = jQuery(this).data('fa-plus');
        let expandable = jQuery(this).attr('aria-expanded');

        if (expandable === 'false') {
            jQuery(this).attr('aria-expanded', true);
            jQuery(`.expandable-icon-${id}`)
                .removeClass(faPlus)
                .addClass(faMinus)
                ;
            jQuery(`.expandable-body-${id}`)
                .slideDown()
                .removeClass('d-none');
            return ;
        }
        jQuery(this).attr('aria-expanded', false);
        jQuery(`.expandable-icon-${id}`)
                .removeClass(faMinus)
                .addClass(faPlus)
                ;
        jQuery(`.expandable-body-${id}`)
                .slideUp()
                .addClass('d-none');
    });
    /**
     * Revalidate field
     */
    jQuery('body').on('change','select.revalidate-field', function(e) {
        e.preventDefault();
        const $this = jQuery(this);

        const $form = $this.closest('form');
        const value = $this.val();
        const fieldRelId = $this.data('rel-id');
        const fieldElem = jQuery(`input#${fieldRelId}`);

        if (!_.isEmpty(value)) {
            fieldElem.val($this.find('option:selected').text());
        } else {
            fieldElem.val('');
        }
        $form.formValidation('revalidateField', fieldElem.attr('name'));
    });
    jQuery('body').on('keyup search', 'input.revalidate-field', function(e) {
        e.preventDefault();
        const $this = jQuery(this);
        const $form = $this.closest('form');
        const $field = $this.data('field');
        $form.formValidation('revalidateField', $field);
    });
    /**
     *
     */
    jQuery('body').on('click', '.pts-header', function (e) {
		e.preventDefault();
		const $this = jQuery(this);
        const $url = $this.attr('data-url');
		if (!_.isEmpty($url)) {
            const $card = $this.closest('.card');
			jQuery.ajax({
				type: 'POST',
				url: $url,
                data: {
                    collapse: $card.hasClass('collapsed-card')
                }
			});
		}
	});
    jQuery('body').on('change', '.point', function(e) {
        e.preventDefault();
        const $this = jQuery(this);
        const $form = $this.closest('form');
        jQuery('.point').each((_i, elem) => {
            let $that = $(elem);
            let $name = $that.attr('name');
            $form.formValidation('revalidateField', `${$name}`);
        })
    });
    jQuery('body').on('change', '.only-numbers', function(e) {
        e.preventDefault();
        const $this = jQuery(this);
        const $form = $this.closest('form');
        jQuery('.only-numbers').each((_i, elem) => {
            let $that = $(elem);
            let $name = $that.attr('name');
            $form.formValidation('revalidateField', `${$name}`);
        })
    })
    /**
     *
     */
    jQuery('body').on('focus', '.form-control', function(e){
        e.preventDefault();
        jQuery('.alert.alert-danger').delay(800).fadeOut('slow');
    });
    jQuery.fn.tableHover = () => {
        jQuery('table.text-nowrap tr').on('mouseover', function () {
            let $this = $(this);
            let $hasAction = $this.find('.has-action');
            let $action = $this.find('.action-abs');
            if ($hasAction.length > 0) {
                let $table = $this.closest('div.card-body');
                let $scrollLeft = $('.table-responsive').scrollLeft();
                $action.css('left', ($table.width() - $action.width()) + $scrollLeft);
            }
            $action.show();
        });
        jQuery('.table-responsive').on('scroll', function(e) {
            let $this = $(this);
            const $scrollLeft = $this.scrollLeft();
            let $action = $this.find('.action-abs');
            if ($scrollLeft > 0 && $action.length > 0 && $action.is(':visible')) {
                $action.hide();
            } 
        });
    }
    jQuery.fn.tableHover();
})(jQuery);

Youez - 2016 - github.com/yon3zu
LinuXploit