Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getAutomationSendSummary($TM_SERVICE=null,$param){
- $response = array();
- $automation_id = $param['AutomationID'];
- $check_automation = $TM_SERVICE->checkAutomation($automation_id);
- if(!$check_automation['status']){
- return $check_automation;
- }
- $sql = "SELECT emailed,
- completed,
- unique_opens,
- unique_clicks,
- contacts
- FROM automation_list
- WHERE automation_id = @automation_id";
- $sql_param = array();
- $sql_param['automation_id'] = $automation_id;
- $ds = null;
- $res = $TM_SERVICE::$DB->query($ds,$sql,$sql_param,0,-1,"ASSOC");
- $item = array();
- $item['finished'] = $ds[0]['completed'];
- $item['emails_sent'] = $ds[0]['emailed'];
- $item['opens'] = $ds[0]['unique_opens'];
- $item['clicks'] = $ds[0]['unique_clicks'];
- $data = array();
- $data['contacts'] = $ds[0]['contacts'];
- $data['summary'] = $item;
- if($res > 0){
- $response['status'] = true;
- $response['error_code']['code'] = "";
- $response['error_code']['message'] = "";
- $response['data'] = $data;
- }else{
- $response['status'] = false;
- $response['error_code'] = $TM_SERVICE::$RESPONSE_ERROR_CODE['AUTOMATION_NOT_FOUND'];
- $response['data'] = "";
- }
- return $response;
- }
- function summaryData(){
- $.ajax({
- type: "post",
- url: BASE_CALL_API,
- data: {
- "Command": "Automations.GetSendSummary",
- "AutomationID": automation_id,
- },
- dataType: "json",
- error: function(e) {
- },
- success: function(res) {
- var data = res['data'];
- var data_size = data.length;
- var str_html = '';
- $('#txt_contracts_value').text(data.contacts);
- Object.keys(data.summary).forEach(function(key, val){
- str_html += '<div>';
- str_html += ' <span>' + replaceTitle(key) + '</span>';
- str_html += ' <small class="pull-right">' + findPercent(data['summary'][key], data.contacts) + '%</small>';
- str_html += '</div>';
- str_html += '<div id="wrap_' + key + '" class="progress progress-small info_tooltip" data-toggle="tooltip" data-placement="top" title="' + tooltipAutomationDisplay(data['summary'][key], data.contacts) + '">';
- str_html += ' <div style="width: ' + findPercent(data['summary'][key], data.contacts) + '%;" class="progress-bar"></div>';
- str_html += '</div>';
- });
- $('#data-summary').html(str_html);
- $('.info_tooltip').tooltip({
- container: "body"
- });
- }
- });
- }
Add Comment
Please, Sign In to add comment