From de693ae3ed8a584d4c198bf79694d3cbbc6aa3cf Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Tue, 27 Dec 2016 10:04:07 +0100 Subject: [PATCH 01/15] start of css changement --- adm/helpers/HelperFormBootstrap.php | 74 +-- adm/helpers/includes/css/custom.css | 14 +- .../privatesales/AdminPrivateSalesSales.php | 503 ++++++++++++------ 3 files changed, 395 insertions(+), 196 deletions(-) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index a437de51..4f5ed746 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -160,8 +160,11 @@ class HelperFormBootstrap{ } } - public static function generateInput($input) { - echo $this->addInput($input); + public function generateInput($input) { + $this->addInput($input); + $result = $this->_html; + $this->_html = ''; + return $result; } public function addJs($js){ @@ -315,7 +318,7 @@ class HelperFormBootstrap{ $this->_html .='
'.(isset($p['label']) && $p['label'] ?'':'').' -
+
'.(isset($p['before']) && $p['before'] ?'
'.$p['before'].'
':'').' '.(isset($p['after']) && $p['after'] ?'
'.$p['after'].'
':'').' @@ -326,7 +329,7 @@ class HelperFormBootstrap{
'.(isset($p['label-to']) && $p['label-to'] ?'':'').' -
+
'.(isset($p['before-to']) && $p['before-to'] ?'
'.$p['before-to'].'
':'').' '.(isset($p['after-to']) && $p['after-to'] ?'
'.$p['after-to'].'
':'').' @@ -348,9 +351,14 @@ class HelperFormBootstrap{ if ( (isset($opt['selected']) && $opt['selected']) || (isset($this->_object) && $this->_object->{$p['name']} == $opt['value']) - ) + ) { $selected = ' selected="selected"'; - $this->_html .= ''; + } + $disabled = ''; + if (isset($opt['disabled']) && $opt['disabled']) { + $disabled = ' disabled="disabled"'; + } + $this->_html .= ''; } $this->_html .='
@@ -403,18 +411,22 @@ class HelperFormBootstrap{ public function inputText($p = array()){ - if (isset($p['lang']) && $p['lang'] === true) + if (isset($p['lang']) && $p['lang'] === true) { return $this->inputTextL($p); + } + $default_value = (isset($p['default']) ? $p['default'] : ''); $disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : ''); - $this->_html .= ''.$p['label'].' -
- - ' . ((isset($p['required']) && $p['required']) ? ' *' : '') . ' - ' . ((isset($p['hint']) && $p['hint']) ? '

'.$p['hint'].'

' : '') . ' - ' . ((isset($p['help']) && $p['help']) ? '

'.$p['help'].'

' : '') . ' + + $this->_html .= ' +
+ +
+ + ' . ((isset($p['help']) && $p['help']) ? ''.$p['help'].'' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ' -
'; +
+
'; } public function inputTextL($p = array()){ @@ -436,6 +448,23 @@ class HelperFormBootstrap{
'; } + public function inputBool($p = array()) { + $checked = ((isset($p['default']) && $p['default']) ? $p['default'] : false); + $this->_html .= ' +
+ +
+ + +
+
+
'; + } + public function inputFile($p = array()){ $this->_html .= ''.$p['label'].'
@@ -491,23 +520,6 @@ class HelperFormBootstrap{
'; } - public function inputBool($p = array()){ - $checked = ((isset($p['default']) && $p['default']) ? $p['default'] : false); - if ($this->_object) - $checked = $this->_object->{$p['name']}; - $this->_html .= ''.$p['label'].' -
-
- ' . (isset($p['label_on']) && $p['label_on'] ? ' ' : '') . ' - ' . (isset($p['label_off']) && $p['label_off'] ? ' ' : '') . ' -
-
- ' . ((isset($p['hint']) && $p['hint']) ? '

'.$p['hint'].'

' : '') . ' - ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ' -
-
'; - } - public function inputCheckbox($p = array()){ $checked = ((isset($p['checked']) && $p['checked']) ? $p['checked'] : false); if ($this->_object) diff --git a/adm/helpers/includes/css/custom.css b/adm/helpers/includes/css/custom.css index fb286231..b3310361 100644 --- a/adm/helpers/includes/css/custom.css +++ b/adm/helpers/includes/css/custom.css @@ -80,7 +80,6 @@ form label{ /*background: rgba(86,84,133,1); color: #fff;*/ } - .panel { position: relative; width: 100%; @@ -123,6 +122,10 @@ form label{ .panel-title h2 small { margin-left: 10px; } +.panel_toolbox>li { + float: left; + cursor: pointer; +} .panel-content { padding: 0 5px; position: relative; @@ -237,6 +240,15 @@ textarea { border: 1px solid #ccc; } +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 5px; + color: #737373; + font-size: 11px; + font-style: italic; +} + /* table */ table.table-custombordered { border: 1px solid rgba(221,221,221,0.78); diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index f799a043..18052c11 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -1,5 +1,6 @@ + $helperForm = new HelperFormBootstrap(); + $helperForm->_select2 = true; + $helperForm->_inputMask = true; + + $helperForm->_js .=' - - -
-
- '.$this->l('Edit a sale').''; + '; + echo $helperForm->renderStyle(); + echo '
+
+

'.$this->l('Edit a sale').'

+
+
+
+ '; $categories = Db::getInstance()->ExecuteS(' SELECT c.`id_category`, l.`name`, l.`link_rewrite` @@ -220,106 +230,288 @@ class AdminPrivateSalesSales extends AdminTab { $used_categories[] = $cat['id_category']; } $categories_ordered = array(); - echo ' - -
- - * -

'.$this->l('Categories already affected to other sales are greyed.').'

-
- - '; + foreach($categories as $category) { + $categories_ordered[(string) $category['id_category']] = $category; + $id_category_options[(int)$category['id_category']] = array( + 'label' => $category['id_category'].' - '.$category['name'], + 'value' => (int) $category['id_category'] + ); + if($this->cursale!==NULL && $this->cursale->id_category==$category['id_category']) { + $id_category_options[(int)$category['id_category']]['selected'] = true; + } + if(in_array($category['id_category'], $used_categories)){ + $id_category_options[(int)$category['id_category']]['disabled'] = true; + } + } - echo ' -
-
- -

'.$this->l('This value is set by the name of the root category for this sale.').'

-
-
-
'; + $helperForm->_js .= ''; - echo ' -
-
- - * -
-
-
'; + echo '
'; + // select root category + $input = array( + 'type' => 'select2', + //'label' => $this->l('Root category'), + // 'label-class' => 'col-md-2', + // 'select-class' => 'col-md-8', + 'class-select' => '', + 'name' => 'id_category', + 'options' => $id_category_options, + ); + echo $helperForm->generateInput($input); + echo '
'; - echo ' -
-
- cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' - * -
-
-
'; + // title + $input = array( + 'type' => 'text', + 'label' => $this->l('Title'), + // 'label-class' => 'col-md-2', + // 'input-class' => 'col-md-8', + 'disabled' => true, + 'name' => 'title', + 'help' => $this->l('This value is set by the name of the root category for this sale.'), + 'default' => ($this->cursale!==NULL? $categories_ordered[$this->cursale->id_category]['name']: (in_array($categories[0]['id_category'], $used_categories)? '': $categories[0]['name'])), + ); + echo $helperForm->generateInput($input); + echo '
'; - echo ' -
-
- cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' - * -
-
-
'; + // Alias + $input = array( + 'type' => 'text', + 'label' => $this->l('Alias'), + // 'label-class' => 'col-md-2', + // 'input-class' => 'col-md-8', + 'disabled' => true, + 'name' => 'alias', + 'help' => $this->l('This value is set by the alias of the root category for this sale.'), + 'default' => ($this->cursale!==NULL? $categories_ordered[$this->cursale->id_category]['link_rewrite']: (in_array($categories[0]['id_category'], $used_categories)? '': $categories[0]['link_rewrite'])), + ); + echo $helperForm->generateInput($input); + echo '
'; + + // Date start + $input = array( + 'type' => 'simpleDate', + 'id' => 'date_start', + 'name' => 'date_start', + 'label' => $this->l('Start date'), + // 'label-class' => 'control-label col-md-2', + // 'input-class' => 'col-md-7', + 'after' => '', + 'value' => ($this->cursale!==NULL? $this->cursale->date_start: ''), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + // Date end + $input = array( + 'type' => 'simpleDate', + 'id' => 'date_end', + 'name' => 'date_end', + 'label' => $this->l('End date'), + // 'label-class' => 'control-label col-md-2', + // 'input-class' => 'col-md-7', + 'after' => '', + 'value' => ($this->cursale!==NULL? $this->cursale->date_end: ''), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + echo '
'; + + // Status + $input = array( + 'type' => 'bool', + 'name' => 'enabled', + 'label' => $this->l('Status:'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'logout', + 'label' => $this->l('Display:'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'pub', + 'label' => $this->l('Public sale:'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'braderie', + 'label' => $this->l('Braderie :'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'featured', + 'label' => $this->l('Featured sale:'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'new', + 'label' => $this->l('Nouveau :'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'forward_news', + 'label' => $this->l('Mise en avant Newsletter :'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + $input = array( + 'type' => 'bool', + 'name' => 'shipping_fr', + 'label' => $this->l('Livraison seulement en France :'), + 'label_on' => '', + 'label_off' => '', + 'label-class' => 'col-sm-5', + 'input-class' => 'col-sm-6', + 'default' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + // echo ' + //
+ //
+ // cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' + // * + //
+ //
+ //
'; + + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' + // * + //
+ //
+ //
'; - echo ' -
-
- cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - * -
-
-
'; + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' + // * + //
+ //
+ //
'; - echo ' -
-
- cursale!==NULL? ($this->cursale->braderie==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->braderie ==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - * -
-
-
'; + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->braderie==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->braderie ==1? ' checked="checked"': '').' /> '.$this->l('Yes').' + // * + //
+ //
+ //
'; - echo ' -
- -
-
'; + // echo ' + //
+ // + //
+ //
'; + + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' + // * + //
+ //
+ //
'; + + + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' + // * + //
+ //
+ //
'; + + echo '
'; echo '
@@ -333,27 +525,6 @@ class AdminPrivateSalesSales extends AdminTab {
'; - - echo ' -
-
- cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' - * -
-
-
'; - - - echo ' -
-
- cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' - * -
-
-
'; - - echo '
@@ -487,14 +658,14 @@ class AdminPrivateSalesSales extends AdminTab {
'; - echo ' -
-
- cursale!==NULL? ($this->cursale->shipping_fr==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->shipping_fr==1?' checked="checked"': '').' /> '.$this->l('Oui').' - * -
-
-
'; + // echo ' + //
+ //
+ // cursale!==NULL? ($this->cursale->shipping_fr==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->shipping_fr==1?' checked="checked"': '').' /> '.$this->l('Oui').' + // * + //
+ //
+ //
'; // } // echo ' @@ -561,8 +732,10 @@ class AdminPrivateSalesSales extends AdminTab { cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" />
'; - echo '
-
'; + echo ' +
+
'; + echo $helperForm->renderScript(); } public function display() { @@ -608,14 +781,6 @@ class AdminPrivateSalesSales extends AdminTab { $sale_shipping[$ss['id_sale']] = $ss['id_shipping']; } - //ANTADIS - echo '
'; - echo 'Tri des ventes'; - echo ''; - echo ''; - echo ''; - echo '
'; - ?> + //echo ' - '; + } } public function inputUploadImage($p = array()) { diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 2962695e..c1635451 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -259,7 +259,7 @@ class AdminPrivateSalesSales extends AdminTab { }); '; - echo '
'; + echo '
'; // select root category $input = array( 'type' => 'select2', @@ -330,7 +330,7 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - echo '
'; + echo '
'; // Status $input = array( @@ -339,106 +339,113 @@ class AdminPrivateSalesSales extends AdminTab { 'label' => $this->l('Status:'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Display $input = array( 'type' => 'bool', 'name' => 'logout', 'label' => $this->l('Display:'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Public $input = array( 'type' => 'bool', 'name' => 'pub', 'label' => $this->l('Public sale:'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Braderie $input = array( 'type' => 'bool', 'name' => 'braderie', 'label' => $this->l('Braderie :'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Featured $input = array( 'type' => 'bool', 'name' => 'featured', 'label' => $this->l('Featured sale:'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // New $input = array( 'type' => 'bool', 'name' => 'new', 'label' => $this->l('Nouveau :'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Newsletter $input = array( 'type' => 'bool', 'name' => 'forward_news', 'label' => $this->l('Mise en avant Newsletter :'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0), 'required' => true, ); echo $helperForm->generateInput($input); echo '
'; + // Shipping only fr $input = array( 'type' => 'bool', 'name' => 'shipping_fr', 'label' => $this->l('Livraison seulement en France :'), 'label_on' => '', 'label_off' => '', - 'label-class' => 'col-sm-5', - 'input-class' => 'col-sm-6', + 'label-class' => 'col-sm-8', + 'input-class' => 'col-sm-4', 'default' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0), 'required' => true, ); @@ -510,109 +517,282 @@ class AdminPrivateSalesSales extends AdminTab { //
//
'; - echo '
'; + echo '
+
'; - echo ' -
- - * -
-
'; + $id_employee_options = array(); + foreach(Employee::getEmployees() as $e) { + $id_employee_options[(int)$e['id_employee']] = array( + 'label' => $e['name'], + 'value' => (int) $e['id_employee'] + ); + if($this->cursale!==NULL && $this->cursale->id_employee==$e['id_employee']){ + $id_employee_options[(int)$e['id_employee']]['selected'] = true; + } + } + // Employee manager + $input = array( + 'type' => 'select2', + 'label' => $this->l('Sale manager:'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'id_employee', + 'options' => $id_employee_options, + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; - echo ' -
-
- - * -
-
-
'; + // echo ' + //
+ // + // * + //
+ //
'; - $groups = Db::getInstance()->ExecuteS(' + $id_delay_options = array( + array( + 'label' => $this->l('Livraison classique'), + 'value' => 1, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 1?true:false) + ), + array( + 'label' => $this->l('Livraison 48h'), + 'value' => 2, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 2?true:false) + ), + array( + 'label' => $this->l('Livraison 7 Jours'), + 'value' => 3, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 3?true:false) + ), + array( + 'label' => $this->l('Livraison 10 Jours'), + 'value' => 4, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 4?true:false) + ), + array( + 'label' => $this->l('Livraison Noel'), + 'value' => 5, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 5?true:false) + ), + array( + 'label' => $this->l('Produit Star'), + 'value' => 6, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 6?true:false) + ), + array( + 'label' => $this->l('Livraison 72h'), + 'value' => 7, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 7?true:false) + ), + array( + 'label' => $this->l('Livraison 48h Noel'), + 'value' => 8, + 'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 8?true:false) + ), + ); + // Delivery delay + $input = array( + 'type' => 'select2', + 'label' => $this->l('Délai de livraison :'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'delivery_delay', + 'options' => $id_delay_options, + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + // echo ' + //
+ //
+ // + // * + //
+ //
+ //
'; + + $id_group_options = array(); + foreach(Db::getInstance()->ExecuteS(' SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', ( SELECT IFNULL(g.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_group` g WHERE l.`id_group` = g.`id_group` AND g.`id_sale` = '.$this->cursale->id.' ) AS `id_sale`': '').' FROM `'._DB_PREFIX_.'group_lang` l WHERE l.`id_lang` = '.$cookie->id_lang + ) as $group) { + $id_group_options[(int)$group['id_group']] = array( + 'label' => $group['name'], + 'value' => (int) $group['id_group'] + ); + if(isset($group['id_sale']) && $group['id_sale'] !== NULL){ + $id_group_options[(int)$group['id_group']]['selected'] = true; + } + if(!isset($this->cursale->id) && $group['id_group'] == 1){ + $id_group_options[(int)$group['id_group']]['selected'] = true; + } + } + // Group + $input = array( + 'type' => 'select2', + 'label' => $this->l('Groups:'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'm_groups[]', + 'id' => 'm_groups', + 'option_all' => true, + 'option_clear' => true, + 'options' => $id_group_options, + 'multiple' => true, + 'placeholder' => $this->l('Select one or more groups...'), + 'required' => true, ); - echo ' -
-
- -
- -
-
'; + echo $helperForm->generateInput($input); + echo '
'; - $site_versions = array('fr', 'es'/*, 'it'*/); - echo ' -
-
- -
- -
-
'; + // echo ' + //
+ //
+ // + //
+ // + //
+ //
'; - $countries = Country::getCountries($cookie->id_lang, false); - echo ' -
-
- -
-
-
'; + $id_version_options = array( + array( + 'label'=> 'fr', + 'value'=>'fr', + 'selected'=>false, + ), + array( + 'label'=>'es', + 'value'=>'es', + 'selected'=>false, + ), + ); + foreach($id_version_options as $version) { + if(isset($this->cursale->id) && in_array($version, $this->cursale->versions)){ + $version['selected'] = true; + } + if(!isset($this->cursale->id) && $version == 'fr') { + $version['selected'] = true; + } + } + // Version + $input = array( + 'type' => 'select2', + 'label' => $this->l('Versions :'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'm_versions[]', + 'id' => 'm_versions', + 'option_all' => true, + 'option_clear' => true, + 'options' => $id_version_options, + 'multiple' => true, + 'placeholder' => $this->l('Select one or more versions...'), + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + // $site_versions = array('fr', 'es'/*, 'it'*/); + // echo ' + //
+ //
+ // + //
+ // + //
+ //
'; + + $id_country_options = array(); + $id_country_options[0] = array( + 'label' => 'Choisir...', + 'value' => (int) 0 + ); + foreach (Country::getCountries($cookie->id_lang, false) as $country) { + $id_country_options[(int)$country['id_country']] = array( + 'label' => $country['name'], + 'value' => (int) $country['id_country'] + ); + if($this->cursale!==NULL && $this->cursale->id_country==$country['id_country']){ + $id_country_options[(int)$country['id_country']]['selected'] = true; + } + } + // country + $input = array( + 'type' => 'select2', + 'label' => $this->l('Pays de la Vente :'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'id_country', + 'options' => $id_country_options, + 'required' => true, + ); + echo $helperForm->generateInput($input); + echo '
'; + + // $countries = Country::getCountries($cookie->id_lang, false); + // echo ' + //
+ //
+ // + //
+ //
+ //
'; // if(Configuration::get('PRIVATESALES_CARRIERFENCE')) { $carriers = Db::getInstance()->ExecuteS(' From 795aca43a7c46677d4b4b6b9470e742701dccf42 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Wed, 28 Dec 2016 17:16:50 +0100 Subject: [PATCH 04/15] continuing --- adm/helpers/HelperFormBootstrap.php | 100 ++++++-- js/admin.js | 3 + .../privatesales/AdminPrivateSalesSales.php | 222 ++++++++++++------ 3 files changed, 235 insertions(+), 90 deletions(-) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 0155c564..90b9740a 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -212,6 +212,9 @@ class HelperFormBootstrap{ $this->inputSwitch($input); break; case 'textarea': + $this->inputTextarea($input); + break; + case 'rte': $this->inputRte($input); break; case 'file': @@ -368,7 +371,13 @@ class HelperFormBootstrap{ $this->_html .='
'.((isset($p['option_all']) && $p['option_all'])?'':'').' - '.((isset($p['option_clear']) && $p['option_clear'])?'':'').' + '.((isset($p['option_clear']) && $p['option_clear'])?'':''); + if(isset($p['buttons']) && is_array($p['buttons'])){ + foreach ($p['buttons'] as $button) { + $this->_html .=''; + } + } + $this->_html .='
'; } @@ -384,8 +393,14 @@ class HelperFormBootstrap{ allowClear: true }); '.((isset($p['option_all']) && $p['option_all'])?'$(".select_all_for_'.(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(["'.(implode('","',$all_opt)).'"]).trigger("change"); });':'').' - '.((isset($p['option_clear']) && $p['option_clear'])?'$(".clear_for_'.(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(null).trigger("change"); });':'').' - }); + '.((isset($p['option_clear']) && $p['option_clear'])?'$(".clear_for_'.(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(null).trigger("change"); });':''); + if(isset($p['buttons']) && is_array($p['buttons'])){ + foreach ($p['buttons'] as $button) { + $this->_html .='$(".'.$button['class'].(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(['.$button['value'].']).trigger("change"); });'; + } + } + $this->_html .=' + }); '; } else { $this->_html .=' -
-
'; + $id_carrier_options = array(); + foreach ($carriers as $carrier) { + $id_carrier_options[$carrier['id_carrier']] = array( + 'label' => $carrier['name'], + 'value' => $carrier['id_carrier'] + ); + if(Tools::getIsset('edit') && (isset($carrier['id_sale']) && $carrier['id_sale'] !== NULL)) { + $id_carrier_options[$carrier['id_carrier']]['selected'] = true; + } elseif (!Tools::getIsset('edit') && in_array($carrier['id_carrier'], $carriers_default)) { + $id_carrier_options[$carrier['id_carrier']]['selected'] = true; + } + } + // Carriers + $input = array( + 'type' => 'select2', + 'label' => $this->l('Carriers :'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'm_carriers[]', + 'id' => 'm_carriers', + 'option_all' => true, + 'option_clear' => true, + 'options' => $id_carrier_options, + 'multiple' => true, + 'placeholder' => $this->l('Select one or more carriers...'), + 'required' => true, + 'buttons' => array( + array( + 'label' => 'Default', + 'value' => '"'.implode('","',$carriers_default).'"', + 'class' => 'defaut_for_', + ), + ), + ); + echo $helperForm->generateInput($input); + echo '
'; + + // echo ' + //
+ //
+ // + //
+ // + //
+ //
'; // echo ' //
@@ -856,59 +894,97 @@ class AdminPrivateSalesSales extends AdminTab { //
//
'; - echo ' -
'; - foreach($this->_languages as $language) { - echo '
- -
'; - } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); - echo '
-
'; + // Description + $input = array( + 'type' => 'textarea', + 'label' => $this->l('Description:'), + 'lang' => true, + 'name' => 'description', + 'id' => 'description', + 'required' => true, + 'languages' => $this->_languages, + 'id_langs' => $divLangName, + 'link_flag_img' => '../img/l/', + 'default' => ($this->cursale !== NULL?$this->cursale->description:'') + ); + echo $helperForm->generateInput($input); + echo '
'; - echo ' -
'; - foreach($this->_languages as $language) { - echo '
- cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; - echo '
'; - } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); - echo '
-

'.$this->l('Youtube full URL').'

-
'; + // echo ' + //
'; + // foreach($this->_languages as $language) { + // echo '
+ // + //
'; + // } + // $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); + // echo '
+ //
'; + + // Video + $input = array( + 'type' => 'text', + 'label' => $this->l('Video:'), + 'lang' => true, + 'name' => 'video', + 'id' => 'video', + 'required' => true, + 'languages' => $this->_languages, + 'id_langs' => $divLangName, + 'link_flag_img' => '../img/l/', + 'default' => ($this->cursale !== NULL?$this->cursale->video:'') + ); + echo $helperForm->generateInput($input); + echo '
'; + + // echo ' + //
'; + // foreach($this->_languages as $language) { + // echo '
+ // cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; + // echo '
'; + // } + // $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); + // echo '
+ //

'.$this->l('Youtube full URL').'

+ //
'; + Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); + + echo '
+
+

Images

'; foreach($this->imagelist as $k => $v) { echo ' -
'; +
'; foreach($this->_languages as $language) { echo '
-

'.$this->l('Size:').' '.$v[1].'

'; +

'.$this->l('Size:').' '.$v[1].'

'; if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) { echo '

'.$this->l('Preview').'

'; } echo '
'; } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); + $helperForm->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); echo '
'; } - Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); - echo '
-
+ echo '
+
+
+
- cursale !== NULL ? 'disabled=disabled': '').' name="submitSaleAdd" value="'.$this->l('Add this sale').'" /> - cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" /> + cursale !== NULL ? 'disabled=disabled': '').' name="submitSaleAdd" value="'.$this->l('Add this sale').'" /> + cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" />
'; echo ' From 13e343c6ffcf7ca77a13fc8944fb7e9d5bb8f779 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 29 Dec 2016 15:29:23 +0100 Subject: [PATCH 05/15] continuing changement css --- adm/helpers/HelperFormBootstrap.php | 81 +++++++++--- adm/helpers/includes/css/custom.css | 30 ++++- adm/helpers/includes/js/custom.js | 16 ++- js/admin.js | 3 - .../privatesales/AdminPrivateSalesSales.php | 120 +++++++++++------- .../privatesales_extrafields.php | 29 +++-- .../privatesales_shipping.php | 13 +- .../privatesales_tags/privatesales_tags.php | 9 +- 8 files changed, 206 insertions(+), 95 deletions(-) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 90b9740a..40544d0a 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -315,23 +315,23 @@ class HelperFormBootstrap{ } public function inputSimpleDate($p = array()) { - if($p['period']) { + if(isset($p['period']) && $p['period']) { $this->_html .='
'; } $this->_html .='
- '.(isset($p['label']) && $p['label'] ?'':'').' + '.(isset($p['label']) && $p['label'] ?'':'').'
'.(isset($p['before']) && $p['before'] ?'
'.$p['before'].'
':'').' '.(isset($p['after']) && $p['after'] ?'
'.$p['after'].'
':'').'
'; - if($p['period']) { + if(isset($p['period']) && $p['period']) { $this->_html .='
- '.(isset($p['label-to']) && $p['label-to'] ?'':'').' + '.(isset($p['label-to']) && $p['label-to'] ?'':'').'
'.(isset($p['before-to']) && $p['before-to'] ?'
'.$p['before-to'].'
':'').' @@ -415,6 +415,9 @@ class HelperFormBootstrap{ } public function inputUploadImage($p = array()) { + if(isset($p['lang']) && $p['lang']) { + return $this->inputUploadImageL($p); + } $this->_html .='
'.(isset($p['label'])?'':'').' @@ -433,6 +436,44 @@ class HelperFormBootstrap{
+ '.(isset($p['help'])?'

'.$p['help'].'

':'').' +
'; + } + + public function inputUploadImageL($p = array()) { + $defaultLanguage = (isset($p['default_language']) && $p['default_language'])? $p['default_language'] : 2; + $this->_html .=' +
+ '; + //$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img'],'table'); + //$this->_html .= ' + foreach ($p['languages'] as $language) { + $this->_html .=' +
+
+ + + +
+ + Ouvrir + +
+
+
'; + if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) { + $this->_html .='

Image '.$language['iso_code'].'

'; + } + $this->_html .='
'; + } + $this->_html .= '
+ '.((isset($p['help']) && $p['help']) ? ''.$p['help'].'' : '').'
'; } @@ -443,7 +484,7 @@ class HelperFormBootstrap{
@@ -475,7 +516,11 @@ class HelperFormBootstrap{ $defaultLanguage = $p['default_language'] ? $p['default_language'] : 2; $this->_html .= '
- +
'; foreach ($p['languages'] as $language) { $default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value; @@ -484,7 +529,6 @@ class HelperFormBootstrap{
'; } - $this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']); $this->_html .= '
'.((isset($p['help']) && $p['help']) ? ''.$p['help'].'' : '').'
@@ -502,7 +546,11 @@ class HelperFormBootstrap{ $defaultLanguage = $p['default_language'] ? $p['default_language'] : 2; $this->_html .= '
- +
'; foreach ($p['languages'] as $language) { $default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value; @@ -511,7 +559,6 @@ class HelperFormBootstrap{
'; } - $this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']); $this->_html .= '
'; @@ -523,10 +570,10 @@ class HelperFormBootstrap{
-
'; } - public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/") + public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/", $display ='block') { if (sizeof($languages) == 1) return false; - $output = ' + $output = '
-
+
Choose language:
'; foreach ($languages as $language) { if($use_vars_instead_of_ids) - $output .= ''.$language['name'].' '; + $output .= ''.$language['name'].' '; else - $output .= ''.$language['name'].' '; + $output .= ''.$language['name'].' '; } - $output .= '
'; + $output .= '
'; if ($return) return $output; diff --git a/adm/helpers/includes/css/custom.css b/adm/helpers/includes/css/custom.css index b3310361..58feccd9 100644 --- a/adm/helpers/includes/css/custom.css +++ b/adm/helpers/includes/css/custom.css @@ -174,6 +174,17 @@ div.tagsinput span.tag a { color: #fff; } +.select2-container--default .select2-selection--multiple .select2-selection__choice{ + border: 1px solid #504d8b; + background: #796dc7; + color: #fff; + padding: 3px; + border-radius: 2px; +} +.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{ + color: #fff; +} + #content .alert { width: 100%; margin: 0; @@ -193,8 +204,8 @@ div.tagsinput span.tag a { border-color: #d6e9c6; } -/* form */ -.form-control { +/* form img */ +.form-control.image-preview-filename { height: 28px; line-height: 28px; } @@ -224,6 +235,8 @@ div.tagsinput span.tag a { .image-preview-input-title { margin-left:2px; } + +/* switch */ .checkbox.input-switch label, .radio.input-switch label { padding-left: 0px; width: auto; @@ -266,4 +279,17 @@ table.table tr th { .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #504d8b; color: white; +} + +/* Language choice box */ +.flags_custom{ + float: left; + position: relative; +} +.language_flags.language_flags_custom{ + position: absolute; + z-index: 999; + margin: 0; + width: 120px; + right: 0; } \ No newline at end of file diff --git a/adm/helpers/includes/js/custom.js b/adm/helpers/includes/js/custom.js index 38cf6ce9..04750720 100644 --- a/adm/helpers/includes/js/custom.js +++ b/adm/helpers/includes/js/custom.js @@ -1,4 +1,3 @@ - $(document).on('click', '#close-preview', function(){ $('.image-preview').popover('hide'); $('.image-preview').hover( @@ -60,4 +59,17 @@ $(function() { elems.forEach(function(html) { var switchery = new Switchery(html, { size: 'small', color: '#504d8b' }); }); -}); \ No newline at end of file +}); + +function changeLang(field, fieldsString, id_language_new, iso_code, display) +{ + var fields = fieldsString.split('¤'); + for (var i = 0; i < fields.length; ++i) + { + getE(fields[i] + '_' + id_language).style.display = 'none'; + getE(fields[i] + '_' + id_language_new).style.display = display; + getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg'; + } + getE('languages_' + field).style.display = 'none'; + id_language = id_language_new; +} \ No newline at end of file diff --git a/js/admin.js b/js/admin.js index dba1aac3..f05aace3 100755 --- a/js/admin.js +++ b/js/admin.js @@ -176,12 +176,9 @@ function toggleLanguageFlags(elt) // Kept for retrocompatibility only (out of AdminProducts & AdminCategories) function changeLanguage(field, fieldsString, id_language_new, iso_code) { - console.log(field); - console.log(fieldsString); var fields = fieldsString.split('¤'); for (var i = 0; i < fields.length; ++i) { - console.log(fields[i] + '_' + id_language); getE(fields[i] + '_' + id_language).style.display = 'none'; getE(fields[i] + '_' + id_language_new).style.display = 'block'; getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg'; diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index dd345f5b..62ef33b8 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -29,11 +29,13 @@ class AdminPrivateSalesSales extends AdminTab { foreach(array_keys($this->imagelist) as $img) { $images[] = 'img_'.$img; } - $divLangName = 'description¤video¤'.implode('¤', $images); + $divLangName = 'description¤video'; + $divLangImgName = implode('¤', $images); $helperForm = new HelperFormBootstrap(); $helperForm->_select2 = true; $helperForm->_inputMask = true; + $helperForm->_inputSwitch = true; $helperForm->_js .='
-
'; +
+
'; } } From 966dee6a6e0c94364f0d9368d3e0f697d0a3f8b9 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 2 Jan 2017 15:49:14 +0100 Subject: [PATCH 06/15] fix switch and css table of sales --- adm/ajax_vp.php | 59 ++- adm/helpers/HelperFormBootstrap.php | 2 +- .../privatesales/AdminPrivateSalesSales.php | 393 +++--------------- 3 files changed, 112 insertions(+), 342 deletions(-) diff --git a/adm/ajax_vp.php b/adm/ajax_vp.php index ce054392..897a58d0 100644 --- a/adm/ajax_vp.php +++ b/adm/ajax_vp.php @@ -10,6 +10,7 @@ require_once('../modules/privatesales_extrafields/privatesales_extrafields.php') if (isset($_GET['getSales'])){ + global $cookie; $type = $_GET['type']; if($type == 'finished'){ $sales = Sale::getSales(NULL, NULL, NULL, FALSE , FALSE, FALSE, '`position` DESC', NULL, NULL, FALSE, FALSE); @@ -43,7 +44,7 @@ if (isset($_GET['getSales'])){ FR ES Position - Actions + Actions "; @@ -55,7 +56,7 @@ if (isset($_GET['getSales'])){ '.$sale->title[intval($cookie->id_lang)].'
'.$extrafields[$sale->id][1].' '.$sale->date_start.' '.$sale->date_end.' - '.($sale->enabled? '':'').''; + '.($sale->enabled? '':'').''; if($sale->new == 0){ echo "Non"; @@ -68,29 +69,61 @@ if (isset($_GET['getSales'])){ } echo ''.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').' - versions) ? 'class="green"' : 'class="red"').'>FR - versions) ? 'class="green"' : 'class="red"').'>ES - '; + FR + ES + '; if($key != 0){ echo 'Haut'; } if($key + 1 != count($sales)){ - echo 'Bas'; + echo ' Bas'; } $category_link = Link::getCategoryLink($sale->id_category); - + $category_link_bo = '?tab=AdminCatalog&viewcategory&id_category='.$sale->id_category.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)); echo ' - '.($export? '': '').' - - - - - +
+ + + + + + + +
'; + // '.($export? '': '').' + // + // + // + // + // } echo ""; die(); diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 40544d0a..392fa41e 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -484,7 +484,7 @@ class HelperFormBootstrap{
diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 62ef33b8..0a37e9ec 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -136,71 +136,28 @@ class AdminPrivateSalesSales extends AdminTab { } .green { background : #dffad3; + color: #88AF4D!important; + font-weight:bold; } .red { background : #f29b9b; } - fieldset.bg-grey{ + .rose { + background : #e36ea2; + color: rgba(255, 255, 255,0.7)!important; + } + .table tr:nth-child(even) { background: #F1F1F1; - border: 1px solid #565485; } - fieldset.bg-grey legend{ - background: rgba(86,84,133,0.9); - border: 1px solid #565485; - color: #fff; - font-weight: 300; + .table>tbody>tr>td{ + color:#504d8b; + vertical-align:middle; + font-size:0.9em; + padding: 0 6px 0 4px; } - table { - background: #fff; - padding: 20px; - -moz-box-shadow: 2px 2px 5px #cccccc; - -webkit-box-shadow: 2px 2px 5px #CCC; - -ms-box-shadow: 2px 2px 5px #cccccc; - -o-box-shadow: 2px 2px 5px #cccccc; - box-shadow: 2px 2px 5px #CCC; - border-collapse: collapse; - border-spacing: 0; - } - .table { - border: 1px solid #565485; - } - .table tr th{ - background: rgba(86,84,133,0.9); - color: #fff; - font-weight: 300; - } - .table tr td { - border-bottom: 1px solid #DEDEDE; - color: #000; - padding: 0 4px 0 6px; - } - .table tr td:nth-child(6), - .table tr td:nth-child(7), - .table tr td:nth-child(11), - .table tr td:nth-child(12){ - text-align:center; - } - .table tr:nth-child(odd){ - background : #F3F3F3; - } - .button.purple { - background-color: rgba(86,84,133,0.7); - border: 1px solid #565485; - border-left: 1px solid rgba(86,84,133,0.6); - border-top: 1px solid rgba(86,84,133,0.6); - color: rgba(255,255,255,0.9); - padding: 3px; - } - .button.purple:hover { - background-color: #565485; - border: 1px solid rgba(86,84,133,0.6); - border-left: 1px solid #565485; - border-top: 1px solid #565485; - color: #fff; - padding: 3px; - } - .button.purple:focus{ - background-color: rgba(86,84,133,1.6); + .table .input-group-btn .btn{ + padding: 4px 5px; + color: #504d8b; } '; echo $helperForm->renderStyle(); @@ -459,74 +416,9 @@ class AdminPrivateSalesSales extends AdminTab { 'required' => true, ); echo $helperForm->generateInput($input); - echo '
'; - - // echo ' - //
- //
- // cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' - // * - //
- //
- //
'; - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' - // * - //
- //
- //
'; - - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - // * - //
- //
- //
'; - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->braderie==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->braderie ==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - // * - //
- //
- //
'; - - // echo ' - //
- // - //
- //
'; - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' - // * - //
- //
- //
'; - - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' - // * - //
- //
- //
'; - - echo '
+ echo '
+ +
'; $id_employee_options = array(); @@ -552,18 +444,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
- // - // * - //
- //
'; - $id_delay_options = array( array( 'label' => $this->l('Livraison classique'), @@ -619,24 +499,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
- //
- // - // * - //
- //
- //
'; - $id_group_options = array(); foreach(Db::getInstance()->ExecuteS(' SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', ( @@ -674,31 +536,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
- //
- // - //
- // - //
- //
'; - $id_version_options = array( array( 'label'=> 'fr', @@ -736,31 +573,6 @@ class AdminPrivateSalesSales extends AdminTab { ); echo $helperForm->generateInput($input); echo '
'; - // $site_versions = array('fr', 'es'/*, 'it'*/); - // echo ' - //
- //
- // - //
- // - //
- //
'; $id_country_options = array(); $id_country_options[0] = array( @@ -789,20 +601,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // $countries = Country::getCountries($cookie->id_lang, false); - // echo ' - //
- //
- // - //
- //
- //
'; - // if(Configuration::get('PRIVATESALES_CARRIERFENCE')) { $carriers = Db::getInstance()->ExecuteS(' SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', ( @@ -853,56 +651,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
- //
- // - //
- // - //
- //
'; - - // echo ' - //
- //
- // cursale!==NULL? ($this->cursale->shipping_fr==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->shipping_fr==1?' checked="checked"': '').' /> '.$this->l('Oui').' - // * - //
- //
- //
'; - // } - - // echo ' - //
- //
- // '.$this->l('SALETYPE1').' cursale->sale_type) && in_array(1,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="1"> - // '.$this->l('SALETYPE2').' cursale->sale_type) && in_array(2,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="2"> - // '.$this->l('SALETYPE3').' cursale->sale_type) && in_array(3,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="3"> - //
- //
'; - // Description $input = array( 'type' => 'textarea', @@ -919,23 +667,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - - // echo ' - //
'; - // foreach($this->_languages as $language) { - // echo '
- // - //
'; - // } - // $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); - // echo '
- //
'; - // Video $input = array( 'type' => 'text', @@ -952,17 +683,6 @@ class AdminPrivateSalesSales extends AdminTab { echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
'; - // foreach($this->_languages as $language) { - // echo '
- // cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; - // echo '
'; - // } - // $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); - // echo '
- //

'.$this->l('Youtube full URL').'

- //
'; Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); echo '
@@ -986,21 +706,6 @@ class AdminPrivateSalesSales extends AdminTab { ); echo $helperForm->generateInput($input); echo '
'; - // echo ' - //
'; - // foreach($this->_languages as $language) { - // echo '
- // - //

'.$this->l('Size:').' '.$v[1].'

'; - // if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) { - // echo '

'.$this->l('Preview').'

'; - // } - // echo ' - //
'; - // } - // $helperForm->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); - // echo '
- //
'; } echo '
@@ -1184,7 +889,7 @@ class AdminPrivateSalesSales extends AdminTab {
- +
@@ -1200,7 +905,7 @@ class AdminPrivateSalesSales extends AdminTab { - + '; echo ' '; @@ -1219,7 +924,7 @@ class AdminPrivateSalesSales extends AdminTab { - + '; if($sale->new == 0){ @@ -1233,32 +938,66 @@ class AdminPrivateSalesSales extends AdminTab { } echo ' - - + + - '; + // '.($export? '': '').' + // + // + // + // + // } echo ' @@ -1289,8 +1028,6 @@ class AdminPrivateSalesSales extends AdminTab { public function postProcess() { global $cookie, $currentIndex; - //echo '
';var_dump($_POST);echo '
';die(); - if(Tools::isSubmit('submitSaleAdd')) { if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) { return false; From 23116193edc4475add8041e3fa935e96393212d8 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 2 Jan 2017 16:44:29 +0100 Subject: [PATCH 07/15] fix groups selected and css changements for tags --- .../privatesales/AdminPrivateSalesSales.php | 22 ++++++------ .../privatesales_tags/privatesales_tags.php | 34 ++++++++++++------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 0a37e9ec..d22ebadd 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -135,16 +135,16 @@ class AdminPrivateSalesSales extends AdminTab { color: #ffffff; } .green { - background : #dffad3; - color: #88AF4D!important; + background : #C0E3B5; + color: #55b239!important; font-weight:bold; } .red { background : #f29b9b; } .rose { - background : #e36ea2; - color: rgba(255, 255, 255,0.7)!important; + background : rgba(226,110,162,0.2); + color: #e36ea2!important; } .table tr:nth-child(even) { background: #F1F1F1; @@ -172,7 +172,9 @@ class AdminPrivateSalesSales extends AdminTab { $categories = Db::getInstance()->ExecuteS(' SELECT c.`id_category`, l.`name`, l.`link_rewrite` FROM `'._DB_PREFIX_.'category` c, `'._DB_PREFIX_.'category_lang` l - WHERE c.`id_category` = l.`id_category` AND l.`id_lang` = '.intval($cookie->id_lang).' AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' + WHERE c.`id_category` = l.`id_category` + AND l.`id_lang` = '.intval($cookie->id_lang).' + AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' ORDER BY c.`id_category` '); @@ -548,11 +550,11 @@ class AdminPrivateSalesSales extends AdminTab { 'selected'=>false, ), ); - foreach($id_version_options as $version) { - if(isset($this->cursale->id) && in_array($version, $this->cursale->versions)){ + foreach($id_version_options as &$version) { + if(isset($this->cursale->id) && in_array($version['value'], $this->cursale->versions)){ $version['selected'] = true; } - if(!isset($this->cursale->id) && $version == 'fr') { + if(!isset($this->cursale->id) && $version['value'] == 'fr') { $version['selected'] = true; } } @@ -941,9 +943,9 @@ class AdminPrivateSalesSales extends AdminTab { - + - +
'.$this->l('ID').''.$this->l('Shipping').' '.$this->l('News').' '.$this->l('Position').''.$this->l('Actions').''.$this->l('Actions').'
'.$sale->title[intval($cookie->id_lang)].'
'.$extrafields[$sale->id][1].'
'.$sale->date_start.' '.$sale->date_end.''.($sale->enabled?'':'').''.($sale->enabled?'':'').''.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'versions) ? 'class="green"' : 'class="red"').'>FRversions) ? 'class="green"' : 'class="red"').'>ESFRES '.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').' '. $sale->forward_news .''; + '; if($key != 0){ echo 'Haut'; } if($key + 1 != count($sales)){ - echo 'Bas'; + echo ' Bas'; } $category_link = Link::getCategoryLink($sale->id_category); + $category_link_bo = '?tab=AdminCatalog&viewcategory&id_category='.$sale->id_category.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)); echo ' - '.($export? '': '').' - - - - - +
+ + + + + + + +
+
FR ES'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').''.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').''. $sale->forward_news .''. $sale->forward_news .' '; if($key != 0){ diff --git a/modules/privatesales_tags/privatesales_tags.php b/modules/privatesales_tags/privatesales_tags.php index 49170aac..2cd83ca3 100755 --- a/modules/privatesales_tags/privatesales_tags.php +++ b/modules/privatesales_tags/privatesales_tags.php @@ -186,30 +186,40 @@ class PrivateSales_Tags extends Module { } else { echo '
-
-
- '; + $all_opt = array(); foreach($tags as $tag) { + $all_opt[] = $tag['id_tag']; echo ''; } echo '
+
+ + +
-
-
'; + '; + // $(document).ready(function() { + // $("#m_tag").multiSelect({ + // selectAllText: "'.$this->l('Select all').'", + // noneSelected: " ", + // oneOrMoreSelected: "*" + // }); } } From ea735e85198a5ff5c4e549acd68c17b276bb63a7 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 2 Jan 2017 16:49:48 +0100 Subject: [PATCH 08/15] css changement --- adm/helpers/includes/css/custom.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adm/helpers/includes/css/custom.css b/adm/helpers/includes/css/custom.css index 58feccd9..237c4bf5 100644 --- a/adm/helpers/includes/css/custom.css +++ b/adm/helpers/includes/css/custom.css @@ -280,6 +280,10 @@ table.table tr th { background-color: #504d8b; color: white; } +.select2-container--default .select2-selection--multiple .select2-selection__choice{ + margin-top: 2px; + margin-bottom: 2px; +} /* Language choice box */ .flags_custom{ From 7b6239eee4dea1bf70d0c7d0301bc8b95378aa8e Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 2 Jan 2017 17:07:35 +0100 Subject: [PATCH 09/15] changement css for btn-group --- modules/privatesales/AdminPrivateSalesSales.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index d22ebadd..43ad5b73 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -883,11 +883,13 @@ class AdminPrivateSalesSales extends AdminTab {

'.$this->l('Sales list').'

- +
From 49bc6e77f51bb9e8abd737aaf3df83c3bd113705 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 2 Jan 2017 17:13:46 +0100 Subject: [PATCH 10/15] addition of carrier s options --- modules/privatesales/AdminPrivateSalesSales.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 43ad5b73..d8f08fd6 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -613,9 +613,12 @@ class AdminPrivateSalesSales extends AdminTab { '); $carriers_default = array(22, 87, 88, 89); // prod - $carriers_default = array(22, 39, 40, 45); // local + $carriers_default = array(22, 38, 40, 45); // local // $carriers_default = array(22, 46, 47, 48); // dev + $carriers_dom = array(38); // local + $carriers_drop = array(22); // local + $id_carrier_options = array(); foreach ($carriers as $carrier) { $id_carrier_options[$carrier['id_carrier']] = array( @@ -644,10 +647,20 @@ class AdminPrivateSalesSales extends AdminTab { 'required' => true, 'buttons' => array( array( - 'label' => 'Default', + 'label' => 'Classic', 'value' => '"'.implode('","',$carriers_default).'"', 'class' => 'defaut_for_', ), + array( + 'label' => 'Dom', + 'value' => '"'.implode('","',$carriers_dom).'"', + 'class' => 'dom_for_', + ), + array( + 'label' => 'Dropshipping', + 'value' => '"'.implode('","',$carriers_drop).'"', + 'class' => 'drop_for_', + ), ), ); echo $helperForm->generateInput($input); From b0f23e0479d5b1c5f0606f3e3fbb1ce1bbef2029 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Tue, 3 Jan 2017 12:39:13 +0100 Subject: [PATCH 11/15] fix upload image thumbnail --- adm/helpers/HelperFormBootstrap.php | 116 +++++++++++++++++- adm/helpers/includes/js/custom.js | 56 +-------- .../privatesales/AdminPrivateSalesSales.php | 1 + 3 files changed, 115 insertions(+), 58 deletions(-) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 392fa41e..329297e7 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -422,7 +422,7 @@ class HelperFormBootstrap{
'.(isset($p['label'])?'':'').'
-
+
'.(isset($p['help'])?'

'.$p['help'].'

':'').'
'; + + $this->_js .= ' + '; } public function inputUploadImageL($p = array()) { @@ -451,10 +499,14 @@ class HelperFormBootstrap{ '; //$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img'],'table'); //$this->_html .= ' + $this->_js .= ' + '; } public function inputSwitch($p = array()) { diff --git a/adm/helpers/includes/js/custom.js b/adm/helpers/includes/js/custom.js index 04750720..1ef578e3 100644 --- a/adm/helpers/includes/js/custom.js +++ b/adm/helpers/includes/js/custom.js @@ -1,61 +1,7 @@ -$(document).on('click', '#close-preview', function(){ - $('.image-preview').popover('hide'); - $('.image-preview').hover( - function () { - $('.image-preview').popover('show'); - }, - function () { - $('.image-preview').popover('hide'); - } - ); -}); - $(function() { - var closebtn = $(' -
-
-
- -
-
-
- -
+ $helperForm = new HelperFormBootstrap(); + $helperForm->_select2 = true; + + $id_sale_options = array(); + foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) { + $id_sale_options[(int)$sale->id] = array( + 'label' => $sale->id.' - '.$sale->title[(int) $cookie->id_lang], + 'value' => (int) $sale->id + ); + if($sale->id == $current_sale) { + $id_sale_options[(int)$sale->id]['selected'] = true; + } + } + + $this->_html .= $helperForm->renderStyle(); + + $this->_html .= '
+
+

'.$this->l('Génération EAN').'

+
- -

'; +
+
'; + $input = array( + 'type' => 'select2', + 'label' => $this->l('Select a sale:'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'id_sale', + 'id' => 'id_sale', + 'options' => $id_sale_options, + ); + $this->_html .= $helperForm->generateInput($input).' +
+
+
+
+
+ + + + +
+
'; - /*$this->_html .='
- '.$this->l('Rack barcode').' -
- -
-
-

';*/ - - - $this->_html.= ''; - $this->_html.= ''; - $this->_html.= ''; - $this->_html.= ''; + $this->_html .= $helperForm->renderScript(); echo $this->_html; } } From 8269787360072134859631e6b01239e135245519 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Wed, 4 Jan 2017 12:42:41 +0100 Subject: [PATCH 13/15] fix upload img js --- adm/helpers/HelperFormBootstrap.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 329297e7..841f0488 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -442,6 +442,18 @@ class HelperFormBootstrap{ $this->_js .= ' '; + $helperForm->_css .='