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

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

"use strict";
var select2 = $('#toEmail').select2({
    minimumInputLength: 1,
    tags: true,
    tokenSeparators: [",", " "],
})

$('#fromNumber').select2({
    theme: 'bootstrap4',
    multiple:false
});
const fromEmail=$('#fromEmail').select2({
    multiple:false,
    tags:true,
    placeholder:'Type from email'
});

$('#fromSenderId').select2({
    theme: 'bootstrap4'
});

$(function () {
    $('#schedule').daterangepicker({
        autoUpdateInput: true,
        singleDatePicker: true,
        timePicker: true,
        locale: {
            format: 'MM/DD/YYYY hh:mm A'
        }
    });
});

$('#isScheduled').on('change', function (e) {
    const checked = $(this).is(':checked');
    if (checked) {
        $('#schedule').show();
    } else {
        $('#schedule').hide();
    }
})

$('#reset').on('click', function (e) {
    e.preventDefault();
    $(select2).val('').trigger('change');
    $("#compose-textarea").val('');
    let checked = $("#isScheduled").is(':checked');
    if (checked) {
        $('#isScheduled').click().prop("checked", false);
    }
})

$('#draft').on('click', function (e) {
    e.preventDefault();
    const from = $('#fromEmail').val();
    const to = $('#toEmail').val();
    const body = $('#compose-textarea').val();
    const checked = $("#isScheduled").is(':checked');
    const draft_id = $("#draft_id").val();
    const from_name = $("#fromName").val();
    const reply_to = $("#replyTo").val();
    const subject = $("#subject").val();
    let schedule = '';
    if (checked) {
        schedule = $('#schedule').val();
    }

    $.ajax({
        method: 'post',
        url: '/customer/emailbox/draft/store',
        data: {_token: '{{csrf_token()}}', from, to, body, checked, schedule, draft_id,reply_to,subject,from_name},
        success: function (res) {
            if (res.status == 'success') {
                notify('success', res.message);
                var id = res.data.id;
                $('#pre_draft').html("<input type='hidden' id='draft_id' name='draft_id' value='" + id + "'/>");

            } else {
                notify('danger', res.message);
            }
        }
    })

})


$('#phone_number').trigger('change');