Ver Fonte

Added Culqi process to services and user services panel

José Loguercio há 8 anos atrás
pai
commit
c033bf6fa9

+ 1 - 0
plugin/buycourses/lang/spanish.php

@@ -157,3 +157,4 @@ $strings['NoTermsAndConditionsProvided'] = "Terminos y condiciones no establecid
 $strings['GlobalConfig'] = "Configuración global:";
 $strings['WriteHereTheTermsAndConditionsOfYourECommerce'] = "Escriba aquí los terminos y condiciones para su tienda virtual";
 $strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Porfavor seleccione el método de pago de su preferencia antes de confirmar su orden";
+$strings['MyServices'] = "Mis servicios";

+ 14 - 0
plugin/buycourses/src/buy_course_plugin.class.php

@@ -1040,6 +1040,19 @@ class BuyCoursesPlugin extends Plugin
         ];
     }
 
+    /**
+     * Get the list of service types
+     * @return array
+     */
+    public function getServiceTypes()
+    {
+        return [
+            self::SERVICE_TYPE_USER => get_lang('User'),
+            self::SERVICE_TYPE_COURSE => get_lang('Course'),
+            self::SERVICE_TYPE_SESSION => get_lang('Session')
+        ];
+    }
+
     /**
      * Search filtered sessions by name, and range of price
      * @param string $name Optional. The name filter
@@ -1928,6 +1941,7 @@ class BuyCoursesPlugin extends Plugin
             $servicesSale['service']['name'] = $return['name'];
             $servicesSale['service']['description'] = $return['description'];
             $servicesSale['service']['price'] = $return['service_price'];
+            $servicesSale['service']['currency'] = $return['currency'];
             $servicesSale['service']['duration_days'] = $return['duration_days'];
             $servicesSale['service']['applies_to'] = $return['applies_to'];
             $servicesSale['service']['owner']['id'] = $return['owner_id'];

+ 99 - 0
plugin/buycourses/src/buycourses.ajax.php

@@ -339,5 +339,104 @@ switch ($action) {
             }
         }
 
+        break;
+
+    case 'culqi_cargo_service':
+
+        if (!$culqiEnable) {
+            break;
+        }
+
+        $tokenId = $_REQUEST['token_id'];
+        $serviceSaleId = $_REQUEST['service_sale_id'];
+
+        if (!$tokenId || !$serviceSaleId) {
+            break;
+        }
+
+        $serviceSale = $plugin->getServiceSale($serviceSaleId);
+
+        if (!$serviceSale) {
+            break;
+        }
+
+        require_once("Requests.php");
+        Requests::register_autoloader();
+        require_once("culqi.php");
+
+        $culqiParams = $plugin->getCulqiParams();
+
+        // API Key y autenticación
+        $SECRET_API_KEY = $culqiParams['api_key'];
+        $culqi = new Culqi\Culqi(array('api_key' => $SECRET_API_KEY));
+
+        $environment = $culqiParams['integration'];
+
+        $environment = $environment ? BuyCoursesPlugin::CULQI_INTEGRATION_TYPE : BuyCoursesPlugin::CULQI_PRODUCTION_TYPE;
+
+        $culqi->setEnv($environment);
+
+        $user = api_get_user_info();
+
+        try {
+            $cargo = $culqi->Cargos->create(array(
+                "moneda" => $serviceSale['currency'],
+                "monto" => intval(floatval($serviceSale['price']) * 100),
+                "usuario" => $user['username'],
+                "descripcion" => $serviceSale['service']['name'],
+                "pedido" => $serviceSale['reference'],
+                "codigo_pais" => "PE",
+                "direccion" => get_lang('None'),
+                "ciudad" => get_lang('None'),
+                "telefono" => 0,
+                "nombres" => $user['firstname'],
+                "apellidos" => $user['lastname'],
+                "correo_electronico" => $user['email'],
+                "token" => $tokenId
+            ));
+
+            if (is_object($cargo)) {
+
+                $saleIsCompleted = $plugin->completeServiceSale($serviceSale['id']);
+
+                if ($saleIsCompleted) {
+                    Display::addFlash(
+                        Display::return_message(
+                            sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $serviceSale['service']['name']),
+                            'success'
+                        )
+                    );
+                }
+            }
+
+            echo json_encode($cargo);
+
+        } catch(Exception $e) {
+
+            $cargo = json_decode($e->getMessage(), true);
+
+            $plugin->cancelServiceSale($serviceSale['id']);
+
+            unset($_SESSION['bc_sale_id']);
+
+            if (is_array($cargo)) {
+                Display::addFlash(
+                    Display::return_message(
+                        sprintf($plugin->get_lang('ErrorOccurred'), $cargo['codigo'], $cargo['mensaje']),
+                        'error',
+                        false
+                    )
+                );
+            } else {
+                Display::addFlash(
+                    Display::return_message(
+                        $plugin->get_lang('ErrorContactPlatformAdmin'),
+                        'error',
+                        false
+                    )
+                );
+            }
+        }
+
         break;
 }

+ 2 - 0
plugin/buycourses/src/course_panel.php

@@ -13,6 +13,7 @@ require_once __DIR__.'/../../../main/inc/global.inc.php';
 
 $plugin = BuyCoursesPlugin::create();
 $includeSessions = $plugin->get('include_sessions') === 'true';
+$includeServices = $plugin->get('include_services') === 'true';
 
 $userInfo = api_get_user_info();
 
@@ -51,6 +52,7 @@ $templateName = get_lang('TabsDashboard');
 $tpl = new Template($templateName);
 $tpl->assign('showing_courses', true);
 $tpl->assign('sessions_are_included', $includeSessions);
+$tpl->assign('services_are_included', $includeServices);
 $tpl->assign('sale_list', $saleList);
 
 $content = $tpl->fetch('buycourses/view/course_panel.tpl');

+ 75 - 0
plugin/buycourses/src/service_panel.php

@@ -0,0 +1,75 @@
+<?php
+/**
+ * User Panel
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Initialization
+ */
+
+$cidReset = true;
+
+require_once '../../../main/inc/global.inc.php';
+$plugin = BuyCoursesPlugin::create();
+$includeServices = $plugin->get('include_services') === 'true';
+$includeSessions = $plugin->get('include_sessions') === 'true';
+$servicesOnly = $plugin->get('show_services_only') === 'true';
+
+$userInfo = api_get_user_info();
+
+if (!$userInfo) {
+    api_not_allowed(true);
+}
+
+$em = Database::getManager();
+$paymentTypes = $plugin->getPaymentTypes();
+$serviceTypes = $plugin->getServiceTypes();
+
+$serviceSaleStatuses['status_cancelled'] = BuyCoursesPlugin::SERVICE_STATUS_CANCELLED;
+$serviceSaleStatuses['status_pending'] = BuyCoursesPlugin::SERVICE_STATUS_PENDING;
+$serviceSaleStatuses['status_completed'] = BuyCoursesPlugin::SERVICE_STATUS_COMPLETED;
+
+$serviceSales = $plugin->getServiceSale(null, $userInfo['user_id']);
+$saleList = [];
+
+foreach ($serviceSales as $sale) {
+
+    $saleList[] = [
+        'id' => $sale['id'],
+        'name' => $sale['service']['name'],
+        'service_type' => $serviceTypes[$sale['service']['applies_to']],
+        'applies_to' => $sale['service']['applies_to'],
+        'reference' => $sale['reference'],
+        'date' => api_format_date(api_get_local_time($sale['buy_date']), DATE_TIME_FORMAT_LONG_24H),
+        'date_end' => api_format_date(api_get_local_time($sale['date_end']), DATE_TIME_FORMAT_LONG_24H),
+        'currency' => $sale['currency'],
+        'price' => $sale['price'],
+        'status' => $sale['status']  
+    ];
+}
+
+$toolbar = Display::toolbarButton(
+    $plugin->get_lang('CourseListOnSale'),
+    'course_catalog.php',
+    'search-plus',
+    'primary',
+    ['title' => $plugin->get_lang('CourseListOnSale')]
+);
+
+$templateName = $plugin->get_lang('TabsDashboard');
+$tpl = new Template($templateName);
+$tpl->assign('showing_courses', true);
+$tpl->assign('services_are_included', $includeServices);
+$tpl->assign('sessions_are_included', $includeSessions);
+$tpl->assign('service_sale_statuses', $serviceSaleStatuses);
+$tpl->assign('sale_list', $saleList);
+if ($servicesOnly) {
+    $tpl->assign('show_services_only', true);
+}
+
+$content = $tpl->fetch('buycourses/view/service_panel.tpl');
+
+$tpl->assign('actions', $toolbar);
+$tpl->assign('header', $templateName);
+$tpl->assign('content', $content);
+$tpl->display_one_col_template();

+ 45 - 2
plugin/buycourses/src/service_process_confirm.php

@@ -19,11 +19,14 @@ if (empty($serviceSaleId)) {
 
 $serviceSale = $plugin->getServiceSale($serviceSaleId);
 
+$userInfo = api_get_user_info($serviceSale['buyer']['id']);
+
 if (empty($serviceSale)) {
     api_not_allowed(true);
 }
 
 $currency = $plugin->getCurrency($serviceSale['currency_id']);
+$terms = $plugin->getGlobalParameters();
 
 switch ($serviceSale['payment_type']) {
     case BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL:
@@ -96,7 +99,6 @@ switch ($serviceSale['payment_type']) {
         }
 
         $transferAccounts = $plugin->getTransferAccounts();
-        $userInfo = api_get_user_info($serviceSale['buyer']['id']);
 
         $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
 
@@ -158,6 +160,7 @@ switch ($serviceSale['payment_type']) {
 
         $template = new Template();
 
+        $template->assign('terms', $terms['terms_and_conditions']);
         $template->assign('title', $serviceSale['service']['name']);
         $template->assign('price', $serviceSale['price']);
         $template->assign('currency', $serviceSale['currency_id']);
@@ -177,11 +180,51 @@ switch ($serviceSale['payment_type']) {
 
         // We need to include the main online script, acording to the Culqi documentation the JS needs to be loeaded
         // directly from the main url "https://integ-pago.culqi.com" because a local copy of this JS is not supported
-        $htmlHeadXtra[] = '<script src="https://integ-pago.culqi.com/js/v1"></script>';
+        $htmlHeadXtra[] = '<script src="//integ-pago.culqi.com/js/v1"></script>';
+
+        $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
+
+        if ($form->validate()) {
+
+            $formValues = $form->getSubmitValues();
+
+            if (isset($formValues['cancel'])) {
+                $plugin->cancelServiceSale($serviceSale['id']);
+
+                unset($_SESSION['bc_service_sale_id']);
+
+                Display::addFlash(
+                    Display::return_message(
+                        $plugin->get_lang('OrderCanceled'),
+                        'warning',
+                        false
+                    )
+                );
+
+                header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php');
+                exit;
+            }
+        }
+        $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success', 'default', null, ['id' => 'confirm']);
+        $form->addButton('cancel', $plugin->get_lang('CancelOrder'), 'times', 'danger', 'default', null, ['id' => 'cancel']);
 
         $template = new Template();
 
+        $template->assign('terms', $terms['terms_and_conditions']);
+        $template->assign('title', $serviceSale['service']['name']);
+        $template->assign('price', floatval($serviceSale['price']));
+        $template->assign('currency', $plugin->getSelectedCurrency());
+        $template->assign('buying_service', $serviceSale);
+        $template->assign('user', $userInfo);
+        $template->assign('service', $serviceSale['service']);
+        $template->assign('form', $form->returnForm());
+        $template->assign('is_culqi_payment', true);
+        $template->assign('culqi_params', $culqiParams = $plugin->getCulqiParams());
+
+        $content = $template->fetch('buycourses/view/process_confirm.tpl');
 
+        $template->assign('content', $content);
+        $template->display_one_col_template();
         break;
 }
 

+ 2 - 0
plugin/buycourses/src/session_panel.php

@@ -13,6 +13,7 @@ require_once __DIR__.'/../../../main/inc/global.inc.php';
 
 $plugin = BuyCoursesPlugin::create();
 $includeSessions = $plugin->get('include_sessions') === 'true';
+$includeServices = $plugin->get('include_services') === 'true';
 
 $userInfo = api_get_user_info();
 
@@ -51,6 +52,7 @@ $templateName = get_lang('TabsDashboard');
 $tpl = new Template($templateName);
 $tpl->assign('showing_courses', true);
 $tpl->assign('sessions_are_included', $includeSessions);
+$tpl->assign('services_are_included', $includeServices);
 $tpl->assign('sale_list', $saleList);
 
 $content = $tpl->fetch('buycourses/view/session_panel.tpl');

+ 5 - 1
plugin/buycourses/view/catalog.tpl

@@ -84,7 +84,11 @@
                                                 <p><em class="fa fa-user fa-fw"></em> {{ session.coach }}</p>
                                             {% endif %}
                                             <p><em class="fa fa-calendar fa-fw"></em> {{ session.dates.display }}</p>
-                                            <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
+                                            <p class="text-right">
+                                                <span class="label label-primary">
+                                                    {{ session.currency }} {{ session.price }}
+                                                </span>
+                                            </p>
                                             <ul class="list-unstyled">
                                                 {% for course in session.courses %}
                                                     <li>

+ 5 - 0
plugin/buycourses/view/course_panel.tpl

@@ -11,6 +11,11 @@
                 <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
             </li>
         {% endif %}
+        {% if services_are_included %}
+            <li id="buy-services-tab" class="" role="presentation">
+                <a href="service_panel.php" aria-controls="buy-services" role="tab">{{ 'MyServices'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+            </li>
+        {% endif %}
         <li id="buy-courses-tab" class="" role="presentation">
             <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
         </li>

+ 18 - 11
plugin/buycourses/view/process.tpl

@@ -24,21 +24,28 @@
             {% elseif buying_session %}
                 <div class="col-sm-12 col-md-12 col-xs-12">
                     <p>
-                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                        <img alt="{{ session.name }}" class="img-responsive" style="width: 100%;" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
                     </p>
-                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
                 </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ session.name }}</h3>
-                    <p>{{ session.dates.display }}</p>
-                    <dl>
+                <div class="col-sm-12 col-md-12 col-xs-12">
+                    <h3>{{ session.name }}</h3>
+                    <p><em class="fa fa-calendar fa-fw"></em> {{ session.dates.display }}</p>
+                    <ul class="list-unstyled">
                         {% for course in session.courses %}
-                            <dt>{{ course.title }}</dt>
-                            {% for coach in course.coaches %}
-                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
-                            {% endfor %}
+                            <li>
+                                <em class="fa fa-book fa-fw"></em> {{ course.title }}
+                                {% if course.coaches|length %}
+                                    <ul>
+                                        {% for coach in course.coaches %}
+                                            <li><em class="fa fa-user fa-fw"></em>{{ coach }}</li>
+                                        {% endfor %}
+                                    </ul>
+                                {% endif %}
+                            </li>
                         {% endfor %}
-                    </dl>
+                    </ul>
+                    <p id="n-price" class="lead text-right" style="color: white;"><span class="label label-primary">{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price }}</span></p>
+                    <p id="s-price" class="lead text-right"></p>
                 </div>
             {% elseif buying_service %}
                 <div class="col-sm-12 col-md-12 col-xs-12">

+ 33 - 13
plugin/buycourses/view/process_confirm.tpl

@@ -29,21 +29,28 @@
             <div class="row">
                 <div class="col-sm-12 col-md-12 col-xs-12">
                     <p>
-                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                        <img alt="{{ session.name }}" class="img-responsive" style="width: 100%;" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
                     </p>
-                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
                 </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ session.name }}</h3>
-                    <p>{{ session.dates.display }}</p>
-                    <dl>
+                <div class="col-sm-12 col-md-12 col-xs-12">
+                    <h3>{{ session.name }}</h3>
+                    <p><em class="fa fa-calendar fa-fw"></em> {{ session.dates.display }}</p>
+                    <ul class="list-unstyled">
                         {% for course in session.courses %}
-                            <dt>{{ course.title }}</dt>
-                            {% for coach in course.coaches %}
-                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
-                            {% endfor %}
+                            <li>
+                                <em class="fa fa-book fa-fw"></em> {{ course.title }}
+                                {% if course.coaches|length %}
+                                    <ul>
+                                        {% for coach in course.coaches %}
+                                            <li><em class="fa fa-user fa-fw"></em>{{ coach }}</li>
+                                        {% endfor %}
+                                    </ul>
+                                {% endif %}
+                            </li>
                         {% endfor %}
-                    </dl>
+                    </ul>
+                    <p id="n-price" class="lead text-right" style="color: white;"><span class="label label-primary">{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price }}</span></p>
+                    <p id="s-price" class="lead text-right"></p>
                 </div>
             </div>
         {% elseif buying_service %}
@@ -143,7 +150,7 @@
             Culqi.codigoComercio = '{{ culqi_params.commerce_code }}';
             Culqi.configurar({
                 nombre: '{{ _s.institution }}',
-                orden: '{{ sale.reference }}',
+                orden: '{{ sale.reference ?  sale.reference : buying_service.reference }}',
                 moneda: '{{ currency.iso_code }}',
                 descripcion: '{{ title }}',
                 monto: price
@@ -157,9 +164,20 @@
                     if (Culqi.error) {
                         $("#message-alert").html('<div class="col-md-12 alert alert-danger">{{ 'ErrorOccurred'|get_plugin_lang('BuyCoursesPlugin')|format(Culqi.error.codigo, Culqi.error.mensaje) }}</div>')
                     } else if (Culqi.token) {
+
+                        {% if buying_service %}
+
+                            var url = '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a=culqi_cargo_service&token_id=' + Culqi.token.id + '&service_sale_id=' + {{ buying_service.id }};
+
+                        {% else %}
+
+                            var url = '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a=culqi_cargo&token_id=' + Culqi.token.id + '&sale_id=' + {{ sale.id }};
+
+                        {% endif %}
+
                         $.ajax({
                             type: 'POST',
-                            url: '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a=culqi_cargo&token_id=' + Culqi.token.id + '&sale_id=' + {{ sale.id }},
+                            url: url,
                             beforeSend: function() {
                                 $("#confirm").html('<em class="fa fa-spinner fa-pulse fa-fw" ></em> {{ 'Loading' | get_lang }}');
                                 $("#confirm").prop( "disabled", true );
@@ -170,6 +188,8 @@
                             }
                         })
                     }
+
+                    $(".culqi_checkout").unwatch('style');
                 });
 
                 return false;

+ 94 - 0
plugin/buycourses/view/service_panel.tpl

@@ -0,0 +1,94 @@
+<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
+<script type="text/javascript" src="../resources/js/modals.js"></script>
+
+
+<div id="buy-courses-tabs">
+
+    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
+        </li>
+        {% if sessions_are_included %}
+            <li id="buy-sessions-tab" class="" role="presentation">
+                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
+            </li>
+        {% endif %}
+        {% if services_are_included %}
+            <li id="buy-services-tab" class="active" role="presentation">
+                <a href="service_panel.php" aria-controls="buy-services" role="tab">{{ 'MyServices'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+            </li>
+        {% endif %}
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+        </li>
+    </ul>
+
+        
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th>{{ 'Service'| get_plugin_lang('BuyCoursesPlugin')  }}</th>
+                <th class="text-center">{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'ServiceSaleInfo'|get_plugin_lang('BuyCoursesPlugin')  }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for sale in sale_list %}
+                <tr class="{{ sale.status == service_sale_statuses.status_cancelled ? 'buy-courses-cross-out' : '' }}">
+                    <td>{{ sale.name }}</td>
+                    <td class="text-center">{{ sale.service_type }}</td>
+                    <td class="text-center">{{ sale.currency ~ ' ' ~ sale.price }}</td>
+                    <td class="text-center">{{ sale.date }}</td>
+                    <td class="text-center">{{ sale.reference }}</td>
+                    <td class="text-center">
+                        <a id="service_sale_info" tag="{{ sale.id }}" name="s_{{ sale.id }}" class="btn btn-info btn-sm">{{ 'Info' | get_lang }}</a>
+                    </td>
+                    </td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+</div>
+<script>
+    $(document).on('ready', function () {
+        $("td a").click(function() {
+            var id = $(this).attr('tag');
+            var action = $(this).attr('id');
+            $.ajax({
+                data: 'id='+id,
+                url: '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a='+action,
+                type: 'POST',
+                beforeSend: function() {
+                    if (action == 'renewable_info') {
+                        $('a[name=r_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
+                    } else if (action == 'service_sale_info') {
+                        $('a[name=s_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
+                    }
+                },
+                success: function(response) {
+                    $('a[name=r_'+id+']').html('{{ 'Info' | get_lang }}');
+                    $('a[name=s_'+id+']').html('{{ 'Info' | get_lang }}');
+                    var title = "";
+                    if (action == "renewable_info") {
+                        title = "{{ 'RecurringPaymentProfilePaypalInformation' | get_plugin_lang('BuyCoursesPlugin') }}";
+                    } else if (action == 'service_sale_info') {
+                        title = "{{ 'ServiceSaleInfo' | get_plugin_lang('BuyCoursesPlugin') }}";
+                    }
+                    bootbox.dialog({
+                        message: response,
+                        title: title,
+                        buttons: {
+                            main: {
+                                label: "{{ 'Close' | get_lang }}",
+                                className: "btn-default"
+                            }
+                        }
+                    });
+                }
+            })
+        });
+    });
+</script>

+ 5 - 0
plugin/buycourses/view/session_panel.tpl

@@ -11,6 +11,11 @@
                 <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
             </li>
         {% endif %}
+        {% if services_are_included %}
+            <li id="buy-services-tab" class="" role="presentation">
+                <a href="service_panel.php" aria-controls="buy-services" role="tab">{{ 'MyServices'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+            </li>
+        {% endif %}
         <li id="buy-courses-tab" class="" role="presentation">
             <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
         </li>