app.js change search selector and re-factor events

This commit is contained in:
cuneytsenturk 2018-11-12 12:30:14 +03:00
parent 78b622c222
commit f0298588d3

72
public/js/app.js vendored
View File

@ -87,7 +87,7 @@ $(document).ready(function () {
});
};
$('input[name=\'live-search\']').liveSearch({
$('#live-search input[name=\'live-search\']').liveSearch({
'source': function (request, response) {
if (request != '' && request.length > 2) {
$.ajax({
@ -115,7 +115,7 @@ $(document).ready(function () {
last_radio = '';
$("input:radio").each(function () {
$('input:radio').each(function () {
if ($(this).parent().parent().hasClass('radio-inline')) {
input_name = $(this).attr("name");
input_value = $(this).attr("value");
@ -188,7 +188,7 @@ $(document).ready(function () {
});
if (document.getElementById('recurring_frequency')) {
$(".input-group-recurring #recurring_frequency").select2();
$('.input-group-recurring #recurring_frequency').select2();
$('.input-group-recurring #recurring_frequency').trigger('change');
}
@ -203,37 +203,6 @@ $(document).ready(function () {
}
});
function confirmDelete(form_id, title, message, button_cancel, button_delete) {
$('#confirm-modal').remove();
var html = '';
html += '<div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">';
html += ' <div class="modal-dialog">';
html += ' <div class="modal-content">';
html += ' <div class="modal-header">';
html += ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
html += ' <h4 class="modal-title" id="confirmModalLabel">' + title + '</h4>';
html += ' </div>';
html += ' <div class="modal-body">';
html += ' <p>' + message + '</p>';
html += ' <p></p>';
html += ' </div>';
html += ' <div class="modal-footer">';
html += ' <div class="pull-left">';
html += ' <button type="button" class="btn btn-danger" onclick="$(\'' + form_id + '\').submit();">' + button_delete + '</button>';
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">' + button_cancel + '</button>';
html += ' </div>';
html += ' </div>';
html += ' </div>';
html += ' </div>';
html += '</div>';
$('body').append(html);
$('#confirm-modal').modal('show');
}
$(document).on('click', '.popup', function(e) {
e.preventDefault();
@ -280,7 +249,7 @@ $(document).on('change', '.input-group-recurring #recurring_frequency', function
recurring_custom_frequency.removeClass('hidden');
recurring_count.removeClass('hidden');
$("#recurring_custom_frequency").select2();
$('#recurring_custom_frequency').select2();
} else if (value == 'no' || value == '') {
recurring_frequency.removeClass('col-md-10').removeClass('col-md-4').addClass('col-md-12');
@ -312,6 +281,37 @@ $(document).on('change', '.input-group-invoice-text select', function () {
}
});
function confirmDelete(form_id, title, message, button_cancel, button_delete) {
$('#confirm-modal').remove();
var html = '';
html += '<div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">';
html += ' <div class="modal-dialog">';
html += ' <div class="modal-content">';
html += ' <div class="modal-header">';
html += ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
html += ' <h4 class="modal-title" id="confirmModalLabel">' + title + '</h4>';
html += ' </div>';
html += ' <div class="modal-body">';
html += ' <p>' + message + '</p>';
html += ' <p></p>';
html += ' </div>';
html += ' <div class="modal-footer">';
html += ' <div class="pull-left">';
html += ' <button type="button" class="btn btn-danger" onclick="$(\'' + form_id + '\').submit();">' + button_delete + '</button>';
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">' + button_cancel + '</button>';
html += ' </div>';
html += ' </div>';
html += ' </div>';
html += ' </div>';
html += '</div>';
$('body').append(html);
$('#confirm-modal').modal('show');
}
function convertDateFormat(date, split_character) {
var result = [];
var formats = {
@ -339,4 +339,4 @@ function itemTableResize() {
$('#items.table.table-bordered tbody #tr-discount .text-right:first').attr('colspan', colspan);
$('#items.table.table-bordered tbody #tr-tax .text-right:first').attr('colspan', colspan);
$('#items.table.table-bordered tbody #tr-total .text-right:first').attr('colspan', colspan);
}
}