nhance/app/Views/notification.php
2024-05-11 14:20:38 +05:30

1265 lines
57 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
#notification_table{
overflow-x : unset;
}
</style>
<div class="tab-pane fade" id="notification-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/>
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
</div>
<div class="table-responsive" id="notification_table" >
<!-- <form id="notification_enable_form"> -->
<div>
<p><?php
// print_r($notification);
$member_welcome_mail = 0;
$member_remider_mail = 0;
$member_ecard_mail = 0;
$member_review_and_summary_mail = 0;
$account_maneger_summary_mail = 0;
$client_hr_summary_mail = 0;
foreach($notification as $value){
if ($value['template_name'] == 'member_welcome_mail') {
$member_welcome_mail = $value['enabled'];
}
if ($value['template_name'] == 'member_remider_mail') {
$member_remider_mail = $value['enabled'];
}
if ($value['template_name'] == 'member_ecard_mail') {
$member_ecard_mail = $value['enabled'];
}
if ($value['template_name'] == 'member_review_and_summary_mail') {
$member_review_and_summary_mail = $value['enabled'];
}
if ($value['template_name'] == 'account_maneger_summary_mail') {
$account_maneger_summary_mail = $value['enabled'];
}
if ($value['template_name'] == 'client_hr_summary_mail') {
$client_hr_summary_mail = $value['enabled'];
}
}
?></p>
</div>
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_name">Recipient mail ID's<span class="text-danger">*</span></label>
<textarea name="" id="recipient_mail_ids" class="form-control"><?php echo $client['common_mails'] ?></textarea>
</div>
<div class="form-group col-md-6">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Member welcome mail</label>
<label class="switch">
<input id="member_welcome_mail_btn" type="checkbox" name="member_welcome_mail_btn" <?= ($member_welcome_mail == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="member_welcome_mail" onclick="getMailTemplateData(this)" data-target="#member_welcome_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Member remider mail</label>
<label class="switch">
<input id="member_remider_mail_btn" type="checkbox" name="member_remider_mail_btn" <?= $member_remider_mail == 1 ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="member_remider_mail" onclick="getMailTemplateData(this)" data-target="#member_remider_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Member ECard mail</label>
<label class="switch">
<input id="member_ecard_mail_btn" type="checkbox" name="member_ecard_mail_btn" <?= $member_ecard_mail == 1 ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="member_ecard_mail" onclick="getMailTemplateData(this)" data-target="#member_ecard_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Member Review and summary mail</label>
<label class="switch">
<input id="member_review_and_summary_mail_btn" type="checkbox" name="member_review_and_summary_mail_btn" <?= $member_review_and_summary_mail == 1 ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="member_review_and_summary_mail" onclick="getMailTemplateData(this)" data-target="#member_review_and_summary_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Account Maneger summary mail</label>
<label class="switch">
<input id="account_maneger_summary_mail_btn" type="checkbox" name="account_maneger_summary_mail_btn" <?= $account_maneger_summary_mail ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="account_maneger_summary_mail" onclick="getMailTemplateData(this)" data-target="#account_maneger_summary_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="branch_name">Client HR summary mail</label>
<label class="switch">
<input id="client_hr_summary_mail_btn" type="checkbox" name="client_hr_summary_mail_btn" <?= $client_hr_summary_mail == 1 ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="client_hr_summary_mail" onclick="getMailTemplateData(this)" data-target="#client_hr_summary_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<a style="float:right;" id="notification_enable_form_submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</a>
</div>
</div>
</div>
<!-- </form> -->
</div>
</div>
<!-- end -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="member_welcome_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member welcome mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="member_welcome_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Welcome Mail" readonly placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="member_welcome_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="member_welcome_mail_snow_editor" name="content" style="height: 300px;">
</div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<a class="btn btn-primary waves-effect waves-light mr-1"
data-toggle="modal" data-target="#preview_modal">Preview</a>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="member_remider_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member remider mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="member_remider_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Remider Mail" readonly placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select name="" id="" class="form-control" style="z-index: 1;float: right;position: absolute;margin-top: 18px;right: 53px;width: 100px;height: 30px;">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">6</option>
</select>
</div>
</div> -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="member_remider_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="member_remider_mail_snow_editor" style="height: 300px;">
</div>
<div id="editor" name="content"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="member_ecard_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member ecard mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="member_ecard_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Ecard Mail" readonly placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="member_ecard_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="member_ecard_mail_snow_editor" style="height: 300px;">
</div>
<div id="editor" name="content"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="member_review_and_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="member_review_and_summary_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="Member Review and Summary Mail" readonly class="form-control" placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select name="" id="" class="form-control" style="z-index: 1;float: right;position: absolute;margin-top: 18px;right: 53px;width: 100px;height: 30px;">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">6</option>
</select>
</div>
</div> -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="member_review_and_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="member_review_and_summary" style="height: 300px;">
</div>
<div id="editor"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="account_maneger_summary_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="Account Maneger Summary Mail" readonly class="form-control" placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select name="" id="" class="form-control" style="z-index: 1;float: right;position: absolute;margin-top: 18px;right: 53px;width: 100px;height: 30px;">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">6</option>
</select>
</div>
</div> -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="account_maneger_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="account_maneger_summary_mail_snow_editor" style="height: 300px;">
</div>
<div id="editor"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="client_hr_summary_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="Client HR Summary Mail" readonly class="form-control" placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
</div>
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select name="" id="" class="form-control" style="z-index: 1;float: right;position: absolute;margin-top: 18px;right: 53px;width: 100px;height: 30px;">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">6</option>
</select>
</div>
</div> -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="client_hr_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="client_hr_summary" style="height: 300px;">
</div>
<div id="editor"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="preview_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function() {
var toolbar2 = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
const editor = Jodit.make("#member_welcome_mail_snow_editor", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
const editor2 = Jodit.make("#member_remider_mail_snow_editor", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
const editor6 = Jodit.make("#member_ecard_mail_snow_editor", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
const editor3 = Jodit.make("#member_review_and_summary", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
const editor4 = Jodit.make("#account_maneger_summary_mail_snow_editor", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
const editor5 = Jodit.make("#client_hr_summary", {
buttons:toolbar2,
showPlaceholder: false,
toolbarButtonSize: 'small',
showPlaceholder: false,
toolbarAdaptive:false,
saveHeightInStorage: true,
minHeight: 400,
extraButtons: [
{
name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function (editor) {
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click();
},
},
],
});
document.addEventListener('change', function(event) {
var target = event.target;
if (target.matches('#member_welcome_mail_customButton')) {
editor.selection.insertHTML($(target).val());
$(target).val('');
} else if (target.matches('#member_remider_mail_modal_customButton')) {
editor2.selection.insertHTML($(target).val());
$(target).val('');
}else if (target.matches('#member_ecard_mail_modal_customButton')) {
editor6.selection.insertHTML($(target).val());
$(target).val('');
}else if (target.matches('#member_review_and_summary_mail_modal_customButton')) {
editor3.selection.insertHTML($(target).val());
$(target).val('');
} else if (target.matches('#account_maneger_summary_mail_modal_customButton')) {
editor4.selection.insertHTML($(target).val());
$(target).val('');
} else if (target.matches('#client_hr_summary_mail_modal_customButton')) {
editor5.selection.insertHTML($(target).val());
$(target).val('');
}
});
$('.close').click(function () {
$(this).parent().parent().find('#subject').val('');
editor.setEditorValue('');
editor2.setEditorValue('');
editor3.setEditorValue('');
editor4.setEditorValue('');
editor5.setEditorValue('');
editor6.setEditorValue('');
})
const fileInput = document.getElementById("Question_title_fileInput");
fileInput.addEventListener("change", () => {
// Handle the selected file and insert it into the editor
const file = fileInput.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const imageUrl = e.target.result;
editor.selection.insertImage(imageUrl);
};
reader.readAsDataURL(file);
}
fileInput.value = '';
});
$('#member_welcome_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#member_welcome_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$('#member_remider_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor2;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#member_remider_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$('#member_ecard_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor6;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#member_ecard_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$('#member_review_and_summary_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor3;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#member_review_and_summary_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$('#account_maneger_summary_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor4;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#account_maneger_summary_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$('#client_hr_summary_mail_form').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
var joditEditor = editor5;
if (joditEditor) {
// Get the HTML content from the editor
var editorContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'editorContent', value: editorContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// console.log(formData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
$('#client_hr_summary_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
} else {
console.error("Jodit editor instance is not defined.");
}
})
$(document).on('click', '#notification_enable_form_submit', function() {
var formData = [];
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
formData.push({ name: 'recipient_mail_ids', value: $('#recipient_mail_ids').val() });
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
formData.push({ name: 'member_remider_mail_btn', value: $('#member_remider_mail_btn').prop('checked') });
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') });
formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') });
formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') });
console.log(formData);
var form_action = '<?= base_url("client/notification/update_enable") ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
console.log(res);
if (res) {
toastr.success('Update Successfully');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
})
});
$(document).ready(function() {
$('#member_welcome_mail_snow_editor').jodit();
});
document.getElementById("myDropdown").addEventListener("click", function(event) {
// Check if the clicked element is a dropdown item
if (event.target.classList.contains("dropdown-item")) {
const selectedValue = event.target.innerText; // Get the text of the clicked item
const editor = Jodit.instances["member_remider_mail_snow_editor"]; // Get the Jodit editor instance
editor.selection.insertHTML(selectedValue); // Insert the selected value into the editor's content
}
});
function snakeCaseToCamelCase(input) {
return input.split('_').map(function(word, index) {
// Capitalize first letter of each word
return word.charAt(0).toUpperCase() + word.slice(1);
}).join(' ');
}
function getMailTemplateData(element){
var template_name = $(element).attr('id');
if (template_name == "member_welcome_mail" || template_name == "member_remider_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "account_maneger_summary_mail" || template_name == "client_hr_summary_mail") {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/getMailTemplateData/") ?>'+template_name+ '/' + $('#general_PrimaryKey').val();
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
success: function(res) {
console.log(res);
if (res) {
$(`#${template_name}_form`).find('#template_name').val(snakeCaseToCamelCase(res.template_name));
$(`#${template_name}_form`).find('#subject').val(res.subject);
$(`#${template_name}_form`).find('.jodit-wysiwyg').html(res.mail_content);
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
}
}
</script>