Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
945724ae3c | ||
|
|
72c8b4774c | ||
|
|
9a1ee350c3 | ||
|
|
7228bb2922 | ||
|
|
5416bdb840 | ||
|
|
1332448d72 | ||
|
|
9f47df5613 | ||
|
|
731073a133 | ||
|
|
f44b9ec8dd | ||
|
|
ad4fe1cc29 | ||
|
|
8fbf8f2152 |
No files matched your search
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Listen for Xdebug",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9003
|
||||
},
|
||||
{
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 0,
|
||||
"runtimeArgs": [
|
||||
"-dxdebug.start_with_request=yes"
|
||||
],
|
||||
"env": {
|
||||
"XDEBUG_MODE": "debug,develop",
|
||||
"XDEBUG_CONFIG": "client_port=${port}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Launch Built-in web server",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"runtimeArgs": [
|
||||
"-dxdebug.mode=debug",
|
||||
"-dxdebug.start_with_request=yes",
|
||||
"-S",
|
||||
"localhost:0"
|
||||
],
|
||||
"program": "",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"port": 9003,
|
||||
"serverReadyAction": {
|
||||
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
|
||||
"uriFormat": "http://localhost:%s",
|
||||
"action": "openExternally"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,10 +13,10 @@ if(!defined('HOME_LINK_OTHERS')){
|
||||
}
|
||||
|
||||
//Version
|
||||
define('VERSION', '29.0.0.OS');
|
||||
define('CACHE_VALUE', '29.0.0.OS.2020-04021509');
|
||||
define('VERSION_NUMBER', '290000');
|
||||
define('VERSION_DATE', '02/04/2021');
|
||||
define('VERSION', '30.0.0.OS');
|
||||
define('CACHE_VALUE', '30.0.0.OS.2021-06261009');
|
||||
define('VERSION_NUMBER', '300000');
|
||||
define('VERSION_DATE', '26/06/2021');
|
||||
|
||||
if(!defined('CONTACT_EMAIL')){define('CONTACT_EMAIL','icehrm@gamonoid.com');}
|
||||
if(!defined('KEY_PREFIX')){define('KEY_PREFIX','IceHrm');}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
use Classes\ExtensionManager;
|
||||
use Utils\LogManager;
|
||||
|
||||
if (!isset($extensionIndex)) {
|
||||
exit();
|
||||
}
|
||||
define('MODULE_PATH',APP_BASE_PATH.'extensions/'.$moduleName);
|
||||
include APP_BASE_PATH.'header.php';
|
||||
$extensionManager = new ExtensionManager();
|
||||
$meta = $extensionManager->getExtensionMetaData($moduleName);
|
||||
if (!$meta) {
|
||||
LogManager::getInstance()->error("Extension metadata.json not found for $moduleName");
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($meta->headless) {
|
||||
LogManager::getInstance()->error("Extension running in headless mode for $moduleName");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'dist/vendorReact.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'dist/vendorAntd.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'dist/vendorAntdIcons.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'dist/vendorAntv.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'dist/vendorOther.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=EXTENSIONS_URL.$moduleName.'/dist/'.$moduleName.'.js'?>?v=<?=$jsVersion?>"></script>
|
||||
<?php
|
||||
include $extensionIndex;
|
||||
include APP_BASE_PATH.'footer.php';
|
||||
?>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$migrationList = [];
|
||||
$migrationList[] = 'v20210626_290004_add_s3_settings';
|
||||
$migrationList[] = 'v20210606_290003_system_meta_data';
|
||||
$migrationList[] = 'v20210606_290002_add_aws_region';
|
||||
$migrationList[] = 'v20210606_290001_update_s3_config';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Classes\Migration;
|
||||
|
||||
class v20210626_290004_add_s3_settings extends AbstractMigration
|
||||
{
|
||||
|
||||
public function up()
|
||||
{
|
||||
|
||||
$sql = <<<'SQL'
|
||||
REPLACE INTO `Settings` (`name`, `value`, `description`, `meta`, `category`) VALUES
|
||||
('Files: Upload Files to S3', '0', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]', 'System'),
|
||||
('Files: Amazon S3 Key for File Upload', '', 'Please provide S3 Key for uploading files','', 'System'),
|
||||
('Files: Amazon S3 Secret for File Upload', '', 'Please provide S3 Secret for uploading files','', 'System'),
|
||||
('Files: S3 Bucket', '', 'Please provide S3 Bucket name for uploading files','', 'System'),
|
||||
('Files: S3 Web Url', '', 'Please provide Url to the s3 bucket','', 'System'),
|
||||
('System: AWS Region', 'us-east-1', 'Amazon AWS Region used for file storage','', 'System');
|
||||
SQL;
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Classes\Pdf;
|
||||
|
||||
use Forms\Common\EmployeeFormPDFBuilder;
|
||||
use Invoices\InvoicePDFBuilder;
|
||||
|
||||
class PDFRegister
|
||||
{
|
||||
@@ -10,8 +10,8 @@ class PDFRegister
|
||||
|
||||
public static function init()
|
||||
{
|
||||
self::put('empf', function ($data) {
|
||||
return new EmployeeFormPDFBuilder($data);
|
||||
self::put('invoice', function ($data) {
|
||||
return new InvoicePDFBuilder($data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
git keep
|
||||
Vendored
+24757
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["node_modules/browser-pack/_prelude.js","extensions/invoices/web/js/index.js","extensions/invoices/web/js/lib.js","node_modules/process/browser.js","web/api-common/RequestCache.js","web/api/AdapterBase.js","web/api/FormValidation.js","web/api/IceApiClient.js","web/api/IceDataPipe.js","web/api/MasterDataReader.js","web/api/ModuleBase.js","web/api/ReactModalAdapterBase.js","web/components/IceColorPick.js","web/components/IceDataGroup.js","web/components/IceForm.js","web/components/IceFormModal.js","web/components/IceLabel.js","web/components/IceSelect.js","web/components/IceSignature.js","web/components/IceStepForm.js","web/components/IceStepFromModal.js","web/components/IceTable.js","web/components/IceUpload.js","web/node_modules/@icons/material/CheckIcon.js","web/node_modules/@icons/material/UnfoldMoreHorizontalIcon.js","web/node_modules/axios/index.js","web/node_modules/axios/lib/adapters/xhr.js","web/node_modules/axios/lib/axios.js","web/node_modules/axios/lib/cancel/Cancel.js","web/node_modules/axios/lib/cancel/CancelToken.js","web/node_modules/axios/lib/cancel/isCancel.js","web/node_modules/axios/lib/core/Axios.js","web/node_modules/axios/lib/core/InterceptorManager.js","web/node_modules/axios/lib/core/buildFullPath.js","web/node_modules/axios/lib/core/createError.js","web/node_modules/axios/lib/core/dispatchRequest.js","web/node_modules/axios/lib/core/enhanceError.js","web/node_modules/axios/lib/core/mergeConfig.js","web/node_modules/axios/lib/core/settle.js","web/node_modules/axios/lib/core/transformData.js","web/node_modules/axios/lib/defaults.js","web/node_modules/axios/lib/helpers/bind.js","web/node_modules/axios/lib/helpers/buildURL.js","web/node_modules/axios/lib/helpers/combineURLs.js","web/node_modules/axios/lib/helpers/cookies.js","web/node_modules/axios/lib/helpers/isAbsoluteURL.js","web/node_modules/axios/lib/helpers/isURLSameOrigin.js","web/node_modules/axios/lib/helpers/normalizeHeaderName.js","web/node_modules/axios/lib/helpers/parseHeaders.js","web/node_modules/axios/lib/helpers/spread.js","web/node_modules/axios/lib/utils.js","web/node_modules/lodash/_DataView.js","web/node_modules/lodash/_Hash.js","web/node_modules/lodash/_ListCache.js","web/node_modules/lodash/_Map.js","web/node_modules/lodash/_MapCache.js","web/node_modules/lodash/_Promise.js","web/node_modules/lodash/_Set.js","web/node_modules/lodash/_SetCache.js","web/node_modules/lodash/_Stack.js","web/node_modules/lodash/_Symbol.js","web/node_modules/lodash/_Uint8Array.js","web/node_modules/lodash/_WeakMap.js","web/node_modules/lodash/_apply.js","web/node_modules/lodash/_arrayEach.js","web/node_modules/lodash/_arrayFilter.js","web/node_modules/lodash/_arrayLikeKeys.js","web/node_modules/lodash/_arrayMap.js","web/node_modules/lodash/_arrayPush.js","web/node_modules/lodash/_arraySome.js","web/node_modules/lodash/_assignMergeValue.js","web/node_modules/lodash/_assignValue.js","web/node_modules/lodash/_assocIndexOf.js","web/node_modules/lodash/_baseAssign.js","web/node_modules/lodash/_baseAssignIn.js","web/node_modules/lodash/_baseAssignValue.js","web/node_modules/lodash/_baseClone.js","web/node_modules/lodash/_baseCreate.js","web/node_modules/lodash/_baseEach.js","web/node_modules/lodash/_baseFor.js","web/node_modules/lodash/_baseForOwn.js","web/node_modules/lodash/_baseGet.js","web/node_modules/lodash/_baseGetAllKeys.js","web/node_modules/lodash/_baseGetTag.js","web/node_modules/lodash/_baseHasIn.js","web/node_modules/lodash/_baseIsArguments.js","web/node_modules/lodash/_baseIsEqual.js","web/node_modules/lodash/_baseIsEqualDeep.js","web/node_modules/lodash/_baseIsMap.js","web/node_modules/lodash/_baseIsMatch.js","web/node_modules/lodash/_baseIsNative.js","web/node_modules/lodash/_baseIsSet.js","web/node_modules/lodash/_baseIsTypedArray.js","web/node_modules/lodash/_baseIteratee.js","web/node_modules/lodash/_baseKeys.js","web/node_modules/lodash/_baseKeysIn.js","web/node_modules/lodash/_baseMap.js","web/node_modules/lodash/_baseMatches.js","web/node_modules/lodash/_baseMatchesProperty.js","web/node_modules/lodash/_baseMerge.js","web/node_modules/lodash/_baseMergeDeep.js","web/node_modules/lodash/_baseProperty.js","web/node_modules/lodash/_basePropertyDeep.js","web/node_modules/lodash/_baseRest.js","web/node_modules/lodash/_baseSetToString.js","web/node_modules/lodash/_baseTimes.js","web/node_modules/lodash/_baseToString.js","web/node_modules/lodash/_baseUnary.js","web/node_modules/lodash/_cacheHas.js","web/node_modules/lodash/_castFunction.js","web/node_modules/lodash/_castPath.js","web/node_modules/lodash/_cloneArrayBuffer.js","web/node_modules/lodash/_cloneBuffer.js","web/node_modules/lodash/_cloneDataView.js","web/node_modules/lodash/_cloneRegExp.js","web/node_modules/lodash/_cloneSymbol.js","web/node_modules/lodash/_cloneTypedArray.js","web/node_modules/lodash/_copyArray.js","web/node_modules/lodash/_copyObject.js","web/node_modules/lodash/_copySymbols.js","web/node_modules/lodash/_copySymbolsIn.js","webLine truncated
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/src/Invoices/Extension.php';
|
||||
require_once __DIR__.'/src/Invoices/Manager.php';
|
||||
require_once __DIR__.'/src/Invoices/Migration.php';
|
||||
require_once __DIR__.'/src/Invoices/Model/Invoice.php';
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"label": "Invoices",
|
||||
"menu": ["Invoices", "fa-file"],
|
||||
"icon": "fa-file-invoice",
|
||||
"user_levels": [
|
||||
"Admin",
|
||||
"Manager",
|
||||
"User"
|
||||
],
|
||||
"model_namespace": "\\Invoices\\Model",
|
||||
"manager": "\\Invoices\\Extension",
|
||||
"action": "\\Invoices\\Manager",
|
||||
"headless": false
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\IceExtension;
|
||||
|
||||
class Extension extends IceExtension
|
||||
{
|
||||
|
||||
public function install() {
|
||||
$migration = new Migration();
|
||||
return $migration->up();
|
||||
|
||||
}
|
||||
|
||||
public function uninstall() {
|
||||
$migration = new Migration();
|
||||
return $migration->down();
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions()
|
||||
{
|
||||
$this->addModelClass('Invoice');
|
||||
}
|
||||
|
||||
public function setupRestEndPoints()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\Authorizable;
|
||||
use Classes\BaseService;
|
||||
use Classes\IceResponse;
|
||||
use Classes\Pdf\PdfBuilder;
|
||||
use Invoices\Model\Invoice;
|
||||
use Invoices\Pdf\InvoicePdf;
|
||||
|
||||
|
||||
class InvoicePDFBuilder implements Authorizable, PdfBuilder
|
||||
{
|
||||
|
||||
protected $formId;
|
||||
|
||||
public function __construct($formId)
|
||||
{
|
||||
$this->formId = $formId;
|
||||
}
|
||||
|
||||
public function granted(): bool
|
||||
{
|
||||
$empForm = new EmployeeForm();
|
||||
$empForm->Load("id = ?", array($this->formId));
|
||||
|
||||
$currentEmployeeId = BaseService::getInstance()->getCurrentProfileId();
|
||||
$user = BaseService::getInstance()->getCurrentUser();
|
||||
return ($currentEmployeeId == $empForm->employee
|
||||
|| $user->user_level === 'Admin'
|
||||
|| BaseService::getInstance()->isSubordinateEmployee($currentEmployeeId, $empForm->employee)
|
||||
);
|
||||
}
|
||||
|
||||
public function createPdf()
|
||||
{
|
||||
$response = FormsActionManager::getFormDataById($this->formId);
|
||||
if ($response->getStatus() === IceResponse::ERROR) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$form = $response->getData()['form'];
|
||||
$invoiceForm = $response->getData()['data'];
|
||||
|
||||
$invoice = new Invoice();
|
||||
$invoice->Load('id = ?', [$invoiceForm->invoice]);
|
||||
//$employee = FileService::getInstance()->updateSmallProfileImage($employee);
|
||||
|
||||
$pdf = new InvoicePdf($invoice);
|
||||
$pdf->initialize($form->name);
|
||||
$pdf->process();
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\IceResponse;
|
||||
use Classes\SubActionManager;
|
||||
|
||||
class Manager extends SubActionManager
|
||||
{
|
||||
public function printInvoice($req)
|
||||
{
|
||||
$id = $req->id;
|
||||
return new IceResponse(IceResponse::SUCCESS, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\Migration\AbstractMigration;
|
||||
|
||||
class Migration extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
create table Invoices
|
||||
(
|
||||
id bigint auto_increment primary key,
|
||||
paymentId bigint not null,
|
||||
invoiceId bigint not null,
|
||||
description varchar(500) charset utf8 not null,
|
||||
buyerName varchar(200) charset utf8 not null,
|
||||
buyerAddress varchar(200) charset utf8 not null,
|
||||
buyerPostalCode varchar(200) charset utf8 not null,
|
||||
buyerCountry varchar(200) charset utf8 not null,
|
||||
buyerVatId varchar(50) charset utf8 not null,
|
||||
sellerName varchar(200) charset utf8 not null,
|
||||
sellerAddress varchar(200) null,
|
||||
sellerCountry varchar(200) charset utf8 not null,
|
||||
sellerVatId varchar(50) charset utf8 not null,
|
||||
amount decimal(10,2) default 0.00 null,
|
||||
vat decimal(10,2) default 0.00 null,
|
||||
vatRate decimal(10,2) default 0.00 null,
|
||||
issuedDate datetime null,
|
||||
dueDate datetime null,
|
||||
paidDate datetime null,
|
||||
created datetime null,
|
||||
updated datetime null,
|
||||
status enum('Pending', 'Paid', 'Processing', 'Draft', 'Sent', 'Canceled') collate utf8_unicode_ci default 'Pending' null,
|
||||
acceptPayments tinyint default 0 null,
|
||||
buyerEmail varchar(125) charset utf8 null,
|
||||
items text charset utf8 null,
|
||||
constraint invoiceId
|
||||
unique (invoiceId)
|
||||
)
|
||||
collate=utf8mb4_unicode_ci;
|
||||
SQL;
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
DROP TABLE IF EXISTS `Invoices`;
|
||||
SQL;
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Invoices\Model;
|
||||
|
||||
use Classes\ModuleAccess;
|
||||
use Model\BaseModel;
|
||||
|
||||
class Invoice extends BaseModel
|
||||
{
|
||||
public $table = 'Invoices';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getModuleAccess()
|
||||
{
|
||||
return [
|
||||
new ModuleAccess('employees', 'admin'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace Invoices\Pdf;
|
||||
|
||||
use Classes\Pdf\BasePdfTemplate;
|
||||
use Invoices\Model\Invoice;
|
||||
|
||||
class InvoicePdf extends BasePdfTemplate
|
||||
{
|
||||
|
||||
protected $invoice;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$this->addH3($this->form->name, 'B', 'L');
|
||||
$this->addBorderedText($this->invoice->description);
|
||||
}
|
||||
|
||||
// protected function addFormItems()
|
||||
// {
|
||||
// $signatures = [];
|
||||
// $fields = json_decode($this->form->items);
|
||||
// foreach ($fields as $field) {
|
||||
// if ($field->field_type === 'signature') {
|
||||
// $signatures[$field->field_label] = $this->employeeForm->{$field->name};
|
||||
// } elseif ($field->field_type === 'fileupload') {
|
||||
// // ignore
|
||||
// } else {
|
||||
// $this->addKeyValue($field->field_label, $this->employeeForm->{$field->name}, $field->field_type);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// foreach ($signatures as $name => $data) {
|
||||
// $this->addSignature($name, $data);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*$user = \Classes\BaseService::getInstance()->getCurrentUser();
|
||||
echo "Welcome ".$user->username."<br/>";
|
||||
|
||||
echo "Invoices <br/>";
|
||||
*/
|
||||
use Classes\PermissionManager;
|
||||
use Invoices\Model\Invoice;
|
||||
|
||||
?><div class="span9">
|
||||
|
||||
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
|
||||
<li class="active"><a id="tabInvoices" href="#tabPageInvoices"><?=t('Invoices')?></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageInvoices">
|
||||
<div id="InvoicesTable" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>
|
||||
<div id="InvoicesForm"></div>
|
||||
<div id="InvoicesFilterForm"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="dataGroup"></div>
|
||||
<?php
|
||||
$moduleData = [
|
||||
'user_level' => $user->user_level,
|
||||
'permissions' => [
|
||||
'Invoice' => PermissionManager::checkGeneralAccess(new Invoice()),
|
||||
]
|
||||
];
|
||||
?>
|
||||
|
||||
<script>
|
||||
initAdminInvoices(<?=json_encode($moduleData)?>);
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {InvoiceAdapter} from './lib';
|
||||
import IceDataPipe from '../../../../web/api/IceDataPipe';
|
||||
|
||||
function init(data) {
|
||||
const modJsList = [];
|
||||
|
||||
modJsList.tabInvoices =new InvoiceAdapter('Invoice', 'Invoices','','');
|
||||
modJsList.tabInvoices.setObjectTypeName('Invoice');
|
||||
modJsList.tabInvoices.setDataPipe(new IceDataPipe(modJsList.tabInvoices));
|
||||
modJsList.tabInvoices.setAccess(data.permissions.Invoice);
|
||||
|
||||
window.modJs = modJsList.tabInvoices;
|
||||
window.modJsList = modJsList;
|
||||
}
|
||||
|
||||
window.initAdminInvoices = init;
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Space, Tag } from 'antd';
|
||||
import ReactModalAdapterBase from '../../../../web/api/ReactModalAdapterBase';
|
||||
import {
|
||||
EditOutlined, DeleteOutlined, CopyOutlined, MonitorOutlined, PrinterOutlined,
|
||||
} from '@ant-design/icons';
|
||||
/**
|
||||
* VatInvoiceAdapter
|
||||
*/
|
||||
|
||||
class InvoiceAdapter extends ReactModalAdapterBase {
|
||||
|
||||
getDataMapping() {
|
||||
return [
|
||||
'id',
|
||||
'paymentId',
|
||||
'invoiceId',
|
||||
'description',
|
||||
'buyerName',
|
||||
'buyerAddress',
|
||||
'buyerPostalAddress',
|
||||
'buyerVatId',
|
||||
'buyerEmail',
|
||||
'sellerName',
|
||||
'sellerAddress',
|
||||
'sellerVatId',
|
||||
'amount',
|
||||
'vat',
|
||||
'vatRate',
|
||||
'issuedDate',
|
||||
'dueDate',
|
||||
'paidDate',
|
||||
'status',
|
||||
'acceptPayments',
|
||||
'created',
|
||||
'updated',
|
||||
'link',
|
||||
'paymentLink'
|
||||
];
|
||||
}
|
||||
|
||||
getHeaders() {
|
||||
return [
|
||||
{ sTitle: 'ID', bVisible: false },
|
||||
{ sTitle: 'Payment Id' },
|
||||
{ sTitle: 'Invoice ID' },
|
||||
{ sTitle: 'Description' },
|
||||
{ sTitle: 'Buyer Name' },
|
||||
{ sTitle: 'Buyer Address' },
|
||||
{ sTitle: 'Buyer Postal Code' },
|
||||
{ sTitle: 'Buyer Country' },
|
||||
{ sTitle: 'Buyer Vat Id' },
|
||||
{ sTitle: 'Buyer Email' },
|
||||
{ sTitle: 'Seller Name' },
|
||||
{ sTitle: 'Seller Country' },
|
||||
{ sTitle: 'Seller Vat Id' },
|
||||
{ sTitle: 'Amount' },
|
||||
{ sTitle: 'Vat' },
|
||||
{ sTitle: 'Vat Rate' },
|
||||
{ sTitle: 'Issued Date' },
|
||||
{ sTitle: 'Paid Date' },
|
||||
{ sTitle: 'Status' },
|
||||
{ sTitle: 'Accept Payments' },
|
||||
{ sTitle: 'Created' },
|
||||
{ sTitle: 'Updated' },
|
||||
{ sTitle: 'Link' },
|
||||
{ sTitle: 'Payment Link' },
|
||||
];
|
||||
}
|
||||
|
||||
getCountryList() {
|
||||
return [
|
||||
['DE', 'Germany'],
|
||||
['LK', 'Sri Lanka'],
|
||||
];
|
||||
}
|
||||
|
||||
getFormFields() {
|
||||
return [
|
||||
[ 'id', {"label":"ID","type":"hidden"}],
|
||||
[ 'paymentId', {"label":"Payment Id","type":"text","validation":"int"}],
|
||||
[ 'invoiceId', {"label":"Invoice Id","type":"text","validation":"int"}],
|
||||
[ 'description', {"label":"Description","type":"textarea","validation":"none"}],
|
||||
[ 'buyerName', {"label":"Buyer Name","type":"text"}],
|
||||
[ 'buyerAddress', {"label":"Buyer Address","type":"textarea"}],
|
||||
[ 'buyerPostalCode', {"label":"Buyer Postal Code","type":"text"}],
|
||||
[ 'buyerCountry', {"label":"Buyer Country","type":"select2", "remote-source": ["Country", "code", "name"]}],
|
||||
[ 'buyerVatId', {"label":"Buyer Vat Id","type":"text","validation":"none"}],
|
||||
[ 'buyerEmail', {"label":"Buyer Email","type":"text","validation":"email"}],
|
||||
[ 'sellerName', {"label":"Seller Name","type":"text"}],
|
||||
[ 'sellerAddress', {"label":"Seller Address","type":"text"}],
|
||||
[ 'sellerCountry', {"label":"Seller Country","type":"select2", "remote-source": ["Country", "code", "name"]}],
|
||||
[ 'sellerVatId', {"label":"Seller Vat Id","type":"text"}],
|
||||
[ 'amount', {"label":"Amount with VAT","type":"text", "validation":"float"}],
|
||||
[ 'vat', {"label":"Vat","type":"text", "validation":"float"}],
|
||||
[ 'vatRate', {"label":"Vat Rate","type":"text", "validation":"float"}],
|
||||
[ 'issuedDate', {"label":"Issued Date","type":"datetime", "validation":""}],
|
||||
[ 'dueDate', {"label":"Due Date","type":"datetime", "validation":""}],
|
||||
[ 'paidDate', {"label":"Paid Date","type":"datetime", "validation":""}],
|
||||
[ 'status', {"label":"Status","type":"select","source":[["Pending","Pending"],["Paid","Paid"],["Processing","Processing"],["Draft","Draft"],["Sent","Sent"],["Canceled","Canceled"]]}],
|
||||
[ 'acceptPayments', {"label":"Accept Payments","type":"select","source":[["0","No"],["1","Yes"]]}],
|
||||
[ 'created', {"label":"Created","type":"datetime", "validation":""}],
|
||||
[ 'updated', {"label":"Updated","type":"datetime", "validation":""}],
|
||||
[ 'link', {"label":"Link","type":"placeholder"}],
|
||||
[ 'paymentLink', {"label":"Payment Link","type":"placeholder"}],
|
||||
['items', {
|
||||
label: 'Items',
|
||||
type: 'datagroup',
|
||||
form: [
|
||||
['description', { label: 'Description', type: 'textarea', validation: '' }],
|
||||
['rate', { label: 'Rate', type: 'text', validation: '' }],
|
||||
['qty', { label: 'Quantity', type: 'text', validation: '' }],
|
||||
['lineTotal', { label: 'Line Total', type: 'text', validation: '' }],
|
||||
],
|
||||
html: '<div id="#_id_#" class="panel panel-default"><div class="panel-body">#_delete_##_edit_#<span style="color:#999;font-size:13px;font-weight:bold">Date: #_date_#</span><hr/>#_note_#</div></div>',
|
||||
validation: 'none',
|
||||
columns: [
|
||||
{
|
||||
title: 'Description',
|
||||
dataIndex: 'description',
|
||||
key: 'description',
|
||||
},
|
||||
{
|
||||
title: 'Rate',
|
||||
dataIndex: 'rate',
|
||||
key: 'rate',
|
||||
},
|
||||
{
|
||||
title: 'Quantity',
|
||||
dataIndex: 'qty',
|
||||
key: 'qty',
|
||||
},
|
||||
{
|
||||
title: 'Line Total',
|
||||
dataIndex: 'lineTotal',
|
||||
key: 'lineTotal',
|
||||
},
|
||||
],
|
||||
'sort-function': function (a, b) {
|
||||
const t1 = Date.parse(a.date).getTime();
|
||||
const t2 = Date.parse(b.date).getTime();
|
||||
|
||||
return (t1 < t2);
|
||||
},
|
||||
'custom-validate-function': function (data) {
|
||||
const res = {};
|
||||
res.valid = true;
|
||||
data.date = new Date().toString('d-MMM-yyyy hh:mm tt');
|
||||
res.params = data;
|
||||
return res;
|
||||
},
|
||||
|
||||
}],
|
||||
];
|
||||
}
|
||||
|
||||
getTableColumns() {
|
||||
return [
|
||||
{
|
||||
title: 'Invoice Id',
|
||||
dataIndex: 'invoiceId',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: 'Description',
|
||||
dataIndex: 'description',
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
getTableActionButtonJsx(adapter) {
|
||||
return (text, record) => (
|
||||
<Space size="middle">
|
||||
{adapter.hasAccess('save') && adapter.showEdit
|
||||
&& (
|
||||
<Tag color="green" onClick={() => modJs.edit(record.id)} style={{ cursor: 'pointer' }}>
|
||||
<EditOutlined />
|
||||
{` ${adapter.gt('Edit')}`}
|
||||
</Tag>
|
||||
)}
|
||||
{adapter.hasAccess('element')
|
||||
&& (
|
||||
<Tag color="blue" onClick={() => modJs.viewElement(record.id)} style={{ cursor: 'pointer' }}>
|
||||
<MonitorOutlined />
|
||||
{` ${adapter.gt('View')}`}
|
||||
</Tag>
|
||||
)}
|
||||
{adapter.hasAccess('delete') && adapter.showDelete
|
||||
&& (
|
||||
<Tag color="volcano" onClick={() => modJs.deleteRow(record.id)} style={{ cursor: 'pointer' }}>
|
||||
<DeleteOutlined />
|
||||
{` ${adapter.gt('Delete')}`}
|
||||
</Tag>
|
||||
)}
|
||||
{adapter.hasAccess('save')
|
||||
&& (
|
||||
<Tag color="cyan" onClick={() => modJs.copyRow(record.id)} style={{ cursor: 'pointer' }}>
|
||||
<CopyOutlined />
|
||||
{` ${adapter.gt('Copy')}`}
|
||||
</Tag>
|
||||
)}
|
||||
<Tag color="green" onClick={() => modJs.printInvoice(record.id)} style={{ cursor: 'pointer' }}>
|
||||
<PrinterOutlined />
|
||||
{` ${adapter.gt('Print')}`}
|
||||
</Tag>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
printInvoice(id) {
|
||||
const params = {};
|
||||
params.id = id;
|
||||
const reqJson = JSON.stringify(params);
|
||||
const callBackData = [];
|
||||
callBackData.callBackData = [];
|
||||
callBackData.callBackSuccess = 'printInvoiceSuccessCallback';
|
||||
callBackData.callBackFail = 'printInvoiceFailCallback';
|
||||
|
||||
this.customAction('printInvoice', 'extension=invoices', reqJson, callBackData);
|
||||
}
|
||||
|
||||
|
||||
printInvoiceSuccessCallback(callBackData) {
|
||||
this.showMessage('Success', 'Printing Done');
|
||||
this.get([]);
|
||||
}
|
||||
|
||||
|
||||
printInvoiceFailCallback(callBackData) {
|
||||
this.showMessage('Error', callBackData);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports ={InvoiceAdapter};
|
||||
+41
@@ -361,6 +361,47 @@ gulp.task('modules-js', (done) => {
|
||||
.pipe(gulp.dest('./web/dist'));
|
||||
});
|
||||
|
||||
gulp.task('extension-js', (done) => {
|
||||
let extension = process.argv.filter((item) => item.substr(0, 3) === '--x');
|
||||
if (extension.length === 1) {
|
||||
extension = extension[0].substr(3);
|
||||
}
|
||||
|
||||
// map them to our stream function
|
||||
return browserify({
|
||||
entries: [`extensions/${extension}/web/js/index.js`],
|
||||
basedir: '.',
|
||||
debug: true,
|
||||
cache: {},
|
||||
packageCache: {},
|
||||
})
|
||||
.external(vendorsFlat)
|
||||
.transform('babelify', {
|
||||
plugins: [
|
||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
||||
],
|
||||
presets: ['@babel/preset-env', '@babel/preset-react'],
|
||||
extensions: ['.js', '.jsx'],
|
||||
})
|
||||
.transform(require('browserify-css'))
|
||||
.bundle()
|
||||
.pipe(source(`${extension}.js`))
|
||||
.pipe(buffer())
|
||||
.pipe(ifElse(!isProduction, () => sourcemaps.init({ loadMaps: true })))
|
||||
.pipe(ifElse(isProduction, () => uglifyes(
|
||||
{
|
||||
compress: true,
|
||||
mangle: {
|
||||
reserved: [],
|
||||
},
|
||||
},
|
||||
)))
|
||||
.pipe(ifElse(isProduction, () => javascriptObfuscator({
|
||||
compact: true,
|
||||
})))
|
||||
.pipe(ifElse(!isProduction, () => sourcemaps.write('./')))
|
||||
.pipe(gulp.dest(`./extensions/${extension}/dist`));
|
||||
});
|
||||
|
||||
gulp.task('watch', () => {
|
||||
gulp.watch('web/admin/src/*/*.js', gulp.series('admin-js'));
|
||||
|
||||
+19
@@ -1,5 +1,24 @@
|
||||
# Release Notes IceHrm Open Source
|
||||
|
||||
## Release note v30.0.0.OS
|
||||
|
||||
### 🛡️ Security improvements
|
||||
|
||||
* This release is fixing some critical security issues related to file storage. All IceHrm installations should be upgraded to this version immediately.
|
||||
Please review instructions provided under [this link](https://icehrm.gitbook.io/icehrm/getting-started/securing-icehrm-installation) to make sure your IceHrm installation is secure.
|
||||
|
||||
### 🧲 New features
|
||||
|
||||
* Ability to use Amazon S3 as a secure file storage for IceHrm [find instructions here](https://icehrm.gitbook.io/icehrm/getting-started/using-aws-s3-for-icehrm-file-storage)
|
||||
* Secure local file storage
|
||||
* Connection module for showing critical errors in installation and sending extracting system information
|
||||
* Ability to change AWS region via settings
|
||||
|
||||
### 🐛 Bug fixes
|
||||
* Displaying employees list with non-UTF employee names
|
||||
* Fix extension loading issue. This fixes the issue with loading new extension created following the [documentation](https://icehrm.gitbook.io/icehrm/developer-guide/creating-first-extension).
|
||||
* Fix the issue with editing employee fields
|
||||
|
||||
## Release note v29.0.0.OS
|
||||
|
||||
### 🧲 New features
|
||||
|
||||
@@ -105,6 +105,7 @@ class UserAdapter extends AdapterBase {
|
||||
if (msg == null) {
|
||||
const id = $(`#${this.getTableName()}_submit #id`).val();
|
||||
params.csrf = $(`#${this.getTableName()}Form`).data('csrf');
|
||||
|
||||
if (id != null && id !== undefined && id !== '') {
|
||||
params.id = id;
|
||||
this.add(params, []);
|
||||
|
||||
@@ -453,7 +453,7 @@ class AdapterBase extends ModuleBase {
|
||||
$.getJSON(this.moduleRelativeURL, {
|
||||
t: this.table, a: 'ca', sa: subAction, mod: module, req: request,
|
||||
}, (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.status === 'SUCCESS') {
|
||||
callBackData.callBackData.push(data.data);
|
||||
that.callFunction(callBackData.callBackSuccess, callBackData.callBackData);
|
||||
} else {
|
||||
|
||||
Vendored
+47033
-4
File diff suppressed because it is too large.
Load diff
Vendored
+531
-1
@@ -1 +1,531 @@
|
||||
var _0x3da4=['#_notifications_#','value','#_time_#','.label-danger','serverGMToffset','100%','\x20hours\x20ago','July','width','setTimeUtils','#notifications','timeUtils','image','Cannot\x20call\x20a\x20class\x20as\x20a\x20function','configurable','.notificationTime','renderNotifications','templates','removeAllByPrefix','storage','RequestCache','default','August','slimscroll','setTemplates','substring','<br/>','width=','indexOf','getMinutes','getTimezoneOffset','SUCCESS','getMonth','replace','http://twitter.com/share?text=','enumerable','width=550,height=260,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200','parse','less\x20than\x20a\x20minute\x20ago','\x20new\x20notification','popup','notifications','defineProperty',',top=','3px','key','You\x20have\x20no\x20new\x20notifications','html','status','__esModule','Tuesday','https://www.linkedin.com/cws/share?url=','split','renderNotification','#_image_#','find','March','SocialShare','\x20minutes\x20ago','getHours',',height=','exports','./Notifications','getKey','.navbar\x20.menu','function','#_count_#','November','about\x20an\x20hour\x20ago','February',',left=','getNotifications','./TimeUtils','getLineBreakString','baseUrl','May','toString','getItem','replaceWith','clearNotifications','css','round','getTime','#_url_#','writable','MODULE_NOT_FOUND','prototype','Share\x20on\x20Google','Share\x20on\x20Linked\x20in','clearPendingNotifications','getMySQLFormatDate','code','concat','#_message_#','September','setData','notification','service.php','abs','action','Wednesday','getData','each','remove','invalidateTable','#_header_#','getJSON','message','keys','open','setupNotifications','\x20new\x20notifications','./SocialShare','setBaseUrl','height','You\x20have\x20','length','\x20at\x20','January','call','https://plus.google.com/share?url=','June','time','https://www.facebook.com/sharer/sharer.php?u=','&url=','Thursday','./RequestCache','about\x20a\x20minute\x20ago','December','Sunday','setServerGMToffset','Saturday','getFullYear','data','title','320px'];(function(_0x198ecd,_0x3da454){var _0x54958e=function(_0x484a68){while(--_0x484a68){_0x198ecd['push'](_0x198ecd['shift']());}};_0x54958e(++_0x3da454);}(_0x3da4,0x86));var _0x5495=function(_0x198ecd,_0x3da454){_0x198ecd=_0x198ecd-0x0;var _0x54958e=_0x3da4[_0x198ecd];return _0x54958e;};!function e(_0x484a68,_0x3c0cbb,_0x4be79d){var _0x53a125=_0x5495;function _0x1c5197(_0x411bc1,_0x5f551e){var _0x1842d6=_0x5495;if(!_0x3c0cbb[_0x411bc1]){if(!_0x484a68[_0x411bc1]){var _0x4d20c0='function'==typeof require&&require;if(!_0x5f551e&&_0x4d20c0)return _0x4d20c0(_0x411bc1,!0x0);if(_0x4f741c)return _0x4f741c(_0x411bc1,!0x0);var _0x2d52c9=new Error('Cannot\x20find\x20module\x20\x27'+_0x411bc1+'\x27');throw _0x2d52c9[_0x1842d6('0x5d')]=_0x1842d6('0x57'),_0x2d52c9;}var _0x557b9a=_0x3c0cbb[_0x411bc1]={'exports':{}};_0x484a68[_0x411bc1][0x0][_0x1842d6('0x79')](_0x557b9a[_0x1842d6('0x3f')],function(_0x20b96e){return _0x1c5197(_0x484a68[_0x411bc1][0x1][_0x20b96e]||_0x20b96e);},_0x557b9a,_0x557b9a[_0x1842d6('0x3f')],e,_0x484a68,_0x3c0cbb,_0x4be79d);}return _0x3c0cbb[_0x411bc1][_0x1842d6('0x3f')];}for(var _0x4f741c=_0x53a125('0x43')==typeof require&&require,_0x3d305d=0x0;_0x3d305d<_0x4be79d['length'];_0x3d305d++)_0x1c5197(_0x4be79d[_0x3d305d]);return _0x1c5197;}({0x1:[function(_0x1e7ed6,_0x1ede44,_0x347c04){var _0x2282bd=_0x5495;'use strict';function _0x24486b(_0x31cc8e,_0x34549e){var _0x3c6c9a=_0x5495;for(var _0x54c5b4=0x0;_0x54c5b4<_0x34549e[_0x3c6c9a('0x76')];_0x54c5b4++){var _0x35be4e=_0x34549e[_0x54c5b4];_0x35be4e[_0x3c6c9a('0x25')]=_0x35be4e[_0x3c6c9a('0x25')]||!0x1,_0x35be4e[_0x3c6c9a('0x10')]=!0x0,_0x3c6c9a('0x3')in _0x35be4e&&(_0x35be4e[_0x3c6c9a('0x56')]=!0x0),Object[_0x3c6c9a('0x2c')](_0x31cc8e,_0x35be4e[_0x3c6c9a('0x2f')],_0x35be4e);}}Object['defineProperty'](_0x347c04,_0x2282bd('0x33'),{'value':!0x0}),_0x347c04[_0x2282bd('0x17')]=void 0x0;var _0x5dbf35=function(){var _0x34c76f=_0x2282bd;function _0xd6b48a(){var _0x4bb2c8=_0x5495;!function(_0x44e54c,_0x7b9112){var _0xbe35ee=_0x5495;if(!(_0x44e54c instanceof _0x7b9112))throw new TypeError(_0xbe35ee('0xf'));}(this,_0xd6b48a),this['baseUrl']='',this[_0x4bb2c8('0x13')]={};}var _0x5c2002,_0x2dc18f,_0x5910b;return _0x5c2002=_0xd6b48a,(_0x2dc18f=[{'key':_0x34c76f('0x73'),'value':function(_0x5c8f0f){this['baseUrl']=_0x5c8f0f;}},{'key':_0x34c76f('0x1a'),'value':function(_0x1acf64){var _0x1b839d=_0x34c76f;this[_0x1b839d('0x13')]=_0x1acf64;}},{'key':_0x34c76f('0xb'),'value':function(_0x177850){var _0x5e1dc8=_0x34c76f;this[_0x5e1dc8('0xd')]=_0x177850;}},{'key':_0x34c76f('0x49'),'value':function(_0x3b4e27,_0x5520a2){var _0x6b77a9=_0x34c76f,_0x16838a=this;$['getJSON'](this[_0x6b77a9('0x4c')],{'a':_0x6b77a9('0x49')},function(_0x3c5c08){var _0x32508d=_0x6b77a9;_0x32508d('0x21')===_0x3c5c08[_0x32508d('0x32')]&&_0x16838a['renderNotifications'](_0x3c5c08[_0x32508d('0x87')][0x1],_0x3c5c08[_0x32508d('0x87')][0x0]);});}},{'key':_0x34c76f('0x5b'),'Line truncated
|
||||
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
var NotificationManager = /*#__PURE__*/function () {
|
||||
function NotificationManager() {
|
||||
_classCallCheck(this, NotificationManager);
|
||||
|
||||
this.baseUrl = '';
|
||||
this.templates = {};
|
||||
}
|
||||
|
||||
_createClass(NotificationManager, [{
|
||||
key: "setBaseUrl",
|
||||
value: function setBaseUrl(url) {
|
||||
this.baseUrl = url;
|
||||
}
|
||||
}, {
|
||||
key: "setTemplates",
|
||||
value: function setTemplates(data) {
|
||||
this.templates = data;
|
||||
}
|
||||
}, {
|
||||
key: "setTimeUtils",
|
||||
value: function setTimeUtils(timeUtils) {
|
||||
this.timeUtils = timeUtils;
|
||||
}
|
||||
}, {
|
||||
key: "getNotifications",
|
||||
value: function getNotifications(name, data) {
|
||||
var that = this;
|
||||
$.getJSON(this.baseUrl, {
|
||||
a: 'getNotifications'
|
||||
}, function (_data) {
|
||||
if (_data.status === 'SUCCESS') {
|
||||
that.renderNotifications(_data.data[1], _data.data[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "clearPendingNotifications",
|
||||
value: function clearPendingNotifications(name, data) {
|
||||
var that = this;
|
||||
$.getJSON(this.baseUrl, {
|
||||
a: 'clearNotifications'
|
||||
}, function (_data) {});
|
||||
}
|
||||
}, {
|
||||
key: "renderNotifications",
|
||||
value: function renderNotifications(notifications, unreadCount) {
|
||||
if (notifications.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var t = this.templates.notifications;
|
||||
|
||||
if (unreadCount > 0) {
|
||||
t = t.replace('#_count_#', unreadCount);
|
||||
|
||||
if (unreadCount > 1) {
|
||||
t = t.replace('#_header_#', "You have ".concat(unreadCount, " new notifications"));
|
||||
} else {
|
||||
t = t.replace('#_header_#', "You have ".concat(unreadCount, " new notification"));
|
||||
}
|
||||
} else {
|
||||
t = t.replace('#_count_#', '');
|
||||
t = t.replace('#_header_#', 'You have no new notifications');
|
||||
}
|
||||
|
||||
var notificationStr = '';
|
||||
|
||||
for (var index in notifications) {
|
||||
notificationStr += this.renderNotification(notifications[index]);
|
||||
}
|
||||
|
||||
t = t.replace('#_notifications_#', notificationStr);
|
||||
var $obj = $(t);
|
||||
|
||||
if (unreadCount === 0) {
|
||||
$obj.find('.label-danger').remove();
|
||||
}
|
||||
|
||||
$obj.attr('id', 'notifications');
|
||||
var k = $('#notifications');
|
||||
k.replaceWith($obj);
|
||||
$('.navbar .menu').slimscroll({
|
||||
height: '320px',
|
||||
alwaysVisible: false,
|
||||
size: '3px'
|
||||
}).css('width', '100%');
|
||||
this.timeUtils.convertToRelativeTime($('.notificationTime'));
|
||||
}
|
||||
}, {
|
||||
key: "renderNotification",
|
||||
value: function renderNotification(notification) {
|
||||
var t = this.templates.notification;
|
||||
t = t.replace('#_image_#', notification.image);
|
||||
|
||||
try {
|
||||
var json = JSON.parse(notification.action);
|
||||
t = t.replace('#_url_#', this.baseUrl.replace('service.php', '?') + json.url);
|
||||
} catch (e) {
|
||||
t = t.replace('#_url_#', '');
|
||||
}
|
||||
|
||||
t = t.replace('#_time_#', notification.time);
|
||||
t = t.replace('#_fromName_#', notification.type);
|
||||
t = t.replace('#_message_#', this.getLineBreakString(notification.message, 27));
|
||||
return t;
|
||||
}
|
||||
}, {
|
||||
key: "getLineBreakString",
|
||||
value: function getLineBreakString(str, len) {
|
||||
var t = '';
|
||||
|
||||
try {
|
||||
var arr = str.split(' ');
|
||||
var count = 0;
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
count += arr[i].length + 1;
|
||||
|
||||
if (count > len) {
|
||||
t += "".concat(arr[i], "<br/>");
|
||||
count = 0;
|
||||
} else {
|
||||
t += "".concat(arr[i], " ");
|
||||
}
|
||||
}
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
}]);
|
||||
|
||||
return NotificationManager;
|
||||
}();
|
||||
|
||||
var _default = NotificationManager;
|
||||
exports["default"] = _default;
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
|
||||
/**
|
||||
* RequestCache
|
||||
*/
|
||||
var MemoryStorage = /*#__PURE__*/function () {
|
||||
function MemoryStorage() {
|
||||
_classCallCheck(this, MemoryStorage);
|
||||
|
||||
this.data = {};
|
||||
}
|
||||
|
||||
_createClass(MemoryStorage, [{
|
||||
key: "getItem",
|
||||
value: function getItem(key) {
|
||||
return this.data[key];
|
||||
}
|
||||
}, {
|
||||
key: "setItem",
|
||||
value: function setItem(key, data) {
|
||||
this.data[key] = data;
|
||||
}
|
||||
}, {
|
||||
key: "removeAllByPrefix",
|
||||
value: function removeAllByPrefix(prefix) {
|
||||
var keys = Object.keys(this.data);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i].indexOf(prefix) > 0) {
|
||||
delete this.data[keys[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return MemoryStorage;
|
||||
}();
|
||||
|
||||
var RequestCache = /*#__PURE__*/function () {
|
||||
function RequestCache(storage) {
|
||||
_classCallCheck(this, RequestCache);
|
||||
|
||||
if (!storage) {
|
||||
this.storage = new MemoryStorage();
|
||||
} else {
|
||||
this.storage = storage;
|
||||
}
|
||||
}
|
||||
|
||||
_createClass(RequestCache, [{
|
||||
key: "getKey",
|
||||
value: function getKey(url, params) {
|
||||
var key = "".concat(url, "|");
|
||||
|
||||
for (var index in params) {
|
||||
key += "".concat(index, "=").concat(params[index], "|");
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
/*
|
||||
invalidateTable(table) {
|
||||
let key;
|
||||
for (let i = 0; i < this.storage.length; i++) {
|
||||
key = this.storage.key(i);
|
||||
if (key.indexOf(`t=${table}`) > 0) {
|
||||
this.storage.removeItem(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "invalidateTable",
|
||||
value: function invalidateTable(table) {
|
||||
this.storage.removeAllByPrefix("t=".concat(table));
|
||||
}
|
||||
}, {
|
||||
key: "getData",
|
||||
value: function getData(key) {
|
||||
var data = this.storage.getItem(key);
|
||||
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "setData",
|
||||
value: function setData(key, data) {
|
||||
if (data.status !== undefined && data.status != null && data.status !== 'SUCCESS') {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.storage.setItem(key, data);
|
||||
return data;
|
||||
}
|
||||
}]);
|
||||
|
||||
return RequestCache;
|
||||
}();
|
||||
|
||||
var _default = RequestCache;
|
||||
exports["default"] = _default;
|
||||
|
||||
},{}],3:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
var SocialShare = {
|
||||
facebook: function facebook(url) {
|
||||
var w = 700;
|
||||
var h = 500;
|
||||
var left = screen.width / 2 - w / 2;
|
||||
var top = screen.height / 2 - h / 2;
|
||||
url = "https://www.facebook.com/sharer/sharer.php?u=".concat(encodeURIComponent(url));
|
||||
window.open(url, 'Share on Facebook', "width=".concat(w, ",height=").concat(h, ",left=").concat(left, ",top=").concat(top));
|
||||
return false;
|
||||
},
|
||||
google: function google(url) {
|
||||
var w = 500;
|
||||
var h = 500;
|
||||
var left = screen.width / 2 - w / 2;
|
||||
var top = screen.height / 2 - h / 2;
|
||||
url = "https://plus.google.com/share?url=".concat(encodeURIComponent(url));
|
||||
window.open(url, 'Share on Google', "width=".concat(w, ",height=").concat(h, ",left=").concat(left, ",top=").concat(top));
|
||||
return false;
|
||||
},
|
||||
linkedin: function linkedin(url) {
|
||||
var w = 500;
|
||||
var h = 500;
|
||||
var left = screen.width / 2 - w / 2;
|
||||
var top = screen.height / 2 - h / 2;
|
||||
url = "https://www.linkedin.com/cws/share?url=".concat(encodeURIComponent(url));
|
||||
window.open(url, 'Share on Linked in', "width=".concat(w, ",height=").concat(h, ",left=").concat(left, ",top=").concat(top));
|
||||
return false;
|
||||
},
|
||||
twitter: function twitter(url, msg) {
|
||||
window.open("http://twitter.com/share?text=".concat(escape(msg), "&url=").concat(escape(url)), 'popup', 'width=550,height=260,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var _default = SocialShare;
|
||||
exports["default"] = _default;
|
||||
|
||||
},{}],4:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
/* eslint-disable camelcase,brace-style */
|
||||
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
var TimeUtils = /*#__PURE__*/function () {
|
||||
function TimeUtils() {
|
||||
_classCallCheck(this, TimeUtils);
|
||||
}
|
||||
|
||||
_createClass(TimeUtils, [{
|
||||
key: "setServerGMToffset",
|
||||
value: function setServerGMToffset(serverGMToffset) {
|
||||
this.serverGMToffset = serverGMToffset;
|
||||
}
|
||||
}, {
|
||||
key: "getMySQLFormatDate",
|
||||
value: function getMySQLFormatDate(date) {
|
||||
var format = function format(val) {
|
||||
if (val < 10) {
|
||||
return "0".concat(val);
|
||||
}
|
||||
|
||||
return val;
|
||||
};
|
||||
|
||||
return "".concat(date.getUTCFullYear(), "-").concat(format(date.getUTCMonth() + 1), "-").concat(format(date.getUTCDate()));
|
||||
}
|
||||
}, {
|
||||
key: "convertToRelativeTime",
|
||||
value: function convertToRelativeTime(selector) {
|
||||
var that = this;
|
||||
|
||||
var getAmPmTime = function getAmPmTime(curHour, curMin) {
|
||||
var amPm = 'am';
|
||||
var amPmHour = curHour;
|
||||
|
||||
if (amPmHour >= 12) {
|
||||
amPm = 'pm';
|
||||
|
||||
if (amPmHour > 12) {
|
||||
amPmHour -= 12;
|
||||
}
|
||||
}
|
||||
|
||||
var prefixCurMin = '';
|
||||
|
||||
if (curMin < 10) {
|
||||
prefixCurMin = '0';
|
||||
}
|
||||
|
||||
var prefixCurHour = '';
|
||||
|
||||
if (curHour === 0) {
|
||||
prefixCurHour = '0';
|
||||
}
|
||||
|
||||
return " at ".concat(prefixCurHour).concat(amPmHour, ":").concat(prefixCurMin).concat(curMin).concat(amPm);
|
||||
};
|
||||
|
||||
var getBrowserTimeZone = function getBrowserTimeZone() {
|
||||
var current_date = new Date();
|
||||
var gmt_offset = current_date.getTimezoneOffset() / 60;
|
||||
return -gmt_offset;
|
||||
};
|
||||
|
||||
var curDate = new Date();
|
||||
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
var timezoneDiff = this.serverGMToffset - getBrowserTimeZone();
|
||||
var timezoneTimeDiff = timezoneDiff * 60 * 60 * 1000;
|
||||
selector.each(function () {
|
||||
try {
|
||||
var thisValue = $(this).html(); // Split value into date and time
|
||||
|
||||
var thisValueArray = thisValue.split(' ');
|
||||
var thisValueDate = thisValueArray[0];
|
||||
var thisValueTime = thisValueArray[1]; // Split date into components
|
||||
|
||||
var thisValueDateArray = thisValueDate.split('-');
|
||||
var curYear = thisValueDateArray[0];
|
||||
var curMonth = thisValueDateArray[1] - 1;
|
||||
var curDay = thisValueDateArray[2]; // Split time into components
|
||||
|
||||
var thisValueTimeArray = thisValueTime.split(':');
|
||||
var curHour = thisValueTimeArray[0];
|
||||
var curMin = thisValueTimeArray[1];
|
||||
var curSec = thisValueTimeArray[2]; // Create this date
|
||||
|
||||
var thisDate = new Date(curYear, curMonth, curDay, curHour, curMin, curSec);
|
||||
var thisTime = thisDate.getTime();
|
||||
var tzDate = new Date(thisTime - timezoneTimeDiff); // var tzDay = tzDate.getDay();//getDay will return the day of the week not the month
|
||||
// var tzDay = tzDate.getUTCDate(); //getUTCDate will return the day of the month
|
||||
|
||||
var tzDay = tzDate.toString('d'); //
|
||||
|
||||
var tzYear = tzDate.getFullYear();
|
||||
var tzHour = tzDate.getHours();
|
||||
var tzMin = tzDate.getMinutes(); // Create the full date
|
||||
// var fullDate = days[tzDate.getDay()] + ", " + months[tzDate.getMonth()] + " " + tzDay + ", " + tzYear + getAmPmTime(tzHour, tzMin);
|
||||
|
||||
var fullDate = "".concat(days[tzDate.getDay()], ", ").concat(months[tzDate.getMonth()], " ").concat(tzDay, ", ").concat(tzYear).concat(getAmPmTime(tzHour, tzMin)); // Get the time different
|
||||
|
||||
var timeDiff = (curDate.getTime() - tzDate.getTime()) / 1000;
|
||||
var minDiff = Math.abs(timeDiff / 60);
|
||||
var hourDiff = Math.abs(timeDiff / (60 * 60));
|
||||
var dayDiff = Math.abs(timeDiff / (60 * 60 * 24));
|
||||
var yearDiff = Math.abs(timeDiff / (60 * 60 * 24 * 365)); // If more than a day old, display the month, day and time (and year, if applicable)
|
||||
|
||||
var fbDate = '';
|
||||
|
||||
if (dayDiff > 1) {
|
||||
// fbDate = curDay + " " + months[tzDate.getMonth()].substring(0,3);
|
||||
fbDate = "".concat(tzDay, " ").concat(months[tzDate.getMonth()].substring(0, 3)); // Add the year, if applicable
|
||||
|
||||
if (yearDiff > 1) {
|
||||
fbDate = "".concat(fbDate, " ").concat(curYear);
|
||||
} // Add the time
|
||||
|
||||
|
||||
fbDate += getAmPmTime(tzHour, tzMin);
|
||||
} // Less than a day old, and more than an hour old
|
||||
else if (hourDiff >= 1) {
|
||||
var roundedHour = Math.round(hourDiff);
|
||||
if (roundedHour === 1) fbDate = 'about an hour ago';else fbDate = "".concat(roundedHour, " hours ago");
|
||||
} // Less than an hour, and more than a minute
|
||||
else if (minDiff >= 1) {
|
||||
var roundedMin = Math.round(minDiff);
|
||||
if (roundedMin === 1) fbDate = 'about a minute ago';else fbDate = "".concat(roundedMin, " minutes ago");
|
||||
} // Less than a minute
|
||||
else if (minDiff < 1) {
|
||||
fbDate = 'less than a minute ago';
|
||||
} // Update this element
|
||||
|
||||
|
||||
$(this).html(fbDate);
|
||||
$(this).attr('title', fullDate);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return TimeUtils;
|
||||
}();
|
||||
|
||||
var _default = TimeUtils;
|
||||
exports["default"] = _default;
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
var _Notifications = _interopRequireDefault(require("./Notifications"));
|
||||
|
||||
var _TimeUtils = _interopRequireDefault(require("./TimeUtils"));
|
||||
|
||||
var _RequestCache = _interopRequireDefault(require("./RequestCache"));
|
||||
|
||||
var _SocialShare = _interopRequireDefault(require("./SocialShare"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
/* global timeUtils */
|
||||
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
window.RequestCache = _RequestCache["default"];
|
||||
window.SocialShare = _SocialShare["default"];
|
||||
|
||||
window.setupTimeUtils = function (diffHoursBetweenServerTimezoneWithGMT) {
|
||||
var timeUtils = new _TimeUtils["default"]();
|
||||
timeUtils.setServerGMToffset(diffHoursBetweenServerTimezoneWithGMT);
|
||||
return timeUtils;
|
||||
};
|
||||
|
||||
window.setupNotifications = function (baseUrl) {
|
||||
var notificationManager = new _Notifications["default"]();
|
||||
notificationManager.setBaseUrl(baseUrl);
|
||||
notificationManager.setTimeUtils(timeUtils);
|
||||
return notificationManager;
|
||||
};
|
||||
|
||||
},{"./Notifications":1,"./RequestCache":2,"./SocialShare":3,"./TimeUtils":4}]},{},[5])
|
||||
|
||||
//# sourceMappingURL=common.js.map
|
||||
Vendored
+10479
-4
File diff suppressed because it is too large.
Load diff
Vendored
+37479
-5
File diff suppressed because it is too large.
Load diff
Vendored
+34095
-34095
File diff suppressed because it is too large.
Load diff
Vendored
+91750
-5
File diff suppressed because it is too large.
Load diff
Vendored
+39547
-2
File diff suppressed because it is too large.
Load diff
Vendored
+92733
-5
File diff suppressed because it is too large.
Load diff
Vendored
+15464
-2
File diff suppressed because it is too large.
Load diff
Vendored
+28918
-10
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user