File manager - Edit - /home/autoph/public_html/connectv1/resources/views/common/scripts/functions.php
Back
<script> //common start function checkIfEmpty(value, row, index) { if (isEmpty(value)) { return "<span style='color:red;'> (Not Provided) </span>"; } return value; } function uniqId() { return Math.round(new Date().getTime() + (Math.random() * 100)); } function isEmpty(string) { // alert(string) var flag = false; try { if (string == null) { flag = true; } else if (typeof string === 'undefined') { flag = true; } else if (string.trim() == '') { flag = true; } } catch (err) { console.log(err); flag = true; } return flag; } function check_if_empty_field($element, msg) { if (isEmpty($element.val())) { $element.focus(); toastr.remove(); toastr.error(msg); return true; } else { return false; } } function tbl_field_formatter_dash(value, row, index) { if (isEmpty(value)) { return "-"; } return value; } function back() { window.history.back(); } $(document).on('click', '[data-toggle="lightbox"]', function(event) { event.preventDefault(); $(this).ekkoLightbox({ alwaysShowClose: true }); }); function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function sweetAlertSimple(icon, title, text) { // Swal.fire({ // icon: icon, // title: title, // text: text, // allowEnterKey: true // default value // }) toastr.remove(); switch (icon) { case 'success': toastr.success(text); break; case 'info': toastr.info(text); break; case 'warning': toastr.warning(text); break; case 'error': toastr.error(text); break; } } //common end function generate_json(attribute, $element) { var /* Create an object. */ obj = {}, /* Create a variable that references the current object (default → obj). */ ref = obj; /* Iterate over every input. */ $element.each(function() { /* Cache the id of the input. */ var id = this.id; /* Check whether the nodetype attribute is set to 'parent'. */ if (this.getAttribute(attribute) == "parent") { /* Set a new object to the property and set ref to refer to it. */ ref = obj[id] = {}; } else { /* Set the value of the input to the referred object. */ if (this.getAttribute(attribute) == "true") { if (isEmpty($(this).val())) { ref[id] = ''; } else { ref[id] = $(this).val().trim(); } } } }); /* Stringify the object and return it. */ return JSON.stringify(obj); } function generate_json_attr_key(attribute, attr_key, $element) { var /* Create an object. */ obj = {}, /* Create a variable that references the current object (default → obj). */ ref = obj; /* Iterate over every input. */ $element.each(function() { /* Cache the id of the input. */ var id = this.id; /* Check whether the nodetype attribute is set to 'parent'. */ if (this.getAttribute(attribute) == "parent") { /* Set a new object to the property and set ref to refer to it. */ ref = obj[id] = {}; } else { /* Set the value of the input to the referred object. */ if (this.getAttribute(attribute) == "true") { var key = $(this).attr(attr_key); if (isEmpty($(this).val())) { ref[key] = ''; } else { ref[key] = $(this).val().trim(); } } } }); /* Stringify the object and return it. */ return JSON.stringify(obj); } </script>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings