Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/js/customer
الملفات الموجودة في هذا الـ Path:
.
..
campaign.js
campaign_statistic.js
compose.js
contact.js
dashboard.js
domain.js
email_account.js
email_template.js
form.js
group.js
inbox.js
label.js
lead_finder.js
list_builder.js
queue.js
sender.js
sent.js
settings.js
ticket.js

مشاهدة ملف: settings.js

"use strict";
let $validate = $('#profile_form').validate({
    rules: {
        email: {
            required: true,
            email: true,
        },
        first_name: {
            required: true
        },
        last_name: {
            required: true
        },
    },
    messages: {
        email: {
            required: "Please enter a email address",
            email: "Please enter a valid email address"
        },
        password: {
            required: "Please provide a password",
            minlength: "Your password must be at least 5 characters long"
        },
        first_name: {required: "Please provide first name"},
        last_name: {required: "Please provide last name"}
    },
    errorElement: 'span',
    errorPlacement: function (error, element) {
        error.addClass('invalid-feedback');
        element.closest('.form-group').append(error);
    },
    highlight: function (element, errorClass, validClass) {
        $(element).addClass('is-invalid');
    },
    unhighlight: function (element, errorClass, validClass) {
        $(element).removeClass('is-invalid');
    }
});

$('#notification_switch').on('change',function(e){
    const isChecked=$(this).is(':checked');
    $.ajax({
        method:'post',
        url:'/settings/notification_update',
        data:{_token:'{{csrf_token()}}',isChecked},
        success:function(res){
            notify('success',res.message);
        }
    })
})

$(document).ready(function () {
    bsCustomFileInput.init();
});

$('#templateForm').validate({
    rules: {
        title: {
            required: true,
            title: true,
        },
        body: {
            required: true
        },
        status: {
            required: true
        },
    },
    messages: {
        title: {
            required: "Please enter template title",
        },
        body: {
            required: "Please enter template body",
        },
        status: {required: "Please select template status"},
    },
    errorElement: 'span',
    errorPlacement: function (error, element) {
        error.addClass('invalid-feedback');
        element.closest('.form-group').append(error);
    },
    highlight: function (element, errorClass, validClass) {
        $(element).addClass('is-invalid');
    },
    unhighlight: function (element, errorClass, validClass) {
        $(element).removeClass('is-invalid');
    }
});

$(document).on('click', '#addNewTemplate', function (e){
    $('#emailTemplateModal').modal('show');
    $('#title').text($(this).attr('data-title'));
});

$('.add_tool').on('click', function (e) {
    var curPos =
        document.getElementById("template_body").selectionStart;

    let x = $("#template_body").val();
    let text_to_insert = $(this).attr('data-name');
    $("#template_body").val(
        x.slice(0, curPos) + text_to_insert + x.slice(curPos));

});


$(document).on('click', '.template-edit', function (e) {
    $('#emailTemplateModal').modal('show');
    const value = JSON.parse($(this).attr('data-value'));

    $('#template_id').val(value.id);
    $('#template_subject').val(value.subject);
    $('#template_body').text(value.body);
    $('#title').text('Email Template Edit');
    $("#template_status").val(value.status);

});

$(document).on('keyup or click', '#template_body', function (e){
    const character = $(this).val().length;

    var messageValue = $(this).val();
    var div = parseInt(parseInt(messageValue.length - 1) / 160) + 1;
    if (div <= 1) {
        $("#count").text("Characters left: " + (160 - messageValue.length));
    } else $("#count").text("Characters left: " + (160 * div - messageValue.length) + "/" + div);
});