Version Notes
Frontend update
Download this release
Release Info
Developer | Davide Costa |
Extension | Squeezol_Payment |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- app/code/local/Squeezol/Payment/Model/Params.php +1 -1
- app/code/local/Squeezol/Payment/Model/Paramsandbox.php +3 -1
- app/code/local/Squeezol/Payment/controllers/IndexController.php +149 -146
- app/design/frontend/base/default/template/squeezol_payment/create.phtml +8 -7
- app/design/frontend/base/default/template/squeezol_payment/digest.phtml +4 -4
- app/design/frontend/base/default/template/squeezol_payment/invitation.phtml +4 -4
- app/design/frontend/base/default/template/squeezol_payment/logo.phtml +5 -5
- app/design/frontend/base/default/template/squeezol_payment/review.phtml +49 -30
- app/design/frontend/base/default/template/squeezol_payment/start.phtml +59 -47
- lib/oauth2/Client.php +186 -185
- lib/oauth2/auth_request.php +27 -18
- package.xml +1 -1
- skin/frontend/base/default/css/squeezol.css +124 -82
- skin/frontend/base/default/images/squeezol_payment/ajax-loader.gif +0 -0
- skin/frontend/base/default/images/squeezol_payment/btn-finger.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/busta.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/busta2.jpg +0 -0
- skin/frontend/base/default/images/squeezol_payment/calendar.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/check.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/default.jpg +0 -0
- skin/frontend/base/default/images/squeezol_payment/fb_login.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/fenicottero.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/g_login.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/gestpay.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/ghianda_step_blu.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/ghianda_step_grigia.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/info-black.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/logo_min.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/pay_button.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/pay_button2.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/plus.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/salva2.jpg +0 -0
- skin/frontend/base/default/images/squeezol_payment/salvadanaio.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/shopping-cart.jpg +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-aziende.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-creasplit-pink.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-creasplit.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-invita-pink.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-invita.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-riassunto-pink.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/squeezol_icon-riassunto.png +0 -0
- skin/frontend/base/default/images/squeezol_payment/x.png +0 -0
- skin/frontend/base/default/js/_squeezol3.js +578 -521
app/code/local/Squeezol/Payment/Model/Params.php
CHANGED
@@ -5,7 +5,7 @@ class Squeezol_Payment_Model_Params extends Mage_Core_Model_Abstract {
|
|
5 |
const CALLBACK_URL = 'squeezol/index/oauth';
|
6 |
const REQUEST_TOKEN_URL = 'https://www.squeezol.com/api/oauth2/request_token/';
|
7 |
const ACCESS_TOKEN_URL = 'https://www.squeezol.com/api/oauth2/access_token/';
|
8 |
-
const AUTHORIZATION_URL = 'https://www.squeezol.com/
|
9 |
|
10 |
const PAY_PAGE = 'squeezol/index/pay';
|
11 |
const REVIEW_PAGE = 'squeezol/index/review';
|
5 |
const CALLBACK_URL = 'squeezol/index/oauth';
|
6 |
const REQUEST_TOKEN_URL = 'https://www.squeezol.com/api/oauth2/request_token/';
|
7 |
const ACCESS_TOKEN_URL = 'https://www.squeezol.com/api/oauth2/access_token/';
|
8 |
+
const AUTHORIZATION_URL = 'https://www.squeezol.com/plugin/authorize/';
|
9 |
|
10 |
const PAY_PAGE = 'squeezol/index/pay';
|
11 |
const REVIEW_PAGE = 'squeezol/index/review';
|
app/code/local/Squeezol/Payment/Model/Paramsandbox.php
CHANGED
@@ -5,13 +5,15 @@ class Squeezol_Payment_Model_Paramsandbox extends Mage_Core_Model_Abstract {
|
|
5 |
const CALLBACK_URL = 'squeezol/index/oauth';
|
6 |
const REQUEST_TOKEN_URL = 'https://sandbox.squeezol.com/api/oauth2/request_token/';
|
7 |
const ACCESS_TOKEN_URL = 'https://sandbox.squeezol.com/api/oauth2/access_token/';
|
8 |
-
const AUTHORIZATION_URL = 'https://sandbox.squeezol.com/
|
9 |
|
10 |
const PAY_PAGE = 'squeezol/index/pay';
|
11 |
const REVIEW_PAGE = 'squeezol/index/review';
|
12 |
|
13 |
const RESOURCE_USER_URL = 'https://sandbox.squeezol.com/api/user/';
|
14 |
const RESOURCE_GROUP_URL = 'https://sandbox.squeezol.com/api/group/create/.json';
|
|
|
|
|
15 |
const RESOURCE_PRODUCT_URL = 'https://sandbox.squeezol.com/api/product/create/';
|
16 |
const RESOURCE_DIGEST_URL = 'https://sandbox.squeezol.com/api/group/digest/';
|
17 |
const RESOURCE_INVITATION_URL = 'https://sandbox.squeezol.com/api/group/invitation/';
|
5 |
const CALLBACK_URL = 'squeezol/index/oauth';
|
6 |
const REQUEST_TOKEN_URL = 'https://sandbox.squeezol.com/api/oauth2/request_token/';
|
7 |
const ACCESS_TOKEN_URL = 'https://sandbox.squeezol.com/api/oauth2/access_token/';
|
8 |
+
const AUTHORIZATION_URL = 'https://sandbox.squeezol.com/plugin/authorize/';
|
9 |
|
10 |
const PAY_PAGE = 'squeezol/index/pay';
|
11 |
const REVIEW_PAGE = 'squeezol/index/review';
|
12 |
|
13 |
const RESOURCE_USER_URL = 'https://sandbox.squeezol.com/api/user/';
|
14 |
const RESOURCE_GROUP_URL = 'https://sandbox.squeezol.com/api/group/create/.json';
|
15 |
+
// TODO: verificare funzioanmento, test in corso
|
16 |
+
#const RESOURCE_GROUP_NEW_URL = 'https://test.squeezol.com/api/group/create_new/.json';
|
17 |
const RESOURCE_PRODUCT_URL = 'https://sandbox.squeezol.com/api/product/create/';
|
18 |
const RESOURCE_DIGEST_URL = 'https://sandbox.squeezol.com/api/group/digest/';
|
19 |
const RESOURCE_INVITATION_URL = 'https://sandbox.squeezol.com/api/group/invitation/';
|
app/code/local/Squeezol/Payment/controllers/IndexController.php
CHANGED
@@ -21,130 +21,133 @@ class Squeezol_Payment_IndexController extends Mage_Core_Controller_Front_Action
|
|
21 |
}
|
22 |
|
23 |
public function gatewayAction () {
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$this->renderLayout();
|
45 |
-
|
46 |
-
return $this;
|
47 |
}
|
48 |
|
49 |
public function payAction () {
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
if(
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
} else if($_SERVER['REQUEST_METHOD'] == 'GET') {
|
77 |
-
$endpoint = new SqueezolGroupsEndpoint($token, $_POST);
|
78 |
-
$res = $endpoint->get_group();
|
79 |
-
} else {
|
80 |
-
$ret = $BAD_REQUEST;
|
81 |
-
}
|
82 |
-
|
83 |
-
if($endpoint->isValid()) {
|
84 |
-
$ret = $res;
|
85 |
-
} else {
|
86 |
-
$ret = $res;
|
87 |
-
}
|
88 |
} else {
|
89 |
-
$ret = $
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
public function oauthAction () {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
$client = new OAuth2\Client($app_id, $secret);
|
121 |
-
|
122 |
if (!isset($_GET['code'])) {
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
} else {
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
public function reviewAction () {
|
147 |
-
|
148 |
$token = $this->getSession()->getSqueezolToken();
|
149 |
if (empty($token)) {
|
150 |
|
@@ -165,25 +168,27 @@ class Squeezol_Payment_IndexController extends Mage_Core_Controller_Front_Action
|
|
165 |
|
166 |
$callbackUrl = $basePath . $paramsModel::CALLBACK_URL;
|
167 |
$this->getSession()->setFromReview(true);
|
168 |
-
|
169 |
$client = new OAuth2\Client($app_id, $secret);
|
170 |
-
|
171 |
if (!isset($_GET['code'])) {
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
} else {
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
|
181 |
-
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
}
|
|
|
|
|
|
|
187 |
}
|
188 |
|
189 |
$this->loadLayout();
|
@@ -276,31 +281,29 @@ class Squeezol_Payment_IndexController extends Mage_Core_Controller_Front_Action
|
|
276 |
}
|
277 |
|
278 |
public function ipnAction () {
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
$order->cancel()->save();
|
301 |
-
$ret = array('status'=>'I', 'order_id' => $order->getId(), 'group' => $data['group']);
|
302 |
-
}
|
303 |
}
|
304 |
-
|
|
|
305 |
}
|
306 |
}
|
21 |
}
|
22 |
|
23 |
public function gatewayAction () {
|
24 |
+
$lastOrderId = isset($_GET['oid']) ? $_GET['oid'] : null;
|
25 |
+
|
26 |
+
if (!$lastOrderId) {
|
27 |
+
$lastOrderId = Mage::getSingleton('checkout/session')
|
28 |
+
->getLastRealOrderId();
|
29 |
+
}
|
30 |
+
|
31 |
+
if (!$lastOrderId) {
|
32 |
+
die();
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->getSession()->setCurrOrder($lastOrderId);
|
36 |
+
$group = Mage::helper('squeezol_payment')->getGroupByOrder($lastOrderId);
|
37 |
+
if (!$group) {
|
38 |
+
Mage::helper('squeezol_payment')->insertOrder($lastOrderId);
|
39 |
+
}
|
40 |
+
|
41 |
+
$this->loadLayout();
|
42 |
+
$this->renderLayout();
|
43 |
+
return $this;
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
public function payAction () {
|
47 |
+
require_once Mage::getBaseDir('lib') . '/Squeezol/endpoints.php';
|
48 |
+
|
49 |
+
$UNAUTH_ERROR = array("status" => "error", "error" => "unauth_request");
|
50 |
+
$FORM_OK = array("status" => "ok");
|
51 |
+
$INVALID_FORM_ERROR = array("status" => "error", "error" => "form_error" );
|
52 |
+
$BAD_REQUEST = array("status" => "error", "error" => "bad_request");
|
53 |
+
$token = $this->getSession()->getSqueezolToken();
|
54 |
+
if (empty($_POST)) {
|
55 |
+
$helper = Mage::helper('squeezol_payment');
|
56 |
+
$prod_data = $helper->getJsonProductsData();
|
57 |
+
$token = $this->getSession()->getSqueezolToken();
|
58 |
+
$endpoint = new SqueezolProductsEndpoint($token, $prod_data);
|
59 |
+
$data = $endpoint->create_product();
|
60 |
+
} else {
|
61 |
+
$token = $this->getSession()->getSqueezolToken();
|
62 |
+
if(!empty($token)) {
|
63 |
+
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
64 |
+
$endpoint = new SqueezolGroupsEndpoint($token, $_POST);
|
65 |
+
$res = $endpoint->create_group();
|
66 |
+
if ($res['status'] !== 'error') {
|
67 |
+
Mage::helper('squeezol_payment')->updateGroup($res['group_id'], $this->getSession()->getCurrOrder());
|
68 |
+
}
|
69 |
+
|
70 |
+
} else if($_SERVER['REQUEST_METHOD'] == 'GET') {
|
71 |
+
$endpoint = new SqueezolGroupsEndpoint($token, $_POST);
|
72 |
+
$res = $endpoint->get_group();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
} else {
|
74 |
+
$ret = $BAD_REQUEST;
|
75 |
}
|
76 |
|
77 |
+
if($endpoint->isValid()) {
|
78 |
+
$ret = $res;
|
79 |
+
} else {
|
80 |
+
$ret = $res;
|
81 |
+
}
|
82 |
+
} else {
|
83 |
+
$ret = $UNAUTH_ERROR;
|
84 |
+
}
|
85 |
+
echo json_encode($ret);
|
86 |
+
die();
|
87 |
+
}
|
88 |
+
$this->loadLayout();
|
89 |
+
$this->renderLayout();
|
90 |
+
return $this;
|
91 |
}
|
92 |
|
93 |
public function oauthAction () {
|
94 |
+
require_once Mage::getBaseDir('lib') . '/oauth2/Client.php';
|
95 |
+
require_once Mage::getBaseDir('lib') . '/oauth2/GrantType/IGrantType.php';
|
96 |
+
require_once Mage::getBaseDir('lib') . '/oauth2/GrantType/AuthorizationCode.php';
|
97 |
+
$token = $this->getSession()->getSqueezolToken();
|
98 |
+
|
99 |
+
$model = Mage::getModel('squeezol_payment/paymentMethod');
|
100 |
+
if ($model->getConfigData('use_sandbox') == 1) {
|
101 |
+
$paramsModel = Mage::getModel('squeezol_payment/paramsandbox');
|
102 |
+
} else {
|
103 |
+
$paramsModel = Mage::getModel('squeezol_payment/params');
|
104 |
+
}
|
105 |
+
|
106 |
+
$app_id = $model->getConfigData('app_id');
|
107 |
+
$secret = $model->getConfigData('app_secret');
|
108 |
+
$basePath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
109 |
+
|
110 |
+
$callbackUrl = $basePath . $paramsModel::CALLBACK_URL;
|
111 |
+
if (empty($token)) {
|
112 |
$client = new OAuth2\Client($app_id, $secret);
|
113 |
+
|
114 |
if (!isset($_GET['code'])) {
|
115 |
+
$extra_parameters = array('scope' => 'create+pay');
|
116 |
+
$auth_url = $client->getAuthenticationUrl($paramsModel::AUTHORIZATION_URL, $callbackUrl, $extra_parameters);
|
117 |
+
header('Location: ' . $auth_url);
|
118 |
+
die('Redirect');
|
119 |
} else {
|
120 |
+
$params = array('code' => $_GET['code'], 'redirect_uri' => $callbackUrl);
|
121 |
+
$response = $client->getAccessToken($paramsModel::ACCESS_TOKEN_URL, 'authorization_code', $params);
|
122 |
+
$info = $response['result'];
|
123 |
+
|
124 |
+
$client->setAccessToken($info['access_token']);
|
125 |
+
|
126 |
+
$this->getSession()->setSqueezolToken($info['access_token']);
|
127 |
+
$this->getSession()->setExpirationTime($_SERVER['REQUEST_TIME'] + $info['expires_in']);
|
128 |
+
$this->getSession()->setRefreshToken($info['refresh_token']);
|
129 |
+
if ($this->getSession()->getFromReview()) {
|
130 |
+
header('Location: ' . $basePath . $paramsModel::REVIEW_PAGE);
|
131 |
+
$this->getSession()->unsFromReview();
|
132 |
+
} else {
|
133 |
+
header('Location: ' . $basePath . $paramsModel::PAY_PAGE);
|
134 |
+
}
|
135 |
+
die();
|
136 |
+
}
|
137 |
+
}
|
138 |
+
else{
|
139 |
+
if ($this->getSession()->getFromReview()) {
|
140 |
+
header('Location: ' . $basePath . $paramsModel::REVIEW_PAGE);
|
141 |
+
$this->getSession()->unsFromReview();
|
142 |
+
} else {
|
143 |
+
header('Location: ' . $basePath . $paramsModel::PAY_PAGE);
|
144 |
}
|
145 |
+
die();
|
146 |
+
}
|
147 |
+
|
148 |
}
|
149 |
|
150 |
public function reviewAction () {
|
|
|
151 |
$token = $this->getSession()->getSqueezolToken();
|
152 |
if (empty($token)) {
|
153 |
|
168 |
|
169 |
$callbackUrl = $basePath . $paramsModel::CALLBACK_URL;
|
170 |
$this->getSession()->setFromReview(true);
|
171 |
+
/* TODO: SEMBRA ANDARE
|
172 |
$client = new OAuth2\Client($app_id, $secret);
|
|
|
173 |
if (!isset($_GET['code'])) {
|
174 |
+
$extra_parameters = array('scope' => 'create+pay');
|
175 |
+
$auth_url = $client->getAuthenticationUrl($paramsModel::AUTHORIZATION_URL, $callbackUrl, $extra_parameters);
|
176 |
+
header('Location: ' . $auth_url);
|
177 |
+
die('Redirect');
|
178 |
} else {
|
179 |
+
$params = array('code' => $_GET['code'], 'redirect_uri' => $callbackUrl);
|
180 |
+
$response = $client->getAccessToken($paramsModel::ACCESS_TOKEN_URL, 'authorization_code', $params);
|
181 |
+
$info = $response['result'];
|
182 |
|
183 |
+
$client->setAccessToken($info['access_token']);
|
184 |
|
185 |
+
$this->getSession()->setSqueezolToken($info['access_token']);
|
186 |
+
header('Location: ' . $basePath . $paramsModel::REVIEW_PAGE);
|
187 |
+
die();
|
188 |
}
|
189 |
+
header('Location: ' . $basePath . $paramsModel::REVIEW_PAGE);
|
190 |
+
die();
|
191 |
+
*/
|
192 |
}
|
193 |
|
194 |
$this->loadLayout();
|
281 |
}
|
282 |
|
283 |
public function ipnAction () {
|
284 |
+
$payload = file_get_contents('php://input');
|
285 |
+
$data = json_decode($payload, true);
|
286 |
+
$group = Mage::helper('squeezol_payment')->getOrderByGroup($data['group']);
|
287 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($group['order_id']);
|
288 |
+
if ($order && $order->getId()) {
|
289 |
+
if ($data['status'] == 'S') {
|
290 |
+
$order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
|
291 |
+
$order->save();
|
292 |
+
$order->sendNewOrderEmail();
|
293 |
+
$historyItem = Mage::getResourceModel('sales/order_status_history_collection')->getUnnotifiedForInstance($order, Mage_Sales_Model_Order::HISTORY_ENTITY_NAME);
|
294 |
+
//track history
|
295 |
+
if ($historyItem) {
|
296 |
+
$historyItem->setIsCustomerNotified(1);
|
297 |
+
$historyItem->save();
|
298 |
+
}
|
299 |
+
$ret = array('status'=>'S', 'order_id' => $order->getId(), 'group' => $group['group_id']);
|
300 |
+
} else {
|
301 |
+
//$order->setStatus($model->getConfigData('order_canceled'));
|
302 |
+
$order->setStatus(Mage_Sales_Model_Order::STATE_CANCELED);
|
303 |
+
$order->cancel()->save();
|
304 |
+
$ret = array('status'=>'I', 'order_id' => $order->getId(), 'group' => $group['group_id']);
|
|
|
|
|
|
|
305 |
}
|
306 |
+
}
|
307 |
+
echo json_encode($ret);
|
308 |
}
|
309 |
}
|
app/design/frontend/base/default/template/squeezol_payment/create.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<script>
|
2 |
-
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
3 |
-
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
4 |
-
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
5 |
</script>
|
6 |
|
7 |
<?php
|
@@ -10,12 +10,13 @@ var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
|
10 |
|
11 |
$items = $this->getOrderItems();
|
12 |
?>
|
13 |
-
<div id="squeezol_view"
|
|
|
14 |
|
15 |
<?php
|
16 |
$model = Mage::getModel('squeezol_payment/params');
|
17 |
-
$invitation_url = Mage::getBaseUrl() . '
|
18 |
-
$digest_url = Mage::getBaseUrl() . '
|
19 |
?>
|
20 |
|
21 |
<script>
|
@@ -23,7 +24,7 @@ SqueezolApi.createGroup(
|
|
23 |
'<?php echo money_format('%.2n', $order['base_grand_total']) ?>',
|
24 |
'<?php echo $order['base_currency_code']; ?>',
|
25 |
'<?php echo json_encode($this->getProductsIds()) ?>',
|
26 |
-
'<?php echo Mage::getBaseUrl() . '
|
27 |
'<?php echo $invitation_url; ?>',
|
28 |
'<?php echo $digest_url; ?>'
|
29 |
);
|
1 |
<script>
|
2 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
3 |
+
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/css/';
|
4 |
+
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/js/';
|
5 |
</script>
|
6 |
|
7 |
<?php
|
10 |
|
11 |
$items = $this->getOrderItems();
|
12 |
?>
|
13 |
+
<div id="squeezol_view">
|
14 |
+
</div>
|
15 |
|
16 |
<?php
|
17 |
$model = Mage::getModel('squeezol_payment/params');
|
18 |
+
$invitation_url = Mage::getBaseUrl() . 'squeezol/index/invitation/?page=group_id';
|
19 |
+
$digest_url = Mage::getBaseUrl() . 'squeezol/index/digest/?page=group_id';
|
20 |
?>
|
21 |
|
22 |
<script>
|
24 |
'<?php echo money_format('%.2n', $order['base_grand_total']) ?>',
|
25 |
'<?php echo $order['base_currency_code']; ?>',
|
26 |
'<?php echo json_encode($this->getProductsIds()) ?>',
|
27 |
+
'<?php echo Mage::getBaseUrl() . 'squeezol/index/pay'; ?>',
|
28 |
'<?php echo $invitation_url; ?>',
|
29 |
'<?php echo $digest_url; ?>'
|
30 |
);
|
app/design/frontend/base/default/template/squeezol_payment/digest.phtml
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<script>
|
2 |
-
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
3 |
-
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
4 |
-
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
5 |
</script>
|
6 |
|
7 |
<div id="squeezol_view"></div>
|
8 |
|
9 |
<script>
|
10 |
-
SqueezolApi.getDigestData( '<?php echo $_GET['page']; ?>', '<?php echo Mage::getBaseUrl();
|
11 |
</script>
|
12 |
|
13 |
<style>
|
1 |
<script>
|
2 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
3 |
+
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/css/';
|
4 |
+
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/js/';
|
5 |
</script>
|
6 |
|
7 |
<div id="squeezol_view"></div>
|
8 |
|
9 |
<script>
|
10 |
+
SqueezolApi.getDigestData( '<?php echo $_GET['page']; ?>', '<?php echo Mage::getBaseUrl(); ?>squeezol/index/getdigest');
|
11 |
</script>
|
12 |
|
13 |
<style>
|
app/design/frontend/base/default/template/squeezol_payment/invitation.phtml
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<script>
|
2 |
-
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
3 |
-
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
4 |
-
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
5 |
</script>
|
6 |
|
7 |
<div id="squeezol_view"></div>
|
8 |
|
9 |
<script>
|
10 |
-
SqueezolApi.getInvitationData( '<?php echo $_GET['page']; ?>', '<?php echo Mage::getBaseUrl();
|
11 |
</script>
|
12 |
|
13 |
<style>
|
1 |
<script>
|
2 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
3 |
+
var css_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/css/';
|
4 |
+
var js_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/js/';
|
5 |
</script>
|
6 |
|
7 |
<div id="squeezol_view"></div>
|
8 |
|
9 |
<script>
|
10 |
+
SqueezolApi.getInvitationData( '<?php echo $_GET['page']; ?>', '<?php echo Mage::getBaseUrl(); ?>squeezol/index/getinvitation');
|
11 |
</script>
|
12 |
|
13 |
<style>
|
app/design/frontend/base/default/template/squeezol_payment/logo.phtml
CHANGED
@@ -60,7 +60,7 @@
|
|
60 |
}
|
61 |
|
62 |
.sq-popover {
|
63 |
-
width:
|
64 |
}
|
65 |
|
66 |
.sq-img-responsive {
|
@@ -87,7 +87,7 @@
|
|
87 |
h4.sq-text-center {
|
88 |
display: block;
|
89 |
float: left;
|
90 |
-
line-height:
|
91 |
margin-left: 1px;
|
92 |
width: 65% !important;
|
93 |
font-size: 14px !important;
|
@@ -115,11 +115,11 @@ h3.sq-text-center {
|
|
115 |
<script>
|
116 |
(function() {
|
117 |
'use strict';
|
118 |
-
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
119 |
var wizard, sqBox, sqImg, sqh, sqNode, sqImg, i, sqPopover,
|
120 |
sqView, eView, colXs, sqWrite, sqImgLogo, sqHow;
|
121 |
var imgSuffix = ['btn2.jpg', 'busta2.jpg', 'salva2.jpg'];
|
122 |
-
var sqText = ['1.Crea
|
123 |
var locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
|
124 |
var inp=document.getElementById('p_method_squeezol_payment');
|
125 |
|
@@ -136,7 +136,7 @@ h3.sq-text-center {
|
|
136 |
sqWrite.setAttribute('style', 'cursor:pointer; position: relative; left: 5px;');
|
137 |
|
138 |
sqImgLogo = document.createElement('img');
|
139 |
-
sqImgLogo.setAttribute('src', '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
140 |
sqImgLogo.setAttribute('style', 'height: 24px; margin-left:10px; margin-right: 10px; display:inline;');
|
141 |
sqWrite.appendChild(sqImgLogo);
|
142 |
//sqWrite.appendChild(sqHow);
|
60 |
}
|
61 |
|
62 |
.sq-popover {
|
63 |
+
width: 400px;
|
64 |
}
|
65 |
|
66 |
.sq-img-responsive {
|
87 |
h4.sq-text-center {
|
88 |
display: block;
|
89 |
float: left;
|
90 |
+
line-height: 80px;
|
91 |
margin-left: 1px;
|
92 |
width: 65% !important;
|
93 |
font-size: 14px !important;
|
115 |
<script>
|
116 |
(function() {
|
117 |
'use strict';
|
118 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
119 |
var wizard, sqBox, sqImg, sqh, sqNode, sqImg, i, sqPopover,
|
120 |
sqView, eView, colXs, sqWrite, sqImgLogo, sqHow;
|
121 |
var imgSuffix = ['btn2.jpg', 'busta2.jpg', 'salva2.jpg'];
|
122 |
+
var sqText = ['1.Crea un pagamento di gruppo', '2.Invita chi vuoi a dividere l\'acquisto', '3.Versa solo la tua quota'];
|
123 |
var locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
|
124 |
var inp=document.getElementById('p_method_squeezol_payment');
|
125 |
|
136 |
sqWrite.setAttribute('style', 'cursor:pointer; position: relative; left: 5px;');
|
137 |
|
138 |
sqImgLogo = document.createElement('img');
|
139 |
+
sqImgLogo.setAttribute('src', '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/logo_min.png');
|
140 |
sqImgLogo.setAttribute('style', 'height: 24px; margin-left:10px; margin-right: 10px; display:inline;');
|
141 |
sqWrite.appendChild(sqImgLogo);
|
142 |
//sqWrite.appendChild(sqHow);
|
app/design/frontend/base/default/template/squeezol_payment/review.phtml
CHANGED
@@ -1,53 +1,72 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
2 |
$groups = Mage::helper('squeezol_payment')->getGroupsData();
|
3 |
|
4 |
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
5 |
|
6 |
$sql = 'SELECT * FROM squeezol_groups WHERE group_id IS NULL AND user_id = ' . $customerId;
|
7 |
$orders = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchAll($sql);
|
8 |
-
?>
|
9 |
|
10 |
-
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/fenicottero.png" style="
|
11 |
-
<
|
12 |
-
|
13 |
-
<table class="sq-table sq-table-bordered">
|
14 |
<tr>
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
</tr>
|
22 |
|
23 |
<?php foreach ($groups as $g): ?>
|
24 |
<tr>
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
</tr>
|
32 |
<?php endforeach; ?>
|
33 |
-
</table>
|
34 |
|
35 |
-
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/fenicottero.png" style="
|
36 |
-
<
|
37 |
|
38 |
-
<table class="sq-table sq-table-
|
39 |
<tr>
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
</tr>
|
44 |
|
45 |
<?php foreach ($orders as $o): ?>
|
46 |
-
<?php $ord = Mage::getModel('sales/order')->loadByIncrementId($o['order_id'])->getId(); ?>
|
47 |
-
|
48 |
<td>#<?php echo $o['order_id']; ?></td>
|
|
|
49 |
<td><a href="<?php echo Mage::getBaseUrl(); ?>sales/order/view/order_id/<?php echo $ord; ?>/">Visualizza</a></td>
|
50 |
-
<td><a href="<?php echo Mage::getBaseUrl(); ?>squeezol/index/gateway/?oid=<?php echo $o['order_id']; ?>">Crea</a></td>
|
51 |
-
|
52 |
<?php endforeach; ?>
|
53 |
-
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$squeezolToken = Mage::getSingleton("squeezol_payment/session")->getSqueezolToken();
|
3 |
+
if (!empty($squeezolToken)): ?>
|
4 |
+
<?php
|
5 |
$groups = Mage::helper('squeezol_payment')->getGroupsData();
|
6 |
|
7 |
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
8 |
|
9 |
$sql = 'SELECT * FROM squeezol_groups WHERE group_id IS NULL AND user_id = ' . $customerId;
|
10 |
$orders = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchAll($sql);
|
11 |
+
?>
|
12 |
|
13 |
+
<h1 style="display:inline;"><img style="display:inline; max-width: 50px;" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/fenicottero.png" style="max-width: 50px; float: left;" />
|
14 |
+
Lista Split<p style="display:inline; font-size: 16px;">: questo è l'elenco dei tuoi acquisti di gruppo che hai creato o concluso</p></h1>
|
15 |
+
<table class="sq-table sq-table-striped">
|
|
|
16 |
<tr>
|
17 |
+
<th>Nome colletta</th>
|
18 |
+
<th>Immagine</th>
|
19 |
+
<th>Giorni mancanti</th>
|
20 |
+
<th>Totale da pagare</th>
|
21 |
+
<th>Totale pagato</th>
|
22 |
+
<th></th>
|
23 |
</tr>
|
24 |
|
25 |
<?php foreach ($groups as $g): ?>
|
26 |
<tr>
|
27 |
+
<td><?php echo $g['name']; ?></td>
|
28 |
+
<td><img style="max-width: 50px;" src="<?php echo $g['picture']; ?>" /></td>
|
29 |
+
<td><?php echo $g['days_left']; ?></td>
|
30 |
+
<td><?php echo money_format('%.2n', $g['amount']) . ' ' . $g['currency']; ?></td>
|
31 |
+
<td><?php echo money_format('%.2n', $g['total_paid']) . ' ' . $g['currency']; ?></td>
|
32 |
+
<td><a href="<?php echo Mage::getBaseUrl(); ?>squeezol/index/digest/?page=<?php echo $g['id']; ?>">Vai allo split</a></td>
|
33 |
</tr>
|
34 |
<?php endforeach; ?>
|
35 |
+
</table>
|
36 |
|
37 |
+
<h1 style="float: left; display: inline;"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/fenicottero.png" style="max-width: 50px; float: left; display: inline;" />
|
38 |
+
Ordini da completare<p style="display: inline; font-size:16px;">: questo è l'elenco degli ordini in cui hai scelto Squeezol come metodo di pagamento. Crea il gruppo di acquisto o annulla l'ordine.</p></h1>
|
39 |
|
40 |
+
<table class="sq-table sq-table-striped">
|
41 |
<tr>
|
42 |
+
<th>Ordine</th>
|
43 |
+
<th>Immagine</th>
|
44 |
+
<th>Visualizza</th>
|
45 |
+
<th>Crea colletta</th>
|
46 |
</tr>
|
47 |
|
48 |
<?php foreach ($orders as $o): ?>
|
49 |
+
<?php $ord = Mage::getModel('sales/order')->loadByIncrementId($o['order_id'])->getId(); ?>
|
50 |
+
<tr>
|
51 |
<td>#<?php echo $o['order_id']; ?></td>
|
52 |
+
<td>
|
53 |
<td><a href="<?php echo Mage::getBaseUrl(); ?>sales/order/view/order_id/<?php echo $ord; ?>/">Visualizza</a></td>
|
54 |
+
<td><a href="<?php echo Mage::getBaseUrl(); ?>squeezol/index/gateway/?oid=<?php echo $o['order_id']; ?>">Crea Split</a></td>
|
55 |
+
</tr>
|
56 |
<?php endforeach; ?>
|
57 |
+
</table>'
|
58 |
+
<?php else: ?>
|
59 |
+
<div id="squeezol_btn">
|
60 |
+
<div class="sq-col-xs-4 sq-col-xs-offset-4">
|
61 |
+
<div id="sq-loading">
|
62 |
+
<img class="sq-img-responsive" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/squeezol.png">
|
63 |
+
<img class="sq-img-responsive" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/ajax-loader.gif">
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<script>
|
68 |
+
var auth_url = '<?php echo Mage::getBaseUrl(); ?>squeezol/index/oauth';
|
69 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
70 |
+
SqueezolApi.createSqButton(auth_url, 'big', '<?php $squeezolToken; ?>');
|
71 |
+
</script>
|
72 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/squeezol_payment/start.phtml
CHANGED
@@ -1,50 +1,62 @@
|
|
1 |
<script>
|
2 |
-
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
|
|
3 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
<h4 class="sq-text">
|
8 |
-
Squeezol ti permette di dividire il costo del carrello con amici, colleghi e parenti.
|
9 |
-
</h4>
|
10 |
-
|
11 |
-
<h3> Come procedere: </h3>
|
12 |
-
<p> <p class="sq-text">Clicca su Pay With Squeezol</p> e autorizza l'utilizzo del servizio. </p>
|
13 |
-
<p> Dai un nome e una descrizione alla colletta e dillo ai tuoi invitati con email e Facebook.</p>
|
14 |
-
<p> <p class="sq-text">Paga la tua quota</p> e...non aver fretta, i partecipanti avranno <p class="sq-text">20 giorni</p> di tempo per completare l'acquisto!</p>
|
15 |
-
|
16 |
-
<div id="squeezol_btn"></div>
|
17 |
-
|
18 |
-
<table class="shipping-data sq-table sq-table-bordered">
|
19 |
-
<tr>
|
20 |
-
<th>Oggetto</th>
|
21 |
-
<th>Quantità</th>
|
22 |
-
<th>Prezzo</th>
|
23 |
-
</tr>
|
24 |
-
|
25 |
-
<?php foreach ($this->getOrderItems() as $item): ?>
|
26 |
-
<?php
|
27 |
-
$data = $item->getData();
|
28 |
-
?>
|
29 |
-
|
30 |
-
<tr>
|
31 |
-
<td><?php echo $data['name']; ?></td>
|
32 |
-
<td><?php echo round($data['qty_ordered']); ?></td>
|
33 |
-
<td><?php echo money_format('%.2n', $data['price_incl_tax']); ?></td>
|
34 |
-
</tr>
|
35 |
-
<?php endforeach; ?>
|
36 |
-
|
37 |
-
<?php $order = $this->getOrderData(); ?>
|
38 |
-
<tr>
|
39 |
-
<td></td>
|
40 |
-
<td class="bld">Spedizione</td>
|
41 |
-
<td><?php echo money_format('%.2n', $order['base_shipping_amount']); ?></td>
|
42 |
-
</tr>
|
43 |
-
<tr>
|
44 |
-
<td></td>
|
45 |
-
<td class="bld">Totale</td>
|
46 |
-
<td><?php echo money_format('%.2n', $order['base_grand_total']); ?></td>
|
47 |
-
</tr>
|
48 |
-
</table>
|
49 |
-
|
50 |
-
<script> SqueezolApi.createSqButton('<?php echo Mage::getBaseUrl(); ?>/squeezol/index/oauth', 'big'); </script>
|
1 |
<script>
|
2 |
+
var img_url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/';
|
3 |
+
var auth_url = '<?php echo Mage::getBaseUrl(); ?>squeezol/index/oauth';
|
4 |
</script>
|
5 |
+
<div id="squeezol_view" class="sq-container-fluid">
|
6 |
+
<div class="sq-row row-separata">
|
7 |
+
<h3> Paga con Squeezol </h3>
|
8 |
+
<h4> Dividi il costo del carrello con amici, colleghi e parenti. </h4>
|
9 |
+
<br />
|
10 |
+
<h3> Come funziona: </h3>
|
11 |
+
<ol>
|
12 |
+
<li> Clicca sul Bottone PAY WITH e autorizza l'utilizzo del servizio. È necessaria la registrazione, in un click con Facebook!</li>
|
13 |
+
<li> Dai un nome e una descrizione allo Split e invita con email e Facebook.</li>
|
14 |
+
<li> Paga la tua quota e non aver fretta, i partecipanti avranno 20 giorni di tempo per completare l'acquisto!</li>
|
15 |
+
</ol>
|
16 |
+
<br />
|
17 |
+
<p> Attiva le finestre popup del tuo browser per poter proseguire con il pagamento</p>
|
18 |
+
<div id="squeezol_btn">
|
19 |
+
<div class="sq-col-xs-4 sq-col-xs-offset-4">
|
20 |
+
<div id="sq-loading">
|
21 |
+
<img class="sq-img-responsive" style="margin:auto; max-width:100px;" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/squeezol.png">
|
22 |
+
<img class="sq-img-responsive" style="margin:auto;" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/squeezol_payment/ajax-loader.gif">
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<!--table class="shipping-data sq-table sq-table-bordered">
|
29 |
+
<tr>
|
30 |
+
<th>Oggetto</th>
|
31 |
+
<th>Quantità</th>
|
32 |
+
<th>Prezzo</th>
|
33 |
+
</tr>
|
34 |
+
|
35 |
+
<?php foreach ($this->getOrderItems() as $item): ?>
|
36 |
+
<?php
|
37 |
+
$data = $item->getData();
|
38 |
+
?>
|
39 |
+
|
40 |
+
<tr>
|
41 |
+
<td><?php echo $data['name']; ?></td>
|
42 |
+
<td><?php echo round($data['qty_ordered']); ?></td>
|
43 |
+
<td><?php echo money_format('%.2n', $data['price_incl_tax']); ?></td>
|
44 |
+
</tr>
|
45 |
+
<?php endforeach; ?>
|
46 |
+
|
47 |
+
<?php $order = $this->getOrderData(); ?>
|
48 |
+
<tr>
|
49 |
+
<td></td>
|
50 |
+
<td class="bld">Spedizione</td>
|
51 |
+
<td><?php echo money_format('%.2n', $order['base_shipping_amount']); ?></td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td></td>
|
55 |
+
<td class="bld">Totale</td>
|
56 |
+
<td><?php echo money_format('%.2n', $order['base_grand_total']); ?></td>
|
57 |
+
</tr>
|
58 |
+
</table-->
|
59 |
+
|
60 |
+
<script>setTimeout(function(){ SqueezolApi.createSqButton(auth_url, 'big', '<?php echo Mage::getSingleton("squeezol_payment/session")->getSqueezolToken(); ?>'); }, 3000);
|
61 |
|
62 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/oauth2/Client.php
CHANGED
@@ -136,7 +136,20 @@ class Client
|
|
136 |
* @var array
|
137 |
*/
|
138 |
protected $curl_options = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
|
|
140 |
/**
|
141 |
* Construct
|
142 |
*
|
@@ -148,17 +161,17 @@ class Client
|
|
148 |
*/
|
149 |
public function __construct($client_id, $client_secret, $client_auth = self::AUTH_TYPE_URI, $certificate_file = null)
|
150 |
{
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
}
|
163 |
|
164 |
/**
|
@@ -168,7 +181,7 @@ class Client
|
|
168 |
*/
|
169 |
public function getClientId()
|
170 |
{
|
171 |
-
|
172 |
}
|
173 |
|
174 |
/**
|
@@ -178,7 +191,7 @@ class Client
|
|
178 |
*/
|
179 |
public function getClientSecret()
|
180 |
{
|
181 |
-
|
182 |
}
|
183 |
|
184 |
/**
|
@@ -191,12 +204,11 @@ class Client
|
|
191 |
*/
|
192 |
public function getAuthenticationUrl($auth_endpoint, $redirect_uri, array $extra_parameters = array())
|
193 |
{
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
return $auth_endpoint . '?' . http_build_query($parameters, null, '&');
|
200 |
}
|
201 |
|
202 |
/**
|
@@ -209,37 +221,36 @@ class Client
|
|
209 |
*/
|
210 |
public function getAccessToken($token_endpoint, $grant_type, array $parameters)
|
211 |
{
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
return $this->executeRequest($token_endpoint, $parameters, self::HTTP_METHOD_POST, $http_headers, self::HTTP_FORM_CONTENT_TYPE_APPLICATION);
|
243 |
}
|
244 |
|
245 |
/**
|
@@ -250,7 +261,7 @@ class Client
|
|
250 |
*/
|
251 |
public function setAccessToken($token)
|
252 |
{
|
253 |
-
|
254 |
}
|
255 |
|
256 |
/**
|
@@ -261,7 +272,7 @@ class Client
|
|
261 |
*/
|
262 |
public function setClientAuthType($client_auth)
|
263 |
{
|
264 |
-
|
265 |
}
|
266 |
|
267 |
/**
|
@@ -273,7 +284,7 @@ class Client
|
|
273 |
*/
|
274 |
public function setCurlOption($option, $value)
|
275 |
{
|
276 |
-
|
277 |
}
|
278 |
|
279 |
/**
|
@@ -284,7 +295,7 @@ class Client
|
|
284 |
*/
|
285 |
public function setCurlOptions($options)
|
286 |
{
|
287 |
-
|
288 |
}
|
289 |
|
290 |
/**
|
@@ -297,9 +308,9 @@ class Client
|
|
297 |
*/
|
298 |
public function setAccessTokenType($type, $secret = null, $algorithm = null)
|
299 |
{
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
}
|
304 |
|
305 |
/**
|
@@ -312,35 +323,33 @@ class Client
|
|
312 |
* @param int $form_content_type HTTP form content type to use
|
313 |
* @return array
|
314 |
*/
|
315 |
-
public function fetch($protected_resource_url, $parameters = array()
|
316 |
{
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
InvalidArgumentException::REQUIRE_PARAMS_AS_ARRAY
|
326 |
-
);
|
327 |
-
}
|
328 |
-
break;
|
329 |
-
case self::ACCESS_TOKEN_BEARER:
|
330 |
-
$http_headers['Authorization'] = 'Bearer ' . $this->access_token;
|
331 |
-
break;
|
332 |
-
case self::ACCESS_TOKEN_OAUTH:
|
333 |
-
$http_headers['Authorization'] = 'OAuth ' . $this->access_token;
|
334 |
-
break;
|
335 |
-
case self::ACCESS_TOKEN_MAC:
|
336 |
-
$http_headers['Authorization'] = 'MAC ' . $this->generateMACSignature($protected_resource_url, $parameters, $http_method);
|
337 |
-
break;
|
338 |
-
default:
|
339 |
-
throw new Exception('Unknown access token type.', Exception::INVALID_ACCESS_TOKEN_TYPE);
|
340 |
-
break;
|
341 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
-
|
|
|
344 |
}
|
345 |
|
346 |
/**
|
@@ -353,31 +362,30 @@ class Client
|
|
353 |
*/
|
354 |
private function generateMACSignature($url, $parameters, $http_method)
|
355 |
{
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
}
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
. $http_method . "\n"
|
375 |
-
. $parsed_url['path'] . "\n"
|
376 |
-
. $parsed_url['host'] . "\n"
|
377 |
-
. $parsed_url['port'] . "\n\n"
|
378 |
-
, $this->access_token_secret, true));
|
379 |
-
|
380 |
-
return 'id="' . $this->access_token . '", ts="' . $timestamp . '", nonce="' . $nonce . '", mac="' . $signature . '"';
|
381 |
}
|
382 |
|
383 |
/**
|
@@ -392,84 +400,76 @@ class Client
|
|
392 |
*/
|
393 |
private function executeRequest($url, $parameters = array(), $http_method = self::HTTP_METHOD_GET, array $http_headers = null, $form_content_type = self::HTTP_FORM_CONTENT_TYPE_MULTIPART)
|
394 |
{
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
|
|
|
|
431 |
}
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
} else {
|
464 |
-
$json_decode = json_decode($result, true);
|
465 |
-
}
|
466 |
-
curl_close($ch);
|
467 |
-
|
468 |
-
return array(
|
469 |
-
'result' => (null === $json_decode) ? $result : $json_decode,
|
470 |
-
'code' => $http_code,
|
471 |
-
'content_type' => $content_type
|
472 |
-
);
|
473 |
}
|
474 |
|
475 |
/**
|
@@ -495,7 +495,8 @@ class Client
|
|
495 |
array_walk($parts, function(&$item) { $item = ucfirst($item);});
|
496 |
return implode('', $parts);
|
497 |
}
|
498 |
-
|
|
|
499 |
|
500 |
class Exception extends \Exception
|
501 |
{
|
136 |
* @var array
|
137 |
*/
|
138 |
protected $curl_options = array();
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Expires in parameter
|
142 |
+
* @var string
|
143 |
+
*/
|
144 |
+
protected $expires_in = null;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Refresh Token parameter
|
148 |
+
* @var string
|
149 |
+
*/
|
150 |
+
protected $refresh_token = null;
|
151 |
|
152 |
+
|
153 |
/**
|
154 |
* Construct
|
155 |
*
|
161 |
*/
|
162 |
public function __construct($client_id, $client_secret, $client_auth = self::AUTH_TYPE_URI, $certificate_file = null)
|
163 |
{
|
164 |
+
if (!extension_loaded('curl')) {
|
165 |
+
throw new Exception('The PHP exention curl must be installed to use this library.', Exception::CURL_NOT_FOUND);
|
166 |
+
}
|
167 |
+
|
168 |
+
$this->client_id = $client_id;
|
169 |
+
$this->client_secret = $client_secret;
|
170 |
+
$this->client_auth = $client_auth;
|
171 |
+
$this->certificate_file = $certificate_file;
|
172 |
+
if (!empty($this->certificate_file) && !is_file($this->certificate_file)) {
|
173 |
+
throw new InvalidArgumentException('The certificate file was not found', InvalidArgumentException::CERTIFICATE_NOT_FOUND);
|
174 |
+
}
|
175 |
}
|
176 |
|
177 |
/**
|
181 |
*/
|
182 |
public function getClientId()
|
183 |
{
|
184 |
+
return $this->client_id;
|
185 |
}
|
186 |
|
187 |
/**
|
191 |
*/
|
192 |
public function getClientSecret()
|
193 |
{
|
194 |
+
return $this->client_secret;
|
195 |
}
|
196 |
|
197 |
/**
|
204 |
*/
|
205 |
public function getAuthenticationUrl($auth_endpoint, $redirect_uri, array $extra_parameters = array())
|
206 |
{
|
207 |
+
$parameters = array_merge(array('response_type' => 'code',
|
208 |
+
'client_id' => $this->client_id,
|
209 |
+
'redirect_uri' => $redirect_uri),
|
210 |
+
$extra_parameters);
|
211 |
+
return $auth_endpoint . '?' . http_build_query($parameters, null, '&');
|
|
|
212 |
}
|
213 |
|
214 |
/**
|
221 |
*/
|
222 |
public function getAccessToken($token_endpoint, $grant_type, array $parameters)
|
223 |
{
|
224 |
+
if (!$grant_type) {
|
225 |
+
throw new InvalidArgumentException('The grant_type is mandatory.', InvalidArgumentException::INVALID_GRANT_TYPE);
|
226 |
+
}
|
227 |
+
$grantTypeClassName = $this->convertToCamelCase($grant_type);
|
228 |
+
$grantTypeClass = __NAMESPACE__ . '\\GrantType\\' . $grantTypeClassName;
|
229 |
+
if (!class_exists($grantTypeClass)) {
|
230 |
+
throw new InvalidArgumentException('Unknown grant type \'' . $grant_type . '\'', InvalidArgumentException::INVALID_GRANT_TYPE);
|
231 |
+
}
|
232 |
+
$grantTypeObject = new $grantTypeClass();
|
233 |
+
$grantTypeObject->validateParameters($parameters);
|
234 |
+
if (!defined($grantTypeClass . '::GRANT_TYPE')) {
|
235 |
+
throw new Exception('Unknown constant GRANT_TYPE for class ' . $grantTypeClassName, Exception::GRANT_TYPE_ERROR);
|
236 |
+
}
|
237 |
+
$parameters['grant_type'] = $grantTypeClass::GRANT_TYPE;
|
238 |
+
$http_headers = array();
|
239 |
+
switch ($this->client_auth) {
|
240 |
+
case self::AUTH_TYPE_URI:
|
241 |
+
case self::AUTH_TYPE_FORM:
|
242 |
+
$parameters['client_id'] = $this->client_id;
|
243 |
+
$parameters['client_secret'] = $this->client_secret;
|
244 |
+
break;
|
245 |
+
case self::AUTH_TYPE_AUTHORIZATION_BASIC:
|
246 |
+
$parameters['client_id'] = $this->client_id;
|
247 |
+
$http_headers['Authorization'] = 'Basic ' . base64_encode($this->client_id . ':' . $this->client_secret);
|
248 |
+
break;
|
249 |
+
default:
|
250 |
+
throw new Exception('Unknown client auth type.', Exception::INVALID_CLIENT_AUTHENTICATION_TYPE);
|
251 |
+
break;
|
252 |
+
}
|
253 |
+
return $this->executeRequest($token_endpoint, $parameters, self::HTTP_METHOD_POST, $http_headers, self::HTTP_FORM_CONTENT_TYPE_APPLICATION);
|
|
|
254 |
}
|
255 |
|
256 |
/**
|
261 |
*/
|
262 |
public function setAccessToken($token)
|
263 |
{
|
264 |
+
$this->access_token = $token;
|
265 |
}
|
266 |
|
267 |
/**
|
272 |
*/
|
273 |
public function setClientAuthType($client_auth)
|
274 |
{
|
275 |
+
$this->client_auth = $client_auth;
|
276 |
}
|
277 |
|
278 |
/**
|
284 |
*/
|
285 |
public function setCurlOption($option, $value)
|
286 |
{
|
287 |
+
$this->curl_options[$option] = $value;
|
288 |
}
|
289 |
|
290 |
/**
|
295 |
*/
|
296 |
public function setCurlOptions($options)
|
297 |
{
|
298 |
+
$this->curl_options = array_merge($this->curl_options, $options);
|
299 |
}
|
300 |
|
301 |
/**
|
308 |
*/
|
309 |
public function setAccessTokenType($type, $secret = null, $algorithm = null)
|
310 |
{
|
311 |
+
$this->access_token_type = $type;
|
312 |
+
$this->access_token_secret = $secret;
|
313 |
+
$this->access_token_algorithm = $algorithm;
|
314 |
}
|
315 |
|
316 |
/**
|
323 |
* @param int $form_content_type HTTP form content type to use
|
324 |
* @return array
|
325 |
*/
|
326 |
+
public function fetch($protected_resource_url, $parameters = array(),$http_method = self::HTTP_METHOD_GET, array $http_headers = array(), $form_content_type = self::HTTP_FORM_CONTENT_TYPE_MULTIPART)
|
327 |
{
|
328 |
+
if ($this->access_token) {
|
329 |
+
switch ($this->access_token_type) {
|
330 |
+
case self::ACCESS_TOKEN_URI:
|
331 |
+
if (is_array($parameters)) {
|
332 |
+
$parameters[$this->access_token_param_name] = $this->access_token;
|
333 |
+
} else {
|
334 |
+
throw new InvalidArgumentException('You need to give parameters as array if you want to give the token within the URI.',
|
335 |
+
InvalidArgumentException::REQUIRE_PARAMS_AS_ARRAY);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
+
break;
|
338 |
+
case self::ACCESS_TOKEN_BEARER:
|
339 |
+
$http_headers['Authorization'] = 'Bearer ' . $this->access_token;
|
340 |
+
break;
|
341 |
+
case self::ACCESS_TOKEN_OAUTH:
|
342 |
+
$http_headers['Authorization'] = 'OAuth ' . $this->access_token;
|
343 |
+
break;
|
344 |
+
case self::ACCESS_TOKEN_MAC:
|
345 |
+
$http_headers['Authorization'] = 'MAC ' . $this->generateMACSignature($protected_resource_url, $parameters, $http_method);
|
346 |
+
break;
|
347 |
+
default:
|
348 |
+
throw new Exception('Unknown access token type.', Exception::INVALID_ACCESS_TOKEN_TYPE);
|
349 |
+
break;
|
350 |
}
|
351 |
+
}
|
352 |
+
return $this->executeRequest($protected_resource_url, $parameters, $http_method, $http_headers, $form_content_type);
|
353 |
}
|
354 |
|
355 |
/**
|
362 |
*/
|
363 |
private function generateMACSignature($url, $parameters, $http_method)
|
364 |
{
|
365 |
+
$timestamp = time();
|
366 |
+
$nonce = uniqid();
|
367 |
+
$parsed_url = parse_url($url);
|
368 |
+
if (!isset($parsed_url['port']))
|
369 |
+
{
|
370 |
+
$parsed_url['port'] = ($parsed_url['scheme'] == 'https') ? 443 : 80;
|
371 |
+
}
|
372 |
+
if ($http_method == self::HTTP_METHOD_GET) {
|
373 |
+
if (is_array($parameters)) {
|
374 |
+
$parsed_url['path'] .= '?' . http_build_query($parameters, null, '&');
|
375 |
+
} elseif ($parameters) {
|
376 |
+
$parsed_url['path'] .= '?' . $parameters;
|
377 |
}
|
378 |
+
}
|
379 |
+
$signature = base64_encode(hash_hmac($this->access_token_algorithm,
|
380 |
+
$timestamp . "\n"
|
381 |
+
. $nonce . "\n"
|
382 |
+
. $http_method . "\n"
|
383 |
+
. $parsed_url['path'] . "\n"
|
384 |
+
. $parsed_url['host'] . "\n"
|
385 |
+
. $parsed_url['port'] . "\n\n"
|
386 |
+
, $this->access_token_secret, true));
|
387 |
+
|
388 |
+
return 'id="' . $this->access_token . '", ts="' . $timestamp . '", nonce="' . $nonce . '", mac="' . $signature . '"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
}
|
390 |
|
391 |
/**
|
400 |
*/
|
401 |
private function executeRequest($url, $parameters = array(), $http_method = self::HTTP_METHOD_GET, array $http_headers = null, $form_content_type = self::HTTP_FORM_CONTENT_TYPE_MULTIPART)
|
402 |
{
|
403 |
+
$curl_options = array(CURLOPT_RETURNTRANSFER => true,
|
404 |
+
CURLOPT_SSL_VERIFYPEER => true,
|
405 |
+
CURLOPT_CUSTOMREQUEST => $http_method);
|
406 |
+
switch($http_method) {
|
407 |
+
case self::HTTP_METHOD_POST:
|
408 |
+
$curl_options[CURLOPT_POST] = true;
|
409 |
+
/* No break */
|
410 |
+
case self::HTTP_METHOD_PUT:
|
411 |
+
case self::HTTP_METHOD_PATCH:
|
412 |
+
/**
|
413 |
+
* Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data,
|
414 |
+
* while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.
|
415 |
+
* http://php.net/manual/en/function.curl-setopt.php
|
416 |
+
*/
|
417 |
+
if(is_array($parameters) && self::HTTP_FORM_CONTENT_TYPE_APPLICATION === $form_content_type) {
|
418 |
+
$parameters = http_build_query($parameters, null, '&');
|
419 |
+
}
|
420 |
+
$curl_options[CURLOPT_POSTFIELDS] = $parameters;
|
421 |
+
break;
|
422 |
+
case self::HTTP_METHOD_HEAD:
|
423 |
+
$curl_options[CURLOPT_NOBODY] = true;
|
424 |
+
/* No break */
|
425 |
+
case self::HTTP_METHOD_DELETE:
|
426 |
+
case self::HTTP_METHOD_GET:
|
427 |
+
if (is_array($parameters)) {
|
428 |
+
$url .= '?' . http_build_query($parameters, null, '&');
|
429 |
+
} elseif ($parameters) {
|
430 |
+
$url .= '?' . $parameters;
|
431 |
+
}
|
432 |
+
break;
|
433 |
+
default:
|
434 |
+
break;
|
435 |
+
}
|
436 |
+
$curl_options[CURLOPT_URL] = $url;
|
437 |
+
if (is_array($http_headers)) {
|
438 |
+
$header = array();
|
439 |
+
foreach($http_headers as $key => $parsed_urlvalue) {
|
440 |
+
$header[] = "$key: $parsed_urlvalue";
|
441 |
}
|
442 |
+
$curl_options[CURLOPT_HTTPHEADER] = $header;
|
443 |
+
}
|
444 |
+
|
445 |
+
$ch = curl_init();
|
446 |
+
curl_setopt_array($ch, $curl_options);
|
447 |
+
// https handling
|
448 |
+
if (!empty($this->certificate_file)) {
|
449 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
450 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
451 |
+
curl_setopt($ch, CURLOPT_CAINFO, $this->certificate_file);
|
452 |
+
} else {
|
453 |
+
// bypass ssl verification
|
454 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
455 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
456 |
+
}
|
457 |
+
if (!empty($this->curl_options)) {
|
458 |
+
curl_setopt_array($ch, $this->curl_options);
|
459 |
+
}
|
460 |
+
$result = curl_exec($ch);
|
461 |
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
462 |
+
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
|
463 |
+
if ($curl_error = curl_error($ch)) {
|
464 |
+
throw new Exception($curl_error, Exception::CURL_ERROR);
|
465 |
+
} else {
|
466 |
+
$json_decode = json_decode($result, true);
|
467 |
+
}
|
468 |
+
curl_close($ch);
|
469 |
+
|
470 |
+
return array('result' => (null === $json_decode) ? $result : $json_decode,
|
471 |
+
'code' => $http_code,
|
472 |
+
'content_type' => $content_type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
}
|
474 |
|
475 |
/**
|
495 |
array_walk($parts, function(&$item) { $item = ucfirst($item);});
|
496 |
return implode('', $parts);
|
497 |
}
|
498 |
+
|
499 |
+
}
|
500 |
|
501 |
class Exception extends \Exception
|
502 |
{
|
lib/oauth2/auth_request.php
CHANGED
@@ -3,24 +3,33 @@ require('Client.php');
|
|
3 |
require('GrantType/IGrantType.php');
|
4 |
require('GrantType/AuthorizationCode.php');
|
5 |
require('../config.php');
|
6 |
-
|
7 |
-
$
|
8 |
-
|
9 |
-
{
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
else
|
17 |
-
|
18 |
-
$params = array('code' => $_GET['code'], 'redirect_uri' => CALLBACK_URL);
|
19 |
-
$response = $client->getAccessToken(ACCESS_TOKEN_URL, 'authorization_code', $params);
|
20 |
-
$info = $response['result'];
|
21 |
-
$client->setAccessToken($info['access_token']);
|
22 |
-
$_SESSION['squeezolToken'] = $info['access_token'];
|
23 |
-
header('Location: ' . SQUEEZOL_PAY_PAGE);
|
24 |
-
error_log('Access token' . "{$_SESSION['squeezolToken']}");
|
25 |
-
}
|
26 |
?>
|
3 |
require('GrantType/IGrantType.php');
|
4 |
require('GrantType/AuthorizationCode.php');
|
5 |
require('../config.php');
|
6 |
+
|
7 |
+
$_ses = Mage::getSingleton('squeezol_payment/session');
|
8 |
+
$token = $_ses->getSqueezolToken();
|
9 |
+
if (empty($token)) {
|
10 |
+
session_start();
|
11 |
+
$client = new OAuth2\Client(SQUEEZOL_ID, SQUEEZOL_SECRET);
|
12 |
+
if (!isset($_GET['code']))
|
13 |
+
{
|
14 |
+
$extra_parameters = array('scope' => SCOPE );
|
15 |
+
$auth_url = $client->getAuthenticationUrl(AUTHORIZATION_URL, CALLBACK_URL, $extra_parameters);
|
16 |
+
die(var_dump($auth_url));
|
17 |
+
header('Location: ' . $auth_url);
|
18 |
+
die('Redirect');
|
19 |
+
}
|
20 |
+
else
|
21 |
+
{
|
22 |
+
$params = array('code' => $_GET['code'], 'redirect_uri' => CALLBACK_URL);
|
23 |
+
$response = $client->getAccessToken(ACCESS_TOKEN_URL, 'authorization_code', $params);
|
24 |
+
$info = $response['result'];
|
25 |
+
$client->setAccessToken($info['access_token']);
|
26 |
+
$_ses->setSqueezolToken() = $info['access_token'];
|
27 |
+
$_ses->setExpirationTime() = $_SERVER['REQUEST_TIME'] + $info['expires_in'];
|
28 |
+
$_ses->setRefreshToken() = $info['refresh_token'];
|
29 |
+
header('Location: ' . SQUEEZOL_PAY_PAGE);
|
30 |
+
error_log('Access token' . $_ses->getSqueezolToken());
|
31 |
+
}
|
32 |
}
|
33 |
else
|
34 |
+
header('Location: ' . SQUEEZOL_PAY_PAGE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
?>
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>Squeezol_Payment</name><version>1.1.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Squeezol_Payment</name><version>1.1.3</version><stability>stable</stability><license>OSL</license><channel>community</channel><extends></extends><summary>It enables group payments, a split of cart amount</summary><description>Squeezol Split is the innovative payment technology that solves personal fundraising problems between people, simplifying scheduling, budget planning and finally payments. Enable group purchasing on your e-commerce site or marketplace just integrating ‘Pay with Squeezol’ button: everyone puts his share in, then the merchant receives the entire payment due. A buying system used in current life now completely digitalized, taking advantage of social media tools to ease at the same time the whole customers’ experience and the viral diffusion of merchants brand.</description><notes>Frontend update</notes><authors><author><name>Davide Costa</name><user>nafta86</user><email>davide.costa@squeezol.com</email></author><author><name>Alessandro Caligaris</name><user>alfietto91</user><email>alessandro.caligaris1991@gmail.com</email></author><author><name>John Doe</name><user>john</user><email>john3@doe.com</email></author></authors><date>2015-04-24</date><time>2:46:04</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="lib"><dir name="Squeezol"><file name="endpoints.php" hash="bb57c3f817e4a7bbe578056475c2c85b"/></dir><dir name="oauth2"><file name="Client.php" hash="70b2339659102f8394e383184d8f93ab"/><file name="README" hash="8ef3bf723c93b6e091b707a546df2804"/><file name="auth_request.php" hash="f01b0791cccc4ac3d3b3e840ca6b502f"/><file name="composer.json" hash="b1a24295215d44d727f603e7da644a5a"/><dir name="GrantType"><file name="AuthorizationCode.php" hash="a1ff324a733fc33dbf938153c4c1667c"/><file name="ClientCredentials.php" hash="21b30fbb06d4b67263499d687316ae8b"/><file name="IGrantType.php" hash="ee03d4c5bc20f518716fc2c616b4d38d"/><file name="Password.php" hash="2e938e60c4af8bad71b5c4f0f1a40969"/><file name="RefreshToken.php" hash="a773f48348ad7aa510955099ba18d3ad"/></dir></dir></dir><dir name="app"><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="squeezol_payment"><file name="create.phtml" hash="54e036005a82106efec87bc91beaf4c9"/><file name="digest.phtml" hash="880c5444c6fcd2a1b2f74124eb41e87e"/><file name="invitation.phtml" hash="970d588176c44c7c72e02bc61f36d2b5"/><file name="logo.phtml" hash="8cb129f70a41ff6c36f7a4304bf98267"/><file name="review.phtml" hash="7ef1885f44542fd8fb06713553390a34"/><file name="start.phtml" hash="07cea513f4b283728687aad22c512081"/></dir></dir><dir name="layout"><file name="squeezol_payment.xml" hash="fc7666d8961c3a5006df797c7fcc2ed7"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Squeezol_Payment.xml" hash="8069f82ec151f6c45be892bcc32460f8"/></dir></dir><dir name="code"><dir name="local"><dir name="Squeezol"><dir name="Payment"><dir name="Helper"><file name="Data.php" hash="435781e5e5e1a60ddd4c631f8efcfb42"/></dir><dir name="Block"><file name="Logo.php" hash="f9c7b30ccf3d9c947ec4a33c1662c395"/><file name="Start.php" hash="7edb0747a52d16fa21a2952c6d356191"/></dir><dir name="data"><dir name="squeezol_payment_setup"><file name="data-install-0.1.0.php" hash="3b58d0cdbc68e0260e839a2c8f0d4675"/></dir></dir><dir name="etc"><file name="config.xml" hash="816f839cf9155c94838938ee9b4c1532"/><file name="system.xml" hash="426d16d38ff0bdbe709c4b3c175b9e02"/></dir><dir name="Model"><file name="Params.php" hash="2f4137399e69f9a35ffeccfbb8664a66"/><file name="Paramsandbox.php" hash="4a6a732a905a43e17058a2ba06ffefde"/><file name="PaymentMethod.php" hash="37fcaf2619c43b2713c4a5441d5345cc"/><file name="Session.php" hash="6453e3413705bde3e492ac9829b954e8"/><dir name="Mysql4"><file name="Params.php" hash="b12305337a72803ed2d61f6b8cac0159"/><dir name="Params"><file name="Collection.php" hash="5c73d0c799b880eed0bfc65bd50f17b6"/></dir></dir><dir name="Resource"><file name="Setup.php" hash="0340022ca0914dfcd7b6b589767dbc21"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="2334b90db1a90c9b8833b8bee7534df9"/><file name="OrderProcessingController.php" hash="5e56204902a16dd1c726dc61050c2503"/></dir><dir name="sql"><dir name="squeezol_payment_setup"><file name="install-0.1.0.php" hash="404031896ca519d8739300687fc1ab9e"/><file name="upgrade-0.1.0-0.2.0.php" hash="1bd99cfd46a27f7d94754540d32af500"/><file name="upgrade-0.2.0-1.0.0.php" hash="36edcf31ba4f44b97b80d77868da31e9"/></dir></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="DejaVuSansCondensed-BoldOblique.eot" hash="2c79dd754287cea48f32a3fff983bf15"/><file name="DejaVuSansCondensed-BoldOblique.svg" hash="326f9917a1db7537c95bf0b6124b899f"/><file name="DejaVuSansCondensed-BoldOblique.ttf" hash="7bb71c1ec629c0bf5d27e2e2d5e20066"/><file name="DejaVuSansCondensed-BoldOblique.woff" hash="3242cc1f8b2373420e38d3aefcc9e408"/><file name="absolut_pro_boldcondensed-webfont.ttf" hash="dee7ac19c5727e29ba33192f466560ea"/><file name="absolut_pro_boldcondensed-webfont.woff" hash="585c3a24a09cd230d2e456db4a04d4d7"/><file name="absolut_pro_bookcondensed-webfont.ttf" hash="2c8c3c2eb35d5d36ab0927d2fd6f1732"/><file name="absolut_pro_bookcondensed-webfont.woff" hash="4868c6df04841d20c0ff3ee3a2e9830d"/><file name="bootstrap-responsive.css" hash="d2c30d07a98d50e945570bf32c56435f"/><file name="bootstrap-responsive.min.css" hash="365a247af4036532701d83957e490adc"/><file name="bootstrap.css" hash="08f2256002f66a415dbc2e8afb722d70"/><file name="bootstrap.min.css" hash="2b4369ee3c21cf58516751cb49a01ccc"/><file name="dejavusanscondensed-bold-webfont.eot" hash="fa2f3a00c08cc9f47201cac746a06bf2"/><file name="dejavusanscondensed-bold-webfont.svg" hash="f4f7213b78edc8ce3756a61868540ea4"/><file name="dejavusanscondensed-bold-webfont.ttf" hash="c2ca6902c10cb361346e2561c41af171"/><file name="dejavusanscondensed-bold-webfont.woff" hash="2eefe2ee018b50741c817aff2e25931a"/><file name="dejavusanscondensed-webfont.ttf" hash="5c1e2a1d836ff13b21d208ae62263331"/><file name="dejavusanscondensed-webfont.woff" hash="3aa174b6ab569947533738c8d9cd1808"/><file name="pikaday.css" hash="5a32b7adc30d7de002b204036e5c40ae"/><file name="squeezol.css" hash="13b9d9ccdf7818a7a20b8f2257416586"/></dir><dir name="js"><file name="_squeezol3.js" hash="47fee6537aada7e3f6edb81e979b0565"/><file name="bootstrap.min.js" hash="a121f0e47edc5182e1aca1396807db70"/><file name="jquery.min.js" hash="8101d596b2b8fa35fe3a634ea342d7c3"/><file name="pikaday.js" hash="441d514c9231d36b1d589bb3b78accb1"/></dir><dir name="images"><dir name="squeezol_payment"><file name="ajax-loader.gif" hash="01430f311396b62361003a6f2d43afc4"/><file name="btn-finger.png" hash="32939ad91cd1416e303fe72edde3389e"/><file name="btn2.jpg" hash="ddc15e5c081115513a9e9e6dc41cdafc"/><file name="busta.png" hash="f5da1e0e1e1a5eb3cea2d6d9d89a91d6"/><file name="busta2.jpg" hash="6056ab70cbb9fb274510fafc79ebc745"/><file name="calendar.png" hash="3da523926d6f8bec8628ebed3c136b1f"/><file name="check.png" hash="33b3e57ad09e1953ef33029297338730"/><file name="default.jpg" hash="dd9154d475d1abaa69163378cfa482f8"/><file name="facebook_small.png" hash="24a08c9069e7a37d56ef7c2514c652b5"/><file name="fb_login.png" hash="a60e75950f678a001644936e31753fca"/><file name="fenicottero.png" hash="dd5753b966338ca1f711ceec5dbcf75b"/><file name="g_login.png" hash="c28120543472e243b2cd2f2af8ba4932"/><file name="gestpay.png" hash="88573030c75355174ce51f3329c29643"/><file name="ghianda_step_blu.png" hash="9ff125808d9fbdef766caf502a304ad2"/><file name="ghianda_step_grigia.png" hash="4d58eee97a1f8655a87c7a0f20e66eda"/><file name="info-black.png" hash="10de26a1713ff21b9a4f169da5abdbdb"/><file name="logo_min.png" hash="70e11306eda7fbd42d78a72f1109a17d"/><file name="logo_squeezol_blu_nowrite.png" hash="9a0ac507017fb6b268a43d454f436b61"/><file name="mail_small.png" hash="da8257e98dd2ad413c61309043f71ed9"/><file name="pay_button.png" hash="970ec7feff9b6b7b9062d8f5a8e10bd1"/><file name="pay_button2.png" hash="6f6727fb922f128dc3cf3a9b42b00e1a"/><file name="plus.png" hash="1cba8cc1bb64c269caefe4667b635ab5"/><file name="salva2.jpg" hash="557ff279658464685464b856d4d3f634"/><file name="salvadanaio.png" hash="a2a0d69adabe332b8106bfaec0d49f87"/><file name="squeezol.png" hash="e2059411e9f14fdfe1e8b21739f7a512"/><file name="squeezol_icon-creasplit-pink.png" hash="a7d5094fca629f3f8d068049db852d03"/><file name="squeezol_icon-creasplit.png" hash="decd22b53c32b8472b0a46d0aed4afe9"/><file name="squeezol_icon-invita-pink.png" hash="b1eb9ef65c147d6552d4d402373bcf10"/><file name="squeezol_icon-invita.png" hash="0b274298ec828752a61db8686af9f720"/><file name="squeezol_icon-riassunto-pink.png" hash="82db5c7c4329194760ad7cb728bd1014"/><file name="squeezol_icon-riassunto.png" hash="2e50238f01e7a407e5d491ec75c25ec8"/><file name="x.png" hash="cdc8921a161bed3ebe6a0d67705ad210"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|
skin/frontend/base/default/css/squeezol.css
CHANGED
@@ -60,12 +60,6 @@ h4.sq-text {
|
|
60 |
font-weight: 100 !important;
|
61 |
}
|
62 |
|
63 |
-
#squeezol_view input, textarea {
|
64 |
-
font-weight: 10 !important;
|
65 |
-
}
|
66 |
-
|
67 |
-
#squeezol_view label { font-weight: bold !important; color: #08B3C7 !important; }
|
68 |
-
|
69 |
.sq-popover {
|
70 |
z-index:1000 !important;
|
71 |
}
|
@@ -74,35 +68,57 @@ h4.sq-text {
|
|
74 |
z-index: 999 !important;
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
77 |
#squeezol_button, .squeezolButtonSuccess, .sq-invita-ancora, #SqueezolFinishPay_, #SqueezolPay_, #SqueezolStartPay_, #SqueezolDeserted_, #SqueezolModifyAmount_, #squeezol_next, #squeezolSubmit_ {
|
78 |
cursor: pointer !important;
|
79 |
-
background-color: #
|
80 |
-
border: #
|
81 |
color: white !important;
|
82 |
font-family: "DejaVuSansCondensed-BoldOblique";
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
.sq-invita-ancora {
|
86 |
margin-top: 10px;
|
87 |
|
88 |
}
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
float: right;
|
93 |
}
|
94 |
|
95 |
-
|
96 |
-
background-
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
|
|
99 |
#SqueezolRefund_ {
|
100 |
font-family: "DejaVuSansCondensed-BoldOblique";
|
101 |
}
|
102 |
|
103 |
#SqueezolStartPay_, #SqueezolInvitation_, #SqueezolModifyAmount_, #SqueezolPay_, #SqueezolDeserted_ {
|
104 |
height: 40px !important;
|
105 |
-
|
106 |
}
|
107 |
|
108 |
#SqueezolModifyAmount_ {
|
@@ -126,26 +142,10 @@ h4.sq-text {
|
|
126 |
cursor: pointer !important;
|
127 |
}
|
128 |
|
129 |
-
#
|
130 |
-
|
131 |
-
color: #FFF;
|
132 |
-
display: block;
|
133 |
-
border-radius: 4px !important;
|
134 |
-
-webkit-border-radius: 4px;
|
135 |
-
-moz-border-radius: 4px;
|
136 |
-
font-family: DejaVuSansCondensed-BoldOblique;
|
137 |
-
font-size: 12px;
|
138 |
-
color: #FFF;
|
139 |
-
font-style: normal;
|
140 |
-
text-align: center;
|
141 |
-
line-height: 10px;
|
142 |
-
letter-spacing: 0em;
|
143 |
-
cursor: pointer;
|
144 |
-
float: right;
|
145 |
-
padding-right: 25px;
|
146 |
}
|
147 |
|
148 |
-
|
149 |
.sq-buttonEmail {
|
150 |
background-color: #FC8F1A !important;
|
151 |
border: #FC8F1A !important;
|
@@ -176,7 +176,13 @@ h4.sq-text {
|
|
176 |
text-align: center !important;
|
177 |
line-height: 10px !important;
|
178 |
letter-spacing: 0em !important;
|
179 |
-
cursor: pointer !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
|
182 |
div.row-separata {
|
@@ -184,6 +190,11 @@ div.row-separata {
|
|
184 |
padding-top: 10px !important;
|
185 |
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
187 |
.separator {
|
188 |
border-bottom: 1px solid #dcdcdc !important;
|
189 |
margin-top: 15px !important;
|
@@ -264,7 +275,7 @@ div.row-separata {
|
|
264 |
font-family: AbsolutProCond-Bold;
|
265 |
font-size: 24.2px !important;
|
266 |
font-style: normal !important;
|
267 |
-
text-align: left
|
268 |
line-height: 29px !important;
|
269 |
letter-spacing: 0em !important;
|
270 |
opacity: 1 !important;
|
@@ -293,6 +304,11 @@ div.row-separata {
|
|
293 |
padding: 5px;
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
|
|
296 |
.sq-label {
|
297 |
font-family: AbsolutProCond;
|
298 |
font-size: 15px !important;
|
@@ -339,7 +355,7 @@ h4.wizardOpen{
|
|
339 |
}
|
340 |
|
341 |
.sq-date-icon {
|
342 |
-
max-width:
|
343 |
}
|
344 |
|
345 |
.squeezol_button_big{
|
@@ -354,18 +370,13 @@ h4.wizardOpen{
|
|
354 |
cursor: pointer !important;
|
355 |
}
|
356 |
|
357 |
-
h3.sq-popover-title {
|
358 |
-
font-family: "DejaVuSansCondensed-BoldOblique";
|
359 |
-
color: #808080 !important;
|
360 |
-
padding-left:40px !important;
|
361 |
-
}
|
362 |
-
|
363 |
-
|
364 |
p.sq-alert-danger, #squeezolNotifyAmount_ {
|
365 |
margin-top: 5px !important;
|
366 |
}
|
367 |
|
368 |
-
|
|
|
|
|
369 |
.sq-container-dashboard {
|
370 |
background-color: #FFFFFF !important;
|
371 |
-webkit-border-radius: 4px;
|
@@ -374,19 +385,27 @@ p.sq-alert-danger, #squeezolNotifyAmount_ {
|
|
374 |
border: 1px solid #dcdcdc !important;
|
375 |
|
376 |
box-shadow: 3px 3px 1px #dcdcdc !important;
|
377 |
-
padding-top:50px !important;
|
378 |
-
padding-bottom:50px !important;
|
379 |
}
|
380 |
|
381 |
-
iframe {
|
382 |
-
position: absolute
|
383 |
-
top:
|
384 |
-
left:250px
|
385 |
-
}
|
|
|
|
|
386 |
|
387 |
input.sq-form-control, textarea.sq-form-control, select {
|
388 |
width:100% !important;
|
389 |
-
font-family: AbsoluteProCond !important
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
391 |
|
392 |
.sq-form-group > select {
|
@@ -405,6 +424,18 @@ input.sq-form-control, textarea.sq-form-control, select {
|
|
405 |
|
406 |
}
|
407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
.sq-input-group-addon{
|
409 |
color:#FFF !important;
|
410 |
background-color:#0AB3C6 !important;
|
@@ -443,38 +474,21 @@ input.sq-form-control, textarea.sq-form-control, select {
|
|
443 |
}
|
444 |
|
445 |
div.sq-glyph-info-sign {
|
446 |
-
display: inline !important;
|
447 |
-
width: 30px !important;
|
448 |
-
height: 30px !important;
|
449 |
-
cursor: pointer !important;
|
450 |
-
padding-left: 1px !important;
|
451 |
-
color: rgb(255, 255, 255) !important;
|
452 |
-
box-shadow: 1px 1px 0.5px #0AB3C6 !important;
|
453 |
-
border-radius: 20px !important;
|
454 |
-
-webkit-border-radius: 20px;
|
455 |
-
-moz-border-radius: 20px;
|
456 |
-
}
|
457 |
-
|
458 |
-
.sq-icon p {
|
459 |
font-family: "AbsolutePro-BoldOblique";
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
display: inline !important;
|
464 |
-
margin:3px !important;
|
465 |
-
padding:3px !important;
|
466 |
-
line-height: 20px;
|
467 |
-
}
|
468 |
-
|
469 |
-
.sq-icon {
|
470 |
-
color: #7F8389 !important;
|
471 |
-
width: 100px !important;
|
472 |
-
height: 100px !important;
|
473 |
display: inline !important;
|
474 |
-
|
475 |
-
|
476 |
-
font-size: 100% !important;
|
477 |
cursor: pointer !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
}
|
479 |
|
480 |
.target-A {
|
@@ -499,7 +513,8 @@ div.sq-glyph-info-sign {
|
|
499 |
letter-spacing: 0em !important;
|
500 |
opacity: 1 !important;
|
501 |
color: #FFF !important;
|
502 |
-
padding:
|
|
|
503 |
border-radius: 4px !important;
|
504 |
-webkit-border-radius: 4px;
|
505 |
-moz-border-radius: 4px;
|
@@ -560,10 +575,25 @@ div.sq-glyph-info-sign {
|
|
560 |
}
|
561 |
|
562 |
.sq-pink-text {
|
563 |
-
color:#
|
564 |
font-family: "DejaVuSansCondensed-BoldOblique" !important;
|
565 |
}
|
566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
div.withPaddedBorder {
|
568 |
border: 1px solid #DDD;
|
569 |
-webkit-border-radius: 4px;
|
@@ -575,6 +605,15 @@ div.withPaddedBorder {
|
|
575 |
.part h4{
|
576 |
font-family: 'AbsolutProCond';
|
577 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
#closeModal {
|
579 |
background-color: #FFFFFF;
|
580 |
border-radius: 4px !important;
|
@@ -602,6 +641,9 @@ div.withPaddedBorder {
|
|
602 |
line-height: 10px;
|
603 |
letter-spacing: 0em;
|
604 |
opacity: 1;
|
|
|
|
|
|
|
605 |
color: #FFF;
|
606 |
padding: 5px;
|
607 |
}
|
60 |
font-weight: 100 !important;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
.sq-popover {
|
64 |
z-index:1000 !important;
|
65 |
}
|
68 |
z-index: 999 !important;
|
69 |
}
|
70 |
|
71 |
+
.sq-panel{
|
72 |
+
padding: 20px;
|
73 |
+
}
|
74 |
+
|
75 |
#squeezol_button, .squeezolButtonSuccess, .sq-invita-ancora, #SqueezolFinishPay_, #SqueezolPay_, #SqueezolStartPay_, #SqueezolDeserted_, #SqueezolModifyAmount_, #squeezol_next, #squeezolSubmit_ {
|
76 |
cursor: pointer !important;
|
77 |
+
background-color: #DA396F;
|
78 |
+
border: #DA396F !important;
|
79 |
color: white !important;
|
80 |
font-family: "DejaVuSansCondensed-BoldOblique";
|
81 |
}
|
82 |
|
83 |
+
|
84 |
+
#squeezol_button:hover, .squeezolButtonSuccess:hover, .sq-invita-ancora:hover, #SqueezolFinishPay_:hover, #SqueezolPay_:hover, #SqueezolStartPay_:hover, #SqueezolDeserted_:hover, #SqueezolModifyAmount_:hover, #squeezolSubmit_:hover, #squeezol_next:hover {
|
85 |
+
background-color: #F9598F !important;
|
86 |
+
}
|
87 |
+
|
88 |
+
#squeezolFb_:hover, #sq-fb-sharer:hover {
|
89 |
+
background-color: #5078C9 !important;
|
90 |
+
}
|
91 |
+
|
92 |
+
#emailModal_:hover, #squeezolEmail_:hover {
|
93 |
+
background-color: #FCAA53 !important;
|
94 |
+
color: white;
|
95 |
+
}
|
96 |
+
|
97 |
.sq-invita-ancora {
|
98 |
margin-top: 10px;
|
99 |
|
100 |
}
|
101 |
|
102 |
+
.ajax-loading{
|
103 |
+
margin: auto;
|
|
|
104 |
}
|
105 |
|
106 |
+
.sq-btn-rm{
|
107 |
+
background-image: url(../images/squeezol_payment/x.png);
|
108 |
+
width: 30px !important;
|
109 |
+
height: 30px !important;
|
110 |
+
background-repeat:no-repeat;
|
111 |
+
background-size: 100% 100%;
|
112 |
}
|
113 |
|
114 |
+
|
115 |
#SqueezolRefund_ {
|
116 |
font-family: "DejaVuSansCondensed-BoldOblique";
|
117 |
}
|
118 |
|
119 |
#SqueezolStartPay_, #SqueezolInvitation_, #SqueezolModifyAmount_, #SqueezolPay_, #SqueezolDeserted_ {
|
120 |
height: 40px !important;
|
121 |
+
font-size: 12px !important;
|
122 |
}
|
123 |
|
124 |
#SqueezolModifyAmount_ {
|
142 |
cursor: pointer !important;
|
143 |
}
|
144 |
|
145 |
+
#squeezol_view ol {
|
146 |
+
list-style: decimal;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
|
|
149 |
.sq-buttonEmail {
|
150 |
background-color: #FC8F1A !important;
|
151 |
border: #FC8F1A !important;
|
176 |
text-align: center !important;
|
177 |
line-height: 10px !important;
|
178 |
letter-spacing: 0em !important;
|
179 |
+
cursor: pointer !important;
|
180 |
+
}
|
181 |
+
|
182 |
+
.sq-check {
|
183 |
+
background-image: url(../images/squeezol_payment/check.png);
|
184 |
+
background-repeat: no-repeat;
|
185 |
+
background-size: 100%;
|
186 |
}
|
187 |
|
188 |
div.row-separata {
|
190 |
padding-top: 10px !important;
|
191 |
}
|
192 |
|
193 |
+
div.row-separata-bottom {
|
194 |
+
margin-bottom: 15px;
|
195 |
+
padding-bottom: 10px;
|
196 |
+
}
|
197 |
+
|
198 |
.separator {
|
199 |
border-bottom: 1px solid #dcdcdc !important;
|
200 |
margin-top: 15px !important;
|
275 |
font-family: AbsolutProCond-Bold;
|
276 |
font-size: 24.2px !important;
|
277 |
font-style: normal !important;
|
278 |
+
text-align: left;
|
279 |
line-height: 29px !important;
|
280 |
letter-spacing: 0em !important;
|
281 |
opacity: 1 !important;
|
304 |
padding: 5px;
|
305 |
}
|
306 |
|
307 |
+
.sq-exp {
|
308 |
+
padding: 0em 0.9em 0em;
|
309 |
+
font-size: 11px;
|
310 |
+
}
|
311 |
+
|
312 |
.sq-label {
|
313 |
font-family: AbsolutProCond;
|
314 |
font-size: 15px !important;
|
355 |
}
|
356 |
|
357 |
.sq-date-icon {
|
358 |
+
max-width: 15px !important;
|
359 |
}
|
360 |
|
361 |
.squeezol_button_big{
|
370 |
cursor: pointer !important;
|
371 |
}
|
372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
p.sq-alert-danger, #squeezolNotifyAmount_ {
|
374 |
margin-top: 5px !important;
|
375 |
}
|
376 |
|
377 |
+
.sq-header{
|
378 |
+
background-color: #ECF1F3;
|
379 |
+
}
|
380 |
.sq-container-dashboard {
|
381 |
background-color: #FFFFFF !important;
|
382 |
-webkit-border-radius: 4px;
|
385 |
border: 1px solid #dcdcdc !important;
|
386 |
|
387 |
box-shadow: 3px 3px 1px #dcdcdc !important;
|
|
|
|
|
388 |
}
|
389 |
|
390 |
+
/*iframe {
|
391 |
+
position: absolute;
|
392 |
+
top: 100px;
|
393 |
+
left:250px;
|
394 |
+
}*/
|
395 |
+
|
396 |
+
|
397 |
|
398 |
input.sq-form-control, textarea.sq-form-control, select {
|
399 |
width:100% !important;
|
400 |
+
/*font-family: AbsoluteProCond !important;*/
|
401 |
+
}
|
402 |
+
|
403 |
+
#containerCronologia input.sq-form-control, #containerCronologia .sq-input-group-addon {
|
404 |
+
border-color: #DFF0D8;
|
405 |
+
}
|
406 |
+
|
407 |
+
#sq-calendar {
|
408 |
+
cursor:pointer;
|
409 |
}
|
410 |
|
411 |
.sq-form-group > select {
|
424 |
|
425 |
}
|
426 |
|
427 |
+
.sq-display-none {
|
428 |
+
display: none !important;
|
429 |
+
}
|
430 |
+
|
431 |
+
.sq-text-left{
|
432 |
+
text-align: left;
|
433 |
+
}
|
434 |
+
|
435 |
+
.sq-text-right{
|
436 |
+
text-align: right;
|
437 |
+
}
|
438 |
+
|
439 |
.sq-input-group-addon{
|
440 |
color:#FFF !important;
|
441 |
background-color:#0AB3C6 !important;
|
474 |
}
|
475 |
|
476 |
div.sq-glyph-info-sign {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
font-family: "AbsolutePro-BoldOblique";
|
478 |
+
font-weight: 100 !important;
|
479 |
+
color: #DA396F !important;
|
480 |
+
font-size: 12px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
display: inline !important;
|
482 |
+
width: 80px !important;
|
483 |
+
height: 80px !important;
|
|
|
484 |
cursor: pointer !important;
|
485 |
+
margin: 2px !important;
|
486 |
+
padding-left: 5px !important;
|
487 |
+
padding-right: 5px !important;
|
488 |
+
border-radius: 10px 10px 10px 10px;
|
489 |
+
-moz-border-radius: 10px 10px 10px 10px;
|
490 |
+
-webkit-border-radius: 10px 10px 10px 10px;
|
491 |
+
border: 2px solid #DA396F;
|
492 |
}
|
493 |
|
494 |
.target-A {
|
513 |
letter-spacing: 0em !important;
|
514 |
opacity: 1 !important;
|
515 |
color: #FFF !important;
|
516 |
+
padding-top: 20px;
|
517 |
+
padding-bottom: 20px;
|
518 |
border-radius: 4px !important;
|
519 |
-webkit-border-radius: 4px;
|
520 |
-moz-border-radius: 4px;
|
575 |
}
|
576 |
|
577 |
.sq-pink-text {
|
578 |
+
color:#0AB3C6 !important;
|
579 |
font-family: "DejaVuSansCondensed-BoldOblique" !important;
|
580 |
}
|
581 |
|
582 |
+
.socialPaddedBorder {
|
583 |
+
font-family: DejaVuSansCondensed;
|
584 |
+
font-size: 14px;
|
585 |
+
color: #4F424A;
|
586 |
+
font-style: normal;
|
587 |
+
text-align: left;
|
588 |
+
line-height: 16.8px;
|
589 |
+
letter-spacing: 0em;
|
590 |
+
opacity: 1;
|
591 |
+
margin-top: 10px;
|
592 |
+
margin-bottom: 10px;
|
593 |
+
border: 2px solid #08b3c7 !important;
|
594 |
+
border-radius: 30px !important;
|
595 |
+
}
|
596 |
+
|
597 |
div.withPaddedBorder {
|
598 |
border: 1px solid #DDD;
|
599 |
-webkit-border-radius: 4px;
|
605 |
.part h4{
|
606 |
font-family: 'AbsolutProCond';
|
607 |
}
|
608 |
+
|
609 |
+
#contributionType, #contributionType option
|
610 |
+
{
|
611 |
+
font-family: 'DejavuSansCondensed-Bold';
|
612 |
+
}
|
613 |
+
.sq-panel, .sq-exp, h3.sq-popover-title {
|
614 |
+
font-family: 'DejavuSansCondensed';
|
615 |
+
}
|
616 |
+
|
617 |
#closeModal {
|
618 |
background-color: #FFFFFF;
|
619 |
border-radius: 4px !important;
|
641 |
line-height: 10px;
|
642 |
letter-spacing: 0em;
|
643 |
opacity: 1;
|
644 |
+
border-radius: 4px;
|
645 |
+
-webkit-border-radius: 4px;
|
646 |
+
-moz-border-radius: 4px;
|
647 |
color: #FFF;
|
648 |
padding: 5px;
|
649 |
}
|
skin/frontend/base/default/images/squeezol_payment/ajax-loader.gif
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/btn-finger.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/busta.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/busta2.jpg
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/calendar.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/check.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/default.jpg
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/fb_login.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/fenicottero.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/g_login.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/gestpay.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/ghianda_step_blu.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/ghianda_step_grigia.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/info-black.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/logo_min.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/pay_button.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/pay_button2.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/plus.png
ADDED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/salva2.jpg
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/salvadanaio.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/shopping-cart.jpg
DELETED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/squeezol.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-aziende.png
DELETED
Binary file
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-creasplit-pink.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-creasplit.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-invita-pink.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-invita.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-riassunto-pink.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/squeezol_icon-riassunto.png
CHANGED
File without changes
|
skin/frontend/base/default/images/squeezol_payment/x.png
ADDED
Binary file
|
skin/frontend/base/default/js/_squeezol3.js
CHANGED
@@ -3,199 +3,6 @@
|
|
3 |
* Copyright 2013-2015 Squeezol SRL.
|
4 |
* Licensed under OSL
|
5 |
*/
|
6 |
-
|
7 |
-
if (typeof JSON !== 'object') {
|
8 |
-
JSON = {};
|
9 |
-
}
|
10 |
-
|
11 |
-
if (typeof jQuery === 'undefined') {
|
12 |
-
throw new Error('Squeezol\'s Library requires jQuery')
|
13 |
-
}
|
14 |
-
|
15 |
-
(function () {
|
16 |
-
'use strict';
|
17 |
-
function f(n) {
|
18 |
-
return n < 10 ? '0' + n : n;
|
19 |
-
}
|
20 |
-
if (typeof Date.prototype.toJSON !== 'function') {
|
21 |
-
Date.prototype.toJSON = function () {
|
22 |
-
return isFinite(this.valueOf())
|
23 |
-
? this.getUTCFullYear() + '-' +
|
24 |
-
f(this.getUTCMonth() + 1) + '-' +
|
25 |
-
f(this.getUTCDate()) + 'T' +
|
26 |
-
f(this.getUTCHours()) + ':' +
|
27 |
-
f(this.getUTCMinutes()) + ':' +
|
28 |
-
f(this.getUTCSeconds()) + 'Z'
|
29 |
-
: null;
|
30 |
-
};
|
31 |
-
String.prototype.toJSON =
|
32 |
-
Number.prototype.toJSON =
|
33 |
-
Boolean.prototype.toJSON = function () {
|
34 |
-
return this.valueOf();
|
35 |
-
};
|
36 |
-
}
|
37 |
-
var cx,
|
38 |
-
escapable,
|
39 |
-
gap,
|
40 |
-
indent,
|
41 |
-
meta,
|
42 |
-
rep;
|
43 |
-
function quote(string) {
|
44 |
-
escapable.lastIndex = 0;
|
45 |
-
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
46 |
-
var c = meta[a];
|
47 |
-
return typeof c === 'string'
|
48 |
-
? c
|
49 |
-
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
50 |
-
}) + '"' : '"' + string + '"';
|
51 |
-
}
|
52 |
-
function str(key, holder) {
|
53 |
-
// Produce a string from holder[key].
|
54 |
-
var i, // The loop counter.
|
55 |
-
k, // The member key.
|
56 |
-
v, // The member value.
|
57 |
-
length,
|
58 |
-
mind = gap,
|
59 |
-
partial,
|
60 |
-
value = holder[key];
|
61 |
-
if (value && typeof value === 'object' &&
|
62 |
-
typeof value.toJSON === 'function') {
|
63 |
-
value = value.toJSON(key);
|
64 |
-
}
|
65 |
-
if (typeof rep === 'function') {
|
66 |
-
value = rep.call(holder, key, value);
|
67 |
-
}
|
68 |
-
switch (typeof value) {
|
69 |
-
case 'string':
|
70 |
-
return quote(value);
|
71 |
-
case 'number':
|
72 |
-
return isFinite(value) ? String(value) : 'null';
|
73 |
-
case 'boolean':
|
74 |
-
case 'null':
|
75 |
-
return String(value);
|
76 |
-
case 'object':
|
77 |
-
if (!value) {
|
78 |
-
return 'null';
|
79 |
-
}
|
80 |
-
gap += indent;
|
81 |
-
partial = [];
|
82 |
-
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
83 |
-
length = value.length;
|
84 |
-
for (i = 0; i < length; i += 1) {
|
85 |
-
partial[i] = str(i, value) || 'null';
|
86 |
-
}
|
87 |
-
v = partial.length === 0
|
88 |
-
? '[]'
|
89 |
-
: gap
|
90 |
-
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
91 |
-
: '[' + partial.join(',') + ']';
|
92 |
-
gap = mind;
|
93 |
-
return v;
|
94 |
-
}
|
95 |
-
if (rep && typeof rep === 'object') {
|
96 |
-
length = rep.length;
|
97 |
-
for (i = 0; i < length; i += 1) {
|
98 |
-
if (typeof rep[i] === 'string') {
|
99 |
-
k = rep[i];
|
100 |
-
v = str(k, value);
|
101 |
-
if (v) {
|
102 |
-
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
103 |
-
}
|
104 |
-
}
|
105 |
-
}
|
106 |
-
} else {
|
107 |
-
for (k in value) {
|
108 |
-
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
109 |
-
v = str(k, value);
|
110 |
-
if (v) {
|
111 |
-
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
-
}
|
116 |
-
v = partial.length === 0
|
117 |
-
? '{}'
|
118 |
-
: gap
|
119 |
-
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
120 |
-
: '{' + partial.join(',') + '}';
|
121 |
-
gap = mind;
|
122 |
-
return v;
|
123 |
-
}
|
124 |
-
}
|
125 |
-
if (typeof JSON.stringify !== 'function') {
|
126 |
-
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
127 |
-
meta = { // table of character substitutions
|
128 |
-
'\b': '\\b',
|
129 |
-
'\t': '\\t',
|
130 |
-
'\n': '\\n',
|
131 |
-
'\f': '\\f',
|
132 |
-
'\r': '\\r',
|
133 |
-
'"' : '\\"',
|
134 |
-
'\\': '\\\\'
|
135 |
-
};
|
136 |
-
JSON.stringify = function (value, replacer, space) {
|
137 |
-
var i;
|
138 |
-
gap = '';
|
139 |
-
indent = '';
|
140 |
-
if (typeof space === 'number') {
|
141 |
-
for (i = 0; i < space; i += 1) {
|
142 |
-
indent += ' ';
|
143 |
-
}
|
144 |
-
} else if (typeof space === 'string') {
|
145 |
-
indent = space;
|
146 |
-
}
|
147 |
-
rep = replacer;
|
148 |
-
if (replacer && typeof replacer !== 'function' &&
|
149 |
-
(typeof replacer !== 'object' ||
|
150 |
-
typeof replacer.length !== 'number')) {
|
151 |
-
throw new Error('JSON.stringify');
|
152 |
-
}
|
153 |
-
return str('', {'': value});
|
154 |
-
};
|
155 |
-
}
|
156 |
-
if (typeof JSON.parse !== 'function') {
|
157 |
-
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
158 |
-
JSON.parse = function (text, reviver) {
|
159 |
-
var j;
|
160 |
-
function walk(holder, key) {
|
161 |
-
var k, v, value = holder[key];
|
162 |
-
if (value && typeof value === 'object') {
|
163 |
-
for (k in value) {
|
164 |
-
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
165 |
-
v = walk(value, k);
|
166 |
-
if (v !== undefined) {
|
167 |
-
value[k] = v;
|
168 |
-
} else {
|
169 |
-
delete value[k];
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
return reviver.call(holder, key, value);
|
175 |
-
}
|
176 |
-
text = String(text);
|
177 |
-
cx.lastIndex = 0;
|
178 |
-
if (cx.test(text)) {
|
179 |
-
text = text.replace(cx, function (a) {
|
180 |
-
return '\\u' +
|
181 |
-
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
182 |
-
});
|
183 |
-
}
|
184 |
-
if (/^[\],:{}\s]*$/
|
185 |
-
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
186 |
-
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
187 |
-
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
188 |
-
j = eval('(' + text + ')');
|
189 |
-
return typeof reviver === 'function'
|
190 |
-
? walk({'': j}, '')
|
191 |
-
: j;
|
192 |
-
}
|
193 |
-
|
194 |
-
throw new SyntaxError('JSON.parse');
|
195 |
-
};
|
196 |
-
}
|
197 |
-
}());
|
198 |
-
|
199 |
+function($sqjQuery) {
|
200 |
// DOM ELEMENTS
|
201 |
var SqStr = function(str) {
|
@@ -466,21 +273,28 @@ if (cx.test(text)) {
|
|
466 |
that.getName = function() { return obj.el.name; };
|
467 |
that.getValue = function() { return SqStr(obj.el.value).entityify(); };
|
468 |
that.getRawValue = function() { return obj.el.value };
|
469 |
-
that.labelize = function(labelName, helpText) {
|
470 |
var lab, div;
|
471 |
var ui = UserInterface();
|
|
|
472 |
lab = document.createElement('label');
|
473 |
div = document.createElement('div');
|
474 |
lab.for = obj.el.id;
|
475 |
div.className = 'sq-form-group';
|
476 |
lab.appendChild(ui.textWithHelper(labelName, helpText));
|
477 |
-
div.appendChild(lab)
|
478 |
-
|
|
|
|
|
|
|
|
|
|
|
479 |
return DomElement({el: div});
|
480 |
},
|
481 |
-
that.labelizeWithSpan = function(labelName, span, helpText){
|
482 |
var lab;
|
483 |
var ui = UserInterface();
|
|
|
484 |
divForm = document.createElement('div');
|
485 |
divInput = document.createElement('div');
|
486 |
lab = document.createElement('label');
|
@@ -490,7 +304,12 @@ if (cx.test(text)) {
|
|
490 |
divInput.appendChild(obj.el);
|
491 |
divInput.appendChild(span);
|
492 |
lab.appendChild(ui.textWithHelper(labelName, helpText));
|
493 |
-
divForm.appendChild(lab)
|
|
|
|
|
|
|
|
|
|
|
494 |
divForm.appendChild(divInput)
|
495 |
return DomElement({el: divForm});
|
496 |
},
|
@@ -662,8 +481,8 @@ if (cx.test(text)) {
|
|
662 |
|
663 |
var Trolley = function(obj) {
|
664 |
var that, trolley = {};
|
665 |
-
trolley.
|
666 |
-
trolley.
|
667 |
trolley.products = obj.codP;
|
668 |
that = {};
|
669 |
that.get = function() { return trolley; };
|
@@ -696,11 +515,22 @@ if (cx.test(text)) {
|
|
696 |
|
697 |
var UserInterface = function() {
|
698 |
var that = {};
|
699 |
-
that.
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
},
|
705 |
that.switchCurrency = function(curr){
|
706 |
if (curr == 'EUR'){
|
@@ -718,53 +548,70 @@ if (cx.test(text)) {
|
|
718 |
var active='blu';
|
719 |
var inactive='grigia';
|
720 |
var crea = invita = gestisci = 'inactive';
|
721 |
-
var title = '';
|
|
|
722 |
var c_var = i_var = d_var = '';
|
723 |
switch(page){
|
724 |
case 'create':
|
725 |
crea='active';
|
726 |
c_var='-pink';
|
727 |
title = 'Crea Split';
|
|
|
|
|
728 |
break;
|
729 |
case 'invitation':
|
730 |
invita='active';
|
731 |
i_var='-pink';
|
732 |
title = 'Invita';
|
|
|
|
|
733 |
break;
|
734 |
case 'digest':
|
735 |
gestisci='active';
|
736 |
d_var='-pink';
|
737 |
title = 'Gestisci';
|
|
|
|
|
738 |
break;
|
739 |
}
|
740 |
-
// Bootstrap 3 Implementation
|
741 |
viewPortDiv = $sqjQuery('#squeezol_view');
|
742 |
viewPortDiv.addClass("container-fluid");
|
743 |
modalDiv = '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-container-dashboard">'+
|
744 |
'<div id="squeezol_view">'+
|
745 |
-
'<div class="sq-row">'+
|
746 |
-
'<div class="sq-col-
|
747 |
-
'<img class="
|
|
|
|
|
|
|
748 |
'</div>'+
|
749 |
'</div>'+
|
750 |
'<div class="sq-row row-separata">'+
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
'</div>'+
|
|
|
|
|
|
|
|
|
|
|
761 |
'<div class="sq-row">'+
|
762 |
-
|
763 |
-
|
764 |
-
|
|
|
|
|
|
|
|
|
765 |
'</div>'+
|
766 |
'</div>'+
|
767 |
-
'</div>'+
|
768 |
'</div>';
|
769 |
viewPortDiv.append(modalDiv);
|
770 |
viewPortDiv.removeAttr('id', null);
|
@@ -783,12 +630,12 @@ if (cx.test(text)) {
|
|
783 |
that.drawSeparatorCollapse = function(text){
|
784 |
var viewPortDiv = $sqjQuery('#squeezol_view');
|
785 |
var panel = '<div class="sq-row row-separata" id="squeezol-accordion-container">'+
|
786 |
-
'<div class="sq-col-md-
|
787 |
'<div class="sq-panel-group">'+
|
788 |
'<div class="sq-panel sq-panel-default">'+
|
789 |
-
'<div class="sq-panel-heading sq-
|
790 |
'<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">'+
|
791 |
-
'<p class="sq-label">'+text+'</p>'+
|
792 |
'</a>'+
|
793 |
'</div>'+
|
794 |
'<div id="collapseOne" class="sq-panel-collapse sq-collapse sq-out">'+
|
@@ -844,7 +691,7 @@ if (cx.test(text)) {
|
|
844 |
return textElem;
|
845 |
},
|
846 |
that.renderAlreadyInvited = function(emailDiv, fbDiv, alreadyInvited, group) {
|
847 |
-
this.drawSeparator('
|
848 |
var container = document.createElement('div');
|
849 |
container.id = 'containerCronologia';
|
850 |
container.className = 'sq-row';
|
@@ -863,7 +710,7 @@ if (cx.test(text)) {
|
|
863 |
tmp.className = 'sq-row sq-fb-element';
|
864 |
tmp.innerHTML += '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-has-success sq-input-group"> <input type="hidden" class="fbEntry sq-form-control" value="'+invObj.fb_id+'"disabled></input>'+
|
865 |
'<input value="'+invObj.name+'" class="sq-form-control" type="text" name="email" disabled>'+
|
866 |
-
'<span class="sq-input-group-addon sq-glyph-ok"
|
867 |
'</div>';
|
868 |
}
|
869 |
else {
|
@@ -871,7 +718,7 @@ if (cx.test(text)) {
|
|
871 |
tmp.innerHTML+= '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-form-group sq-has-success sq-input-group">'+
|
872 |
|
873 |
'<input value="'+invObj.email+'" class="sq-form-control" type="email" name="email" placeholder="email address" disabled>'+
|
874 |
-
'<span class="sq-input-group-addon sq-glyph-ok"
|
875 |
'</div>';
|
876 |
}
|
877 |
$sqjQuery(container).append(tmp);
|
@@ -914,8 +761,8 @@ if (cx.test(text)) {
|
|
914 |
if (id == 'emailModal') {
|
915 |
if (modal == false){
|
916 |
removeBtn = Button()
|
917 |
-
removeBtn.create('
|
918 |
-
removeBtn.addClass('sq-btn sq-btn-xs sq-btn-
|
919 |
removeBtn.regHandler('click', function(e){
|
920 |
var event= e || window.event;
|
921 |
var target = event.target || event.srcElement || event.originalTarget;
|
@@ -942,17 +789,46 @@ if (cx.test(text)) {
|
|
942 |
}
|
943 |
else if (id == 'facebookModal'){
|
944 |
modalContent.append(content);
|
945 |
-
|
946 |
location.reload(true);
|
947 |
-
})
|
948 |
-
}
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
956 |
that.textWithHelper = function(labelName, helpText){
|
957 |
var txt = document.createElement('p')
|
958 |
var $question = $sqjQuery('<div />');
|
@@ -962,13 +838,13 @@ if (cx.test(text)) {
|
|
962 |
$question.attr('data-placement', 'top');
|
963 |
$question.attr('title', helpText);
|
964 |
$question.addClass('sq-icon sq-glyph-info-sign');
|
965 |
-
$question.append('
|
966 |
$sqjQuery(txt).append($question);
|
967 |
return txt;
|
968 |
},
|
969 |
that.iconPopover = function(){
|
970 |
-
|
971 |
-
|
972 |
$sqjQuery(this).popover('show')
|
973 |
});
|
974 |
$sqjQuery('.sq-icon').on('mouseout', function(){
|
@@ -976,8 +852,7 @@ if (cx.test(text)) {
|
|
976 |
});
|
977 |
$sqjQuery('.sq-icon').on('hidden.bs.popover', function(){
|
978 |
$sqjQuery(this).css("display", "");
|
979 |
-
})
|
980 |
-
|
981 |
};
|
982 |
return that;
|
983 |
};
|
@@ -997,7 +872,7 @@ if (cx.test(text)) {
|
|
997 |
|
998 |
var i18n_ita = { previousMonth : 'Mese precedente',
|
999 |
nextMonth : 'Mese successivo',
|
1000 |
-
months : ['Gennaio','
|
1001 |
weekdays : ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'],
|
1002 |
weekdaysShort : ['Dom','Lun','Mar','Merc','Gio','Ven','Sab']
|
1003 |
}
|
@@ -1029,30 +904,35 @@ if (cx.test(text)) {
|
|
1029 |
wrapper, accordion, tempAcc, dateIcon;
|
1030 |
var opt = [];
|
1031 |
var tempRowDiv, spanCurr;
|
1032 |
-
var tmp, startDate, d1, d2;
|
1033 |
var day = 24 * 60 * 60 * 1000;
|
1034 |
var ui = UserInterface();
|
1035 |
-
var placeholder = { 'name': '
|
1036 |
'description': 'Descrivi cosa intendi fare con la somma raccolta'}
|
|
|
|
|
|
|
|
|
1037 |
var helpText = { 'name': 'Dai un titolo allo Split. Per esempio: regalo per Marco, week end in Montagna ecc.',
|
1038 |
'description': 'Il posto giusto dove inserire qualche dettaglio che invogli i tuoi amici a partecipare',
|
1039 |
'max_acceptance_date': 'Scegli la data entro la quale gli invitati dovranno confermare la propria partecipazione',
|
1040 |
-
'max_payment_date': 'Scegli la data entro la quale i partecipanti possono effettuare i pagamenti. La durata massima
|
1041 |
'occurrence': 'Fai sapere ai partecipanti per quale occasione si effettua l\'acquisto',
|
1042 |
'promo_code': 'Inserisci un codice promozionale valido: ti consente di avere uno sconto sullo Split',
|
1043 |
-
'alert_email': '
|
1044 |
-
'hide_contribution': 'Nasconde ai
|
1045 |
'hide_invitation': 'Nasconde l\' identità dei partecipanti tra di loro.',
|
1046 |
'isOpen': 'Split aperto a chiunque abbia un invito, senza PIN e a donazione libera' }
|
1047 |
wrapper_row = { wrapper: 'div', className: 'sq-row'};
|
1048 |
wrapper_row_pad = { wrapper: 'div', className: 'sq-row pad-it'};
|
1049 |
-
wrapper_left = { wrapper: 'div', className : 'sq-col-md-
|
1050 |
wrapper_left_small = { wrapper: 'div', className : 'sq-col-md-4 sq-col-md-offset-1 sq-col-xs-12' }
|
1051 |
-
wrapper_right = { wrapper: 'div', className: 'sq-col-md-
|
1052 |
-
wrapper_btn = { wrapper: 'div', className: 'sq-col-md-
|
1053 |
wrapper_push_right = { wrapper: 'div', className: 'sq-col-md-3 sq-col-md-offset-9 sq-col-xs-12'};
|
|
|
1054 |
dateIcon = document.createElement('img');
|
1055 |
-
dateIcon.setAttribute('src', img_url+'
|
1056 |
dateIcon.className = 'sq-img-responsive sq-date-icon';
|
1057 |
//UI
|
1058 |
ui.drawHeader('create', 'modal');
|
@@ -1062,17 +942,45 @@ if (cx.test(text)) {
|
|
1062 |
tmp=document.createElement('div');
|
1063 |
tempRowDiv = Div(tmp);
|
1064 |
tempRowDiv.addClass('sq-row');
|
1065 |
-
// Nome
|
1066 |
input = TextInput();
|
1067 |
input.create('name');
|
1068 |
input.get().setAttribute('placeholder', placeholder['name']);
|
1069 |
inputs.push(input);
|
1070 |
// Data Accettazione
|
1071 |
-
tempRowDiv.append(input.labelize('
|
1072 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1073 |
date1 = DateInput();
|
1074 |
-
d1 = new Date(new Date().getTime()
|
1075 |
-
//startDate = ('0' + d.getDate()).slice(-2) + "-" + ('0' + d.getMonth()).slice(-2) + "-" + d.getFullYear();
|
1076 |
date1.create('max_acceptance_date', d1);
|
1077 |
date1.get().id = 'datepicker1';
|
1078 |
date1.addPicker(dp1);
|
@@ -1080,7 +988,8 @@ if (cx.test(text)) {
|
|
1080 |
spanCurr = document.createElement('span');
|
1081 |
spanCurr.className = 'sq-input-group-addon';
|
1082 |
spanCurr.appendChild(dateIcon);
|
1083 |
-
tempRowDiv.append(date1.labelizeWithSpan('Scadenza Invito', spanCurr, helpText['max_acceptance_date']).wrap(
|
|
|
1084 |
// Append first row
|
1085 |
viewPortDiv.append(tempRowDiv.get());
|
1086 |
// Temp Div
|
@@ -1092,38 +1001,12 @@ if (cx.test(text)) {
|
|
1092 |
input.create('description');
|
1093 |
input.get().setAttribute('placeholder', placeholder['description']);
|
1094 |
inputs.push(input);
|
1095 |
-
tempRowDiv.append(input.labelize('Descrizione', helpText['description']).wrap(wrapper_left));
|
1096 |
-
// Data Pagamenti
|
1097 |
-
date2 = DateInput();
|
1098 |
-
d2 = new Date(new Date().getTime() + 20*day);
|
1099 |
-
//startDate = ('0' + d.getDate()).slice(-2) + "-" + ('0' + d.getMonth()).slice(-2) + "-" + d.getFullYear();
|
1100 |
-
date2.create('max_payment_date', d2);
|
1101 |
-
date2.get().id = 'datepicker2';
|
1102 |
-
date2.addPicker(dp2);
|
1103 |
-
|
1104 |
-
inputs.push(date2);
|
1105 |
-
spanCurr = document.createElement('span');
|
1106 |
-
spanCurr.className = 'sq-input-group-addon';
|
1107 |
-
spanCurr.appendChild(dateIcon.cloneNode())
|
1108 |
-
tempRowDiv.append(date2.labelizeWithSpan('Scadenza Pagamenti', spanCurr, helpText['max_payment_date']).wrap(wrapper_right));
|
1109 |
-
this.initDatePickers(d1, d2);
|
1110 |
-
opt.push({value: 'R', text: 'Acquisto regalo'});
|
1111 |
-
opt.push({value: 'V', text: 'Viaggio di gruppo'});
|
1112 |
-
opt.push({value: 'C', text: 'Evento/Concerto'});
|
1113 |
-
opt.push({value: 'G', text: 'Grigliata'});
|
1114 |
-
opt.push({value: 'N', text: 'Regalo Nozze'});
|
1115 |
-
opt.push({value: 'A', text: 'Altro ...'});
|
1116 |
-
combo = ComboBox();
|
1117 |
-
combo.create(opt);
|
1118 |
-
viewPortDiv.append(tempRowDiv.get())
|
1119 |
|
1120 |
-
|
1121 |
-
tempRowDiv = Div(tmp);
|
1122 |
-
tempRowDiv.addClass('sq-row');
|
1123 |
-
tempRowDiv.append(combo.labelize('Occasione', helpText['occurrence']).wrap(wrapper_left));
|
1124 |
viewPortDiv.append(tempRowDiv.get())
|
1125 |
ui.drawSeparator('');
|
1126 |
-
ui.drawSeparatorCollapse('Opzioni
|
1127 |
//squeezol-accordion
|
1128 |
tempAcc = document.getElementById('squeezol-accordion');
|
1129 |
accordion = Div(tempAcc);
|
@@ -1131,7 +1014,7 @@ if (cx.test(text)) {
|
|
1131 |
checkBox = CheckBox();
|
1132 |
checkBox.create({name: 'alert_email', value: 'Email notifications'});
|
1133 |
checkBoxes.push(checkBox);
|
1134 |
-
accordion.append(checkBox.labelize('
|
1135 |
|
1136 |
checkBox = CheckBox();
|
1137 |
checkBox.create({name: 'hide_contribution', value: 'Hide Contribution'});
|
@@ -1142,24 +1025,22 @@ if (cx.test(text)) {
|
|
1142 |
checkBox.create({name: 'hide_invitation', value: 'Hide Invitation'});
|
1143 |
checkBoxes.push(checkBox);
|
1144 |
accordion.append(checkBox.labelize('Nascondi partecipanti', helpText['hide_invitation']).wrap(wrapper_row_pad));
|
1145 |
-
|
1146 |
checkBox = CheckBox();
|
1147 |
checkBox.create({name: 'isOpen', value: 'Open funding', checked: 'true'});
|
1148 |
checkBoxes.push(checkBox);
|
1149 |
-
accordion.append(checkBox.labelize('Split a donazione libera', helpText['isOpen']).wrap(
|
1150 |
-
|
1151 |
promo = TextInput();
|
1152 |
promo.create('promo_code');
|
1153 |
-
accordion.append(promo.labelize('Codice Promozionale', helpText['promo_code']).wrap(
|
1154 |
-
|
1155 |
|
1156 |
button.create('Prosegui', 'big', 'squeezol_button');
|
1157 |
button.addClass('sq-btn')
|
1158 |
button.regHandler('click', buttonHandler);
|
1159 |
-
button = Div(button.wrap(wrapper_btn));
|
1160 |
tmp = document.getElementById('squeezol-accordion-container');
|
1161 |
tempRowDiv = Div(tmp);
|
1162 |
-
tempRowDiv.append(button.wrap(
|
1163 |
ui.iconPopover();
|
1164 |
return this;
|
1165 |
};
|
@@ -1430,29 +1311,97 @@ if (cx.test(text)) {
|
|
1430 |
};
|
1431 |
|
1432 |
var InvitationObj = function() {
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1439 |
},
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
|
|
|
|
1450 |
totAdmin= parseFloat(contrib)+parseFloat(rest);
|
1451 |
adminContrib.value = parseFloat(totAdmin).toFixed(2);
|
1452 |
}
|
1453 |
else{
|
1454 |
adminContrib.value = parseFloat(contrib).toFixed(2);
|
1455 |
}
|
|
|
1456 |
adminContrib.disabled = true;
|
1457 |
return;
|
1458 |
},
|
@@ -1723,8 +1672,8 @@ if (cx.test(text)) {
|
|
1723 |
'</div>'+
|
1724 |
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-form-group sq-has-success sq-input-group">'+
|
1725 |
'<input value="'+currSent.value+'" class="sq-form-control" type="email" name="email" placeholder="email address" disabled>'+
|
1726 |
-
'<span class="sq-input-group-addon sq-glyph-ok">'+
|
1727 |
-
'
|
1728 |
'</div>'+
|
1729 |
'</div>';
|
1730 |
container.appendChild(div);
|
@@ -1742,7 +1691,7 @@ if (cx.test(text)) {
|
|
1742 |
that.renderGET = function(invitationUrl) {
|
1743 |
var params, participantAdmin, group, alreadyInvited, socialProviders,
|
1744 |
grId, grAmount, gData, pAdminId;
|
1745 |
-
var btnText = ['Email', 'f |
|
1746 |
btnId = ['squeezolEmail_', 'squeezolFb_', 'squeezolSubmit_' ],
|
1747 |
btnSize = ['small', 'small', 'big'],
|
1748 |
btnClass = ['sq-btn sq-btn-lg sq-buttonEmail', 'sq-btn sq-btn-lg sq-buttonFb', 'sq-btn'];
|
@@ -1753,11 +1702,17 @@ if (cx.test(text)) {
|
|
1753 |
var copiaUrl, a_temp, a_link;
|
1754 |
var i, j, currBtn, ui;
|
1755 |
var wrapper_left = { wrapper: 'div', className : 'sq-col-xs-2' };
|
1756 |
-
var wrapper_center = { wrapper: 'div', className : 'sq-col-md-3 sq-col-xs-10
|
1757 |
-
var wrapper_btn = { wrapper: 'div', className : 'sq-col-
|
1758 |
var wrapper_row = { wrapper: 'div', className : 'sq-row' };
|
1759 |
-
var wrapper_remove = { wrapper: 'div', className: 'sq-col-sm-
|
1760 |
if(answer.status === 'ok') {
|
|
|
|
|
|
|
|
|
|
|
|
|
1761 |
// Parsing Parametri
|
1762 |
params=JSON.parse(answer.params);
|
1763 |
grId = params.group_id;
|
@@ -1781,7 +1736,7 @@ if (cx.test(text)) {
|
|
1781 |
fbDiv.id = 'squeezolFb'
|
1782 |
invitationBtn = InvitationObj();
|
1783 |
emailBtn = invitationBtn.createButton('+ Email', btnId[0], btnSize[0], 'sq-btn sq-btn-sm sq-buttonEmail');
|
1784 |
-
emailModal = invitationBtn.createButton('@ |
|
1785 |
|
1786 |
// SEND EMAIL handler:
|
1787 |
submitBtn = invitationBtn.createButton(btnText[2], btnId[2], btnSize[2], btnClass[2]);
|
@@ -1807,8 +1762,8 @@ if (cx.test(text)) {
|
|
1807 |
submitDiv.appendChild(submitBtn.wrap({ wrapper: 'div', className : 'sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-3 sq-col-md-offset-8'}));
|
1808 |
|
1809 |
var NewremoveBtn = Button()
|
1810 |
-
NewremoveBtn.create('
|
1811 |
-
NewremoveBtn.addClass('sq-btn sq-btn-xs sq-btn-
|
1812 |
NewremoveBtn.regHandler('click', function(e){
|
1813 |
var event= e || window.event;
|
1814 |
var target = event.target || event.srcElement || event.originalTarget;
|
@@ -1825,8 +1780,8 @@ if (cx.test(text)) {
|
|
1825 |
var contribType = sBox.options[sBox.selectedIndex].value;
|
1826 |
|
1827 |
removeBtn = Button()
|
1828 |
-
removeBtn.create('
|
1829 |
-
removeBtn.addClass('sq-btn sq-btn-xs sq-btn-
|
1830 |
removeBtn.regHandler('click', function(e){
|
1831 |
var event= e || window.event;
|
1832 |
var target = event.target || event.srcElement || event.originalTarget;
|
@@ -1838,7 +1793,7 @@ if (cx.test(text)) {
|
|
1838 |
$sqjQuery(newEmail).append('<div class="sq-hidden-xs sq-col-sm-2 sq-col-md-2">'+
|
1839 |
'<img style="display:inline;" class="imgAvatar sq-thumbnail" src="' + img_url + 'default.jpg" alt="User Avatar"></img>'+
|
1840 |
'</div>'+
|
1841 |
-
'<div class="sq-col-sm-
|
1842 |
'<input class="sq-form-control mail__Invitation" placeholder="Aggiungi Email" type="email" name="email">'+
|
1843 |
'</div>');
|
1844 |
newEmail.appendChild(removeBtn.wrap(wrapper_remove));
|
@@ -1849,21 +1804,27 @@ if (cx.test(text)) {
|
|
1849 |
.append('<div class="sq-hidden-xs sq-col-sm-2 sq-col-md-2">'+
|
1850 |
'<img style="display:inline;" class="imgAvatar sq-thumbnail" src="' + img_url + 'default.jpg" alt="User Avatar"></img>'+
|
1851 |
'</div>'+
|
1852 |
-
'<div class="sq-col-sm-
|
1853 |
'<input class="sq-form-control mail__Invitation" placeholder="Aggiungi Email" type="email" name="email">'+
|
1854 |
'</div>', NewremoveBtn.wrap(wrapper_remove)))
|
1855 |
emailModal.regHandler('click', function() {
|
1856 |
var ui = UserInterface();
|
1857 |
ui.sqModal(emailDiv, submitDiv, 'emailModal');
|
1858 |
});
|
1859 |
-
|
|
|
|
|
|
|
|
|
|
|
1860 |
tmpObj = document.createElement('div');
|
1861 |
-
tmpObj.className = 'sq-
|
|
|
1862 |
tmpObj.appendChild(emailModal.wrap(wrapper_btn));
|
1863 |
|
1864 |
// FACEBOOK IFRAME handler:
|
1865 |
if (params.fb_url) {
|
1866 |
-
fbBtn = invitationBtn.createButton(btnText[1], btnId[1], '
|
1867 |
fbBtn.regHandler('click', function(){
|
1868 |
var iFrameModal;
|
1869 |
var ui=UserInterface();
|
@@ -1876,49 +1837,33 @@ if (cx.test(text)) {
|
|
1876 |
else {
|
1877 |
iFrameModal.innerHTML = '';
|
1878 |
}
|
1879 |
-
var socIframe = '<
|
1880 |
-
|
1881 |
-
'</button>'+
|
1882 |
-
'<div class="sq-col-xs-10 sq-col-xs-offset-1">'+
|
1883 |
-
'<iframe width="620px" height="620px" class="squeezol_iframe" src="'+params.fb_url+'" frameborder="0">'+
|
1884 |
-
'NON è possibile invitare con Facebook da questo dispositivo'+
|
1885 |
-
'</iframe>'+
|
1886 |
'</div>';
|
1887 |
-
|
1888 |
-
|
1889 |
iFrameModal.innerHTML=socIframe;
|
1890 |
-
ui.sqModal(iFrameModal,'', 'facebookModal')
|
1891 |
return
|
1892 |
});
|
1893 |
tmpObj.appendChild(fbBtn.wrap(wrapper_center));
|
1894 |
}
|
1895 |
-
/*
|
1896 |
else {
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
copiaUrl.setAttribute('title', 'Aggiungi Facebook per invitare i tuoi contatti');
|
1901 |
-
a_temp = document.createElement('a');
|
1902 |
-
a_temp.innerHTML = 'Invita con Facebook';
|
1903 |
-
a_link=DomElement({'el': a_temp});
|
1904 |
-
a_link.id='sqFbLink';
|
1905 |
-
a_link.regHandler('click', function(e) {
|
1906 |
-
window.location.replace(answer.redirect_url);
|
1907 |
});
|
1908 |
-
|
1909 |
-
|
1910 |
-
}*/
|
1911 |
|
1912 |
copiaUrl = document.createElement('div')
|
1913 |
copiaUrl.className = 'sq-col-md-3 sq-col-xs-10 sq-col-xs-offset-1 pink-link';
|
1914 |
copiaUrl.setAttribute('data-placement', 'top');
|
1915 |
copiaUrl.setAttribute('title', 'Copia URL dello Split e condividilo dove preferisci');
|
1916 |
a_temp = document.createElement('a');
|
1917 |
-
a_temp.innerHTML = '
|
1918 |
a_link=DomElement({'el': a_temp});
|
1919 |
a_link.id='clipBoardLink';
|
1920 |
a_link.regHandler('click', function(e) {
|
1921 |
-
var message = 'Copia
|
1922 |
if (answer.group.isOpen){
|
1923 |
window.prompt(message, params.link_url);
|
1924 |
}
|
@@ -1927,8 +1872,27 @@ if (cx.test(text)) {
|
|
1927 |
}
|
1928 |
});
|
1929 |
copiaUrl.appendChild(a_link.get());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1930 |
tmpObj.appendChild(copiaUrl);
|
1931 |
-
|
|
|
1932 |
|
1933 |
// NEXT Button handler
|
1934 |
nextBtn = invitationBtn.createButton('Prosegui', 'squeezol_next', 'big', btnClass[2]);
|
@@ -1941,21 +1905,24 @@ if (cx.test(text)) {
|
|
1941 |
invError.removeErrorInfo();
|
1942 |
ui.loadState(target);
|
1943 |
invitations.send()
|
1944 |
-
ui.loadStop(target);
|
1945 |
});
|
1946 |
// Select Contribution Type handler:
|
1947 |
var box = DomElement({el: document.getElementById('contributionType')});
|
1948 |
box.regHandler('change', function(e){
|
1949 |
var invObj = InvitationObj();
|
1950 |
var event= e || window.event;
|
|
|
1951 |
var target = event.target || event.srcElement || event.originalTarget;
|
1952 |
-
if (target.value
|
1953 |
contribution = invObj.computeSingleContribution(group.amount);
|
1954 |
invitationBtn.updateContribution(contribution, group.amount);
|
1955 |
}
|
1956 |
-
else
|
1957 |
invObj.setToZero();
|
|
|
1958 |
}
|
|
|
|
|
1959 |
});
|
1960 |
// Append to View Port .invitationContainer
|
1961 |
containerDiv = document.createElement('div');
|
@@ -1971,8 +1938,8 @@ if (cx.test(text)) {
|
|
1971 |
|
1972 |
// Append Next Div to .invitationContainer
|
1973 |
nextDiv = document.createElement('div');
|
1974 |
-
nextDiv.className = 'sq-row';
|
1975 |
-
nextDiv.appendChild(nextBtn.wrap({ wrapper: 'div', className : 'sq-col-xs-10 sq-col-xs-offset-1 sq-col-
|
1976 |
SqDiv.appendChild(nextDiv);
|
1977 |
}
|
1978 |
else if(answer.status === 'anauth'){
|
@@ -1990,101 +1957,73 @@ if (cx.test(text)) {
|
|
1990 |
},
|
1991 |
that.renderGroupData = function(group, participantAdmin, adminEmail, alreadyInvited) {
|
1992 |
var ui = UserInterface();
|
1993 |
-
|
1994 |
-
var
|
1995 |
var isOpen='';
|
1996 |
var groupDigest2;
|
1997 |
-
var date1=new Date(group.max_acceptance_date);
|
1998 |
-
var date2=new Date(group.max_payment_date);
|
1999 |
var sqDiv = document.getElementById('squeezol_view');
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
'</div>';
|
2007 |
}
|
2008 |
-
else {
|
2009 |
-
isOpen = '<input type="hidden" id="sq-group-amount" value="'+group.amount+'"></input>'+
|
2010 |
-
'<p class="sq-content-body"> Obiettivo:</p>'+
|
2011 |
-
'<p class="sq-content-body"><strong>'+group.amount + ui.switchCurrency(group.currency) +'</strong></p>';
|
2012 |
-
}
|
2013 |
-
if (group.fundraising == 'D'){
|
2014 |
-
contrib = participantAdmin.single_amount;
|
2015 |
-
options = '<option value="S">Equa</option>'+
|
2016 |
-
'<option value="D" selected>Suggerita</option>';
|
2017 |
-
}
|
2018 |
-
else if(group.fundraising == 'S') {
|
2019 |
contrib = parseFloat(group.amount/(alreadyInvited.length+1)).toFixed(2);
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023 |
}
|
2024 |
-
|
|
|
2025 |
groupDigest=document.createElement('div');
|
2026 |
groupDigest.id = "squeezol_btn_container";
|
2027 |
-
groupDigest.className = "sq-
|
2028 |
groupDigest2=document.createElement('div');
|
2029 |
groupDigest2.className='sq-row row-separata';
|
2030 |
-
groupDigest2.innerHTML = '<div class="sq-col-
|
2031 |
-
'<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2032 |
'</div>'+
|
2033 |
-
'<div class="sq-col-
|
2034 |
-
'<
|
2035 |
-
'<p class="sq-
|
2036 |
-
|
2037 |
-
'</
|
2038 |
'</div>'+
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
'</strong></p>'+
|
2044 |
'</div>'+
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
groupDigest.innerHTML= '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-withBorder">'+
|
2050 |
-
'<div class="sq-row">'+
|
2051 |
-
'<div class="sq-col-xs-10 sq-col-md-3 sq-col-left">'+
|
2052 |
-
'<div class="sq-box-blu">'+
|
2053 |
-
'<p><strong>'+alreadyInvited.length+'</strong></p>'+
|
2054 |
-
'<p>invitati</p>'+
|
2055 |
-
'</div>'+
|
2056 |
-
'</div>'+
|
2057 |
-
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-form-group" style="margin: 10px 0px 0px 20px;">'+
|
2058 |
-
'<p class="sq-label">Tipo quota:'+
|
2059 |
-
'<div data-toggle="popover" data-placement="top" title="Suggerisci la '+
|
2060 |
-
'quota che verrà visualizzata dagli invitati. Altrimenti la quota proposta '+
|
2061 |
-
'verrà calcolata in base al numero di invitati"'+
|
2062 |
-
'class="sq-icon sq-glyph-info-sign">'+
|
2063 |
-
'<p>i</p>'+
|
2064 |
-
'</div>'+
|
2065 |
-
'</p>'+
|
2066 |
-
'<select class="selectContrib" id="contributionType">'+options+'</select>'+
|
2067 |
-
'<input value="'+adminEmail+'"type="hidden" name="email" disabled>'+
|
2068 |
-
'</div>'+
|
2069 |
-
'<div class="squeezol_quota sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0" style="margin: 10px 0px 0px 20px;">'+
|
2070 |
-
'<p class="sq-label">Quota singola:'+
|
2071 |
-
'<div data-toggle="popover" data-placement="top" title="La quota è un '+
|
2072 |
-
'suggerimento per gli invitati."'+
|
2073 |
-
'class="sq-icon sq-glyph-info-sign">'+
|
2074 |
-
'<p>i</p>'+
|
2075 |
-
'</div>'+
|
2076 |
-
'</p>'+
|
2077 |
-
'<div class="sq-input-group">'+
|
2078 |
-
'<input id="squeezol_admin_contrib" value="'+contrib+'" name="email_contribution"'+
|
2079 |
-
'type="text" class="squeezolPrice sq-form-control" '+disabled+'><span class="sq-input-group-addon">'+ui.switchCurrency(group.currency)+'</span>'
|
2080 |
-
'</div>'+
|
2081 |
-
'</div>'+
|
2082 |
-
'</div>'+
|
2083 |
-
'</div>';
|
2084 |
-
groupDigest2=Div(groupDigest2);
|
2085 |
-
sqDiv.appendChild(groupDigest2.get());
|
2086 |
-
groupDigest=Div(groupDigest);
|
2087 |
-
sqDiv.appendChild(groupDigest.get());
|
2088 |
};
|
2089 |
return that;
|
2090 |
};
|
@@ -2098,21 +2037,25 @@ if (cx.test(text)) {
|
|
2098 |
openPay, canFinish, targetAmount, renderBtn, singleAmountBtn, inviteBtn,
|
2099 |
renderDiv, participantId, invAmount, alertPaid, renderRef, refContainer;
|
2100 |
var paidCount=0;
|
2101 |
-
var part, totalPaid;
|
2102 |
var SqDiv=document.getElementById('squeezol_view');
|
2103 |
var sqBtnContainer;
|
2104 |
var i, j, k, p, spanCurr, quotaDiv, labelQuota;
|
2105 |
var status, ui, state, ghianda, avatar_url, alertDes, contribution_amount;
|
|
|
2106 |
var paidText = '<p class="sq-text-center"><strong> La tua quota è stata prenotata! </strong>'+
|
2107 |
-
'L\'importo verrà scalato dalla tua carta solo se l\'obiettivo verrà raggiunto
|
2108 |
-
'Invita altri amici per diminuire la quota
|
2109 |
'Oppure continua lo shopping!'
|
2110 |
+'</p>';
|
2111 |
-
var wrapper = {wrapper: 'div', className: 'sq-col-md-
|
|
|
2112 |
var wrapper_row = {wrapper: 'div', className: 'sq-row'};
|
2113 |
var wrapBtn = {wrapper: 'div', className: 'sq-col-md-2 sq-col-xs-10 sq-col-xs-offset-1'};
|
|
|
2114 |
var wrapper_right = {wrapper: 'div', className: 'sq-col-md-3 sq-col-md-offset-3 sq-col-xs-10 sq-col-xs-offset-1'};
|
2115 |
-
var helpText = { 'p_quota': 'Inserisci la quota che intendi versare. Nota: fai click su modifica dopo aver inserito l\'importo'
|
|
|
2116 |
|
2117 |
if(answer.status === 'ok') {
|
2118 |
params=JSON.parse(answer.params);
|
@@ -2131,9 +2074,9 @@ if (cx.test(text)) {
|
|
2131 |
ui.drawHeader('digest', 'modal');
|
2132 |
|
2133 |
this.renderGroupData(answer.group, params, SqDiv, participants);
|
2134 |
-
|
2135 |
renderDiv=Div(document.createElement('div'));
|
2136 |
-
renderDiv.addClass('sq-row');
|
2137 |
|
2138 |
renderBtn = Button();
|
2139 |
singleAmountBtn = Button();
|
@@ -2142,7 +2085,7 @@ if (cx.test(text)) {
|
|
2142 |
// Group completed with success
|
2143 |
if(groupStatus == 'CWS') {
|
2144 |
alertDes = document.createElement('div');
|
2145 |
-
alertDes.className = 'sq-row sq-alert sq-alert-success'
|
2146 |
alertDes.innerHTML = '<p class="sq-text-center">'+
|
2147 |
'<strong> Congratulazioni! Ordine Completato</strong>'+
|
2148 |
'Lo split si è concluso con successo! '+
|
@@ -2153,10 +2096,11 @@ if (cx.test(text)) {
|
|
2153 |
else if (groupStatus == 'WAC' || groupStatus == 'WPA'){
|
2154 |
// Possibilita' di proporre un importo se si e' in fase di accettazione o il gruppo e' aperto e WPA
|
2155 |
if (params.p_status == 'A' && !canFinish){
|
|
|
2156 |
saInput.create('single-amount');
|
2157 |
saInput.get().value=parseFloat(params.p_single_amount).toFixed(2);
|
2158 |
saInput.get().id='squeezol_single_amount';
|
2159 |
-
singleAmountBtn.create('
|
2160 |
singleAmountBtn.get().setAttribute('data-participant', participantId);
|
2161 |
singleAmountBtn.get().setAttribute('data-action', 'SA');
|
2162 |
singleAmountBtn.get().className='sq-btn sq-btn-lg';
|
@@ -2166,10 +2110,11 @@ if (cx.test(text)) {
|
|
2166 |
spanCurr = document.createElement('span');
|
2167 |
spanCurr.className = 'sq-input-group-addon';
|
2168 |
spanCurr.innerHTML = ui.switchCurrency(answer.group.currency);
|
2169 |
-
quotaDiv.append(saInput.labelizeWithSpan('
|
2170 |
-
renderDiv.append(quotaDiv.wrap(
|
2171 |
renderDiv.append(singleAmountBtn.wrap(wrapBtn));
|
2172 |
SqDiv.appendChild(renderDiv.get());
|
|
|
2173 |
}
|
2174 |
|
2175 |
ui.iconPopover();
|
@@ -2181,7 +2126,7 @@ if (cx.test(text)) {
|
|
2181 |
renderBtn.create('Inizia i pagamenti!', 'ui', 'SqueezolStartPay_');
|
2182 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2183 |
renderBtn.get().setAttribute('data-action', 'OP');
|
2184 |
-
renderBtn.get().className='sq-btn
|
2185 |
renderBtn.regHandler('click', buttonHandler);
|
2186 |
}
|
2187 |
// Se puo' concludere la collette
|
@@ -2189,9 +2134,14 @@ if (cx.test(text)) {
|
|
2189 |
renderBtn.create('Concludi Split', 'ui', 'SqueezolFinishPay_');
|
2190 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2191 |
renderBtn.get().setAttribute('data-action', 'CG');
|
2192 |
-
renderBtn.get().className='squeezolButtonSuccess sq-btn
|
2193 |
renderBtn.regHandler('click', buttonHandler);
|
|
|
|
|
|
|
|
|
2194 |
renderDiv.append(renderBtn.wrap(wrapper));
|
|
|
2195 |
SqDiv.appendChild(renderDiv.get());
|
2196 |
renderBtn = '';
|
2197 |
renderBtn = Button();
|
@@ -2201,6 +2151,7 @@ if (cx.test(text)) {
|
|
2201 |
renderBtn.get().setAttribute('data-action', 'RG');
|
2202 |
renderBtn.get().className='sq-btn sq-btn-sm sq-btn-danger';
|
2203 |
renderBtn.regHandler('click', buttonHandler);
|
|
|
2204 |
}
|
2205 |
// Se i pagamenti sono aperti
|
2206 |
else if(openPay==true) {
|
@@ -2209,22 +2160,37 @@ if (cx.test(text)) {
|
|
2209 |
if(partObj.id==participantId) {
|
2210 |
if (partObj.status==='P'){
|
2211 |
alertPaid=document.createElement('div');
|
2212 |
-
alertPaid.className='sq-alert sq-alert-success
|
2213 |
alertPaid.innerHTML=paidText;
|
2214 |
renderBtn = Button();
|
2215 |
renderBtn=Div(alertPaid);
|
2216 |
}
|
2217 |
else{
|
2218 |
-
renderBtn.create('
|
2219 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2220 |
renderBtn.get().setAttribute('data-action', 'P');
|
2221 |
renderBtn.get().className='sq-btn sq-btn-lg';
|
2222 |
renderBtn.regHandler('click', buttonHandler);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2223 |
}
|
2224 |
}
|
2225 |
if(partObj.status=='P' && paidCount==0){
|
2226 |
paidCount=1;
|
2227 |
refContainer = Div(document.createElement('div'));
|
|
|
|
|
|
|
|
|
|
|
2228 |
renderRef=Button();
|
2229 |
renderRef.create('Rimborsa', 'small', 'SqueezolRefund_');
|
2230 |
renderRef.get().setAttribute('data-participant', participantId);
|
@@ -2232,7 +2198,8 @@ if (cx.test(text)) {
|
|
2232 |
renderRef.get().className='sq-btn sq-btn-sm sq-btn-danger';
|
2233 |
renderRef.regHandler('click', buttonHandler);
|
2234 |
refContainer.append(renderRef.wrap(wrapBtn));
|
2235 |
-
|
|
|
2236 |
}
|
2237 |
}
|
2238 |
}
|
@@ -2256,19 +2223,26 @@ if (cx.test(text)) {
|
|
2256 |
if(partObj.id==participantId) {
|
2257 |
if (partObj.status==='P'){
|
2258 |
alertPaid=document.createElement('div');
|
2259 |
-
alertPaid.className='sq-alert sq-alert-success
|
2260 |
alertPaid.innerHTML=paidText;
|
2261 |
renderBtn=Div(alertPaid);
|
2262 |
}
|
2263 |
else{
|
2264 |
-
renderBtn.create('
|
2265 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2266 |
renderBtn.get().setAttribute('data-action', 'P');
|
2267 |
-
renderBtn.get().className='sq-btn
|
2268 |
renderBtn.regHandler('click', buttonHandler);
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2272 |
}
|
2273 |
}
|
2274 |
}
|
@@ -2276,22 +2250,33 @@ if (cx.test(text)) {
|
|
2276 |
}
|
2277 |
|
2278 |
// Render
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2283 |
if (isAdmin == true){
|
2284 |
-
|
2285 |
-
}
|
2286 |
-
else {
|
2287 |
-
superTemp.innerHTML = '<p class="sq-text-center">Potrai versare la tua quota quando l\'organizzatore avrà iniziato i pagamenti(una notifica ti verrà inviata per email)</p>';
|
2288 |
}
|
2289 |
-
|
|
|
|
|
|
|
|
|
2290 |
}
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
renderDiv.append(renderBtn.wrap(wrapper));
|
2295 |
if (params.invitation_url && isAdmin && (answer.group.status == 'WPA' || answer.group.status == 'WAC')){
|
2296 |
inviteBtn = Button();
|
2297 |
inviteBtn.create('Invita ancora', 'ui', 'SqueezolInvitation_');
|
@@ -2310,7 +2295,7 @@ if (cx.test(text)) {
|
|
2310 |
renderBtn.get().disabled=true;
|
2311 |
renderBtn.get().className='buttonWarning sq-btn sq-btn-lg';
|
2312 |
alertDes = document.createElement('div');
|
2313 |
-
alertDes.className = 'sq-row'
|
2314 |
alertDes.innerHTML = '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-alert sq-alert-warning"><p>'+
|
2315 |
'<strong>Attenzione!</strong>'+
|
2316 |
'Lo Split è stato chiuso dall\'organizzatore o è scaduto il termine di 20 giorni entro i quali effettuare il pagamento. Le quote versate torneranno disponibili al massimo entro 30 giorni dalla data del pagamento.'+
|
@@ -2324,6 +2309,7 @@ if (cx.test(text)) {
|
|
2324 |
part=document.createElement('div');
|
2325 |
part.className = 'sq-row part';
|
2326 |
p=participants[j];
|
|
|
2327 |
status=this.switchStatus(p.status);
|
2328 |
var img = new Image();
|
2329 |
if(p.avatar_url){
|
@@ -2332,8 +2318,14 @@ if (cx.test(text)) {
|
|
2332 |
avatar_url = img_url + 'default.jpg';
|
2333 |
}
|
2334 |
if (p.status == 'P'){
|
2335 |
-
|
2336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2337 |
}
|
2338 |
else if (p.status == 'A'){
|
2339 |
state = 'accepted';
|
@@ -2346,19 +2338,19 @@ if (cx.test(text)) {
|
|
2346 |
contribution_amount = '-';
|
2347 |
else
|
2348 |
contribution_amount = p.single_amount + ' ' + ui.switchCurrency(answer.group.currency);
|
2349 |
-
part.innerHTML= '<div class="sq-col-
|
2350 |
'<img id="thumb'+j+'" class="imgAvatar sq-thumbnail sq-img-responsive" src="'+avatar_url+'" alt="User Avatar"></img>'+
|
2351 |
'</div>'+
|
2352 |
-
'<div class="sq-col-
|
2353 |
-
'<p class="sq-
|
2354 |
'</div>'+
|
2355 |
-
'<div class="sq-col-
|
2356 |
'<h4 class="sq-text-center">'+contribution_amount+'</h4>'+
|
2357 |
'</div>'+
|
2358 |
-
'<div class="sq-col-
|
2359 |
'<h4 class="sq-text-center text-step-'+state+'">'+status+'</h4>'+
|
2360 |
'</div>'+
|
2361 |
-
'<div class="sq-col-
|
2362 |
'<img class="sq-img-responsive" src="' + img_url + 'ghianda_step_'+ghianda+'.png">'+
|
2363 |
'</div>';
|
2364 |
SqDiv.appendChild(part);
|
@@ -2440,7 +2432,8 @@ if (cx.test(text)) {
|
|
2440 |
var groupDigest, status, sqDiv;
|
2441 |
var ui, p, admin_name, participant, testo, classe;
|
2442 |
var totalPaid=0.00;
|
2443 |
-
|
|
|
2444 |
sqDiv = document.getElementById('squeezol_view');
|
2445 |
groupDigest=document.createElement('div');
|
2446 |
groupDigest.id = "squeezol_btn_container";
|
@@ -2467,7 +2460,7 @@ if (cx.test(text)) {
|
|
2467 |
testo = 'Quota che intendo versare';
|
2468 |
}
|
2469 |
else if (group.fundraising == 'S'){
|
2470 |
-
testo = 'Quota
|
2471 |
}
|
2472 |
else if (group.fundraising == 'F'){
|
2473 |
testo = 'Quota fissa';
|
@@ -2481,19 +2474,12 @@ if (cx.test(text)) {
|
|
2481 |
}
|
2482 |
else
|
2483 |
classe='target-R';
|
2484 |
-
groupDigest.innerHTML= '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-
|
2485 |
'<p class="sq-content-title">'+ group.name +'<p>'+
|
2486 |
'</div>'+
|
2487 |
-
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-
|
2488 |
-
'<p class="sq-content-body">Organizzatore:</p>'+
|
2489 |
'<strong>'+admin_name+'</strong>'+
|
2490 |
-
'</div>'+
|
2491 |
-
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-3 sq-col-md-offset-0">'+
|
2492 |
-
'<button id="sq-fb-sharer">'+
|
2493 |
-
'<span class="sq-img-social">'+
|
2494 |
-
'<img class="sq-img-responsive" style="display:inline;" src="'+ img_url +'/facebook_small.png">'+
|
2495 |
-
'</span>Condividi'+
|
2496 |
-
'</button>'+
|
2497 |
'</div>';
|
2498 |
groupDigest=Div(groupDigest);
|
2499 |
sqDiv.appendChild(groupDigest.get());
|
@@ -2504,16 +2490,17 @@ if (cx.test(text)) {
|
|
2504 |
'<div class="sq-col-md-4">'+
|
2505 |
'<div class="sq-row">'+
|
2506 |
'<h4>TERMINA FRA</h4>'+
|
2507 |
-
'<div class="sq-col-md-4 sq-no-pad">'+
|
2508 |
'<p class="sq-target-small">'+params.daysLeft+' G</p>'+
|
2509 |
'</div>'+
|
2510 |
-
'<div class="sq-col-md-4 sq-no-pad">'+
|
2511 |
'<p class="sq-target-small">'+params.hoursLeft+' H</p>'+
|
2512 |
'</div>'+
|
2513 |
-
'<div class="sq-col-md-4 sq-no-pad">'+
|
2514 |
'<p class="sq-target-small">'+params.minutesLeft+' M</p>'+
|
2515 |
'</div>'+
|
2516 |
'</div>'+
|
|
|
2517 |
'</div>'+
|
2518 |
'<div class="sq-col-md-4">'+
|
2519 |
'<div class="sq-row">'+
|
@@ -2540,12 +2527,11 @@ if (cx.test(text)) {
|
|
2540 |
'</div>';
|
2541 |
groupDigest=Div(groupDigest);
|
2542 |
sqDiv.appendChild(groupDigest.get());
|
2543 |
-
ui.fbSharer('sq-fb-sharer', params.link_url);
|
2544 |
},
|
2545 |
that.POSTcallback = function(answer, action, targetUrl){
|
2546 |
var oldBtn, parentDiv, payBox, payBoxP, alertPaid, renderBtn;
|
2547 |
var renderButton=Button();
|
2548 |
-
var participantId, form, sq_message;
|
2549 |
if (action == 'OPENPAY'){
|
2550 |
oldBtn = document.getElementById('SqueezolStartPay_');
|
2551 |
participantId = oldBtn.getAttribute('data-participant');
|
@@ -2556,7 +2542,7 @@ if (cx.test(text)) {
|
|
2556 |
parentDiv.removeChild(sq_message);
|
2557 |
parentDiv=document.getElementById('squeezolPayBox');
|
2558 |
parentDiv.innerHTML='';
|
2559 |
-
renderButton.create('
|
2560 |
renderButton.get().setAttribute('data-action', 'P');
|
2561 |
renderButton.get().setAttribute('data-participant', participantId);
|
2562 |
renderButton.regHandler('click', function(e){
|
@@ -2566,29 +2552,37 @@ if (cx.test(text)) {
|
|
2566 |
request.send(target);
|
2567 |
});
|
2568 |
renderButton.addClass('sq-btn')
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2573 |
}
|
2574 |
else if (action == 'FINISH'){
|
2575 |
oldBtn = document.getElementById('SqueezolFinishPay_');
|
2576 |
payBox = document.getElementById('squeezolPayBox');
|
2577 |
participantId = oldBtn.getAttribute('data-participant');
|
2578 |
-
|
2579 |
-
|
|
|
2580 |
alertPaid=document.createElement('div');
|
2581 |
-
alertPaid.className='sq-alert sq-alert-success
|
2582 |
alertPaid.innerHTML='<p class="sq-text-center">'+
|
2583 |
-
'<strong> Congratulazioni
|
2584 |
-
'
|
2585 |
'</p>';
|
2586 |
renderBtn=Div(document.createElement('div'));
|
2587 |
renderBtn.append(alertPaid);
|
2588 |
payBoxP = payBox.parentNode;
|
2589 |
payBoxP.removeChild(payBox);
|
2590 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2591 |
-
renderBtn.get().className='sq-btn sq-btn-lg';
|
2592 |
parentDiv.appendChild(renderBtn.get());
|
2593 |
}
|
2594 |
else if(action == 'PAY'){
|
@@ -2641,22 +2635,85 @@ if (cx.test(text)) {
|
|
2641 |
};
|
2642 |
return that;
|
2643 |
};
|
2644 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2645 |
// API Call
|
2646 |
window.SqueezolApi = {
|
2647 |
-
createSqButton: function(targetUrl, size) {
|
2648 |
var tmpBtn, btn, div, txt;
|
2649 |
-
var
|
2650 |
-
|
|
|
|
|
2651 |
tmpBtn.innerHTML = '<img src="' + img_url + 'pay_button2.png"></img>';
|
2652 |
btn = Div(tmpBtn);
|
2653 |
btn.addClass('squeezol_button_'+size)
|
2654 |
btn.regHandler('click', function() {
|
2655 |
-
|
2656 |
});
|
2657 |
div = Div();
|
2658 |
div.get('squeezol_btn');
|
|
|
2659 |
div.append(btn.get());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2660 |
},
|
2661 |
createGroup: function(amount, currency, codProducts, targetUrl, firstUrl, secondUrl) {
|
2662 |
var trolley, groupCr, ui;
|
3 |
* Copyright 2013-2015 Squeezol SRL.
|
4 |
* Licensed under OSL
|
5 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
+function($sqjQuery) {
|
7 |
// DOM ELEMENTS
|
8 |
var SqStr = function(str) {
|
273 |
that.getName = function() { return obj.el.name; };
|
274 |
that.getValue = function() { return SqStr(obj.el.value).entityify(); };
|
275 |
that.getRawValue = function() { return obj.el.value };
|
276 |
+
that.labelize = function(labelName, helpText, expl) {
|
277 |
var lab, div;
|
278 |
var ui = UserInterface();
|
279 |
+
var p = document.createElement('p');
|
280 |
lab = document.createElement('label');
|
281 |
div = document.createElement('div');
|
282 |
lab.for = obj.el.id;
|
283 |
div.className = 'sq-form-group';
|
284 |
lab.appendChild(ui.textWithHelper(labelName, helpText));
|
285 |
+
div.appendChild(lab);
|
286 |
+
if (expl != ''){
|
287 |
+
p.innerHTML=expl;
|
288 |
+
p.className='sq-exp';
|
289 |
+
div.appendChild(p);
|
290 |
+
}
|
291 |
+
div.appendChild(obj.el);
|
292 |
return DomElement({el: div});
|
293 |
},
|
294 |
+
that.labelizeWithSpan = function(labelName, span, helpText, expl){
|
295 |
var lab;
|
296 |
var ui = UserInterface();
|
297 |
+
var p = document.createElement('p');
|
298 |
divForm = document.createElement('div');
|
299 |
divInput = document.createElement('div');
|
300 |
lab = document.createElement('label');
|
304 |
divInput.appendChild(obj.el);
|
305 |
divInput.appendChild(span);
|
306 |
lab.appendChild(ui.textWithHelper(labelName, helpText));
|
307 |
+
divForm.appendChild(lab);
|
308 |
+
if (expl != ''){
|
309 |
+
p.innerHTML=expl;
|
310 |
+
p.className='sq-exp';
|
311 |
+
divForm.appendChild(p);
|
312 |
+
}
|
313 |
divForm.appendChild(divInput)
|
314 |
return DomElement({el: divForm});
|
315 |
},
|
481 |
|
482 |
var Trolley = function(obj) {
|
483 |
var that, trolley = {};
|
484 |
+
trolley.amount = obj.am;
|
485 |
+
trolley.currency = obj.curr;
|
486 |
trolley.products = obj.codP;
|
487 |
that = {};
|
488 |
that.get = function() { return trolley; };
|
515 |
|
516 |
var UserInterface = function() {
|
517 |
var that = {};
|
518 |
+
that.PopupCenter = function(url, title, w, h) {
|
519 |
+
// Fixes dual-screen position Most browsers Firefox
|
520 |
+
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
|
521 |
+
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
|
522 |
+
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
523 |
+
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
524 |
+
|
525 |
+
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
|
526 |
+
var top = ((height / 2) - (h / 2)) + dualScreenTop;
|
527 |
+
var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
528 |
+
|
529 |
+
// Puts focus on the newWindow
|
530 |
+
if (window.focus) {
|
531 |
+
newWindow.focus();
|
532 |
+
}
|
533 |
+
return newWindow;
|
534 |
},
|
535 |
that.switchCurrency = function(curr){
|
536 |
if (curr == 'EUR'){
|
548 |
var active='blu';
|
549 |
var inactive='grigia';
|
550 |
var crea = invita = gestisci = 'inactive';
|
551 |
+
var title = howWorks = '';
|
552 |
+
var hide_c = hide_i = hide_r = 'sq-hidden-xs';
|
553 |
var c_var = i_var = d_var = '';
|
554 |
switch(page){
|
555 |
case 'create':
|
556 |
crea='active';
|
557 |
c_var='-pink';
|
558 |
title = 'Crea Split';
|
559 |
+
hide_c = '';
|
560 |
+
howWorks = '<p class="sq-text-center">Queste informazioni saranno visibili nell\’invito per i tuoi amici, convincili a partecipare!</p>';
|
561 |
break;
|
562 |
case 'invitation':
|
563 |
invita='active';
|
564 |
i_var='-pink';
|
565 |
title = 'Invita';
|
566 |
+
hide_i = '';
|
567 |
+
howWorks = '<p class="sq-text-center">Scegli come dividere le quote e ricorda che potrai modificare questa opzione in qualunque momento.</p>';
|
568 |
break;
|
569 |
case 'digest':
|
570 |
gestisci='active';
|
571 |
d_var='-pink';
|
572 |
title = 'Gestisci';
|
573 |
+
hide_r = '';
|
574 |
+
howWorks = '';
|
575 |
break;
|
576 |
}
|
|
|
577 |
viewPortDiv = $sqjQuery('#squeezol_view');
|
578 |
viewPortDiv.addClass("container-fluid");
|
579 |
modalDiv = '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-container-dashboard">'+
|
580 |
'<div id="squeezol_view">'+
|
581 |
+
'<div class="sq-row sq-header">'+
|
582 |
+
'<div class="sq-col-sm-2 sq-col-sm-offset-1 sq-col-xs-4 sq-col-xs-offset-4">'+
|
583 |
+
'<img class="sq-img-responsive" src="'+img_url+'logo_squeezol_blu_nowrite.png">'+
|
584 |
+
'</div>'+
|
585 |
+
'<div class="sq-col-sm-2 sq-col-sm-offset-6 sq-col-xs-4 sq-col-xs-offset-4">'+
|
586 |
+
'<img class="sq-img-responsive" src="'+img_url+'gestpay.png">'+
|
587 |
'</div>'+
|
588 |
'</div>'+
|
589 |
'<div class="sq-row row-separata">'+
|
590 |
+
'<div class="sq-col-sm-3 sq-col-sm-offset-1 sq-col-xs-4 sq-col-xs-offset-4 '+hide_c+'">'+
|
591 |
+
'<p class="sq-text-left"><img class="sq-img-responsive" style="display:inline;" src="'+img_url+'squeezol_icon-creasplit'+c_var+'.png"/></p>'+
|
592 |
+
'</div>'+
|
593 |
+
'<div class="sq-col-sm-4 sq-col-sm-offset-0 sq-col-xs-4 sq-col-xs-offset-4 '+hide_i+'">'+
|
594 |
+
'<p class="sq-text-center"><img class="sq-img-responsive" style="display:inline;" src="'+img_url+'squeezol_icon-invita'+i_var+'.png"/></p>'+
|
595 |
+
'</div>'+
|
596 |
+
'<div class="sq-col-sm-3 sq-col-sm-offset-0 sq-col-xs-4 sq-col-xs-offset-4 '+hide_r+'">'+
|
597 |
+
'<p class="sq-text-right"><img class="sq-img-responsive" style="display:inline;" src="'+img_url+'squeezol_icon-riassunto'+d_var+'.png"/></p>'+
|
598 |
+
'</div>'+
|
599 |
'</div>'+
|
600 |
+
'<div class="sq-row sq-hidden-xs">'+
|
601 |
+
'<div class="sq-col-xs-3 sq-col-xs-offset-1 separator-'+crea+'"></div>'+
|
602 |
+
'<div class="sq-col-xs-4 separator-'+invita+'"></div>'+
|
603 |
+
'<div class="sq-col-xs-3 separator-'+gestisci+'"></div>'+
|
604 |
+
'</div>'+
|
605 |
'<div class="sq-row">'+
|
606 |
+
'<div class="sq-col-xs-10 sq-col-xs-offset-1">'+
|
607 |
+
'<div class="sq-row sq-panel">'+
|
608 |
+
'<div class="sq-col-xs-12">'+
|
609 |
+
howWorks+
|
610 |
+
'</div>'+
|
611 |
+
'</div>'+
|
612 |
+
'</div>'+
|
613 |
'</div>'+
|
614 |
'</div>'+
|
|
|
615 |
'</div>';
|
616 |
viewPortDiv.append(modalDiv);
|
617 |
viewPortDiv.removeAttr('id', null);
|
630 |
that.drawSeparatorCollapse = function(text){
|
631 |
var viewPortDiv = $sqjQuery('#squeezol_view');
|
632 |
var panel = '<div class="sq-row row-separata" id="squeezol-accordion-container">'+
|
633 |
+
'<div class="sq-col-md-5 sq-col-md-offset-1 sq-col-xs-12">'+
|
634 |
'<div class="sq-panel-group">'+
|
635 |
'<div class="sq-panel sq-panel-default">'+
|
636 |
+
'<div class="sq-panel-heading sq-panel-custom">'+
|
637 |
'<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">'+
|
638 |
+
'<p class="sq-text-left sq-label">'+text+'</p>'+
|
639 |
'</a>'+
|
640 |
'</div>'+
|
641 |
'<div id="collapseOne" class="sq-panel-collapse sq-collapse sq-out">'+
|
691 |
return textElem;
|
692 |
},
|
693 |
that.renderAlreadyInvited = function(emailDiv, fbDiv, alreadyInvited, group) {
|
694 |
+
this.drawSeparator('Inviti inviati:');
|
695 |
var container = document.createElement('div');
|
696 |
container.id = 'containerCronologia';
|
697 |
container.className = 'sq-row';
|
710 |
tmp.className = 'sq-row sq-fb-element';
|
711 |
tmp.innerHTML += '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-has-success sq-input-group"> <input type="hidden" class="fbEntry sq-form-control" value="'+invObj.fb_id+'"disabled></input>'+
|
712 |
'<input value="'+invObj.name+'" class="sq-form-control" type="text" name="email" disabled>'+
|
713 |
+
'<span class="sq-input-group-addon sq-glyph-ok sq-check"></span>'+
|
714 |
'</div>';
|
715 |
}
|
716 |
else {
|
718 |
tmp.innerHTML+= '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-form-group sq-has-success sq-input-group">'+
|
719 |
|
720 |
'<input value="'+invObj.email+'" class="sq-form-control" type="email" name="email" placeholder="email address" disabled>'+
|
721 |
+
'<span class="sq-input-group-addon sq-glyph-ok sq-check"></span>'+
|
722 |
'</div>';
|
723 |
}
|
724 |
$sqjQuery(container).append(tmp);
|
761 |
if (id == 'emailModal') {
|
762 |
if (modal == false){
|
763 |
removeBtn = Button()
|
764 |
+
removeBtn.create('', 'ui', 'btnRemove');
|
765 |
+
removeBtn.addClass('sq-btn sq-btn-xs sq-btn-rm')
|
766 |
removeBtn.regHandler('click', function(e){
|
767 |
var event= e || window.event;
|
768 |
var target = event.target || event.srcElement || event.originalTarget;
|
789 |
}
|
790 |
else if (id == 'facebookModal'){
|
791 |
modalContent.append(content);
|
792 |
+
/* modalContent.on('hide.bs.modal', function(e){
|
793 |
location.reload(true);
|
794 |
+
});*/
|
795 |
+
}
|
796 |
+
else if(id == 'authorizeModal'){
|
797 |
+
modalBody = $sqjQuery('<div />');
|
798 |
+
modalBody.addClass('sq-modal-body');
|
799 |
+
modalBody.append(content);
|
800 |
+
modalContent.append($sqjQuery('<div />').addClass('sq-modal-dialog sq-modal-lg')
|
801 |
+
.append($sqjQuery('<div />').addClass('sq-modal-content')
|
802 |
+
.append('<div class="sq-modal-header">'+
|
803 |
+
'<h4 class="sq-modal-title">I conti non tornano? Ora c\'è Squeezol! Ti permette di dividire il costo del carrello con amici, colleghi e parenti.</h4>'+
|
804 |
+
'</div>', content, '<div id="social-login" class="sq-row">'+
|
805 |
+
'<div class="sq-col-xs-10 sq-col-xs-offset-1">'+
|
806 |
+
'<div class="sq-col-sm-6 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
807 |
+
'<p class="sq-content-title sq-text-center">Oppure Accedi con</p>'+
|
808 |
+
'</div>'+
|
809 |
+
'<div class="sq-col-sm-3 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
810 |
+
'<a href='+btn+'><img src="'+img_url+'fb_login.png" title="Login with Facebook" alt="Login with Facebook" style="cursor:pointer;" class="sq-img-responsive"></a>'+
|
811 |
+
'</div>'+
|
812 |
+
'<div class="sq-col-sm-3 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
813 |
+
'<a title="Google" href="'+btn+'"><img src="'+img_url+'/g_login.png" class="sq-img-responsive" alt="Login with Google" style="cursor:pointer;"></a>'+
|
814 |
+
'</div>'+
|
815 |
+
'</div>'+
|
816 |
+
'</div>',
|
817 |
+
$sqjQuery('<div />').addClass('sq-modal-footer')
|
818 |
+
.append('<div class="sq-row sq-footer"><div class="sq-col-sm-2 sq-col-sm-offset-0 sq-col-xs-4 sq-col-xs-offset-4">'+
|
819 |
+
'<img class="sq-img-responsive" src="'+img_url+'gestpay.png"></div>'+
|
820 |
+
'<div class="sq-col-sm-2 sq-col-sm-offset-8 sq-col-xs-4 sq-col-xs-offset-4">'+
|
821 |
+
'<img class="sq-img-responsive" src="'+img_url+'logo_squeezol_blu_nowrite.png"></div>'+
|
822 |
+
'</div>'))));
|
823 |
+
$sqjQuery(modalContent).modal({backdrop:'static',keyboard:false});
|
824 |
+
}
|
825 |
+
$sqjQuery(modalContent).modal('show');
|
826 |
+
return modalContent;
|
827 |
+
},
|
828 |
+
that.modalClose = function(id){
|
829 |
+
var currentModal = $sqjQuery('#'+id);
|
830 |
+
currentModal.modal('hide');
|
831 |
+
},
|
832 |
that.textWithHelper = function(labelName, helpText){
|
833 |
var txt = document.createElement('p')
|
834 |
var $question = $sqjQuery('<div />');
|
838 |
$question.attr('data-placement', 'top');
|
839 |
$question.attr('title', helpText);
|
840 |
$question.addClass('sq-icon sq-glyph-info-sign');
|
841 |
+
$question.append('i');
|
842 |
$sqjQuery(txt).append($question);
|
843 |
return txt;
|
844 |
},
|
845 |
that.iconPopover = function(){
|
846 |
+
$sqjQuery('.sq-icon').popover();
|
847 |
+
/*$sqjQuery('.sq-icon').on('mouseenter', function(){
|
848 |
$sqjQuery(this).popover('show')
|
849 |
});
|
850 |
$sqjQuery('.sq-icon').on('mouseout', function(){
|
852 |
});
|
853 |
$sqjQuery('.sq-icon').on('hidden.bs.popover', function(){
|
854 |
$sqjQuery(this).css("display", "");
|
855 |
+
});*/
|
|
|
856 |
};
|
857 |
return that;
|
858 |
};
|
872 |
|
873 |
var i18n_ita = { previousMonth : 'Mese precedente',
|
874 |
nextMonth : 'Mese successivo',
|
875 |
+
months : ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
|
876 |
weekdays : ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'],
|
877 |
weekdaysShort : ['Dom','Lun','Mar','Merc','Gio','Ven','Sab']
|
878 |
}
|
904 |
wrapper, accordion, tempAcc, dateIcon;
|
905 |
var opt = [];
|
906 |
var tempRowDiv, spanCurr;
|
907 |
+
var tmp, startDate, d1, d2, dI2;
|
908 |
var day = 24 * 60 * 60 * 1000;
|
909 |
var ui = UserInterface();
|
910 |
+
var placeholder = { 'name': 'Compleanno di Mario, Laurea di Giulia...',
|
911 |
'description': 'Descrivi cosa intendi fare con la somma raccolta'}
|
912 |
+
var expl = { 'name': 'Scrivi il titolo che i partecipanti leggeranno nel messaggio di invito',
|
913 |
+
'description': 'Aggiungi una descrizione per spiegare i dettagli ai partecipanti',
|
914 |
+
'max_payment_date': 'Scegli la data entro la quale pagare la propria quota',
|
915 |
+
'occurrence': 'Decidi per quale occasione stai organizzando l\'acquisto'}
|
916 |
var helpText = { 'name': 'Dai un titolo allo Split. Per esempio: regalo per Marco, week end in Montagna ecc.',
|
917 |
'description': 'Il posto giusto dove inserire qualche dettaglio che invogli i tuoi amici a partecipare',
|
918 |
'max_acceptance_date': 'Scegli la data entro la quale gli invitati dovranno confermare la propria partecipazione',
|
919 |
+
'max_payment_date': 'Scegli la data entro la quale i partecipanti possono effettuare i pagamenti. La durata massima è 20 giorni, se l\'obiettivo non viene raggiunto entro questa data tutti i pagamenti verranno rimborsati',
|
920 |
'occurrence': 'Fai sapere ai partecipanti per quale occasione si effettua l\'acquisto',
|
921 |
'promo_code': 'Inserisci un codice promozionale valido: ti consente di avere uno sconto sullo Split',
|
922 |
+
'alert_email': 'Invia una mail ogni volta che un invitato decide di accettare o rifiutare il tuo invito',
|
923 |
+
'hide_contribution': 'Nasconde ai partecipanti la quota versata da ognuno. Resta visibile a tutti il totale raccolto',
|
924 |
'hide_invitation': 'Nasconde l\' identità dei partecipanti tra di loro.',
|
925 |
'isOpen': 'Split aperto a chiunque abbia un invito, senza PIN e a donazione libera' }
|
926 |
wrapper_row = { wrapper: 'div', className: 'sq-row'};
|
927 |
wrapper_row_pad = { wrapper: 'div', className: 'sq-row pad-it'};
|
928 |
+
wrapper_left = { wrapper: 'div', className : 'sq-col-md-5 sq-col-md-offset-1 sq-col-xs-12' }
|
929 |
wrapper_left_small = { wrapper: 'div', className : 'sq-col-md-4 sq-col-md-offset-1 sq-col-xs-12' }
|
930 |
+
wrapper_right = { wrapper: 'div', className: 'sq-col-md-5 sq-col-xs-12'};
|
931 |
+
wrapper_btn = { wrapper: 'div', className: 'sq-col-md-3 sq-col-md-offset-3 sq-col-xs-4 sq-col-xs-offset-4'}
|
932 |
wrapper_push_right = { wrapper: 'div', className: 'sq-col-md-3 sq-col-md-offset-9 sq-col-xs-12'};
|
933 |
+
wrapper_hide = {wrapper: 'div', className: 'sq-hidden sq-display-none'};
|
934 |
dateIcon = document.createElement('img');
|
935 |
+
dateIcon.setAttribute('src', img_url+'calendar.png')
|
936 |
dateIcon.className = 'sq-img-responsive sq-date-icon';
|
937 |
//UI
|
938 |
ui.drawHeader('create', 'modal');
|
942 |
tmp=document.createElement('div');
|
943 |
tempRowDiv = Div(tmp);
|
944 |
tempRowDiv.addClass('sq-row');
|
945 |
+
// Nome Collettaat
|
946 |
input = TextInput();
|
947 |
input.create('name');
|
948 |
input.get().setAttribute('placeholder', placeholder['name']);
|
949 |
inputs.push(input);
|
950 |
// Data Accettazione
|
951 |
+
tempRowDiv.append(input.labelize('Titolo*: ', helpText['name'], expl['name']).wrap(wrapper_left));
|
952 |
|
953 |
+
// Data Pagamenti
|
954 |
+
date2 = DateInput();
|
955 |
+
d2 = new Date(new Date().getTime() + 20*day);
|
956 |
+
date2.create('max_payment_date', d2);
|
957 |
+
date2.get().id = 'datepicker2';
|
958 |
+
date2.addPicker(dp2);
|
959 |
+
|
960 |
+
inputs.push(date2);
|
961 |
+
spanCurr = document.createElement('span');
|
962 |
+
spanCurr.className = 'sq-input-group-addon';
|
963 |
+
dI2 = DomElement({'el': dateIcon.cloneNode()});
|
964 |
+
dI2.get().id = 'sq-calendar';
|
965 |
+
dI2.regHandler('click', function(e){
|
966 |
+
date2.get().click();
|
967 |
+
});
|
968 |
+
spanCurr.appendChild(dI2.get());
|
969 |
+
tempRowDiv.append(date2.labelizeWithSpan('Data di fine Split*: ',spanCurr, helpText['max_payment_date'], expl['max_payment_date']).wrap(wrapper_right));
|
970 |
+
this.initDatePickers(d1, d2);
|
971 |
+
opt.push({value: 'R', text: 'Regalo di compleanno'});
|
972 |
+
opt.push({value: 'V', text: 'Viaggio'});
|
973 |
+
opt.push({value: 'C', text: 'Evento, concerto'});
|
974 |
+
opt.push({value: 'G', text: 'Cena, pranzo, catering'});
|
975 |
+
opt.push({value: 'N', text: 'Regalo di Nozze'});
|
976 |
+
opt.push({value: 'A', text: 'Altro ...'});
|
977 |
+
combo = ComboBox();
|
978 |
+
combo.create(opt);
|
979 |
+
viewPortDiv.append(tempRowDiv.get())
|
980 |
+
|
981 |
+
// Hidden acceptance date
|
982 |
date1 = DateInput();
|
983 |
+
d1 = new Date(new Date().getTime()+day);
|
|
|
984 |
date1.create('max_acceptance_date', d1);
|
985 |
date1.get().id = 'datepicker1';
|
986 |
date1.addPicker(dp1);
|
988 |
spanCurr = document.createElement('span');
|
989 |
spanCurr.className = 'sq-input-group-addon';
|
990 |
spanCurr.appendChild(dateIcon);
|
991 |
+
tempRowDiv.append(date1.labelizeWithSpan('Scadenza Invito', spanCurr, helpText['max_acceptance_date']).wrap(wrapper_hide));
|
992 |
+
|
993 |
// Append first row
|
994 |
viewPortDiv.append(tempRowDiv.get());
|
995 |
// Temp Div
|
1001 |
input.create('description');
|
1002 |
input.get().setAttribute('placeholder', placeholder['description']);
|
1003 |
inputs.push(input);
|
1004 |
+
tempRowDiv.append(input.labelize('Descrizione: ', helpText['description'], expl['description']).wrap(wrapper_left));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1005 |
|
1006 |
+
tempRowDiv.append(combo.labelize('Occasione: ', helpText['occurrence'], expl['occurrence']).wrap(wrapper_right));
|
|
|
|
|
|
|
1007 |
viewPortDiv.append(tempRowDiv.get())
|
1008 |
ui.drawSeparator('');
|
1009 |
+
ui.drawSeparatorCollapse('Opzioni');
|
1010 |
//squeezol-accordion
|
1011 |
tempAcc = document.getElementById('squeezol-accordion');
|
1012 |
accordion = Div(tempAcc);
|
1014 |
checkBox = CheckBox();
|
1015 |
checkBox.create({name: 'alert_email', value: 'Email notifications'});
|
1016 |
checkBoxes.push(checkBox);
|
1017 |
+
accordion.append(checkBox.labelize('Attiva notifiche email', helpText['alert_email']).wrap(wrapper_row_pad));
|
1018 |
|
1019 |
checkBox = CheckBox();
|
1020 |
checkBox.create({name: 'hide_contribution', value: 'Hide Contribution'});
|
1025 |
checkBox.create({name: 'hide_invitation', value: 'Hide Invitation'});
|
1026 |
checkBoxes.push(checkBox);
|
1027 |
accordion.append(checkBox.labelize('Nascondi partecipanti', helpText['hide_invitation']).wrap(wrapper_row_pad));
|
1028 |
+
|
1029 |
checkBox = CheckBox();
|
1030 |
checkBox.create({name: 'isOpen', value: 'Open funding', checked: 'true'});
|
1031 |
checkBoxes.push(checkBox);
|
1032 |
+
accordion.append(checkBox.labelize('Split a donazione libera', helpText['isOpen']).wrap(wrapper_hide));
|
|
|
1033 |
promo = TextInput();
|
1034 |
promo.create('promo_code');
|
1035 |
+
accordion.append(promo.labelize('Codice Promozionale', helpText['promo_code']).wrap(wrapper_hide));
|
1036 |
+
|
1037 |
|
1038 |
button.create('Prosegui', 'big', 'squeezol_button');
|
1039 |
button.addClass('sq-btn')
|
1040 |
button.regHandler('click', buttonHandler);
|
|
|
1041 |
tmp = document.getElementById('squeezol-accordion-container');
|
1042 |
tempRowDiv = Div(tmp);
|
1043 |
+
tempRowDiv.append(button.wrap(wrapper_btn));
|
1044 |
ui.iconPopover();
|
1045 |
return this;
|
1046 |
};
|
1311 |
};
|
1312 |
|
1313 |
var InvitationObj = function() {
|
1314 |
+
var that = {};
|
1315 |
+
that.computeSingleContribution = function(targetAmount) {
|
1316 |
+
var emailCount = document.getElementsByClassName('sq-email-element').length+1;
|
1317 |
+
var fbCount = document.getElementsByClassName('sq-fb-element').length;
|
1318 |
+
var friendCount = fbCount+emailCount;
|
1319 |
+
return parseFloat(targetAmount/friendCount).toFixed(2);
|
1320 |
+
},
|
1321 |
+
that.updateFundraising = function(f){
|
1322 |
+
var uxDiv=document.getElementById('sq-fund-text');
|
1323 |
+
var fundText;
|
1324 |
+
if (f=='D'){
|
1325 |
+
fundText ='<p class="sq-content-body"><strong> Suggerisci la quota:</strong></p>'+
|
1326 |
+
'<p class="sq-content-body" id="sq-fundraising-text">'+
|
1327 |
+
'l\'organizzatore suggerisce la quota che dovranno versare i singoli partecipanti. '+
|
1328 |
+
'La quota potrà essere eventualmente modificata al momento del pagamento.'+
|
1329 |
+
'</p>';
|
1330 |
+
}else if(f=='S'){
|
1331 |
+
fundText = '<p class="sq-content-body"><strong> Dividi equamente:</strong></p>'+
|
1332 |
+
'<p class="sq-content-body">'+
|
1333 |
+
'la quota del singolo partecipante verrà ricalcolata ogni volta che l’invitato conferma la sua adesione. '+
|
1334 |
+
'La quota potrà essere eventualmente modificata al momento del pagamento.'+
|
1335 |
+
'</p>';
|
1336 |
+
}else if(f=='F'){
|
1337 |
+
fundText = '<p class="sq-content-body"><strong> Quota fissa:</strong></p>'+
|
1338 |
+
'<p class="sq-content-body">'+
|
1339 |
+
'l\'organizzatore sceglie una quota fissa che i singoli partecipanti dovranno versare. '+
|
1340 |
+
'La quota NON potrà essere modifica al momento del pagamento.'+
|
1341 |
+
'</p>';
|
1342 |
+
|
1343 |
+
}
|
1344 |
+
if(uxDiv){
|
1345 |
+
uxDiv.innerHTML=fundText;
|
1346 |
+
}
|
1347 |
+
return fundText;
|
1348 |
+
},
|
1349 |
+
that.updateQuotaOption=function(f,c,curr){
|
1350 |
+
var uxDiv=document.getElementById('sq-quota-option');
|
1351 |
+
var quotaOption;
|
1352 |
+
if (f=='S'){
|
1353 |
+
quotaOption='<div class="squeezol_quota">'+
|
1354 |
+
'<p class="sq-label">Quota con divisione equa:</p>'+
|
1355 |
+
'<p class="sq-exp">Quota a persona se tutti gli invitati accetteranno l\'invito.</p>'+
|
1356 |
+
'<div class="sq-input-group">'+
|
1357 |
+
'<input id="squeezol_admin_contrib" value="'+c+'" name="email_contribution"'+
|
1358 |
+
'type="text" class="squeezolPrice sq-form-control" disabled><span class="sq-input-group-addon">'+curr+'</span>'+
|
1359 |
+
'</div>'+
|
1360 |
+
'</div>';
|
1361 |
+
}else if(f=='D'){
|
1362 |
+
quotaOption='<div class="squeezol_quota">'+
|
1363 |
+
'<p class="sq-label">Quota suggerita a persona:</p>'+
|
1364 |
+
'<p class="sq-exp">La quota è un suggerimento per gli invitati.</p>'+
|
1365 |
+
'<div class="sq-input-group">'+
|
1366 |
+
'<input id="squeezol_admin_contrib" value="'+c+'" name="email_contribution"'+
|
1367 |
+
'type="text" class="squeezolPrice sq-form-control"><span class="sq-input-group-addon">'+curr+'</span>'+
|
1368 |
+
'</div>'+
|
1369 |
+
'</div>';
|
1370 |
+
}
|
1371 |
+
else if(f=='F'){
|
1372 |
+
quotaOption='<div class="squeezol_quota">'+
|
1373 |
+
'<p class="sq-label">Quota fissa a persona:</p>'+
|
1374 |
+
'<p class="sq-exp">La quota fissa non è modifcabile dagli invitati</p>'+
|
1375 |
+
'<div class="sq-input-group">'+
|
1376 |
+
'<input id="squeezol_admin_contrib" value="'+c+'" name="email_contribution"'+
|
1377 |
+
'type="text" class="squeezolPrice sq-form-control"><span class="sq-input-group-addon">'+curr+'</span>'+
|
1378 |
+
'</div>'+
|
1379 |
+
'</div>';
|
1380 |
+
}
|
1381 |
+
if(uxDiv){
|
1382 |
+
uxDiv.innerHTML=quotaOption;
|
1383 |
+
}
|
1384 |
+
return quotaOption;
|
1385 |
},
|
1386 |
+
that.updateContribution = function(contrib, targetAmount) {
|
1387 |
+
var rest = 0.00;
|
1388 |
+
var tot = 0.00;
|
1389 |
+
var totAdmin;
|
1390 |
+
var inv_div=document.getElementById('sq-inv-count');
|
1391 |
+
var adminContrib=document.getElementById('squeezol_admin_contrib');
|
1392 |
+
var friendList = document.getElementsByClassName('sq-email-element');
|
1393 |
+
var fbList = document.getElementsByClassName('sq-fb-element');
|
1394 |
+
var num_inv=fbList.length+friendList.length;
|
1395 |
+
tot = parseFloat(contrib*(num_inv+1));
|
1396 |
+
if (tot != targetAmount){
|
1397 |
+
rest = parseFloat(targetAmount - tot).toFixed(2);
|
1398 |
totAdmin= parseFloat(contrib)+parseFloat(rest);
|
1399 |
adminContrib.value = parseFloat(totAdmin).toFixed(2);
|
1400 |
}
|
1401 |
else{
|
1402 |
adminContrib.value = parseFloat(contrib).toFixed(2);
|
1403 |
}
|
1404 |
+
inv_div.innerHTML=num_inv;
|
1405 |
adminContrib.disabled = true;
|
1406 |
return;
|
1407 |
},
|
1672 |
'</div>'+
|
1673 |
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-form-group sq-has-success sq-input-group">'+
|
1674 |
'<input value="'+currSent.value+'" class="sq-form-control" type="email" name="email" placeholder="email address" disabled>'+
|
1675 |
+
'<span class="sq-input-group-addon sq-glyph-ok sq-check">'+
|
1676 |
+
'<span/>'+
|
1677 |
'</div>'+
|
1678 |
'</div>';
|
1679 |
container.appendChild(div);
|
1691 |
that.renderGET = function(invitationUrl) {
|
1692 |
var params, participantAdmin, group, alreadyInvited, socialProviders,
|
1693 |
grId, grAmount, gData, pAdminId;
|
1694 |
+
var btnText = ['Email', 'f | INVITA VIA FACEBOOK', 'Invia E-mail'],
|
1695 |
btnId = ['squeezolEmail_', 'squeezolFb_', 'squeezolSubmit_' ],
|
1696 |
btnSize = ['small', 'small', 'big'],
|
1697 |
btnClass = ['sq-btn sq-btn-lg sq-buttonEmail', 'sq-btn sq-btn-lg sq-buttonFb', 'sq-btn'];
|
1702 |
var copiaUrl, a_temp, a_link;
|
1703 |
var i, j, currBtn, ui;
|
1704 |
var wrapper_left = { wrapper: 'div', className : 'sq-col-xs-2' };
|
1705 |
+
var wrapper_center = { wrapper: 'div', className : 'sq-col-md-3 sq-col-xs-10 hidden-xs hidden-sm' };
|
1706 |
+
var wrapper_btn = { wrapper: 'div', className : 'sq-col-md-3 sq-col-md-offset-1 sq-col-xs-10 ' };
|
1707 |
var wrapper_row = { wrapper: 'div', className : 'sq-row' };
|
1708 |
+
var wrapper_remove = { wrapper: 'div', className: 'sq-col-sm-4 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1'}
|
1709 |
if(answer.status === 'ok') {
|
1710 |
+
//Set Post Message
|
1711 |
+
if(window.addEventListener){
|
1712 |
+
window.addEventListener("message",PostMessageReceiver,false)
|
1713 |
+
}else if(window.attachEvent){
|
1714 |
+
window.attachEvent("onmessage",PostMessageReceiver)
|
1715 |
+
}
|
1716 |
// Parsing Parametri
|
1717 |
params=JSON.parse(answer.params);
|
1718 |
grId = params.group_id;
|
1736 |
fbDiv.id = 'squeezolFb'
|
1737 |
invitationBtn = InvitationObj();
|
1738 |
emailBtn = invitationBtn.createButton('+ Email', btnId[0], btnSize[0], 'sq-btn sq-btn-sm sq-buttonEmail');
|
1739 |
+
emailModal = invitationBtn.createButton('@ | INVITA VIA EMAIL', 'emailModal_', 'big', 'sq-btn sq-btn-lg sq-buttonEmail');
|
1740 |
|
1741 |
// SEND EMAIL handler:
|
1742 |
submitBtn = invitationBtn.createButton(btnText[2], btnId[2], btnSize[2], btnClass[2]);
|
1762 |
submitDiv.appendChild(submitBtn.wrap({ wrapper: 'div', className : 'sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-3 sq-col-md-offset-8'}));
|
1763 |
|
1764 |
var NewremoveBtn = Button()
|
1765 |
+
NewremoveBtn.create('', 'ui', 'btnRemove');
|
1766 |
+
NewremoveBtn.addClass('sq-btn sq-btn-xs sq-btn-rm')
|
1767 |
NewremoveBtn.regHandler('click', function(e){
|
1768 |
var event= e || window.event;
|
1769 |
var target = event.target || event.srcElement || event.originalTarget;
|
1780 |
var contribType = sBox.options[sBox.selectedIndex].value;
|
1781 |
|
1782 |
removeBtn = Button()
|
1783 |
+
removeBtn.create('', 'ui', 'btnRemove');
|
1784 |
+
removeBtn.addClass('sq-btn sq-btn-xs sq-btn-rm')
|
1785 |
removeBtn.regHandler('click', function(e){
|
1786 |
var event= e || window.event;
|
1787 |
var target = event.target || event.srcElement || event.originalTarget;
|
1793 |
$sqjQuery(newEmail).append('<div class="sq-hidden-xs sq-col-sm-2 sq-col-md-2">'+
|
1794 |
'<img style="display:inline;" class="imgAvatar sq-thumbnail" src="' + img_url + 'default.jpg" alt="User Avatar"></img>'+
|
1795 |
'</div>'+
|
1796 |
+
'<div class="sq-col-sm-6 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
1797 |
'<input class="sq-form-control mail__Invitation" placeholder="Aggiungi Email" type="email" name="email">'+
|
1798 |
'</div>');
|
1799 |
newEmail.appendChild(removeBtn.wrap(wrapper_remove));
|
1804 |
.append('<div class="sq-hidden-xs sq-col-sm-2 sq-col-md-2">'+
|
1805 |
'<img style="display:inline;" class="imgAvatar sq-thumbnail" src="' + img_url + 'default.jpg" alt="User Avatar"></img>'+
|
1806 |
'</div>'+
|
1807 |
+
'<div class="sq-col-sm-6 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
1808 |
'<input class="sq-form-control mail__Invitation" placeholder="Aggiungi Email" type="email" name="email">'+
|
1809 |
'</div>', NewremoveBtn.wrap(wrapper_remove)))
|
1810 |
emailModal.regHandler('click', function() {
|
1811 |
var ui = UserInterface();
|
1812 |
ui.sqModal(emailDiv, submitDiv, 'emailModal');
|
1813 |
});
|
1814 |
+
var boxInvita = document.createElement('div');
|
1815 |
+
boxInvita.className='sq-row row-separata';
|
1816 |
+
var textInfo = document.createElement('p');
|
1817 |
+
var texttt = document.createTextNode('Per invitare usa una email, un messaggio privato su Facebook oppure Condividi il link! Le informazioni compariranno automaticamente e gli invitati potranno versare la propria quota in 3 click!');
|
1818 |
+
textInfo.appendChild(texttt);
|
1819 |
+
|
1820 |
tmpObj = document.createElement('div');
|
1821 |
+
tmpObj.className = 'sq-col-xs-10 sq-col-xs-offset-1 sq-panel sq-panel-info';
|
1822 |
+
tmpObj.appendChild(textInfo);
|
1823 |
tmpObj.appendChild(emailModal.wrap(wrapper_btn));
|
1824 |
|
1825 |
// FACEBOOK IFRAME handler:
|
1826 |
if (params.fb_url) {
|
1827 |
+
fbBtn = invitationBtn.createButton(btnText[1], btnId[1], 'ui', 'sq-btn sq-btn-lg sq-buttonFb');
|
1828 |
fbBtn.regHandler('click', function(){
|
1829 |
var iFrameModal;
|
1830 |
var ui=UserInterface();
|
1837 |
else {
|
1838 |
iFrameModal.innerHTML = '';
|
1839 |
}
|
1840 |
+
var socIframe = '<div class="ajax-widget-container sq-embed-responsive sq-embed-responsive-4by3" id="appendSqIframe">'+
|
1841 |
+
'<iframe scrolling="auto" class="sq-embed-responsive-item" src="'+params.fb_url+'"></iframe>'
|
|
|
|
|
|
|
|
|
|
|
1842 |
'</div>';
|
|
|
|
|
1843 |
iFrameModal.innerHTML=socIframe;
|
1844 |
+
ui.sqModal(iFrameModal,'', 'facebookModal');
|
1845 |
return
|
1846 |
});
|
1847 |
tmpObj.appendChild(fbBtn.wrap(wrapper_center));
|
1848 |
}
|
|
|
1849 |
else {
|
1850 |
+
fbBtn = invitationBtn.createButton('f | CONDIVIDI SU FACEBOOK', 'sq-fb-sharer', 'ui', 'sq-btn sq-btn-lg sq-buttonFb');
|
1851 |
+
fbBtn.regHandler('click', function(){
|
1852 |
+
ui.PopupCenter('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(params.link_url), 'facebook-share-dialog', '626', '436');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1853 |
});
|
1854 |
+
tmpObj.appendChild(fbBtn.wrap(wrapper_center));
|
1855 |
+
}
|
|
|
1856 |
|
1857 |
copiaUrl = document.createElement('div')
|
1858 |
copiaUrl.className = 'sq-col-md-3 sq-col-xs-10 sq-col-xs-offset-1 pink-link';
|
1859 |
copiaUrl.setAttribute('data-placement', 'top');
|
1860 |
copiaUrl.setAttribute('title', 'Copia URL dello Split e condividilo dove preferisci');
|
1861 |
a_temp = document.createElement('a');
|
1862 |
+
a_temp.innerHTML = 'COPIA LINK INVITO';
|
1863 |
a_link=DomElement({'el': a_temp});
|
1864 |
a_link.id='clipBoardLink';
|
1865 |
a_link.regHandler('click', function(e) {
|
1866 |
+
var message = 'Copia il link con CTRL+C o CMD+C e invialo a chi vuoi utilizzando la tua chat preferita, ad esempio: Whatsapp, Hangouts e Telegram';
|
1867 |
if (answer.group.isOpen){
|
1868 |
window.prompt(message, params.link_url);
|
1869 |
}
|
1872 |
}
|
1873 |
});
|
1874 |
copiaUrl.appendChild(a_link.get());
|
1875 |
+
/*$sqjQuery(copiaUrl).append('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="50" id="clippy" >'+
|
1876 |
+
'<param name="movie" value="'+img_url+'plus.png"/>'+
|
1877 |
+
'<param name="allowScriptAccess" value="always" />'+
|
1878 |
+
'<param name="quality" value="high" />'+
|
1879 |
+
'<param name="scale" value="noscale" />'+
|
1880 |
+
'<param NAME="FlashVars" value="text=COPIA LINK INVITO">'+
|
1881 |
+
'<param name="bgcolor" value="#FFF">'+
|
1882 |
+
'<embed src="'+css_url+'clippy.swf"'+
|
1883 |
+
'width="100"'+
|
1884 |
+
'height="50"'+
|
1885 |
+
'name="clippy"'+
|
1886 |
+
'quality="high"'+
|
1887 |
+
'allowScriptAccess="always"'+
|
1888 |
+
'type="application/x-shockwave-flash"'+
|
1889 |
+
'pluginspage="http://www.macromedia.com/go/getflashplayer"'+
|
1890 |
+
'FlashVars="text='+params.link_url+'"'+
|
1891 |
+
'bgcolor="#DA396F"/>'+
|
1892 |
+
'</object>');*/
|
1893 |
tmpObj.appendChild(copiaUrl);
|
1894 |
+
boxInvita.appendChild(tmpObj);
|
1895 |
+
SqDiv.appendChild(boxInvita);
|
1896 |
|
1897 |
// NEXT Button handler
|
1898 |
nextBtn = invitationBtn.createButton('Prosegui', 'squeezol_next', 'big', btnClass[2]);
|
1905 |
invError.removeErrorInfo();
|
1906 |
ui.loadState(target);
|
1907 |
invitations.send()
|
|
|
1908 |
});
|
1909 |
// Select Contribution Type handler:
|
1910 |
var box = DomElement({el: document.getElementById('contributionType')});
|
1911 |
box.regHandler('change', function(e){
|
1912 |
var invObj = InvitationObj();
|
1913 |
var event= e || window.event;
|
1914 |
+
var ui=UserInterface();
|
1915 |
var target = event.target || event.srcElement || event.originalTarget;
|
1916 |
+
if (target.value == 'S'){
|
1917 |
contribution = invObj.computeSingleContribution(group.amount);
|
1918 |
invitationBtn.updateContribution(contribution, group.amount);
|
1919 |
}
|
1920 |
+
else {
|
1921 |
invObj.setToZero();
|
1922 |
+
contribution = parseFloat(0).toFixed(2);
|
1923 |
}
|
1924 |
+
invObj.updateFundraising(target.value);
|
1925 |
+
invObj.updateQuotaOption(target.value,contribution,ui.switchCurrency(group.currency));
|
1926 |
});
|
1927 |
// Append to View Port .invitationContainer
|
1928 |
containerDiv = document.createElement('div');
|
1938 |
|
1939 |
// Append Next Div to .invitationContainer
|
1940 |
nextDiv = document.createElement('div');
|
1941 |
+
nextDiv.className = 'sq-row row-separata-bottom';
|
1942 |
+
nextDiv.appendChild(nextBtn.wrap({ wrapper: 'div', className : 'sq-col-xs-10 sq-col-xs-offset-1 sq-col-sm-3 sq-col-md-offset-8' }));
|
1943 |
SqDiv.appendChild(nextDiv);
|
1944 |
}
|
1945 |
else if(answer.status === 'anauth'){
|
1957 |
},
|
1958 |
that.renderGroupData = function(group, participantAdmin, adminEmail, alreadyInvited) {
|
1959 |
var ui = UserInterface();
|
1960 |
+
var invObj=InvitationObj();
|
1961 |
+
var groupDigest, status, contrib, options, fundText;
|
1962 |
var isOpen='';
|
1963 |
var groupDigest2;
|
|
|
|
|
1964 |
var sqDiv = document.getElementById('squeezol_view');
|
1965 |
+
var quotaOption;
|
1966 |
+
if (group.fundraising == 'D'){
|
1967 |
+
contrib = participantAdmin.single_amount;
|
1968 |
+
options = '<option value="S">Dividi Equamente</option>'+
|
1969 |
+
'<option value="D" selected>Suggerisci la quota</option>'+
|
1970 |
+
'<option value="F">Quota Fissa</option>';
|
|
|
1971 |
}
|
1972 |
+
else if(group.fundraising == 'S') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1973 |
contrib = parseFloat(group.amount/(alreadyInvited.length+1)).toFixed(2);
|
1974 |
+
options = '<option value="S" selected>Dividi Equamente</option>'+
|
1975 |
+
'<option value="D">Suggerisci la quota</option>'+
|
1976 |
+
'<option value="F">Quota Fissa</option>';
|
1977 |
+
|
1978 |
+
|
1979 |
+
}
|
1980 |
+
else {
|
1981 |
+
contrib = participantAdmin.single_amount;
|
1982 |
+
options = '<option value="S">Dividi Equamente</option>'+
|
1983 |
+
'<option value="D">Suggerisci la quota</option>'+
|
1984 |
+
'<option value="F" selected>Quota Fissa</option>';
|
1985 |
}
|
1986 |
+
fundText=invObj.updateFundraising(group.fundraising);
|
1987 |
+
quotaOption=invObj.updateQuotaOption(group.fundraising,contrib,ui.switchCurrency(group.currency));
|
1988 |
groupDigest=document.createElement('div');
|
1989 |
groupDigest.id = "squeezol_btn_container";
|
1990 |
+
groupDigest.className = "sq-col-sm-5 sq-col-xs-10 sq-col-xs-offset-1";
|
1991 |
groupDigest2=document.createElement('div');
|
1992 |
groupDigest2.className='sq-row row-separata';
|
1993 |
+
groupDigest2.innerHTML = '<div class="sq-col-sm-4 sq-col-sm-offset-1 sq-col-xs-10 sq-col-xs-offset-1">'+
|
1994 |
+
'<div class="sq-row">'+
|
1995 |
+
'<p class="sq-label">Divisione delle quote:'+
|
1996 |
+
'<div data-toggle="popover" data-placement="top" title="Aiuta gli invitati '+
|
1997 |
+
'a capire come intendi dividere le quote dell\'acquisto."'+
|
1998 |
+
'class="sq-icon sq-glyph-info-sign">i'+
|
1999 |
+
'</div>'+
|
2000 |
+
'</p>'+
|
2001 |
+
'<p class="sq-exp">Decidi come dividere le quote con gli invitati.</p>'+
|
2002 |
+
'<select class="selectContrib" id="contributionType">'+options+'</select>'+
|
2003 |
+
'<input value="'+adminEmail+'"type="hidden" name="email" disabled>'+
|
2004 |
+
'</div>'+
|
2005 |
+
'<div class="sq-row row-separata" id="sq-quota-option">'+
|
2006 |
+
quotaOption+
|
2007 |
+
'</div>'+
|
2008 |
+
'</div>';
|
2009 |
+
groupDigest.innerHTML= '<div class="sq-row">'+
|
2010 |
+
'<div class="sq-col-sm-6 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
2011 |
+
'<p>Invitati: <strong id="sq-inv-count">'+alreadyInvited.length+'</strong></p>'+
|
2012 |
'</div>'+
|
2013 |
+
'<div class="sq-col-sm-6 sq-col-sm-offset-0 sq-col-xs-10 sq-col-xs-offset-1">'+
|
2014 |
+
'<input type="hidden" id="sq-group-amount" value="'+group.amount+'"></input>'+
|
2015 |
+
'<p class="sq-text-right"> Obiettivo: '+
|
2016 |
+
'<strong>'+group.amount+ui.switchCurrency(group.currency)+'</strong>'+
|
2017 |
+
'</p>'+
|
2018 |
'</div>'+
|
2019 |
+
'</div>'+
|
2020 |
+
'<div class="sq-row sq-withBorder">'+
|
2021 |
+
'<div class="sq-col-xs-12" id="sq-fund-text">'+
|
2022 |
+
fundText
|
|
|
2023 |
'</div>'+
|
2024 |
+
'</div>';
|
2025 |
+
$sqjQuery(groupDigest2).append(groupDigest);
|
2026 |
+
$sqjQuery(sqDiv).append(groupDigest2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2027 |
};
|
2028 |
return that;
|
2029 |
};
|
2037 |
openPay, canFinish, targetAmount, renderBtn, singleAmountBtn, inviteBtn,
|
2038 |
renderDiv, participantId, invAmount, alertPaid, renderRef, refContainer;
|
2039 |
var paidCount=0;
|
2040 |
+
var part, totalPaid, superTemp, ttt, ttr;
|
2041 |
var SqDiv=document.getElementById('squeezol_view');
|
2042 |
var sqBtnContainer;
|
2043 |
var i, j, k, p, spanCurr, quotaDiv, labelQuota;
|
2044 |
var status, ui, state, ghianda, avatar_url, alertDes, contribution_amount;
|
2045 |
+
var textAdd, tDiv;
|
2046 |
var paidText = '<p class="sq-text-center"><strong> La tua quota è stata prenotata! </strong>'+
|
2047 |
+
'L\'importo verrà scalato dalla tua carta solo se l\'obiettivo verrà raggiunto!<br/>'+
|
2048 |
+
'Invita altri amici per diminuire la quota. '+
|
2049 |
'Oppure continua lo shopping!'
|
2050 |
+'</p>';
|
2051 |
+
var wrapper = {wrapper: 'div', className: 'sq-col-md-2 sq-col-md-offset-1 sq-col-xs-10 sq-col-xs-offset-1'};
|
2052 |
+
var wrapperQ = {wrapper: 'div', className: 'sq-col-md-5 sq-col-md-offset-1 sq-col-xs-10 sq-col-xs-offset-1'};
|
2053 |
var wrapper_row = {wrapper: 'div', className: 'sq-row'};
|
2054 |
var wrapBtn = {wrapper: 'div', className: 'sq-col-md-2 sq-col-xs-10 sq-col-xs-offset-1'};
|
2055 |
+
var wrapper_btn = {wrapper: 'div', className: 'sq-col-sm-4 sq-col-sm-offset-4 sq-col-xs-12 sq-col-xs-offset-0'};
|
2056 |
var wrapper_right = {wrapper: 'div', className: 'sq-col-md-3 sq-col-md-offset-3 sq-col-xs-10 sq-col-xs-offset-1'};
|
2057 |
+
var helpText = { 'p_quota': 'Inserisci la quota che intendi versare. Nota: fai click su modifica dopo aver inserito l\'importo',
|
2058 |
+
'expl': 'Se lo ritieni necessario modifica la tua quota prima di pagare'};
|
2059 |
|
2060 |
if(answer.status === 'ok') {
|
2061 |
params=JSON.parse(answer.params);
|
2074 |
ui.drawHeader('digest', 'modal');
|
2075 |
|
2076 |
this.renderGroupData(answer.group, params, SqDiv, participants);
|
2077 |
+
|
2078 |
renderDiv=Div(document.createElement('div'));
|
2079 |
+
renderDiv.addClass('sq-row row-separata');
|
2080 |
|
2081 |
renderBtn = Button();
|
2082 |
singleAmountBtn = Button();
|
2085 |
// Group completed with success
|
2086 |
if(groupStatus == 'CWS') {
|
2087 |
alertDes = document.createElement('div');
|
2088 |
+
alertDes.className = 'sq-row sq-alert sq-alert-success row-separata'
|
2089 |
alertDes.innerHTML = '<p class="sq-text-center">'+
|
2090 |
'<strong> Congratulazioni! Ordine Completato</strong>'+
|
2091 |
'Lo split si è concluso con successo! '+
|
2096 |
else if (groupStatus == 'WAC' || groupStatus == 'WPA'){
|
2097 |
// Possibilita' di proporre un importo se si e' in fase di accettazione o il gruppo e' aperto e WPA
|
2098 |
if (params.p_status == 'A' && !canFinish){
|
2099 |
+
ui.drawSeparator('Quota');
|
2100 |
saInput.create('single-amount');
|
2101 |
saInput.get().value=parseFloat(params.p_single_amount).toFixed(2);
|
2102 |
saInput.get().id='squeezol_single_amount';
|
2103 |
+
singleAmountBtn.create('Salva quota', 'ui', 'SqueezolModifyAmount_');
|
2104 |
singleAmountBtn.get().setAttribute('data-participant', participantId);
|
2105 |
singleAmountBtn.get().setAttribute('data-action', 'SA');
|
2106 |
singleAmountBtn.get().className='sq-btn sq-btn-lg';
|
2110 |
spanCurr = document.createElement('span');
|
2111 |
spanCurr.className = 'sq-input-group-addon';
|
2112 |
spanCurr.innerHTML = ui.switchCurrency(answer.group.currency);
|
2113 |
+
quotaDiv.append(saInput.labelizeWithSpan('La tua quota', spanCurr, helpText['p_quota'], helpText['expl']).get());
|
2114 |
+
renderDiv.append(quotaDiv.wrap(wrapperQ));
|
2115 |
renderDiv.append(singleAmountBtn.wrap(wrapBtn));
|
2116 |
SqDiv.appendChild(renderDiv.get());
|
2117 |
+
|
2118 |
}
|
2119 |
|
2120 |
ui.iconPopover();
|
2126 |
renderBtn.create('Inizia i pagamenti!', 'ui', 'SqueezolStartPay_');
|
2127 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2128 |
renderBtn.get().setAttribute('data-action', 'OP');
|
2129 |
+
renderBtn.get().className='sq-btn';
|
2130 |
renderBtn.regHandler('click', buttonHandler);
|
2131 |
}
|
2132 |
// Se puo' concludere la collette
|
2134 |
renderBtn.create('Concludi Split', 'ui', 'SqueezolFinishPay_');
|
2135 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2136 |
renderBtn.get().setAttribute('data-action', 'CG');
|
2137 |
+
renderBtn.get().className='squeezolButtonSuccess sq-btn';
|
2138 |
renderBtn.regHandler('click', buttonHandler);
|
2139 |
+
textAdd = document.createTextNode('Obiettivo raggiunto! Clicca su Concludi lo split per confermare l\'acquisto. Una notifica verrà inviata a tutti i partecipanti.');
|
2140 |
+
tDiv = Div(document.createElement('div'));
|
2141 |
+
tDiv.addClass('sq-col-md-7 sq-col-xs-10 sq-col-xs-offset-1');
|
2142 |
+
tDiv.append(textAdd);
|
2143 |
renderDiv.append(renderBtn.wrap(wrapper));
|
2144 |
+
renderDiv.append(tDiv.get());
|
2145 |
SqDiv.appendChild(renderDiv.get());
|
2146 |
renderBtn = '';
|
2147 |
renderBtn = Button();
|
2151 |
renderBtn.get().setAttribute('data-action', 'RG');
|
2152 |
renderBtn.get().className='sq-btn sq-btn-sm sq-btn-danger';
|
2153 |
renderBtn.regHandler('click', buttonHandler);
|
2154 |
+
renderBtn = Div(renderBtn.wrap(wrapper));
|
2155 |
}
|
2156 |
// Se i pagamenti sono aperti
|
2157 |
else if(openPay==true) {
|
2160 |
if(partObj.id==participantId) {
|
2161 |
if (partObj.status==='P'){
|
2162 |
alertPaid=document.createElement('div');
|
2163 |
+
alertPaid.className='sq-alert sq-alert-success';
|
2164 |
alertPaid.innerHTML=paidText;
|
2165 |
renderBtn = Button();
|
2166 |
renderBtn=Div(alertPaid);
|
2167 |
}
|
2168 |
else{
|
2169 |
+
renderBtn.create('Versa la tua quota', 'ui', 'SqueezolPay_');
|
2170 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2171 |
renderBtn.get().setAttribute('data-action', 'P');
|
2172 |
renderBtn.get().className='sq-btn sq-btn-lg';
|
2173 |
renderBtn.regHandler('click', buttonHandler);
|
2174 |
+
superTemp = document.createElement('p');
|
2175 |
+
superTemp.className='sq-text-left';
|
2176 |
+
ttt=document.createTextNode('Versa la tua quota, l\importo verrà scalato dalla carta di credito solo se l\'obiettivo verrà raggiunto');
|
2177 |
+
superTemp.appendChild(ttt);
|
2178 |
+
ttr = document.createElement('div');
|
2179 |
+
ttr.className = 'sq-col-xs-10 sq-col-xs-offset-1 sq-panel sq-panel-info';
|
2180 |
+
ttr.appendChild(superTemp);
|
2181 |
+
ttr = Div(ttr);
|
2182 |
+
ttr.append(renderBtn.wrap(wrapper_btn));
|
2183 |
+
renderBtn = DomElement({'el': ttr.get()});
|
2184 |
}
|
2185 |
}
|
2186 |
if(partObj.status=='P' && paidCount==0){
|
2187 |
paidCount=1;
|
2188 |
refContainer = Div(document.createElement('div'));
|
2189 |
+
refContainer.addClass('sq-row row-separata');
|
2190 |
+
textAdd = document.createTextNode('Puoi rimborsare il pagamento, le quote versate torneranno disponibili secondo le tempistiche dell\'istituto bancario emittente della carta.');
|
2191 |
+
tDiv = Div(document.createElement('div'));
|
2192 |
+
tDiv.addClass('sq-col-md-7 sq-col-xs-10 sq-col-xs-offset-1');
|
2193 |
+
tDiv.append(textAdd);
|
2194 |
renderRef=Button();
|
2195 |
renderRef.create('Rimborsa', 'small', 'SqueezolRefund_');
|
2196 |
renderRef.get().setAttribute('data-participant', participantId);
|
2198 |
renderRef.get().className='sq-btn sq-btn-sm sq-btn-danger';
|
2199 |
renderRef.regHandler('click', buttonHandler);
|
2200 |
refContainer.append(renderRef.wrap(wrapBtn));
|
2201 |
+
refContainer.append(tDiv.get());
|
2202 |
+
SqDiv.appendChild(refContainer.get());
|
2203 |
}
|
2204 |
}
|
2205 |
}
|
2223 |
if(partObj.id==participantId) {
|
2224 |
if (partObj.status==='P'){
|
2225 |
alertPaid=document.createElement('div');
|
2226 |
+
alertPaid.className='sq-alert sq-alert-success';
|
2227 |
alertPaid.innerHTML=paidText;
|
2228 |
renderBtn=Div(alertPaid);
|
2229 |
}
|
2230 |
else{
|
2231 |
+
renderBtn.create('Versa la tua quota', 'ui', 'SqueezolPay_');
|
2232 |
renderBtn.get().setAttribute('data-participant', participantId);
|
2233 |
renderBtn.get().setAttribute('data-action', 'P');
|
2234 |
+
renderBtn.get().className='sq-btn';
|
2235 |
renderBtn.regHandler('click', buttonHandler);
|
2236 |
+
superTemp = document.createElement('p');
|
2237 |
+
superTemp.className='sq-text-center';
|
2238 |
+
ttt=document.createTextNode('Versa la tua quota, l\importo verrà scalato dalla carta di credito solo se l\'obiettivo verrà raggiunto');
|
2239 |
+
superTemp.appendChild(ttt);
|
2240 |
+
ttr = document.createElement('div');
|
2241 |
+
ttr.className = 'sq-col-xs-10 sq-col-xs-offset-1 sq-panel sq-panel-info';
|
2242 |
+
ttr.appendChild(superTemp);
|
2243 |
+
ttr = Div(ttr);
|
2244 |
+
ttr.append(renderBtn.wrap(wrapper_btn));
|
2245 |
+
renderBtn = DomElement({'el': ttr.get()});
|
2246 |
}
|
2247 |
}
|
2248 |
}
|
2250 |
}
|
2251 |
|
2252 |
// Render
|
2253 |
+
renderDiv=Div(document.createElement('div'));
|
2254 |
+
renderDiv.addClass('sq-row row-separata');
|
2255 |
+
renderDiv.get().id='squeezolPayBox';
|
2256 |
+
|
2257 |
+
if (openPay == false && groupStatus == 'WAC') {
|
2258 |
+
superTemp = document.createElement('p');
|
2259 |
+
superTemp.className='sq-text-left';
|
2260 |
+
ttt=document.createTextNode('Al momento i partecipanti non hanno la possibilita\' di pagare. Clicca su Inizia i pagamenti: sara\' possibile a tutti versare la propria quota (una notifica verra\' inoltrata a tutti i partecipanti!)');
|
2261 |
+
superTemp.appendChild(ttt);
|
2262 |
+
ttr = document.createElement('div');
|
2263 |
+
ttr.id='sq-alert-start-pay';
|
2264 |
+
superTemp.appendChild(ttt);
|
2265 |
+
ttr.className = 'sq-col-xs-10 sq-col-xs-offset-1 sq-panel sq-panel-info';
|
2266 |
+
ttr.appendChild(superTemp);
|
2267 |
+
ttr = Div(ttr);
|
2268 |
if (isAdmin == true){
|
2269 |
+
ttr.append(renderBtn.wrap(wrapper_btn));
|
|
|
|
|
|
|
2270 |
}
|
2271 |
+
/*else {
|
2272 |
+
superTemp.append('<p class="sq-text-center">Potrai versare la tua quota quando l\'organizzatore avrà iniziato i pagamenti(una notifica ti verrà inviata per email)</p>');
|
2273 |
+
}*/
|
2274 |
+
renderDiv.append(ttr.wrap(wrapper_row));
|
2275 |
+
// renderDiv.append(renderBtn.wrap(wrapper_right));
|
2276 |
}
|
2277 |
+
else{
|
2278 |
+
renderDiv.append(renderBtn.get());
|
2279 |
+
}
|
|
|
2280 |
if (params.invitation_url && isAdmin && (answer.group.status == 'WPA' || answer.group.status == 'WAC')){
|
2281 |
inviteBtn = Button();
|
2282 |
inviteBtn.create('Invita ancora', 'ui', 'SqueezolInvitation_');
|
2295 |
renderBtn.get().disabled=true;
|
2296 |
renderBtn.get().className='buttonWarning sq-btn sq-btn-lg';
|
2297 |
alertDes = document.createElement('div');
|
2298 |
+
alertDes.className = 'sq-row row-separata';
|
2299 |
alertDes.innerHTML = '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-alert sq-alert-warning"><p>'+
|
2300 |
'<strong>Attenzione!</strong>'+
|
2301 |
'Lo Split è stato chiuso dall\'organizzatore o è scaduto il termine di 20 giorni entro i quali effettuare il pagamento. Le quote versate torneranno disponibili al massimo entro 30 giorni dalla data del pagamento.'+
|
2309 |
part=document.createElement('div');
|
2310 |
part.className = 'sq-row part';
|
2311 |
p=participants[j];
|
2312 |
+
|
2313 |
status=this.switchStatus(p.status);
|
2314 |
var img = new Image();
|
2315 |
if(p.avatar_url){
|
2318 |
avatar_url = img_url + 'default.jpg';
|
2319 |
}
|
2320 |
if (p.status == 'P'){
|
2321 |
+
if (answer.group.status == 'DES'){
|
2322 |
+
state = 'refused';
|
2323 |
+
ghianda = 'grigia';
|
2324 |
+
status = 'Rimborsato';
|
2325 |
+
} else {
|
2326 |
+
state = 'active';
|
2327 |
+
ghianda = 'blu';
|
2328 |
+
}
|
2329 |
}
|
2330 |
else if (p.status == 'A'){
|
2331 |
state = 'accepted';
|
2338 |
contribution_amount = '-';
|
2339 |
else
|
2340 |
contribution_amount = p.single_amount + ' ' + ui.switchCurrency(answer.group.currency);
|
2341 |
+
part.innerHTML= '<div class="sq-col-sm-1 sq-col-sm-offset-1 sq-col-xs-4 sq-col-xs-offset-4">'+
|
2342 |
'<img id="thumb'+j+'" class="imgAvatar sq-thumbnail sq-img-responsive" src="'+avatar_url+'" alt="User Avatar"></img>'+
|
2343 |
'</div>'+
|
2344 |
+
'<div class="sq-col-sm-4 sq-col-sm-offset-1 sq-col-xs-10 sq-col-xs-offset-0 sq-has-success">'+
|
2345 |
+
'<p class="sq-text-center">'+p.name+'</p>'+
|
2346 |
'</div>'+
|
2347 |
+
'<div class="sq-col-sm-2 sq-col-xs-10">'+
|
2348 |
'<h4 class="sq-text-center">'+contribution_amount+'</h4>'+
|
2349 |
'</div>'+
|
2350 |
+
'<div class="sq-col-sm-2 sq-col-xs-10">'+
|
2351 |
'<h4 class="sq-text-center text-step-'+state+'">'+status+'</h4>'+
|
2352 |
'</div>'+
|
2353 |
+
'<div class="sq-col-sm-1 sq-hidden-xs">'+
|
2354 |
'<img class="sq-img-responsive" src="' + img_url + 'ghianda_step_'+ghianda+'.png">'+
|
2355 |
'</div>';
|
2356 |
SqDiv.appendChild(part);
|
2432 |
var groupDigest, status, sqDiv;
|
2433 |
var ui, p, admin_name, participant, testo, classe;
|
2434 |
var totalPaid=0.00;
|
2435 |
+
var d1=new Date(group.max_payment_date);
|
2436 |
+
ui = UserInterface();
|
2437 |
sqDiv = document.getElementById('squeezol_view');
|
2438 |
groupDigest=document.createElement('div');
|
2439 |
groupDigest.id = "squeezol_btn_container";
|
2460 |
testo = 'Quota che intendo versare';
|
2461 |
}
|
2462 |
else if (group.fundraising == 'S'){
|
2463 |
+
testo = 'Quota singola';
|
2464 |
}
|
2465 |
else if (group.fundraising == 'F'){
|
2466 |
testo = 'Quota fissa';
|
2474 |
}
|
2475 |
else
|
2476 |
classe='target-R';
|
2477 |
+
groupDigest.innerHTML= '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-7 sq-col-md-offset-1 sq-col-left">'+
|
2478 |
'<p class="sq-content-title">'+ group.name +'<p>'+
|
2479 |
'</div>'+
|
2480 |
+
'<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0">'+
|
2481 |
+
'<p class="sq-content-body sq-text-center">Organizzatore:</p>'+
|
2482 |
'<strong>'+admin_name+'</strong>'+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2483 |
'</div>';
|
2484 |
groupDigest=Div(groupDigest);
|
2485 |
sqDiv.appendChild(groupDigest.get());
|
2490 |
'<div class="sq-col-md-4">'+
|
2491 |
'<div class="sq-row">'+
|
2492 |
'<h4>TERMINA FRA</h4>'+
|
2493 |
+
'<div class="sq-col-md-4 sq-col-sm-2 sq-col-xs-4 sq-no-pad">'+
|
2494 |
'<p class="sq-target-small">'+params.daysLeft+' G</p>'+
|
2495 |
'</div>'+
|
2496 |
+
'<div class="sq-col-md-4 sq-col-sm-2 sq-col-xs-4 sq-no-pad">'+
|
2497 |
'<p class="sq-target-small">'+params.hoursLeft+' H</p>'+
|
2498 |
'</div>'+
|
2499 |
+
'<div class="sq-col-md-4 sq-col-sm-2 sq-col-xs-4 sq-no-pad">'+
|
2500 |
'<p class="sq-target-small">'+params.minutesLeft+' M</p>'+
|
2501 |
'</div>'+
|
2502 |
'</div>'+
|
2503 |
+
'<p class="sq-content-body">Il '+d1.getDate()+'.'+(parseInt(d1.getMonth())+1).toString()+'.'+d1.getFullYear()+'</p>'+
|
2504 |
'</div>'+
|
2505 |
'<div class="sq-col-md-4">'+
|
2506 |
'<div class="sq-row">'+
|
2527 |
'</div>';
|
2528 |
groupDigest=Div(groupDigest);
|
2529 |
sqDiv.appendChild(groupDigest.get());
|
|
|
2530 |
},
|
2531 |
that.POSTcallback = function(answer, action, targetUrl){
|
2532 |
var oldBtn, parentDiv, payBox, payBoxP, alertPaid, renderBtn;
|
2533 |
var renderButton=Button();
|
2534 |
+
var participantId, form, sq_message, superTemp, ttt, ttr;
|
2535 |
if (action == 'OPENPAY'){
|
2536 |
oldBtn = document.getElementById('SqueezolStartPay_');
|
2537 |
participantId = oldBtn.getAttribute('data-participant');
|
2542 |
parentDiv.removeChild(sq_message);
|
2543 |
parentDiv=document.getElementById('squeezolPayBox');
|
2544 |
parentDiv.innerHTML='';
|
2545 |
+
renderButton.create('Versa la tua quota', 'ui', 'SqueezolPay_');
|
2546 |
renderButton.get().setAttribute('data-action', 'P');
|
2547 |
renderButton.get().setAttribute('data-participant', participantId);
|
2548 |
renderButton.regHandler('click', function(e){
|
2552 |
request.send(target);
|
2553 |
});
|
2554 |
renderButton.addClass('sq-btn')
|
2555 |
+
|
2556 |
+
superTemp = document.createElement('p');
|
2557 |
+
superTemp.className='sq-text-center';
|
2558 |
+
ttt=document.createTextNode('Versa la tua quota, l\importo verrà scalato dalla carta di credito solo se l\'obiettivo verrà raggiunto');
|
2559 |
+
superTemp.appendChild(ttt);
|
2560 |
+
ttr = document.createElement('div');
|
2561 |
+
superTemp.appendChild(ttt);
|
2562 |
+
ttr.className = 'sq-col-xs-10 sq-col-xs-offset-1 sq-panel sq-panel-info';
|
2563 |
+
ttr.appendChild(superTemp);
|
2564 |
+
ttr = Div(ttr);
|
2565 |
+
ttr.append(renderButton.wrap({wrapper: 'div', className: 'sq-col-sm-4 sq-col-sm-offset-4 sq-col-xs-12 sq-col-xs-offset-0'}));
|
2566 |
+
parentDiv.appendChild(ttr.get());
|
2567 |
}
|
2568 |
else if (action == 'FINISH'){
|
2569 |
oldBtn = document.getElementById('SqueezolFinishPay_');
|
2570 |
payBox = document.getElementById('squeezolPayBox');
|
2571 |
participantId = oldBtn.getAttribute('data-participant');
|
2572 |
+
parentDiv = oldBtn.parentNode.parentNode;
|
2573 |
+
parentDiv.removeChild(oldBtn.parentNode.nextSibling);
|
2574 |
+
parentDiv.removeChild(oldBtn.parentNode);
|
2575 |
alertPaid=document.createElement('div');
|
2576 |
+
alertPaid.className='sq-alert sq-alert-success';
|
2577 |
alertPaid.innerHTML='<p class="sq-text-center">'+
|
2578 |
+
'<strong> Congratulazioni! pagamento effettuato, </strong>'+
|
2579 |
+
'lo split si è concluso con successo!'+
|
2580 |
'</p>';
|
2581 |
renderBtn=Div(document.createElement('div'));
|
2582 |
renderBtn.append(alertPaid);
|
2583 |
payBoxP = payBox.parentNode;
|
2584 |
payBoxP.removeChild(payBox);
|
2585 |
renderBtn.get().setAttribute('data-participant', participantId);
|
|
|
2586 |
parentDiv.appendChild(renderBtn.get());
|
2587 |
}
|
2588 |
else if(action == 'PAY'){
|
2635 |
};
|
2636 |
return that;
|
2637 |
};
|
2638 |
+
var PostMessageReceiver = function(e) {
|
2639 |
+
var DecodedString=decodeURIComponent(e.data);
|
2640 |
+
var data=JSON.parse(DecodedString);
|
2641 |
+
var authModal;
|
2642 |
+
if (data.action == 'delete-social'){
|
2643 |
+
$sqjQuery('#social-login').remove();
|
2644 |
+
}
|
2645 |
+
else if (data.action == 'close-pop'){
|
2646 |
+
window.location.replace(auth_url+'?'+data.code);
|
2647 |
+
}
|
2648 |
+
else if (data.action == 'facebook'){
|
2649 |
+
authModal = $sqjQuery('#facebookModal');
|
2650 |
+
authModal.modal('hide');
|
2651 |
+
if (data.fbList)
|
2652 |
+
notifyFacebookPostMessage(data.fbList);
|
2653 |
+
}
|
2654 |
+
}
|
2655 |
+
var notifyFacebookPostMessage = function(fbList){
|
2656 |
+
var container = document.getElementById('containerCronologia')
|
2657 |
+
var alreadyInvited = container.getElementsByClassName('sq-fb-element');
|
2658 |
+
var currSent, inv, div;
|
2659 |
+
var found = false;
|
2660 |
+
console.log(fbList);
|
2661 |
+
for (var i=0; i<fbList.length; i++){
|
2662 |
+
div = document.createElement('div');
|
2663 |
+
div.className = 'sq-row sq-fb-element';
|
2664 |
+
currSent = fbList[i];
|
2665 |
+
for (var j=0; j<alreadyInvited.length; j++) {
|
2666 |
+
inv = alreadyInvited[j].getElementsByTagName('input')[0];
|
2667 |
+
if (inv.value == currSent.id) {
|
2668 |
+
found = true;
|
2669 |
+
}
|
2670 |
+
}
|
2671 |
+
if (found==false) {
|
2672 |
+
if(currSent.avatar_url){
|
2673 |
+
div.innerHTML='<div class="sq-col-md-1 sq-col-md-offset-1 sq-hidden-xs"><img class="sq-thumbnail imgAvatar" src="'+invObj.avatar_url+'" alt="User Avatar"></img></div>';
|
2674 |
+
}
|
2675 |
+
else {
|
2676 |
+
div.innerHTML='<div class="sq-col-md-1 sq-col-md-offset-1 sq-hidden-xs"><img class="imgAvatar sq-thumbnail" src="' + img_url + 'facebook_small.png" alt="User Avatar"></img> </div>';
|
2677 |
+
}
|
2678 |
+
if(currSent.id) {
|
2679 |
+
div.className = 'sq-row sq-fb-element';
|
2680 |
+
div.innerHTML += '<div class="sq-col-xs-10 sq-col-xs-offset-1 sq-col-md-4 sq-col-md-offset-0 sq-has-success sq-input-group"> <input type="hidden" class="fbEntry sq-form-control" value="'+currSent.id+'"disabled></input>'+
|
2681 |
+
'<input value="'+currSent.name+'" class="sq-form-control" type="text" name="email" disabled>'+
|
2682 |
+
'<span class="sq-input-group-addon sq-glyph-ok sq-check"></span>'+
|
2683 |
+
'</div>';
|
2684 |
+
}
|
2685 |
+
container.appendChild(div);
|
2686 |
+
}
|
2687 |
+
}
|
2688 |
+
}
|
2689 |
// API Call
|
2690 |
window.SqueezolApi = {
|
2691 |
+
createSqButton: function(targetUrl, size, access_token) {
|
2692 |
var tmpBtn, btn, div, txt;
|
2693 |
+
var popupWin, m;
|
2694 |
+
var ui=UserInterface();
|
2695 |
+
var sqLoading = Div(document.getElementById('sq-loading'));
|
2696 |
+
tmpBtn=document.createElement('div');
|
2697 |
tmpBtn.innerHTML = '<img src="' + img_url + 'pay_button2.png"></img>';
|
2698 |
btn = Div(tmpBtn);
|
2699 |
btn.addClass('squeezol_button_'+size)
|
2700 |
btn.regHandler('click', function() {
|
2701 |
+
popupWin = ui.PopupCenter(targetUrl, "sq_login", 600, 550);
|
2702 |
});
|
2703 |
div = Div();
|
2704 |
div.get('squeezol_btn');
|
2705 |
+
sqLoading.remove();
|
2706 |
div.append(btn.get());
|
2707 |
+
if(window.addEventListener){
|
2708 |
+
window.addEventListener("message", PostMessageReceiver,false);
|
2709 |
+
}else if(window.attachEvent){
|
2710 |
+
window.attachEvent("onmessage", PostMessageReceiver);
|
2711 |
+
}
|
2712 |
+
if(access_token != "")
|
2713 |
+
window.location.replace(targetUrl);
|
2714 |
+
else
|
2715 |
+
popupWin = ui.PopupCenter(targetUrl, "sq_login", 600, 550);
|
2716 |
+
|
2717 |
},
|
2718 |
createGroup: function(amount, currency, codProducts, targetUrl, firstUrl, secondUrl) {
|
2719 |
var trolley, groupCr, ui;
|