Просмотр исходного кода

Ticket #3342 - Payment: Show current currency in create product, pricing plan, etc forms - Core changes

AntonLV 4 лет назад
Родитель
Сommit
99daa9c55c

+ 24 - 0
modules/boonex/artificer/data/template/system/css/forms.css

@@ -154,6 +154,30 @@ import url(../../../../../../../template/css/forms.css);
 }
 
 
+/*-- Form field: Price --*/
+.bx-form-element .bx-form-value .bx-form-input-wrapper-price {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: stretch;
+    align-items: stretch;
+}
+.bx-form-element .bx-form-value .bx-form-input-wrapper-price span {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+
+    width: auto;
+    border-right-width: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+.bx-form-element .bx-form-value .bx-form-input-price:not(:first-child) {
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
+}
+
+
 /*-- Form field: Date/Time Pickers --*/
 .bx-form-datepicker-modal {
     z-index: 10001 !important;

+ 4 - 0
modules/boonex/artificer/data/template/system/form_field_price.html

@@ -0,0 +1,4 @@
+<bx_if:show_currency>
+    <span class="block w-full py-2 px-3 border border-gray-300 dark:border-gray-700 rounded-md shadow-sm bg-white dark:bg-gray-900 placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-2 focus:text-gray-900 dark:focus:text-gray-100 focus:ring-blue-500 focus:border-opacity-70 focus:ring-opacity-20 focus:border-blue-500 text-sm text-gray-700 dark:text-gray-300 appearance-none">__currency__</span>
+</bx_if:show_currency>
+__input__

+ 6 - 1
modules/boonex/decorous/data/template/system/css/default.less

@@ -750,6 +750,8 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-textarea,
 .bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
 .bx-form-value .bx-form-input-wrapper-password {
     .box-sizing(@base-input-box-sizing);
 
@@ -769,7 +771,9 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-time,
 .bx-form-value .bx-form-input-datepicker,
 .bx-form-value .bx-form-input-datetime,
-.bx-form-value .bx-form-input-text, 
+.bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
 .bx-form-value .bx-form-input-wrapper-password {
     height: @bx-height-form-input;
 }
@@ -789,6 +793,7 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime:focus,
 .bx-form-value .bx-form-input-textarea:focus,
 .bx-form-value .bx-form-input-text:focus,
+.bx-form-value .bx-form-input-price:focus,
 .bx-form-value .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color: @bx-color-border-form-input-active;
     background-color: @bx-color-form-input-active;

+ 5 - 0
modules/boonex/decorous/data/template/system/css/forms.css

@@ -16,6 +16,11 @@
 	transition: all .3s;
 	padding: 4px 8px !important;
 }
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span {
+    border-radius: 2px;
+    transition: all .3s;
+}
 .bx-form-value .bx-form-input-autotoken{
 	min-height: inherit !important;
 	padding: 0px !important;

+ 7 - 2
modules/boonex/lucid/data/template/system/css/default.less

@@ -785,8 +785,10 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-wrapper-textarea.bx-form-input-wrapper-html,
 .bx-form-value .bx-form-input-textarea,
-.bx-form-value .bx-form-input-wrapper-password,
-.bx-form-value .bx-form-input-text {
+.bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
+.bx-form-value .bx-form-input-wrapper-password {
     .box-sizing(@base-input-box-sizing);
 
     border-color: @bx-color-border-form-input;
@@ -809,6 +811,8 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datepicker,
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
 .bx-form-value .bx-form-input-wrapper-password {
     height: @bx-height-form-input;
 }
@@ -840,6 +844,7 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime:focus,
 .bx-form-value .bx-form-input-textarea:focus,
 .bx-form-value .bx-form-input-text:focus,
+.bx-form-value .bx-form-input-price:focus,
 .bx-form-value .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color: @bx-color-border-form-input-active;
     background-color: @bx-color-form-input-active;

+ 3 - 0
modules/boonex/ocean/data/template/system/css/forms.css

@@ -13,6 +13,8 @@
 .bx-form-input-datetime,
 .bx-form-input-textarea,
 .bx-form-input-text,
+.bx-form-input-price,
+.bx-form-input-wrapper-price span,
 .bx-form-input-wrapper-password {
     border-color:#6097b0;
 }
@@ -25,6 +27,7 @@
 .bx-form-input-datetime:focus,
 .bx-form-input-textarea:focus,
 .bx-form-input-text:focus,
+.bx-form-input-price:focus,
 .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color:#57889e;
 }

+ 5 - 0
modules/boonex/protean/data/template/system/css/default.less

@@ -710,6 +710,8 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-textarea,
 .bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
 .bx-form-value .bx-form-input-wrapper-password {
     .box-sizing(@base-input-box-sizing);
 
@@ -730,6 +732,8 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datepicker,
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span,
 .bx-form-value .bx-form-input-wrapper-password {
     height: @bx-height-form-input;
 }
@@ -749,6 +753,7 @@ a.bx-def-font-h3:hover {
 .bx-form-value .bx-form-input-datetime:focus,
 .bx-form-value .bx-form-input-textarea:focus,
 .bx-form-value .bx-form-input-text:focus,
+.bx-form-value .bx-form-input-price:focus,
 .bx-form-value .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color: @bx-color-border-form-input-active;
     background-color: @bx-color-form-input-active;

+ 4 - 1
studio/template/css/forms.css

@@ -15,7 +15,9 @@
 .bx-form-value .bx-form-input-datetime,
 .bx-form-value .bx-form-input-textarea,
 .bx-form-value .bx-form-input-wrapper-password,
-.bx-form-value .bx-form-input-text {
+.bx-form-value .bx-form-input-text,
+.bx-form-value .bx-form-input-price,
+.bx-form-value .bx-form-input-wrapper-price span {
     height: 36px;
     height: 2.4rem;
     box-sizing: border-box;
@@ -57,6 +59,7 @@
 .bx-form-value .bx-form-input-datetime:focus,
 .bx-form-value .bx-form-input-textarea:focus,
 .bx-form-value .bx-form-input-text:focus,
+.bx-form-value .bx-form-input-price:focus,
 .bx-form-value .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color: rgba(136, 143, 153, 1);
     background-color: rgba(255, 255, 255, 1);

+ 30 - 1
template/css/forms.css

@@ -127,7 +127,9 @@
 .bx-form-input-datetime,
 .bx-form-input-textarea,
 .bx-form-input-wrapper-password,
-.bx-form-input-text {
+.bx-form-input-text,
+.bx-form-input-price,
+.bx-form-input-wrapper-price span {
 
     height:40px;
     height:2.5rem;
@@ -173,6 +175,7 @@
 .bx-form-input-datetime:focus,
 .bx-form-input-textarea:focus,
 .bx-form-input-text:focus,
+.bx-form-input-price:focus,
 .bx-form-input-wrapper-password.bx-form-input-focus {
     border-color:#6caa8a;
 
@@ -310,6 +313,32 @@
     z-index: 1;
 }
 
+/* price */
+.bx-form-element .bx-form-value .bx-form-input-wrapper-price {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: stretch;
+    align-items: stretch;
+}
+.bx-form-element .bx-form-value .bx-form-input-wrapper-price span {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+
+    width: auto;
+    border-right-width: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+.bx-form-input-wrapper-price span {
+    background-color: rgba(249, 250, 251, 1.0);
+}
+.bx-form-element .bx-form-value .bx-form-input-price:not(:first-child) {
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
+}
+
 /* privacy group chooser */
 .bx-form-input-wrapper-pgc {
     position: relative;

+ 4 - 0
template/form_field_price.html

@@ -0,0 +1,4 @@
+<bx_if:show_currency>
+    <span>__currency__</span>
+</bx_if:show_currency>
+__input__

+ 43 - 1
template/scripts/BxBaseFormView.php

@@ -1035,6 +1035,10 @@ BLAH;
             case 'password':
             	$sInput = $this->genInputPassword($aInput);
             	break;
+            
+            case 'price':
+            	$sInput = $this->genInputPrice($aInput);
+            	break;
 
             case 'file':
             	$sInput = $this->genInputFile($aInput);
@@ -1907,7 +1911,45 @@ BLAH;
     {
         return $this->oTemplate->parseHtmlByName('form_field_password.html', array('input' => $this->genInputStandard($aInput)));
     }
-    
+
+    function genInputPrice(&$aInput)
+    {
+        /*
+        if(!isset($aInput['attrs_wrapper']['class'])) {
+            if(!isset($aInput['attrs_wrapper'])) 
+                $aInput['attrs_wrapper'] = [];
+            $aInput['attrs_wrapper']['class'] = '';
+        }
+        $aInput['attrs_wrapper']['class'] .= 'bx-form-input-wrapper-text';
+
+        if(!isset($aInput['attrs']['class'])) {
+            if(!isset($aInput['attrs'])) 
+                $aInput['attrs'] = [];
+            $aInput['attrs']['class'] = '';
+        }
+        $aInput['attrs']['class'] .= 'bx-form-input-text';
+         */
+
+        $sCurrency = '';
+        if(!isset($aInput['value_currency'])) {
+            $sCurrency = BxDolPayments::getInstance()->getOption('default_currency_code');
+            if(empty($sCurrency))
+                $sCurrency = getParam('currency_code');
+        }
+        else
+            $sCurrency = $aInput['value_currency'];
+
+        return $this->oTemplate->parseHtmlByName('form_field_price.html', array(
+            'bx_if:show_currency' => [
+                'condition' => !empty($sCurrency),
+                'content' => [
+                    'currency' => $sCurrency,
+                ]
+            ],
+            'input' => $this->genInputStandard($aInput)
+        ));
+    }
+
     function genInputNestedForm(&$aInput)
     {
         return '';