21 \Bitrix\Main\Page\Asset::getInstance()->addJs(
"/bitrix/js/sale/admin/order_info.js");
24 <script type="text/javascript">
26 BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters( BX.Sale.Admin.OrderInfo.getFieldsUpdaters() );
32 protected static function getPaymentsInfo(
Order $order)
34 $payments = $order->getPaymentCollection();
42 foreach ($payments as $payment)
44 $id = $payment->getField(
"PAY_SYSTEM_ID");
45 $ptId = $order->getPersonTypeId();
56 "ID" => $payment->getId(),
57 "NAME" => $params[
"NAME"],
58 "LOGOTIP_PATH" => $params[
"LOGOTIP_PATH"],
59 "IS_PAYED" => $payment->isPaid()
65 protected static function getShipmentsInfo(
Order $order)
68 $shipments = $order->getShipmentCollection();
71 foreach($shipments as $shipment)
73 if($shipment->isSystem())
77 $deliveryService = $shipment->getDelivery();
83 "ID" => $shipment->getId(),
84 "NAME" => $deliveryService->getName(),
85 "LOGOTIP_PATH" => $deliveryService->getLogotipPath(),
86 "IS_SHIPPED" => $shipment->isShipped(),
87 "DEDUCTED" => $shipment->getField(
'DEDUCTED')
98 public static function getView(Order $order, $orderBasket)
100 $currency = $order->getCurrency();
101 $orderProps = $order->getPropertyCollection();
103 if($email = $orderProps->getUserEmail())
104 $email = $email->getViewHtml();
106 if($phone = $orderProps->getPhone())
108 $phoneVal = $phone->getValue();
112 if(!is_array($phoneVal))
113 $phoneVal = array($phoneVal);
117 foreach($phoneVal as $number)
119 $number = str_replace(
"'",
"", htmlspecialcharsbx($number));
124 $phone .=
'<a href="javascript:void(0)" onclick="BX.Sale.Admin.OrderEditPage.desktopMakeCall(\''.$number.
'\');
">'.
135 if($name = $orderProps->getPayerName())
136 $name = $name->getViewHtml();
138 $totalPrices = OrderEdit::getTotalPrices($order, $orderBasket, false);
140 //Here we can receive custom data
141 $event = new Event('sale', 'onSaleAdminOrderInfoBlockShow', array('ORDER' => $order, 'ORDER_BASKET' => $orderBasket));
143 $resultList = $event->getResults();
144 $customData = array();
146 if (is_array($resultList) && !empty($resultList))
148 foreach ($resultList as $eventResult)
151 if ($eventResult->getType() != EventResult::SUCCESS)
154 $params = $eventResult->getParameters();
156 if(!empty($params) && is_array($params))
157 $customData = array_merge($customData, $params);
163 <div class="adm-bus-orderinfoblock adm-detail-tabs-block-pin
" id="sale-order-edit-block-order-info
">
164 <div class="adm-bus-orderinfoblock-container
">
165 <div class="adm-bus-orderinfoblock-title
">
166 <div class="adm-bus-orderinfoblock-title-text
">'.Loc::getMessage("SALE_ORDER_INFO
", array(
167 "#ID#
" => $order->getId(),
168 "#NUM#
" => $order->getField("ACCOUNT_NUMBER
") <> '' ? $order->getField("ACCOUNT_NUMBER
") : $order->getId(),
169 "#DATE#
" => $order->getDateInsert()->toString())
170 )." [
".$order->getSiteId()."]
".'</div>
171 <div class="adm-bus-orderinfoblock-status success
" id="order_info_order_status_name
">'.$order->getField('STATUS_ID').'</div> <!-- TODO -->
173 '.static::getOrderInfoBlock($order).'
174 <div class="adm-bus-orderinfoblock-content
">
175 <div class="adm-bus-orderinfoblock-content-block-customer
">
176 <ul class="adm-bus-orderinfoblock-content-customer-info
">
178 <span class="adm-bus-orderinfoblock-content-customer-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_FIO
").':</span>
179 <span class="adm-bus-orderinfoblock-content-customer-info-separator
"></span>
180 <span class="adm-bus-orderinfoblock-content-customer-info-value
" id="order_info_buyer_name
">'.$name.'</span>
183 <span class="adm-bus-orderinfoblock-content-customer-info-param
">E-Mail:</span>
184 <span class="adm-bus-orderinfoblock-content-customer-info-separator
"></span>
185 <span class="adm-bus-orderinfoblock-content-customer-info-value
" id="order_info_buyer_email
">'.$email.'</span>
188 <span class="adm-bus-orderinfoblock-content-customer-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_PHONE
").':</span>
189 <span class="adm-bus-orderinfoblock-content-customer-info-separator
"></span>
190 <span class="adm-bus-orderinfoblock-content-customer-info-value
" id="order_info_buyer_phone
">'.$phone.'</span>
193 if(!empty($customData))
195 foreach($customData as $custom)
197 if(empty($custom['TITLE']))
198 throw new ArgumentNullException("customData[
'TITLE']
");
200 if(empty($custom['VALUE']))
201 throw new ArgumentNullException("customData[
'VALUE']
");
205 <span class="adm-bus-orderinfoblock-content-customer-info-param
">'.$custom['TITLE'].'</span>
206 <span class="adm-bus-orderinfoblock-content-customer-info-separator
"></span>
207 <span class="adm-bus-orderinfoblock-content-customer-info-value
"'.(!empty($custom['ID']) ? ' id="'.$custom['ID
'].'"' : '' ).'>'.$custom['VALUE'].'</span>
215 <div class="adm-bus-orderinfoblock-content-block-order
">
216 <ul class="adm-bus-orderinfoblock-content-order-info
">
218 <span class="adm-bus-orderinfoblock-content-order-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_PRICE
").'</span>
219 <span class="adm-bus-orderinfoblock-content-order-info-value
" id="order_info_price_basket
">'.
220 SaleFormatCurrency(floatval($totalPrices["PRICE_BASKET
"]), $currency).
223 <li class="adm-bus-orderinfoblock-content-redtext
">
224 <span class="adm-bus-orderinfoblock-content-order-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_DISCOUNT_PRICE
").'</span>
225 <span class="adm-bus-orderinfoblock-content-order-info-value
" id="order_info_price_basket_discount
">'.
226 SaleFormatCurrency(floatval($totalPrices["PRICE_BASKET_DISCOUNTED
"]), $currency).
230 <span class="adm-bus-orderinfoblock-content-order-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_DELIVERY_PRICE
").'</span>
231 <span class="adm-bus-orderinfoblock-content-order-info-value
" id="order_info_delivery_price
">'.
232 SaleFormatCurrency(floatval($order->getDeliveryPrice()), $currency).
236 <ul class="adm-bus-orderinfoblock-content-order-info-result
">
238 <span class="adm-bus-orderinfoblock-content-order-info-param
">'.Loc::getMessage("SALE_ORDER_INFO_ALL_PRICE
").'</span>
239 <span class="adm-bus-orderinfoblock-content-order-info-value
" id="order_info_buyer_price
">'.
240 SaleFormatCurrency(floatval($order->getPrice()), $currency).
245 <div class="adm-bus-orderinfoblock-content-block-last
">
246 '.Loc::getMessage("SALE_ORDER_INFO_PAYED
").': '.SaleFormatCurrency(floatval($order->getSumPaid()), $currency).
247 '<ul class="adm-bus-orderinfoblock-content-last
">';
249 $updatersContent = "";
251 foreach(self::getPaymentsInfo($order) as $payment)
253 $result .= '<a href="#payment_
'.$payment["ID"].'" style="text-decoration: none;
">
254 <li id="sale-admin-order-icon-payment-
'.$payment["ID"].'" class="adm-bus-orderinfoblock-content-last-icon
'.
255 ($payment["IS_PAYED"] ? 'green
' : 'red
').
258 if (strval($payment["LOGOTIP_PATH
"]) != '')
260 $result .= 'style="background-image: url(
'.$payment["LOGOTIP_PATH"].');
" ';
263 $result .= 'title="'.htmlspecialcharsbx($payment["NAME"]).'"'.
264 '><span></span></li></a>';
266 if($updatersContent <> '')
267 $updatersContent .=",\n
";
269 $updatersContent .= "\tPAYMENT_PAID_
".$payment["ID
"].":
function(paid) {
BX.Sale.Admin.OrderInfo.setIconLamp(
'payment',
'".$payment["ID"]."', (paid ==
'Y' ?
'green' :
'red')); }
";
272 '.Loc::getMessage("SALE_ORDER_INFO_SHIPMENT
").'
273 <ul class="adm-bus-orderinfoblock-content-last
">';
274 foreach(self::getShipmentsInfo($order) as $shipment)
276 $result .= '<a href="#shipment_
'.$shipment["ID"].'" style="text-decoration: none;
">
277 <li id="sale-admin-order-icon-shipment-
'.$shipment["ID"].'" class="adm-bus-orderinfoblock-content-last-icon
'.
278 ($shipment["DEDUCTED"] == "Y" ? 'green
' : 'red
').
281 if (strval($shipment["LOGOTIP_PATH
"]) != '')
283 $result .= 'style="background-image: url(
'.$shipment["LOGOTIP_PATH"].');
" ';
285 $result .= 'title="'.htmlspecialcharsbx($shipment["NAME"]).'"'.
286 '><span></span></li></a>';
288 if($updatersContent <> '')
289 $updatersContent .=",\n
";
291 $updatersContent .= "\tSHIPMENT_STATUS_
".$shipment["ID
"].":
function(shipmentStatus) {
BX.Sale.Admin.OrderInfo.setIconLamp(
'shipment',
'".$shipment["ID"]."', (shipmentStatus ==
'DF' ?
'green' :
'red')); }
";
297 <div id="sale-order-edit-block-order-info-pin
" onclick="BX.Sale.Admin.OrderEditPage.toggleFix(this.
id, \
'sale-order-edit-block-order-info\');" class="adm-detail-pin-btn-tabs" style="top: 9px;right: 0;"></div>
301 $orderEditOpts = \CUserOptions::GetOption(
"sale_admin",
"sale_order_edit", array());
302 $isFixed = isset($orderEditOpts[
"fix_sale-order-edit-block-order-info"]) && $orderEditOpts[
"fix_sale-order-edit-block-order-info"] ==
"Y" ? true :
false;
306 <script type="text/javascript">
308 setTimeout(function(){BX.Sale.Admin.OrderEditPage.toggleFix("sale-order-edit-block-order-info-pin", "sale-order-edit-block-order-info");},1);
313 if($updatersContent <>
'')
316 <script type="text/javascript">
318 BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters({