if($order->payment_auto && Producer::getConfig('credit', $order->distribution->id_producer)) { | if($order->payment_auto && Producer::getConfig('credit', $order->distribution->id_producer)) { | ||||
if ($order->getAmount(Order::AMOUNT_REMAINING) > 0) { | if ($order->getAmount(Order::AMOUNT_REMAINING) > 0) { | ||||
$order->creditHistory( | |||||
$order->saveCreditHistory( | |||||
CreditHistory::TYPE_PAYMENT, | CreditHistory::TYPE_PAYMENT, | ||||
$order->getAmount(Order::AMOUNT_REMAINING), | $order->getAmount(Order::AMOUNT_REMAINING), | ||||
$order->distribution->id_producer, | $order->distribution->id_producer, |
if (isset($options['attribute_id_producer']) && strlen($options['attribute_id_producer']) | if (isset($options['attribute_id_producer']) && strlen($options['attribute_id_producer']) | ||||
&& !isset($params[$options['attribute_id_producer']]) && !Yii::$app->user->isGuest) | && !isset($params[$options['attribute_id_producer']]) && !Yii::$app->user->isGuest) | ||||
{ | { | ||||
$params[$options['attribute_id_producer']] = Producer::getId(); | |||||
if(Yii::$app->controller->module->id == 'app-producer') { | |||||
$params[$options['attribute_id_producer']] = Yii::$app->controller->getProducer()->id ; | |||||
} | |||||
else { | |||||
$params[$options['attribute_id_producer']] = Producer::getId() ; | |||||
} | |||||
} | } | ||||
if(!isset($options['type_search'])) { | if(!isset($options['type_search'])) { |
public function rules() | public function rules() | ||||
{ | { | ||||
return [ | return [ | ||||
[['montant'], 'required'], | |||||
[['amount'], 'required'], | |||||
[['id_user', 'id_user_action', 'id_order', 'id_producer'], 'integer'], | [['id_user', 'id_user_action', 'id_order', 'id_producer'], 'integer'], | ||||
[['date'], 'safe'], | [['date'], 'safe'], | ||||
[['amount'], 'double'], | [['amount'], 'double'], | ||||
{ | { | ||||
return in_array($this->type, [ | return in_array($this->type, [ | ||||
self::TYPE_DEBIT, | self::TYPE_DEBIT, | ||||
self::TYPE_PAIEMENT, | |||||
self::TYPE_PAYMENT, | |||||
]) ; | ]) ; | ||||
} | } | ||||
{ | { | ||||
return in_array($this->type, [ | return in_array($this->type, [ | ||||
self::TYPE_CREDIT, | self::TYPE_CREDIT, | ||||
self::TYPE_CREDIT_INITIAL, | |||||
self::TYPE_REMBOURSEMENT | |||||
self::TYPE_INITIAL_CREDIT, | |||||
self::TYPE_REFUND | |||||
]) ; | ]) ; | ||||
} | } | ||||
{ | { | ||||
$str = '' ; | $str = '' ; | ||||
if($this->type == self::TYPE_CREDIT_INITIAL) { | |||||
if($this->type == self::TYPE_INITIAL_CREDIT) { | |||||
$str = 'Crédit initial' ; | $str = 'Crédit initial' ; | ||||
} | } | ||||
elseif($this->type == self::TYPE_CREDIT) { | elseif($this->type == self::TYPE_CREDIT) { | ||||
$str = 'Crédit' ; | $str = 'Crédit' ; | ||||
} | } | ||||
elseif($this->type == self::TYPE_PAIEMENT) { | |||||
elseif($this->type == self::TYPE_PAYMENT) { | |||||
$str = 'Paiement' ; | $str = 'Paiement' ; | ||||
} | } | ||||
elseif($this->type == self::TYPE_REMBOURSEMENT) { | |||||
elseif($this->type == self::TYPE_REFUND) { | |||||
$str = 'Remboursement' ; | $str = 'Remboursement' ; | ||||
} | } | ||||
elseif($this->type == self::TYPE_DEBIT) { | elseif($this->type == self::TYPE_DEBIT) { | ||||
$str = 'Débit' ; | $str = 'Débit' ; | ||||
} | } | ||||
if($this->type == self::TYPE_PAIEMENT || $this->type == self::TYPE_REMBOURSEMENT) { | |||||
if(isset($this->commande)) { | |||||
$str .= '<br />Commande : '.date('d/m/Y',strtotime($this->commande->production->date)) ; | |||||
if($this->type == self::TYPE_PAYMENT || $this->type == self::TYPE_REFUND) { | |||||
if(isset($this->order)) { | |||||
$str .= '<br />Commande : '.date('d/m/Y',strtotime($this->order->distribution->date)) ; | |||||
} | } | ||||
else { | else { | ||||
$str .= '<br />Commande supprimée' ; | $str .= '<br />Commande supprimée' ; |
* @property string $date | * @property string $date | ||||
* @property string $date_update | * @property string $date_update | ||||
* @property integer $id_point_sale | * @property integer $id_point_sale | ||||
* @property integer $id_production | |||||
* @property integer $id_distribution | |||||
* @property boolean $auto_payment | * @property boolean $auto_payment | ||||
*/ | */ | ||||
class Order extends ActiveRecordCommon | class Order extends ActiveRecordCommon | ||||
public function rules() | public function rules() | ||||
{ | { | ||||
return [ | return [ | ||||
[['id_user', 'date', 'id_point_sale', 'id_production'], 'required', 'message' => ''], | |||||
[['id_user', 'id_point_sale', 'id_production'], 'integer'], | |||||
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], | |||||
[['id_user', 'id_point_sale', 'id_distribution'], 'integer'], | |||||
[['auto_payment'], 'boolean'], | [['auto_payment'], 'boolean'], | ||||
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe'] | [['date', 'date_update', 'comment', 'comment_point_sale'], 'safe'] | ||||
]; | ]; | ||||
'date' => 'Date', | 'date' => 'Date', | ||||
'date_update' => 'Date de modification', | 'date_update' => 'Date de modification', | ||||
'id_point_sale' => 'Point de vente', | 'id_point_sale' => 'Point de vente', | ||||
'id_production' => 'Date de production', | |||||
'id_distribution' => 'Date de distribution', | |||||
]; | ]; | ||||
} | } | ||||
->with('product'); | ->with('product'); | ||||
} | } | ||||
public function getProduction() | |||||
public function getDistribution() | |||||
{ | { | ||||
return $this->hasOne(Production::className(), ['id' => 'id_production']) | |||||
return $this->hasOne(Distribution::className(), ['id' => 'id_distribution']) | |||||
->with('producer'); | ->with('producer'); | ||||
} | } | ||||
public function getPointSale() | public function getPointSale() | ||||
{ | { | ||||
return $this->hasOne(PointSale::className(), ['id' => 'id_point_sale']) | return $this->hasOne(PointSale::className(), ['id' => 'id_point_sale']) | ||||
->with('pointSaleUser'); | |||||
->with('userPointSale'); | |||||
} | } | ||||
public function getCreditHistory() | public function getCreditHistory() | ||||
public static function defaultOptionsSearch() { | public static function defaultOptionsSearch() { | ||||
return [ | return [ | ||||
'with' => ['productOrder', 'creditHistory', 'pointSale'], | 'with' => ['productOrder', 'creditHistory', 'pointSale'], | ||||
'join_with' => ['production', 'user', 'user.userProducer'], | |||||
'join_with' => ['distribution', 'user', 'user.userProducer'], | |||||
'orderby' => 'order.date ASC', | 'orderby' => 'order.date ASC', | ||||
'attribute_id_producer' => 'production.id_producer' | |||||
'attribute_id_producer' => 'distribution.id_producer' | |||||
] ; | ] ; | ||||
} | } | ||||
*/ | */ | ||||
public function initAmount() { | public function initAmount() { | ||||
if (isset($this->productOrder)) { | if (isset($this->productOrder)) { | ||||
foreach ($this->productOrder as $p) { | |||||
if ($p->sale_mode == Product::SALE_MODE_UNIT) { | |||||
$this->amount += $p->price * $p->quantity ; | |||||
if(isset($p->product)) { | |||||
$this->weight += ($p->quantity * $p->product->weight) / 1000 ; | |||||
foreach ($this->productOrder as $productOrder) { | |||||
if ($productOrder->sale_mode == Product::SALE_MODE_UNIT) { | |||||
$this->amount += $productOrder->price * $productOrder->quantity ; | |||||
if(isset($productOrder->product)) { | |||||
$this->weight += ($productOrder->quantity * $productOrder->product->weight) / 1000 ; | |||||
} | } | ||||
} | } | ||||
elseif ($p->sale_mode == Product::SALE_MODE_WEIGHT) { | |||||
$this->amount += $p->price * $p->quantity / 1000; | |||||
elseif ($productOrder->sale_mode == Product::SALE_MODE_WEIGHT) { | |||||
$this->amount += $productOrder->price * $productOrder->quantity / 1000; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
$jsonOrder = [ | $jsonOrder = [ | ||||
'products' => [], | 'products' => [], | ||||
'amount' => $order->amount, | 'amount' => $order->amount, | ||||
'str_amount' => $order->getAmount(self::TYPE_AMOUNT_TOTAL, true), | |||||
'paid_amount' => $order->getPaidAmount(self::TYPE_AMOUNT_PAID), | |||||
'str_amount' => $order->getAmount(self::AMOUNT_TOTAL, true), | |||||
'paid_amount' => $order->getPaidAmount(self::AMOUNT_PAID), | |||||
'comment' => $order->comment, | 'comment' => $order->comment, | ||||
]; | ]; | ||||
public function getPaymentStatus() | public function getPaymentStatus() | ||||
{ | { | ||||
// payé | // payé | ||||
if ($this->getAmount() - $this->getAmount(self::TYPE_AMOUNT_PAID) < 0.01 && | |||||
$this->getAmount() - $this->getAmount(self::TYPE_AMOUNT_PAID) >= 0) | |||||
if ($this->getAmount() - $this->getAmount(self::AMOUNT_PAID) < 0.01 && | |||||
$this->getAmount() - $this->getAmount(self::AMOUNT_PAID) >= 0) | |||||
{ | { | ||||
return self::PAYMENT_PAID ; | return self::PAYMENT_PAID ; | ||||
} | } | ||||
// à rembourser | // à rembourser | ||||
elseif ($this->getAmount() - $this->getAmount(self::TYPE_AMOUNT_PAID) <= -0.01) { | |||||
elseif ($this->getAmount() - $this->getAmount(self::AMOUNT_PAID) <= -0.01) { | |||||
return self::PAYMENT_SURPLUS ; | return self::PAYMENT_SURPLUS ; | ||||
} | } | ||||
// reste à payer | // reste à payer | ||||
elseif ($this->getAmount() - $this->getAmount(self::TYPE_AMOUNT_PAID) >= 0.01) { | |||||
elseif ($this->getAmount() - $this->getAmount(self::AMOUNT_PAID) >= 0.01) { | |||||
return self::PAYMENT_UNPAID ; | return self::PAYMENT_UNPAID ; | ||||
} | } | ||||
} | } | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function getSalePointSummary() | |||||
public function getPointSaleSummary() | |||||
{ | { | ||||
$html = ''; | $html = ''; | ||||
if (isset($this->salePoint)) { | |||||
if (isset($this->pointSale)) { | |||||
$html .= '<span class="name-point-sale">' . | $html .= '<span class="name-point-sale">' . | ||||
Html::encode($this->salePoint->name) . | |||||
Html::encode($this->pointSale->name) . | |||||
'</span>' . | '</span>' . | ||||
'<br /><span class="locality">' | '<br /><span class="locality">' | ||||
. Html::encode($this->salePoint->locality) | |||||
. Html::encode($this->pointSale->locality) | |||||
. '</span>'; | . '</span>'; | ||||
if (strlen($this->sale_point_comment)) { | |||||
if (strlen($this->comment_point_sale)) { | |||||
$html .= '<div class="comment"><span>' | $html .= '<div class="comment"><span>' | ||||
. Html::encode($this->comment_point_sale) | . Html::encode($this->comment_point_sale) | ||||
. '</span></div>'; | . '</span></div>'; | ||||
{ | { | ||||
$html = ''; | $html = ''; | ||||
$html .= $this->getAmount(self::TYPE_AMOUNT_TOTAL, true) . '<br />'; | |||||
$html .= $this->getAmount(self::AMOUNT_TOTAL, true) . '<br />'; | |||||
if ($this->paid_amount) { | if ($this->paid_amount) { | ||||
if ($this->getPaymentStatus() == Order::PAYMENT_PAID) { | if ($this->getPaymentStatus() == Order::PAYMENT_PAID) { | ||||
{ | { | ||||
$orderDelay = Producer::getConfig( | $orderDelay = Producer::getConfig( | ||||
'order_delay', | 'order_delay', | ||||
$this->production->id_producer | |||||
$this->distribution->id_producer | |||||
); | ); | ||||
$orderDeadline = Producer::getConfig( | $orderDeadline = Producer::getConfig( | ||||
'order_deadline', | 'order_deadline', | ||||
$this->production->id_producer | |||||
$this->distribution->id_producer | |||||
); | ); | ||||
$orderDate = strtotime($this->production->date); | |||||
$orderDate = strtotime($this->distribution->date); | |||||
$today = strtotime(date('Y-m-d')); | $today = strtotime(date('Y-m-d')); | ||||
$todayHour = date('G'); | $todayHour = date('G'); | ||||
$nbDays = (int) (($dateOrder - $today) / (24 * 60 * 60)); | |||||
$nbDays = (int) (($orderDate - $today) / (24 * 60 * 60)); | |||||
if ($nb_days <= 0) { | |||||
if ($nbDays <= 0) { | |||||
return self::STATE_DELIVERED; | return self::STATE_DELIVERED; | ||||
} | } | ||||
elseif ($nbDays >= $orderDelay && | elseif ($nbDays >= $orderDelay && | ||||
foreach ($orders as $c) { | foreach ($orders as $c) { | ||||
if(is_null($c->date_delete)) { | if(is_null($c->date_delete)) { | ||||
foreach ($c->productOrder as $po) { | foreach ($c->productOrder as $po) { | ||||
if ($po->id_product == $id_product) { | |||||
if ($po->id_product == $idProduct) { | |||||
$quantity += $po->quantity ; | $quantity += $po->quantity ; | ||||
} | } | ||||
} | } |
use Yii; | use Yii; | ||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
use common\models\PointSaleUser; | |||||
use common\models\ProductionPointSale; | |||||
use common\models\UserPointSale; | |||||
use common\models\PointSaleDistribution ; | |||||
use common\components\ActiveRecordCommon ; | |||||
/** | /** | ||||
* This is the model class for table "point_vente". | * This is the model class for table "point_vente". | ||||
* @property string $address | * @property string $address | ||||
* @property integer $id_producer | * @property integer $id_producer | ||||
*/ | */ | ||||
class PointSale extends \yii\db\ActiveRecord | |||||
class PointSale extends ActiveRecordCommon | |||||
{ | { | ||||
var $orders = []; | var $orders = []; | ||||
var $revenues = 0; | var $revenues = 0; | ||||
); | ); | ||||
} | } | ||||
/** | |||||
* Retourne les options de base nécessaires à la fonction de recherche. | |||||
* | |||||
* @return array | |||||
*/ | |||||
public static function defaultOptionsSearch() { | |||||
return [ | |||||
'with' => [], | |||||
'join_with' => [], | |||||
'orderby' => '', | |||||
'attribute_id_producer' => 'point_sale.id_producer' | |||||
] ; | |||||
} | |||||
/** | /** | ||||
* Initialise les commandes liées au point de vente. | * Initialise les commandes liées au point de vente. | ||||
*/ | */ | ||||
public function processRestrictedAccess() | public function processRestrictedAccess() | ||||
{ | { | ||||
PointSaleUser::deleteAll(['id_point_sale' => $this->id]); | |||||
UserPointSale::deleteAll(['id_point_sale' => $this->id]); | |||||
if (is_array($this->users) && count($this->users)) { | if (is_array($this->users) && count($this->users)) { | ||||
foreach ($this->users as $key => $val) { | foreach ($this->users as $key => $val) { | ||||
$user = User::findOne($val); | $user = User::findOne($val); | ||||
if ($user) { | if ($user) { | ||||
$pointSaleUser = new PointSaleUser; | |||||
$pointSaleUser->id_user = $val; | |||||
$pointSaleUser->id_point_sale = $this->id; | |||||
$userPointSale = new UserPointSale; | |||||
$userPointSale->id_user = $val; | |||||
$userPointSale->id_point_sale = $this->id; | |||||
if (isset($this->users_comment[$val]) && strlen($this->users_comment[$val])) { | if (isset($this->users_comment[$val]) && strlen($this->users_comment[$val])) { | ||||
$point_sale_user->comment = $this->users_comment[$val]; | |||||
$userPointSale->comment = $this->users_comment[$val]; | |||||
} | } | ||||
$point_sale_user->save(); | |||||
$userPointSale->save(); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
*/ | */ | ||||
public function getComment() | public function getComment() | ||||
{ | { | ||||
if (isset($this->pointSaleUser)) { | |||||
foreach ($this->pointSaleUser as $pointSaleUser) { | |||||
if ($pointSaleUser->id_user == Yii::$app->user->identity->id) { | |||||
return $pointSaleUser->comment; | |||||
if (isset($this->userPointSale)) { | |||||
foreach ($this->userPointSale as $userPointSale) { | |||||
if ($userPointSale->id_user == User::getCurrentId()) { | |||||
return $userPointSale->comment; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
$field = 'infos_'.$day ; | $field = 'infos_'.$day ; | ||||
if(strlen($this->$field)) { | if(strlen($this->$field)) { | ||||
$str = nl2br(Html::encode($this->$champs)) ; | |||||
$str = nl2br(Html::encode($this->$field)) ; | |||||
$str = preg_replace('/\[select_previous_day\](.*?)\[\/select_previous_day\]/', '<a href="javascript:void(0);" class="select-previous-day">$1</a>' , $str) ; | $str = preg_replace('/\[select_previous_day\](.*?)\[\/select_previous_day\]/', '<a href="javascript:void(0);" class="select-previous-day">$1</a>' , $str) ; | ||||
} | } | ||||
return $str ; | return $str ; |
*/ | */ | ||||
public static function defaultOptionsSearch() { | public static function defaultOptionsSearch() { | ||||
return [ | return [ | ||||
'with' => ['production', 'pointVente'], | |||||
'with' => ['distribution', 'pointSale'], | |||||
'join_with' => [], | 'join_with' => [], | ||||
'orderby' => '', | 'orderby' => '', | ||||
'attribute_id_producer' => '' | 'attribute_id_producer' => '' |
{ | { | ||||
return $this->hasOne(Product::className(), ['id' => 'id_product']); | return $this->hasOne(Product::className(), ['id' => 'id_product']); | ||||
} | } | ||||
public function getDistribution() | |||||
{ | |||||
return $this->hasOne(Distribution::className(), ['id' => 'id_distribution']); | |||||
} | |||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public static function defaultOptionsSearch() { | public static function defaultOptionsSearch() { | ||||
return [ | return [ | ||||
'with' => ['produit','distribution'], | |||||
'with' => ['product','distribution'], | |||||
'join_with' => [], | 'join_with' => [], | ||||
'orderby' => '', | 'orderby' => '', | ||||
'attribute_id_producer' => '' | 'attribute_id_producer' => '' | ||||
if (isset($productDistribution->product)) { | if (isset($productDistribution->product)) { | ||||
$arrayProductsDistribution[$productDistribution->id_product] = [ | $arrayProductsDistribution[$productDistribution->id_product] = [ | ||||
'active' => (int) $productDistribution->active, | 'active' => (int) $productDistribution->active, | ||||
'epuise' => (int) $productDistribution->product->unavailable, | |||||
'unavailable' => (int) $productDistribution->product->unavailable, | |||||
'quantity_max' => $productDistribution->quantity_max, | 'quantity_max' => $productDistribution->quantity_max, | ||||
'quantity_order' => Order::getProductQuantity($productDistribution->id_product, $orders), | 'quantity_order' => Order::getProductQuantity($productDistribution->id_product, $orders), | ||||
'quantity_remaining' => $productDistribution->quantity_max - Order::getProductQuantity($productDistribution->id_product, $orders) | 'quantity_remaining' => $productDistribution->quantity_max - Order::getProductQuantity($productDistribution->id_product, $orders) |
namespace common\models; | namespace common\models; | ||||
use Yii; | use Yii; | ||||
use common\components\ActiveRecordCommon ; | |||||
/** | /** | ||||
* This is the model class for table "product_order". | * This is the model class for table "product_order". | ||||
* @property integer $id_product | * @property integer $id_product | ||||
* @property double $quantity | * @property double $quantity | ||||
*/ | */ | ||||
class ProductOrder extends \yii\db\ActiveRecord | |||||
class ProductOrder extends ActiveRecordCommon | |||||
{ | { | ||||
/** | /** | ||||
'quantity' => 'Quantité', | 'quantity' => 'Quantité', | ||||
]; | ]; | ||||
} | } | ||||
/** | |||||
* Retourne les options de base nécessaires à la fonction de recherche. | |||||
* | |||||
* @return array | |||||
*/ | |||||
public static function defaultOptionsSearch() { | |||||
return [ | |||||
'with' => [], | |||||
'join_with' => [], | |||||
'orderby' => '', | |||||
'attribute_id_producer' => '' | |||||
] ; | |||||
} | |||||
} | } |
use common\components\ActiveRecordCommon ; | use common\components\ActiveRecordCommon ; | ||||
use common\models\Producer; | use common\models\Producer; | ||||
use common\models\PointSale; | use common\models\PointSale; | ||||
use common\models\PointSaleUser; | |||||
use common\models\UserPointSale; | |||||
use common\models\Order; | use common\models\Order; | ||||
use common\models\ProductOrder; | use common\models\ProductOrder; | ||||
$order->id_production = $production->id; | $order->id_production = $production->id; | ||||
$order->auto_payment = $this->auto_payment ; | $order->auto_payment = $this->auto_payment ; | ||||
$pointSaleUser = PointSaleUser::searchOne([ | |||||
$userPointSale = UserPointSale::searchOne([ | |||||
'id_point_sale' => $this->id_point_sale, | 'id_point_sale' => $this->id_point_sale, | ||||
'id_user' => $this->id_user | 'id_user' => $this->id_user | ||||
]) ; | ]) ; | ||||
if ($pointSaleUser && strlen($pointSaleUser->comment)) { | |||||
$order->comment_point_sale = $pointSaleUser->comment; | |||||
if ($userPointSale && strlen($userPointSale->comment)) { | |||||
$order->comment_point_sale = $userPointSale->comment; | |||||
} | } | ||||
$order->save(); | $order->save(); |
$this->renameColumn('product', 'recette', 'recipe') ; | $this->renameColumn('product', 'recette', 'recipe') ; | ||||
$this->renameColumn('product', 'lundi', 'monday') ; | $this->renameColumn('product', 'lundi', 'monday') ; | ||||
$this->renameColumn('product', 'mardi', 'tuesday') ; | $this->renameColumn('product', 'mardi', 'tuesday') ; | ||||
$this->renameColumn('product', 'mercredi', 'w<ednesday') ; | |||||
$this->renameColumn('product', 'mercredi', 'wednesday') ; | |||||
$this->renameColumn('product', 'jeudi', 'thursday') ; | $this->renameColumn('product', 'jeudi', 'thursday') ; | ||||
$this->renameColumn('product', 'vendredi', 'friday') ; | $this->renameColumn('product', 'vendredi', 'friday') ; | ||||
$this->renameColumn('product', 'samedi', 'saterday') ; | $this->renameColumn('product', 'samedi', 'saterday') ; |
<?php if(count($producersArray)): ?> | <?php if(count($producersArray)): ?> | ||||
<h2>Mes producteurs</h2> | <h2>Mes producteurs</h2> | ||||
<?php foreach($producersArray as $producer): ?> | <?php foreach($producersArray as $producer): ?> | ||||
<div class="col-md-<?php if(count($producers) == 1): ?>6<?php elseif(count($producersArray) == 2): ?>6<?php else: ?>3<?php endif; ?>"> | |||||
<div class="col-md-<?php if(count($producersArray) == 1): ?>6<?php elseif(count($producersArray) == 2): ?>6<?php else: ?>3<?php endif; ?>"> | |||||
<div class="producer" style="background-image:url('<?= Yii::$app->urlManagerProducer->getHostInfo().'/'.Yii::$app->urlManagerProducer->baseUrl ; ?>/uploads/<?= $producer->photo ?>');"> | <div class="producer" style="background-image:url('<?= Yii::$app->urlManagerProducer->getHostInfo().'/'.Yii::$app->urlManagerProducer->baseUrl ; ?>/uploads/<?= $producer->photo ?>');"> | ||||
<a class="btn btn-primary" href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]); ?>"><?= Html::encode($producer->name); ?></a> | <a class="btn btn-primary" href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]); ?>"><?= Html::encode($producer->name); ?></a> | ||||
</div> | </div> |
*/ | */ | ||||
public function actionInfosDistribution($idDistribution) | public function actionInfosDistribution($idDistribution) | ||||
{ | { | ||||
$distribution = Distribution::searchOne($idDistribution); | |||||
$distribution = Distribution::searchOne([ | |||||
'id' => $idDistribution | |||||
]); | |||||
if ($distribution) { | if ($distribution) { | ||||
$arr = []; | $arr = []; | ||||
$productsArray = ProductDistribution::searchByDistribution($distribution->id) ; | $productsArray = ProductDistribution::searchByDistribution($distribution->id) ; | ||||
$data['products'] = $productsArray; | $data['products'] = $productsArray; | ||||
$pointSaleArray = PointSale::find() | $pointSaleArray = PointSale::find() | ||||
]) | ]) | ||||
->all(); | ->all(); | ||||
$data['pointsSale'] = []; | |||||
$data['points_sale'] = []; | |||||
foreach ($pointSaleArray as $pointSale) { | foreach ($pointSaleArray as $pointSale) { | ||||
if (isset($pointSale->pointSaleDistribution) && | if (isset($pointSale->pointSaleDistribution) && | ||||
isset($pointSale->pointSaleDistribution[0])) { | isset($pointSale->pointSaleDistribution[0])) { | ||||
$data['points_vente'][$pointSale->id] = $pointSale->pointSaleDistribution[0]->delivery; | |||||
$data['points_sale'][$pointSale->id] = $pointSale->pointSaleDistribution[0]->delivery; | |||||
} else { | } else { | ||||
$data['points_vente'][$pointSale->id] = false; | |||||
$data['points_sale'][$pointSale->id] = false; | |||||
} | } | ||||
} | } | ||||
$pointsSaleArray = PointSale::find() | $pointsSaleArray = PointSale::find() | ||||
->with('userPointSale') | ->with('userPointSale') | ||||
->where(['id_producer' => $idProducer]) | ->where(['id_producer' => $idProducer]) | ||||
->andWhere('restricted_access = 0 OR (restricted_access = 1 AND (SELECT COUNT(*) FROM user_point_sale WHERE point_sale.id = user_point_sale.id_point_sale AND point_sale_user.id_user = :id_user) > 0)') | |||||
->andWhere('restricted_access = 0 OR (restricted_access = 1 AND (SELECT COUNT(*) FROM user_point_sale WHERE point_sale.id = user_point_sale.id_point_sale AND user_point_sale.id_user = :id_user) > 0)') | |||||
->params([':id_user' => User::getCurrentId()]) | ->params([':id_user' => User::getCurrentId()]) | ||||
->all(); | ->all(); | ||||
*/ | */ | ||||
public function actionCreate() | public function actionCreate() | ||||
{ | { | ||||
$idProducer = $this->getProducer()->id ; | $idProducer = $this->getProducer()->id ; | ||||
$order = new Order; | $order = new Order; | ||||
if ($order->load($posts)) { | if ($order->load($posts)) { | ||||
$order = Order::find()->where('id_distribution = ' . $posts['Order']['id_distribution'])->andWhere('id_user = ' . User::getCurrentId())->one(); | |||||
$order = Order::find() | |||||
->where('id_distribution = ' . $posts['Order']['id_distribution']) | |||||
->andWhere('id_user = ' . User::getCurrentId()) | |||||
->one(); | |||||
if (!$order) { | if (!$order) { | ||||
$order = new Order; | $order = new Order; | ||||
$order->load(Yii::$app->request->post()); | $order->load(Yii::$app->request->post()); | ||||
$order->date = date('Y-m-d H:i:s'); | $order->date = date('Y-m-d H:i:s'); | ||||
$order->type = Order::ORIGIN_USER; | $order->type = Order::ORIGIN_USER; | ||||
} | } | ||||
$this->processForm($Order); | |||||
$this->processForm($order); | |||||
} | } | ||||
return $this->render('create', array_merge($this->initForm($order), [ | return $this->render('create', array_merge($this->initForm($order), [ | ||||
*/ | */ | ||||
public function actionUpdate($id) | public function actionUpdate($id) | ||||
{ | { | ||||
$order = sOrder::searchOne([ | |||||
$order = Order::searchOne([ | |||||
'id' => $id | 'id' => $id | ||||
]) ; | ]) ; | ||||
$this->processForm($order); | $this->processForm($order); | ||||
} | } | ||||
return $this->render('update', array_merge($this->processForm($order), [ | |||||
return $this->render('update', array_merge($this->initForm($order), [ | |||||
'model' => $order, | 'model' => $order, | ||||
'orderNotfound' => !$order, | 'orderNotfound' => !$order, | ||||
])); | ])); | ||||
foreach ($posts['Product'] as $key => $quantity) { | foreach ($posts['Product'] as $key => $quantity) { | ||||
$key = (int) str_replace('product_', '', $key); | $key = (int) str_replace('product_', '', $key); | ||||
$product = Produit::find()->where(['id' => $key])->one(); | |||||
$product = Product::find()->where(['id' => $key])->one(); | |||||
$totalQuantity += $quantity; | $totalQuantity += $quantity; | ||||
if ($product && $quantity) { | if ($product && $quantity) { | ||||
$productsArray[] = $product; | $productsArray[] = $product; | ||||
$errorPointSale = true; | $errorPointSale = true; | ||||
} | } | ||||
$pointSale = PointSale::findOne($posts['Commande']['id_point_vente']); | |||||
$pointSale = PointSale::findOne($posts['Order']['id_point_sale']); | |||||
if ($pointSale) { | if ($pointSale) { | ||||
if (strlen($pointSale->code) && !$pointSale->validateCode($posts['code_point_sale_' . $pointSale->id])) { | if (strlen($pointSale->code) && !$pointSale->validateCode($posts['code_point_sale_' . $pointSale->id])) { | ||||
// sauvegarde des produits | // sauvegarde des produits | ||||
foreach ($productsArray as $product) { | foreach ($productsArray as $product) { | ||||
if (isset($availableProducts[$product->id])) { | if (isset($availableProducts[$product->id])) { | ||||
$productOrder = new ProductOrder(); | $productOrder = new ProductOrder(); | ||||
$productOrder->id_order = $order->id; | $productOrder->id_order = $order->id; | ||||
$productOrder->id_product = $product->id; | $productOrder->id_product = $product->id; | ||||
$productOrder->price = $product->price; | $productOrder->price = $product->price; | ||||
$quantity = (int) $posts['Product']['product_' . $product->id]; | $quantity = (int) $posts['Product']['product_' . $product->id]; | ||||
if ($produits_dispos[$product->id]['quantity_max'] && $quantity > $availableProducts[$product->id]['quantity_remaining']) { | |||||
$quantity = $availableProducts[$p->id]['quantity_remaining']; | |||||
if ($availableProducts[$product->id]['quantity_max'] && $quantity > $availableProducts[$product->id]['quantity_remaining']) { | |||||
$quantity = $availableProducts[$product->id]['quantity_remaining']; | |||||
} | } | ||||
$productOrder->quantity = $quantity; | $productOrder->quantity = $quantity; | ||||
$productOrder->sale_mode = Product::SALE_MODE_UNIT ; | |||||
$productOrder->save(); | $productOrder->save(); | ||||
} | } | ||||
} | } | ||||
// credit | // credit | ||||
$credit = isset($posts['credit']) && $posts['credit']; | $credit = isset($posts['credit']) && $posts['credit']; | ||||
$order = Order::searchOne([ | |||||
'id' => $order->id | |||||
]) ; | |||||
if ($credit && ($pointSale->credit || $order->getAmount(Order::AMOUNT_PAID))) { | if ($credit && ($pointSale->credit || $order->getAmount(Order::AMOUNT_PAID))) { | ||||
$order = Order::searchOne([ | |||||
'id' => $order->id | |||||
]) ; | |||||
$amountPaid = $order->getAmount(Order::AMOUNT_PAID); | $amountPaid = $order->getAmount(Order::AMOUNT_PAID); | ||||
// à payer | // à payer | ||||
} | } | ||||
if ($amountRemaining > 0) { | if ($amountRemaining > 0) { | ||||
$order->creditHistory( | |||||
$order->saveCreditHistory( | |||||
CreditHistory::TYPE_PAYMENT, | CreditHistory::TYPE_PAYMENT, | ||||
$amountRemaining, | $amountRemaining, | ||||
$distribution->id_producer, | $distribution->id_producer, | ||||
// surplus à rembourser | // surplus à rembourser | ||||
elseif ($order->getPaymentStatus() == Order::PAYMENT_SURPLUS) { | elseif ($order->getPaymentStatus() == Order::PAYMENT_SURPLUS) { | ||||
$amountSurplus = $order->getAmount(Order::AMOUNT_SURPLUS) ; | $amountSurplus = $order->getAmount(Order::AMOUNT_SURPLUS) ; | ||||
$order->creditHistory( | |||||
$order->saveCreditHistory( | |||||
CreditHistory::TYPE_REFUND, | CreditHistory::TYPE_REFUND, | ||||
$amountSurplus, | $amountSurplus, | ||||
$distribution->id_producer, | $distribution->id_producer, | ||||
if ($order && User::getCurrentId() == $order->id_user) { | if ($order && User::getCurrentId() == $order->id_user) { | ||||
// remboursement | // remboursement | ||||
if ($order->getAmount(Order::AMOUNT_PAID)) { | if ($order->getAmount(Order::AMOUNT_PAID)) { | ||||
$order->creditHistory( | |||||
CreditHistory::PAYMENT_REFUND, | |||||
$order->saveCreditHistory( | |||||
CreditHistory::TYPE_REFUND, | |||||
$order->getAmount(Order::AMOUNT_PAID), | $order->getAmount(Order::AMOUNT_PAID), | ||||
$order->distribution->id_producer, | $order->distribution->id_producer, | ||||
User::getCurrentId(), | User::getCurrentId(), | ||||
* @param string $code | * @param string $code | ||||
* @return boolean | * @return boolean | ||||
*/ | */ | ||||
public function actionvalidateCodePointSale($idPointSale, $code) | |||||
public function actionValidateCodePointSale($idPointSale, $code) | |||||
{ | { | ||||
$pointSale = PointSale::findOne($idPointSale); | $pointSale = PointSale::findOne($idPointSale); | ||||
if ($pointSale) { | if ($pointSale) { |
<?php if($idProducer && count($distributionDaysArray) > 1): ?> | <?php if($idProducer && count($distributionDaysArray) > 1): ?> | ||||
<div id="step-choice-date" class="col-md-6"> | |||||
<div id="step-date" class="col-md-6"> | |||||
<?= $form->field($model, 'id_distribution')->label('')->hiddenInput(); ?> | <?= $form->field($model, 'id_distribution')->label('')->hiddenInput(); ?> | ||||
<?php if (isset($model->id)): ?> | <?php if (isset($model->id)): ?> | ||||
<div id="dates" style="display:none;"> | <div id="dates" style="display:none;"> | ||||
<?php | <?php | ||||
foreach ($distributionDaysArray as $idDistribution => $day) { | foreach ($distributionDaysArray as $idDistribution => $day) { | ||||
if ($j != '--') { | |||||
echo '<div><span class="date">' . $day . '</span><span class="id_production">' . $idDistribution. '</span></div>'; | |||||
if ($day != '--') { | |||||
echo '<div><span class="date">' . $day . '</span><span class="id_distribution">' . $idDistribution. '</span></div>'; | |||||
} | } | ||||
} | } | ||||
?> | ?> | ||||
</div> | </div> | ||||
<div class="clr"></div> | <div class="clr"></div> | ||||
<div id="in-progress-orders" style="display:none;"> | |||||
<div id="orders-in-progress" style="display:none;"> | |||||
<?php foreach ($ordersArray as $order): ?> | <?php foreach ($ordersArray as $order): ?> | ||||
<?php echo '<div class="order" data-iddistribution="' . $order->id_distribution. '" data-id="' . $order->id . '" data-href="' . Yii::$app->urlManager->createUrl(['order/update', 'id' => $order->id, 'id_producer' => $order->distribution->id_producer]) . '"></div>'; ?> | <?php echo '<div class="order" data-iddistribution="' . $order->id_distribution. '" data-id="' . $order->id . '" data-href="' . Yii::$app->urlManager->createUrl(['order/update', 'id' => $order->id, 'id_producer' => $order->distribution->id_producer]) . '"></div>'; ?> | ||||
<?php endforeach; ?> | <?php endforeach; ?> | ||||
<input type="hidden" id="livraison" value="<?php if (!is_null($distribution) && $distribution->delivery): ?>1<?php else: ?>0<?php endif; ?>" /> | <input type="hidden" id="livraison" value="<?php if (!is_null($distribution) && $distribution->delivery): ?>1<?php else: ?>0<?php endif; ?>" /> | ||||
<ul id="points-sale" class="blocs"> | |||||
<ul id="points-sale" class="blocks"> | |||||
<?php | <?php | ||||
foreach ($pointsSaleArray as $pointSale) { | foreach ($pointsSaleArray as $pointSale) { | ||||
{ | { | ||||
if($userPointSale->id_user == User::getCurrentId() && strlen($userPointSale->comment)) | if($userPointSale->id_user == User::getCurrentId() && strlen($userPointSale->comment)) | ||||
{ | { | ||||
$comment = '<div class="commentaire"><span>'.Html::encode($userPointSale->comment).'</span></div>' ; | |||||
$comment = '<div class="comment"><span>'.Html::encode($userPointSale->comment).'</span></div>' ; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
echo '<li class="bloc point-vente point-vente-' . $pointSale->id . '" data-code="'.$dataCode.'" data-credit="'.(int) $pointSale->credit.'"><div class="contenu">' . | |||||
echo '<li class="block point-sale point-sale-' . $pointSale->id . '" data-code="'.$dataCode.'" data-credit="'.(int) $pointSale->credit.'"><div class="contenu">' . | |||||
'<span style="display:none;" class="id">' . $pointSale->id . '</span>' . | '<span style="display:none;" class="id">' . $pointSale->id . '</span>' . | ||||
'<div class="name">' .$htmlCode. Html::encode($pointSale->name) . '</div>' . | '<div class="name">' .$htmlCode. Html::encode($pointSale->name) . '</div>' . | ||||
'<div class="address">à ' . Html::encode($pointSale->locality) . '</div>' . | '<div class="address">à ' . Html::encode($pointSale->locality) . '</div>' . | ||||
<div id="step-infos-point-sale"> | <div id="step-infos-point-sale"> | ||||
<?php | <?php | ||||
foreach ($pointsSaleArray as $pointSale) { | foreach ($pointsSaleArray as $pointSale) { | ||||
echo '<div class="alert alert-warning infos-pv infos-pv-'.$pointSale->id.'"><h4>Infos : <span>'.Html::encode($pointSale->name).'</span></h4>' . | |||||
echo '<div class="alert alert-warning infos-point-sale infos-point-sale-'.$pointSale->id.'"><h4>Infos : <span>'.Html::encode($pointSale->name).'</span></h4>' . | |||||
'<div class="jour jour-1">' . $pointSale->getStrInfos('monday') . '</div>' . | '<div class="jour jour-1">' . $pointSale->getStrInfos('monday') . '</div>' . | ||||
'<div class="jour jour-2">' . $pointSale->getStrInfos('tuesday') . '</div>' . | '<div class="jour jour-2">' . $pointSale->getStrInfos('tuesday') . '</div>' . | ||||
'<div class="jour jour-3">' . $pointSale->getStrInfos('wednesday') . '</div>' . | '<div class="jour jour-3">' . $pointSale->getStrInfos('wednesday') . '</div>' . | ||||
<div id=""> | <div id=""> | ||||
<div class="alert alert-warning unavailable">Produit indisponible pour ce point de vente</div> | <div class="alert alert-warning unavailable">Produit indisponible pour ce point de vente</div> | ||||
<table class="table table-bordered" id="table-produits"> | |||||
<table class="table table-bordered" id="table-products"> | |||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th class="th-photo">Photo</th> | <th class="th-photo">Photo</th> | ||||
endif; ?></span> <?php echo Html::encode(strtolower($product->name)); ?>(s) | endif; ?></span> <?php echo Html::encode(strtolower($product->name)); ?>(s) | ||||
</div> | </div> | ||||
<div class="epuise">Épuisé</div> | |||||
<div class="unavailable">Épuisé</div> | |||||
</td> | </td> | ||||
<td class="total"><strong></strong></td> | <td class="total"><strong></strong></td> | ||||
</tr> | </tr> |
*/ | */ | ||||
use yii\bootstrap\ActiveForm; | use yii\bootstrap\ActiveForm; | ||||
use common\models\Order ; | |||||
$this->setTitle('Historique de mes commandes') ; | $this->setTitle('Historique de mes commandes') ; | ||||
'label' => 'Statut', | 'label' => 'Statut', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($c) { | 'value' => function($c) { | ||||
if($c->getState() == Order::STATE_DELIVERY) { | |||||
if($c->getState() == Order::STATE_DELIVERED) { | |||||
return 'Livrée' ; | return 'Livrée' ; | ||||
} | } | ||||
elseif($c->getState() == Order::STATE_PREPARATION) { | elseif($c->getState() == Order::STATE_PREPARATION) { |
padding: 3px 10px; | padding: 3px 10px; | ||||
} | } | ||||
/* line 200, ../sass/order/_form.scss */ | /* line 200, ../sass/order/_form.scss */ | ||||
.order-create #main #content .order-form .infos-point-sale, | |||||
.order-update #main #content .order-form .infos-point-sale { | |||||
.order-create #main #content .order-form .infos-points-sale, | |||||
.order-update #main #content .order-form .infos-points-sale { | |||||
display: none; | display: none; | ||||
margin-top: 15px; | margin-top: 15px; | ||||
} | } | ||||
/* line 204, ../sass/order/_form.scss */ | /* line 204, ../sass/order/_form.scss */ | ||||
.order-create #main #content .order-form .infos-point-sale h4, | |||||
.order-update #main #content .order-form .infos-point-sale h4 { | |||||
.order-create #main #content .order-form .infos-points-sale h4, | |||||
.order-update #main #content .order-form .infos-points-sale h4 { | |||||
margin-top: 0px; | margin-top: 0px; | ||||
padding-top: 0px; | padding-top: 0px; | ||||
text-align: left; | text-align: left; | ||||
font-family: "myriadpro-semibold"; | font-family: "myriadpro-semibold"; | ||||
} | } | ||||
/* line 212, ../sass/order/_form.scss */ | /* line 212, ../sass/order/_form.scss */ | ||||
.order-create #main #content .order-form .infos-point-sale h4 span, | |||||
.order-update #main #content .order-form .infos-point-sale h4 span { | |||||
.order-create #main #content .order-form .infos-points-sale h4 span, | |||||
.order-update #main #content .order-form .infos-points-sale h4 span { | |||||
font-family: "myriadpro-regular"; | font-family: "myriadpro-regular"; | ||||
text-transform: none; | text-transform: none; | ||||
} | } | ||||
/* line 218, ../sass/order/_form.scss */ | /* line 218, ../sass/order/_form.scss */ | ||||
.order-create #main #content .order-form .infos-point-sale a, | |||||
.order-update #main #content .order-form .infos-point-sale a { | |||||
.order-create #main #content .order-form .infos-points-sale a, | |||||
.order-update #main #content .order-form .infos-points-sale a { | |||||
text-decoration: underline; | text-decoration: underline; | ||||
} | } | ||||
/* line 223, ../sass/order/_form.scss */ | /* line 223, ../sass/order/_form.scss */ | ||||
margin-top: 15px; | margin-top: 15px; | ||||
} | } | ||||
/* line 226, ../sass/order/_form.scss */ | /* line 226, ../sass/order/_form.scss */ | ||||
.order-create #main #content .order-form #products .alert.unavailable, | |||||
.order-update #main #content .order-form #products .alert.unavailable { | |||||
display: none; | |||||
} | |||||
/* line 230, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products #label-products, | .order-create #main #content .order-form #products #label-products, | ||||
.order-update #main #content .order-form #products #label-products { | .order-update #main #content .order-form #products #label-products { | ||||
display: block; | display: block; | ||||
margin-bottom: 5px; | margin-bottom: 5px; | ||||
} | } | ||||
/* line 231, ../sass/order/_form.scss */ | |||||
/* line 235, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table, | .order-create #main #content .order-form #products .table, | ||||
.order-update #main #content .order-form #products .table { | .order-update #main #content .order-form #products .table { | ||||
margin-top: 7px; | margin-top: 7px; | ||||
} | } | ||||
/* line 234, ../sass/order/_form.scss */ | |||||
/* line 238, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .photo, | .order-create #main #content .order-form #products .table .photo, | ||||
.order-update #main #content .order-form #products .table .photo { | .order-update #main #content .order-form #products .table .photo { | ||||
padding: 0px; | padding: 0px; | ||||
width: 120px; | width: 120px; | ||||
} | } | ||||
/* line 239, ../sass/order/_form.scss */ | |||||
/* line 243, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .th-photo, .order-create #main #content .order-form #products .table .td-photo, | .order-create #main #content .order-form #products .table .th-photo, .order-create #main #content .order-form #products .table .td-photo, | ||||
.order-update #main #content .order-form #products .table .th-photo, | .order-update #main #content .order-form #products .table .th-photo, | ||||
.order-update #main #content .order-form #products .table .td-photo { | .order-update #main #content .order-form #products .table .td-photo { | ||||
width: 120px; | width: 120px; | ||||
} | } | ||||
/* line 243, ../sass/order/_form.scss */ | |||||
/* line 247, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .name, | .order-create #main #content .order-form #products .table .name, | ||||
.order-update #main #content .order-form #products .table .name { | .order-update #main #content .order-form #products .table .name { | ||||
font-family: "comfortaalight"; | font-family: "comfortaalight"; | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
font-size: 18px; | font-size: 18px; | ||||
} | } | ||||
/* line 250, ../sass/order/_form.scss */ | |||||
/* line 254, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .description, | .order-create #main #content .order-form #products .table .description, | ||||
.order-update #main #content .order-form #products .table .description { | .order-update #main #content .order-form #products .table .description { | ||||
font-style: italic; | font-style: italic; | ||||
} | } | ||||
/* line 254, ../sass/order/_form.scss */ | |||||
/* line 258, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .recipe, | .order-create #main #content .order-form #products .table .recipe, | ||||
.order-update #main #content .order-form #products .table .recipe { | .order-update #main #content .order-form #products .table .recipe { | ||||
font-size: 12px; | font-size: 12px; | ||||
} | } | ||||
/* line 258, ../sass/order/_form.scss */ | |||||
/* line 262, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .input-group, | .order-create #main #content .order-form #products .table .input-group, | ||||
.order-update #main #content .order-form #products .table .input-group { | .order-update #main #content .order-form #products .table .input-group { | ||||
width: 133px; | width: 133px; | ||||
} | } | ||||
/* line 260, ../sass/order/_form.scss */ | |||||
/* line 264, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .input-group .quantity, | .order-create #main #content .order-form #products .table .input-group .quantity, | ||||
.order-update #main #content .order-form #products .table .input-group .quantity { | .order-update #main #content .order-form #products .table .input-group .quantity { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 265, ../sass/order/_form.scss */ | |||||
/* line 269, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .column-quantity, .order-create #main #content .order-form #products .table .price-unit, .order-create #main #content .order-form #products .table .total, | .order-create #main #content .order-form #products .table .column-quantity, .order-create #main #content .order-form #products .table .price-unit, .order-create #main #content .order-form #products .table .total, | ||||
.order-update #main #content .order-form #products .table .column-quantity, | .order-update #main #content .order-form #products .table .column-quantity, | ||||
.order-update #main #content .order-form #products .table .price-unit, | .order-update #main #content .order-form #products .table .price-unit, | ||||
width: 150px; | width: 150px; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 270, ../sass/order/_form.scss */ | |||||
/* line 274, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table td#total-order, .order-create #main #content .order-form #products .table td#total-order-vrac, .order-create #main #content .order-form #products .table td.total, | .order-create #main #content .order-form #products .table td#total-order, .order-create #main #content .order-form #products .table td#total-order-vrac, .order-create #main #content .order-form #products .table td.total, | ||||
.order-update #main #content .order-form #products .table td#total-order, | .order-update #main #content .order-form #products .table td#total-order, | ||||
.order-update #main #content .order-form #products .table td#total-order-vrac, | .order-update #main #content .order-form #products .table td#total-order-vrac, | ||||
.order-update #main #content .order-form #products .table td.total { | .order-update #main #content .order-form #products .table td.total { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 274, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .epuise, | |||||
.order-update #main #content .order-form #products .table .epuise { | |||||
/* line 278, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .unavailable, | |||||
.order-update #main #content .order-form #products .table .unavailable { | |||||
display: none; | display: none; | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
color: #B32815; | color: #B32815; | ||||
font-size: 16px; | font-size: 16px; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 283, ../sass/order/_form.scss */ | |||||
/* line 287, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .quantity-remaining, | .order-create #main #content .order-form #products .table .quantity-remaining, | ||||
.order-update #main #content .order-form #products .table .quantity-remaining { | .order-update #main #content .order-form #products .table .quantity-remaining { | ||||
font-size: 12px; | font-size: 12px; | ||||
margin-top: 8px; | margin-top: 8px; | ||||
} | } | ||||
/* line 287, ../sass/order/_form.scss */ | |||||
/* line 291, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table .quantity-remaining .nb, | .order-create #main #content .order-form #products .table .quantity-remaining .nb, | ||||
.order-update #main #content .order-form #products .table .quantity-remaining .nb { | .order-update #main #content .order-form #products .table .quantity-remaining .nb { | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 292, ../sass/order/_form.scss */ | |||||
/* line 296, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table td.product, .order-create #main #content .order-form #products .table th.product, | .order-create #main #content .order-form #products .table td.product, .order-create #main #content .order-form #products .table th.product, | ||||
.order-update #main #content .order-form #products .table td.product, | .order-update #main #content .order-form #products .table td.product, | ||||
.order-update #main #content .order-form #products .table th.product { | .order-update #main #content .order-form #products .table th.product { | ||||
width: 70%; | width: 70%; | ||||
} | } | ||||
/* line 296, ../sass/order/_form.scss */ | |||||
/* line 300, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table td.price-unit, .order-create #main #content .order-form #products .table th.price-unit, | .order-create #main #content .order-form #products .table td.price-unit, .order-create #main #content .order-form #products .table th.price-unit, | ||||
.order-update #main #content .order-form #products .table td.price-unit, | .order-update #main #content .order-form #products .table td.price-unit, | ||||
.order-update #main #content .order-form #products .table th.price-unit { | .order-update #main #content .order-form #products .table th.price-unit { | ||||
width: 10%; | width: 10%; | ||||
} | } | ||||
/* line 300, ../sass/order/_form.scss */ | |||||
/* line 304, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table td.column-quantity, .order-create #main #content .order-form #products .table th.column-quantity, | .order-create #main #content .order-form #products .table td.column-quantity, .order-create #main #content .order-form #products .table th.column-quantity, | ||||
.order-update #main #content .order-form #products .table td.column-quantity, | .order-update #main #content .order-form #products .table td.column-quantity, | ||||
.order-update #main #content .order-form #products .table th.column-quantity { | .order-update #main #content .order-form #products .table th.column-quantity { | ||||
width: 10%; | width: 10%; | ||||
} | } | ||||
/* line 304, ../sass/order/_form.scss */ | |||||
/* line 308, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #products .table td.total, .order-create #main #content .order-form #products .table th.total, | .order-create #main #content .order-form #products .table td.total, .order-create #main #content .order-form #products .table th.total, | ||||
.order-update #main #content .order-form #products .table td.total, | .order-update #main #content .order-form #products .table td.total, | ||||
.order-update #main #content .order-form #products .table th.total { | .order-update #main #content .order-form #products .table th.total { | ||||
width: 10%; | width: 10%; | ||||
} | } | ||||
/* line 310, ../sass/order/_form.scss */ | |||||
/* line 314, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed, | .order-create #main #content .order-form #bar-fixed, | ||||
.order-update #main #content .order-form #bar-fixed { | .order-update #main #content .order-form #bar-fixed { | ||||
display: none; | display: none; | ||||
background-color: #F8F1DD; | background-color: #F8F1DD; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 326, ../sass/order/_form.scss */ | |||||
/* line 330, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .container, | .order-create #main #content .order-form #bar-fixed .container, | ||||
.order-update #main #content .order-form #bar-fixed .container { | .order-update #main #content .order-form #bar-fixed .container { | ||||
min-height: auto; | min-height: auto; | ||||
background: none; | background: none; | ||||
border: 0px none; | border: 0px none; | ||||
} | } | ||||
/* line 332, ../sass/order/_form.scss */ | |||||
/* line 336, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed.not-fixed, | .order-create #main #content .order-form #bar-fixed.not-fixed, | ||||
.order-update #main #content .order-form #bar-fixed.not-fixed { | .order-update #main #content .order-form #bar-fixed.not-fixed { | ||||
position: relative; | position: relative; | ||||
border: solid 1px #e0e0e0; | border: solid 1px #e0e0e0; | ||||
padding-right: 20px; | padding-right: 20px; | ||||
} | } | ||||
/* line 339, ../sass/order/_form.scss */ | |||||
/* line 343, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed.not-fixed .container, | .order-create #main #content .order-form #bar-fixed.not-fixed .container, | ||||
.order-update #main #content .order-form #bar-fixed.not-fixed .container { | .order-update #main #content .order-form #bar-fixed.not-fixed .container { | ||||
width: auto; | width: auto; | ||||
} | } | ||||
/* line 345, ../sass/order/_form.scss */ | |||||
/* line 349, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed.no-credit #bloc-valider-commande, | .order-create #main #content .order-form #bar-fixed.no-credit #bloc-valider-commande, | ||||
.order-update #main #content .order-form #bar-fixed.no-credit #bloc-valider-commande { | .order-update #main #content .order-form #bar-fixed.no-credit #bloc-valider-commande { | ||||
margin-top: 0px; | margin-top: 0px; | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 351, ../sass/order/_form.scss */ | |||||
/* line 355, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #total-order-bottom, | .order-create #main #content .order-form #bar-fixed #total-order-bottom, | ||||
.order-update #main #content .order-form #bar-fixed #total-order-bottom { | .order-update #main #content .order-form #bar-fixed #total-order-bottom { | ||||
background-color: white; | background-color: white; | ||||
padding: 5px 25px; | padding: 5px 25px; | ||||
border: solid 1px #e0e0e0; | border: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 358, ../sass/order/_form.scss */ | |||||
/* line 362, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .btn-comment, | .order-create #main #content .order-form #bar-fixed .btn-comment, | ||||
.order-update #main #content .order-form #bar-fixed .btn-comment { | .order-update #main #content .order-form #bar-fixed .btn-comment { | ||||
float: left; | float: left; | ||||
} | } | ||||
/* line 366, ../sass/order/_form.scss */ | |||||
/* line 370, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .btn-comment, | .order-create #main #content .order-form #bar-fixed .btn-comment, | ||||
.order-update #main #content .order-form #bar-fixed .btn-comment { | .order-update #main #content .order-form #bar-fixed .btn-comment { | ||||
margin-right: 10px; | margin-right: 10px; | ||||
} | } | ||||
/* line 370, ../sass/order/_form.scss */ | |||||
/* line 374, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #block-confirm-order, | .order-create #main #content .order-form #bar-fixed #block-confirm-order, | ||||
.order-update #main #content .order-form #bar-fixed #block-confirm-order { | .order-update #main #content .order-form #bar-fixed #block-confirm-order { | ||||
text-align: right; | text-align: right; | ||||
margin-top: 20px; | margin-top: 20px; | ||||
} | } | ||||
/* line 374, ../sass/order/_form.scss */ | |||||
/* line 378, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #block-confirm-order button, | .order-create #main #content .order-form #bar-fixed #block-confirm-order button, | ||||
.order-update #main #content .order-form #bar-fixed #block-confirm-order button { | .order-update #main #content .order-form #bar-fixed #block-confirm-order button { | ||||
width: 340px; | width: 340px; | ||||
margin-right: 10px; | margin-right: 10px; | ||||
} | } | ||||
/* line 380, ../sass/order/_form.scss */ | |||||
/* line 384, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit, | .order-create #main #content .order-form #bar-fixed #checkbox-credit, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit { | .order-update #main #content .order-form #bar-fixed #checkbox-credit { | ||||
float: right; | float: right; | ||||
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 1px rgba(0, 0, 0, 0.075); | -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 1px rgba(0, 0, 0, 0.075); | ||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 1px rgba(0, 0, 0, 0.075); | box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 1px rgba(0, 0, 0, 0.075); | ||||
} | } | ||||
/* line 391, ../sass/order/_form.scss */ | |||||
/* line 395, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit.payment-impossible, | .order-create #main #content .order-form #bar-fixed #checkbox-credit.payment-impossible, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit.payment-impossible { | .order-update #main #content .order-form #bar-fixed #checkbox-credit.payment-impossible { | ||||
background-color: #e0e0e0; | background-color: #e0e0e0; | ||||
} | } | ||||
/* line 395, ../sass/order/_form.scss */ | |||||
/* line 399, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit .info, | .order-create #main #content .order-form #bar-fixed #checkbox-credit .info, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit .info { | .order-update #main #content .order-form #bar-fixed #checkbox-credit .info { | ||||
color: gray; | color: gray; | ||||
font-weight: normal; | font-weight: normal; | ||||
} | } | ||||
/* line 400, ../sass/order/_form.scss */ | |||||
/* line 404, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit .the-credit, | .order-create #main #content .order-form #bar-fixed #checkbox-credit .the-credit, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit .the-credit { | .order-update #main #content .order-form #bar-fixed #checkbox-credit .the-credit { | ||||
background-color: #BB8757; | background-color: #BB8757; | ||||
-webkit-border-radius: 5px; | -webkit-border-radius: 5px; | ||||
border-radius: 5px; | border-radius: 5px; | ||||
} | } | ||||
/* line 407, ../sass/order/_form.scss */ | |||||
/* line 411, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit .amount-paid, | .order-create #main #content .order-form #bar-fixed #checkbox-credit .amount-paid, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit .amount-paid { | .order-update #main #content .order-form #bar-fixed #checkbox-credit .amount-paid { | ||||
color: #BB8757; | color: #BB8757; | ||||
} | } | ||||
/* line 411, ../sass/order/_form.scss */ | |||||
/* line 415, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit #info-credit-empty, | .order-create #main #content .order-form #bar-fixed #checkbox-credit #info-credit-empty, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit #info-credit-empty { | .order-update #main #content .order-form #bar-fixed #checkbox-credit #info-credit-empty { | ||||
font-size: 12px; | font-size: 12px; | ||||
} | } | ||||
/* line 415, ../sass/order/_form.scss */ | |||||
/* line 419, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #checkbox-credit #credit-disabled, | .order-create #main #content .order-form #bar-fixed #checkbox-credit #credit-disabled, | ||||
.order-update #main #content .order-form #bar-fixed #checkbox-credit #credit-disabled { | .order-update #main #content .order-form #bar-fixed #checkbox-credit #credit-disabled { | ||||
display: none; | display: none; | ||||
font-size: 12px; | font-size: 12px; | ||||
} | } | ||||
/* line 421, ../sass/order/_form.scss */ | |||||
/* line 425, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .btn-back, .order-create #main #content .order-form #bar-fixed .cancel-order, | .order-create #main #content .order-form #bar-fixed .btn-back, .order-create #main #content .order-form #bar-fixed .cancel-order, | ||||
.order-update #main #content .order-form #bar-fixed .btn-back, | .order-update #main #content .order-form #bar-fixed .btn-back, | ||||
.order-update #main #content .order-form #bar-fixed .cancel-order { | .order-update #main #content .order-form #bar-fixed .cancel-order { | ||||
float: left; | float: left; | ||||
margin-right: 5px; | margin-right: 5px; | ||||
} | } | ||||
/* line 426, ../sass/order/_form.scss */ | |||||
/* line 430, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .cancel-order, | .order-create #main #content .order-form #bar-fixed .cancel-order, | ||||
.order-update #main #content .order-form #bar-fixed .cancel-order { | .order-update #main #content .order-form #bar-fixed .cancel-order { | ||||
color: #b92c28; | color: #b92c28; | ||||
background-color: white; | background-color: white; | ||||
} | } | ||||
/* line 431, ../sass/order/_form.scss */ | |||||
/* line 435, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed #total-order-bottom, | .order-create #main #content .order-form #bar-fixed #total-order-bottom, | ||||
.order-update #main #content .order-form #bar-fixed #total-order-bottom { | .order-update #main #content .order-form #bar-fixed #total-order-bottom { | ||||
display: none; | display: none; | ||||
font-family: "comfortaalight"; | font-family: "comfortaalight"; | ||||
font-size: 24px; | font-size: 24px; | ||||
} | } | ||||
/* line 438, ../sass/order/_form.scss */ | |||||
/* line 442, ../sass/order/_form.scss */ | |||||
.order-create #main #content .order-form #bar-fixed .field-order-comment, | .order-create #main #content .order-form #bar-fixed .field-order-comment, | ||||
.order-update #main #content .order-form #bar-fixed .field-order-comment { | .order-update #main #content .order-form #bar-fixed .field-order-comment { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 446, ../sass/order/_form.scss */ | |||||
/* line 450, ../sass/order/_form.scss */ | |||||
.order-create .ui-datepicker .ui-widget-header, | .order-create .ui-datepicker .ui-widget-header, | ||||
.order-update .ui-datepicker .ui-widget-header { | .order-update .ui-datepicker .ui-widget-header { | ||||
background: none; | background: none; | ||||
color: black; | color: black; | ||||
font-weight: normal; | font-weight: normal; | ||||
} | } | ||||
/* line 454, ../sass/order/_form.scss */ | |||||
/* line 458, ../sass/order/_form.scss */ | |||||
.order-create .ui-datepicker .ui-datepicker-current-day a, | .order-create .ui-datepicker .ui-datepicker-current-day a, | ||||
.order-create .ui-datepicker a.ui-state-hover, | .order-create .ui-datepicker a.ui-state-hover, | ||||
.order-update .ui-datepicker .ui-datepicker-current-day a, | .order-update .ui-datepicker .ui-datepicker-current-day a, |
$(document).ready(function() { | $(document).ready(function() { | ||||
//chat_scroll() ; | |||||
chat_tabs_gamme_saison() ; | |||||
//chat_slideshow() ; | |||||
$('[data-toggle="tooltip"]').tooltip() ; | $('[data-toggle="tooltip"]').tooltip() ; | ||||
chat_systeme_commande() ; | chat_systeme_commande() ; | ||||
chat_profil_user() ; | chat_profil_user() ; | ||||
function chat_event_click_point_vente(id, force) { | function chat_event_click_point_vente(id, force) { | ||||
if($('.point-vente-'+id).data('code') == 1) { | |||||
if($('.point-sale-'+id).data('code') == 1) { | |||||
$('#modal-code #id-point-vente').val(id) ; | |||||
$('#modal-code #id-point-sale').val(id) ; | |||||
$('#modal-code').modal('show') ; | $('#modal-code').modal('show') ; | ||||
} | } | ||||
else { | else { | ||||
$('#commande-id_point_vente').val(id) ; | |||||
$('#order-id_point_sale').val(id) ; | |||||
$('#points-vente .point-vente').removeClass('selected') ; | |||||
$('.point-vente-'+id).addClass('selected') ; | |||||
$('.point-vente-'+id).hide().fadeIn('fast') ; | |||||
$('#points-sale .point-sale').removeClass('selected') ; | |||||
$('.point-sale-'+id).addClass('selected') ; | |||||
$('.point-sale-'+id).hide().fadeIn('fast') ; | |||||
var pain = parseInt($('.point-vente-'+id).data('pain')) ; | |||||
var vrac = parseInt($('.point-vente-'+id).data('vrac')) ; | |||||
var pain = parseInt($('.point-sale-'+id).data('pain')) ; | |||||
var vrac = parseInt($('.point-sale-'+id).data('vrac')) ; | |||||
if(pain) { | if(pain) { | ||||
$('#pain .table').show() ; | $('#pain .table').show() ; | ||||
$('#vrac .indisponible').show() ; | $('#vrac .indisponible').show() ; | ||||
} | } | ||||
$('#produits, .valider-commande, .btn-commentaire, #bar-fixed').fadeIn() ; | |||||
$('#products, #step-infos-point-sale, .confirm-order, .btn-comment, #bar-fixed').fadeIn() ; | |||||
// credit pain | // credit pain | ||||
chat_systeme_commande_credit_pain_event(chat_systeme_commande_maj_table_prix()) ; | chat_systeme_commande_credit_pain_event(chat_systeme_commande_maj_table_prix()) ; | ||||
// scroll | // scroll | ||||
if(!force) { | if(!force) { | ||||
boulange_scroll('step-infos-pv') ; | |||||
boulange_scroll('step-infos-point-sale') ; | |||||
} | } | ||||
// infos point de vente | // infos point de vente | ||||
$('.infos-pv').hide() ; | |||||
$('.infos-pv-'+id).fadeIn() ; | |||||
$('.infos-point-sale').hide() ; | |||||
$('.infos-point-sale-'+id).fadeIn() ; | |||||
} | } | ||||
} | } | ||||
function chat_init_horaire_point_vente(date) { | function chat_init_horaire_point_vente(date) { | ||||
$('.infos-pv .jour').hide() ; | |||||
var selector_jour = '.infos-pv .jour-'+date.getDay() ; | |||||
$('.infos-point-sale .jour').hide() ; | |||||
var selector_jour = '.infos-point-sale .jour-'+date.getDay() ; | |||||
$(selector_jour).show() ; | $(selector_jour).show() ; | ||||
$('.select-previous-day').unbind('click').click(function() { | $('.select-previous-day').unbind('click').click(function() { | ||||
function chat_systeme_commande() { | function chat_systeme_commande() { | ||||
if($('.commande-form').size()) { | |||||
if($('.order-form').size()) { | |||||
// scroll initial | // scroll initial | ||||
if($('.boulangerie.selected').size()) | |||||
if($('.producer.selected').size()) | |||||
{ | { | ||||
boulange_scroll('step-choix-date') ; | |||||
boulange_scroll('step-date') ; | |||||
} | } | ||||
// affichage des différentes parties du formulaire | // affichage des différentes parties du formulaire | ||||
if(!$('#commande-id_production').val()) { | |||||
$('#depots, #points-vente, #produits, .valider-commande, #info-horaire-retrait-commande, .btn-commentaire, #bar-fixed').hide() ; | |||||
if(!$('#order-id_distribution').val()) { | |||||
$('#block-points-sale, #step-infos-point-sale, #points-sale, #products, .confirm-order, .btn-comment, #bar-fixed').hide() ; | |||||
} | } | ||||
else if(!$('#commande-id_point_vente').val()) { | else if(!$('#commande-id_point_vente').val()) { | ||||
$('#produits, .valider-commande, .btn-commentaire, #bar-fixed').hide() ; | |||||
$('#products, .confirm-order, .btn-comment, #bar-fixed, #has-order-in-progress').hide() ; | |||||
} | } | ||||
// points de vente | // points de vente | ||||
if($('#commande-id_point_vente').val()) | |||||
chat_event_click_point_vente($('#commande-id_point_vente').val(), true) ; | |||||
if($('#order-id_point_sale').val()) { | |||||
chat_event_click_point_vente($('#order-id_point_sale').val(), true) ; | |||||
} | |||||
$('#modal-code form').submit(function() { | $('#modal-code form').submit(function() { | ||||
var id_pv = $('#modal-code #id-point-vente').val() ; | |||||
var id_pv = $('#modal-code #id-point-sale').val() ; | |||||
var code = $('#modal-code #code').val() ; | var code = $('#modal-code #code').val() ; | ||||
$.get(chat_base_url(true)+'commande/verif-code-point-vente',{ | |||||
id_point_vente: id_pv, | |||||
$.get(chat_base_url(true)+'order/validate-code-point-sale',{ | |||||
idPointSale: id_pv, | |||||
code: code | code: code | ||||
}, function(ok) { | }, function(ok) { | ||||
if(ok) { | if(ok) { | ||||
$('.point-vente-'+id_pv).data('code',0) ; | |||||
$('.point-vente-'+id_pv+' .glyphicon').remove() ; | |||||
$('input[name="code_point_vente_'+id_pv+'"]').val(code) ; | |||||
$('.point-sale-'+id_pv).data('code',0) ; | |||||
$('.point-sale-'+id_pv+' .glyphicon').remove() ; | |||||
$('input[name="code_point_sale_'+id_pv+'"]').val(code) ; | |||||
$('#modal-code').modal('hide') ; | $('#modal-code').modal('hide') ; | ||||
chat_event_click_point_vente($('#modal-code #id-point-vente').val()) ; | |||||
chat_event_click_point_vente($('#modal-code #id-point-sale').val()) ; | |||||
} | } | ||||
else { | else { | ||||
$('#modal-code .field-code').addClass('has-error') ; | $('#modal-code .field-code').addClass('has-error') ; | ||||
return false ; | return false ; | ||||
}) ; | }) ; | ||||
$('#points-vente .point-vente').click(function() { | |||||
$('#points-sale .point-sale').click(function() { | |||||
var id = parseInt($(this).find('.id').html()) ; | var id = parseInt($(this).find('.id').html()) ; | ||||
chat_event_click_point_vente(id) ; | chat_event_click_point_vente(id) ; | ||||
}) ; | }) ; | ||||
//var var_datepicker = $.datepicker ; | //var var_datepicker = $.datepicker ; | ||||
$('#datepicker-production').datepicker({ | |||||
$('#datepicker-distribution').datepicker({ | |||||
beforeShowDay: function(date){ | beforeShowDay: function(date){ | ||||
var string = $.datepicker.formatDate('dd/mm/yy', date); | var string = $.datepicker.formatDate('dd/mm/yy', date); | ||||
}, | }, | ||||
onSelect: function(selectedDate) { | onSelect: function(selectedDate) { | ||||
$('.infos-pv').hide() ; | |||||
$('.infos-points-sale').hide() ; | |||||
// on remet tout les prix à zéro | // on remet tout les prix à zéro | ||||
chat_systeme_commande_reset_table_prix() ; | chat_systeme_commande_reset_table_prix() ; | ||||
$('#has-commande-en-cours').hide() ; | |||||
$('#has-order-in-progress').hide() ; | |||||
var tab_date = selectedDate.split('/') ; | var tab_date = selectedDate.split('/') ; | ||||
var date = new Date(tab_date[2],tab_date[1]-1,tab_date[0]) ; | var date = new Date(tab_date[2],tab_date[1]-1,tab_date[0]) ; | ||||
var id_production = 0 ; | var id_production = 0 ; | ||||
$('#dates div .date').each(function() { | $('#dates div .date').each(function() { | ||||
if($(this).html() == selectedDate) { | if($(this).html() == selectedDate) { | ||||
id_production = $(this).parent().find('.id_production').html() ; | |||||
id_production = $(this).parent().find('.id_distribution').html() ; | |||||
} | } | ||||
}); | }); | ||||
$('#commande-id_production').val(id_production) ; | |||||
$('#order-id_distribution').val(id_production) ; | |||||
// verif si le gars a une commande en cours pour cette production | // verif si le gars a une commande en cours pour cette production | ||||
var has_commande_en_cours = false ; | var has_commande_en_cours = false ; | ||||
$('#commandes-en-cours .commande').each(function() { | |||||
if($(this).data('idproduction') == id_production) { | |||||
$('#orders-in-progress .order').each(function() { | |||||
if($(this).data('iddistribution') == id_production) { | |||||
//alert('bada') ; | //alert('bada') ; | ||||
$('#has-commande-en-cours a').attr('href',$(this).data('href')) ; | |||||
$('#has-commande-en-cours').show() ; | |||||
$('#has-order-in-progress a').attr('href',$(this).data('href')) ; | |||||
$('#has-order-in-progress').show() ; | |||||
has_commande_en_cours = true ; | has_commande_en_cours = true ; | ||||
$('#depots, #points-vente, #produits, #info-horaire-retrait-commande').hide() ; | |||||
$('#block-points-sale, #step-infos-point-sale, #points-sale, #products, #bar-fixed').hide() ; | |||||
} | } | ||||
}) ; | }) ; | ||||
chat_systeme_commande_produits_dispos(tab_date[2]+'-'+tab_date[1]+'-'+tab_date[0], date) ; | chat_systeme_commande_produits_dispos(tab_date[2]+'-'+tab_date[1]+'-'+tab_date[0], date) ; | ||||
$('#produits, .valider-commande, .btn-commentaire, #bar-fixed').hide() ; | |||||
$('#products, .confirm-order, .btn-comment, #bar-fixed').hide() ; | |||||
// déselection points de vente | // déselection points de vente | ||||
$('#points-vente .point-vente').removeClass('selected') ; | |||||
$('#commande-id_point_vente').val('') ; | |||||
$('#points-sale .point-sale').removeClass('selected') ; | |||||
$('#order-id_point_sale').val('') ; | |||||
// affichage points de vente | // affichage points de vente | ||||
$('#depots, #points-vente, #info-horaire-retrait-commande').fadeIn() ; | |||||
$('#block-points-sale, #points-sale, #order-infos').fadeIn() ; | |||||
// scroll | // scroll | ||||
boulange_scroll('step-choix-depot') ; | |||||
boulange_scroll('step-point-sale') ; | |||||
} | } | ||||
} | } | ||||
}) ; | }) ; | ||||
if($('#commande-id_production').val()) { | |||||
$("#dates .id_production").each(function() { | |||||
if($(this).html() == $('#commande-id_production').val()) { | |||||
if($('#order-id_distribution').val()) { | |||||
$("#dates .id_distribution").each(function() { | |||||
if($(this).html() == $('#order-id_distribution').val()) { | |||||
var tab_date = $(this).parent().find('.date').html().split('/') ; | var tab_date = $(this).parent().find('.date').html().split('/') ; | ||||
var date = new Date(tab_date[2],tab_date[1]-1,tab_date[0]); | var date = new Date(tab_date[2],tab_date[1]-1,tab_date[0]); | ||||
$('#datepicker-production').datepicker('setDate',date) ; | |||||
$('#datepicker-distribution').datepicker('setDate',date) ; | |||||
chat_systeme_commande_produits_dispos(tab_date[2]+'-'+tab_date[1]+'-'+tab_date[0], date) ; | chat_systeme_commande_produits_dispos(tab_date[2]+'-'+tab_date[1]+'-'+tab_date[0], date) ; | ||||
chat_init_horaire_point_vente(date) ; | chat_init_horaire_point_vente(date) ; | ||||
} | } | ||||
// tableau produits | // tableau produits | ||||
$('.commande-form .move-quantity').click(function() { | |||||
$('.order-form .move-quantity').click(function() { | |||||
var vrac = ($(this).parent().parent().parent().parent().parent().parent().parent().attr('id') == 'vrac') ; | var vrac = ($(this).parent().parent().parent().parent().parent().parent().parent().attr('id') == 'vrac') ; | ||||
if(vrac) { | if(vrac) { | ||||
var quantite = parseInt($(this).parent().parent().find('input.quantity').val()) ; | var quantite = parseInt($(this).parent().parent().find('input.quantity').val()) ; | ||||
if($(this).hasClass('moins') && quantite != 0) | |||||
if($(this).hasClass('minus') && quantite != 0) | |||||
quantite -= 500 ; | quantite -= 500 ; | ||||
if($(this).hasClass('plus')) | if($(this).hasClass('plus')) | ||||
quantite += 500 ; | quantite += 500 ; | ||||
}) ; | }) ; | ||||
var quantite = parseInt($(this).parent().parent().find('input.quantity').val()) ; | var quantite = parseInt($(this).parent().parent().find('input.quantity').val()) ; | ||||
var quantite_restante = parseInt($(this).parent().parent().parent().find('.quantite-restante .nb').html()) ; | |||||
var quantite_max = $(this).parent().parent().parent().parent().data('quantite-max') ; | |||||
var quantite_restante = parseInt($(this).parent().parent().parent().find('.quantity-remaining .nb').html()) ; | |||||
var quantite_max = $(this).parent().parent().parent().parent().data('quantity-max') ; | |||||
var no_limit = $(this).parent().parent().parent().parent().data('no-limit') ; | var no_limit = $(this).parent().parent().parent().parent().data('no-limit') ; | ||||
if($(this).hasClass('moins') && quantite != 0) { | |||||
if($(this).hasClass('minus') && quantite != 0) { | |||||
quantite -- ; | quantite -- ; | ||||
quantite_restante ++ ; | quantite_restante ++ ; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$(this).parent().parent().parent().find('.quantite-restante .nb').html(quantite_restante) ; | |||||
$(this).parent().parent().parent().find('.quantity-remaining .nb').html(quantite_restante) ; | |||||
if(quantite_restante <= 5 && quantite_restante > 0) { | if(quantite_restante <= 5 && quantite_restante > 0) { | ||||
$(this).parent().parent().parent().find('.quantite-restante').fadeIn() ; | |||||
$(this).parent().parent().parent().find('.quantity-remaining').fadeIn() ; | |||||
} | } | ||||
else { | else { | ||||
$(this).parent().parent().parent().find('.quantite-restante').hide() ; | |||||
$(this).parent().parent().parent().find('.quantity-remaining').hide() ; | |||||
} | } | ||||
if(quantite_restante == 0 && !no_limit) { | if(quantite_restante == 0 && !no_limit) { | ||||
$(this).parent().parent().parent().find('.epuise').fadeIn() ; | |||||
$(this).parent().parent().parent().find('.unavailable').fadeIn() ; | |||||
} | } | ||||
else { | else { | ||||
$(this).parent().parent().parent().find('.epuise').hide() ; | |||||
$(this).parent().parent().parent().find('.unavailable').hide() ; | |||||
} | } | ||||
$(this).parent().parent().find('input.quantity').val(quantite) ; | $(this).parent().parent().find('input.quantity').val(quantite) ; | ||||
} | } | ||||
// commentaire commande | // commentaire commande | ||||
$('.commande-form .btn-commentaire').click(function() { | |||||
if($('.field-commande-commentaire').css('display') == 'none') { | |||||
$('.field-commande-commentaire').slideDown() ; | |||||
$('.order-form .btn-comment').click(function() { | |||||
if($('.field-order-comment').css('display') == 'none') { | |||||
$('.field-order-comment').slideDown() ; | |||||
} | } | ||||
else { | else { | ||||
$('.field-commande-commentaire').slideUp() ; | |||||
$('.field-order-comment').slideUp() ; | |||||
} | } | ||||
return false ; | return false ; | ||||
}) ; | }) ; | ||||
if($('#bar-fixed').size()) { | if($('#bar-fixed').size()) { | ||||
$(window).scroll(function (event) { | $(window).scroll(function (event) { | ||||
var scroll = $(window).scrollTop() + $(window).height(); | var scroll = $(window).scrollTop() + $(window).height(); | ||||
var pos_bottom_produits = $('#table-produits').offset().top + $('#table-produits').height() + 100 ; | |||||
var pos_bottom_produits = $('#table-products').offset().top + $('#table-products').height() + 100 ; | |||||
if($(window).height() < 1000) { | |||||
if($(window).height() < 700) { | |||||
if(!$('#bar-fixed').hasClass('not-fixed')) { | if(!$('#bar-fixed').hasClass('not-fixed')) { | ||||
$('#bar-fixed').addClass('not-fixed') ; | $('#bar-fixed').addClass('not-fixed') ; | ||||
} | } | ||||
$('#bar-fixed').removeClass('not-fixed') ; | $('#bar-fixed').removeClass('not-fixed') ; | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
} | } | ||||
function chat_systeme_commande_produits_dispos(str_date, date) { | function chat_systeme_commande_produits_dispos(str_date, date) { | ||||
// produits dispos à la vente à cette date | // produits dispos à la vente à cette date | ||||
$.get(chat_base_url(true)+'commande/infos-production',{ | |||||
id_production: $('#commande-id_production').val() | |||||
$.get(chat_base_url(true)+'order/infos-distribution',{ | |||||
idDistribution: $('#order-id_distribution').val() | |||||
}, function(data) { | }, function(data) { | ||||
if(data.produits_dispos) { | |||||
$.each(data.produits_dispos, function( id_produit, produit ) { | |||||
if(data.products) { | |||||
$.each(data.products, function( id_produit, produit ) { | |||||
if(produit.actif) $('.produit-'+id_produit).show() ; | |||||
else $('.produit-'+id_produit).hide() ; | |||||
if(produit.active) $('.product-'+id_produit).show() ; | |||||
else $('.product-'+id_produit).hide() ; | |||||
var quantite_restante = produit.quantite_max - produit.quantite_commandee ; | |||||
var quantite_restante = produit.quantity_max - produit.quantity_order ; | |||||
var no_limit = 0 ; | var no_limit = 0 ; | ||||
if(!produit.quantite_max) | |||||
if(!produit.quantity_max) | |||||
no_limit = 1 ; | no_limit = 1 ; | ||||
$('.produit-'+id_produit).attr('data-no-limit',no_limit) ; | |||||
$('.produit-'+id_produit).attr('data-quantite-max',produit.quantite_max) ; | |||||
$('.produit-'+id_produit+' .quantite-restante .nb').html(quantite_restante) ; | |||||
$('.product-'+id_produit).attr('data-no-limit',no_limit) ; | |||||
$('.product-'+id_produit).attr('data-quantity-max',produit.quantity_max) ; | |||||
$('.product-'+id_produit+' .quantity-remaining .nb').html(quantite_restante) ; | |||||
if(produit.quantite_max && (!quantite_restante || quantite_restante < 0 || produit.epuise)) { | |||||
$('.produit-'+id_produit+' .epuise').show() ; | |||||
if(produit.quantity_max && (!quantite_restante || quantite_restante < 0 || produit.unavailable)) { | |||||
$('.product-'+id_produit+' .unavailable').show() ; | |||||
if(!$('#id-commande').val() && $('.produit-'+id_produit+' .quantity').val() == 0) | |||||
if(!$('#id-order').val() && $('.product-'+id_produit+' .quantity').val() == 0) | |||||
{ | { | ||||
$('.produit-'+id_produit+' .quantite-restante').hide() ; | |||||
$('.produit-'+id_produit+' .input-group').hide() ; | |||||
$('.product-'+id_produit+' .quantity-remaining').hide() ; | |||||
$('.product-'+id_produit+' .input-group').hide() ; | |||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$('.produit-'+id_produit+' .epuise').hide() ; | |||||
$('.produit-'+id_produit+' .input-group').show() ; | |||||
$('.produit-'+id_produit+' .quantite-restante .nb').html(quantite_restante) ; | |||||
$('.product-'+id_produit+' .unavailable').hide() ; | |||||
$('.product-'+id_produit+' .input-group').show() ; | |||||
$('.product-'+id_produit+' .quantity-remaining .nb').html(quantite_restante) ; | |||||
} | } | ||||
if($('.produit-'+id_produit+' .quantite-restante').size()) { | |||||
if(parseInt($('.produit-'+id_produit+' .quantite-restante .nb').html()) > 5 || | |||||
parseInt($('.produit-'+id_produit+' .quantite-restante .nb').html()) <= 0) { | |||||
$('.produit-'+id_produit+' .quantite-restante').hide() ; | |||||
if($('.product-'+id_produit+' .quantity-remaining').size()) { | |||||
if(parseInt($('.product-'+id_produit+' .quantity-remaining .nb').html()) > 5 || | |||||
parseInt($('.product-'+id_produit+' .quantity-remaining .nb').html()) <= 0) { | |||||
$('.product-'+id_produit+' .quantity-remaining').hide() ; | |||||
} | } | ||||
else { | else { | ||||
$('.produit-'+id_produit+' .quantite-restante').show() ; | |||||
$('.product-'+id_produit+' .quantity-remaining').show() ; | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
$('#points-vente .point-vente').hide() ; | |||||
$('#points-sale .point-sale').hide() ; | |||||
// init affichage points de vente | // init affichage points de vente | ||||
$.each(data.points_vente, function(key, livraison) { | |||||
console.log(key+' | '+livraison) ; | |||||
$.each(data.points_sale, function(key, livraison) { | |||||
if(livraison) { | if(livraison) { | ||||
$('.point-vente-'+key).fadeIn() ; | |||||
$('.point-sale-'+key).fadeIn() ; | |||||
} | } | ||||
else { | else { | ||||
$('.point-vente-'+key).hide() ; | |||||
$('.point-sale-'+key).hide() ; | |||||
} | } | ||||
}) ; | }) ; | ||||
} | } | ||||
function chat_systeme_commande_reset_table_prix() { | function chat_systeme_commande_reset_table_prix() { | ||||
$('#table-produits tr .colonne-quantite .quantity').each(function() { | |||||
$('#table-products tr .column-quantity .quantity').each(function() { | |||||
$(this).val(0) ; | $(this).val(0) ; | ||||
}) ; | }) ; | ||||
chat_systeme_commande_maj_table_prix() ; | chat_systeme_commande_maj_table_prix() ; | ||||
// produits pain | // produits pain | ||||
var prix = 0 ; | var prix = 0 ; | ||||
$('.commande-form #table-produits tbody tr').each(function() { | |||||
$('.order-form #table-products tbody tr').each(function() { | |||||
var quantite = parseInt($(this).find('.quantity').val()) ; | var quantite = parseInt($(this).find('.quantity').val()) ; | ||||
var prix_produit = parseFloat($(this).find('.prix').html()) ; | |||||
var prix_produit = parseFloat($(this).find('.price').html()) ; | |||||
var prix_total_produit = quantite * prix_produit ; | var prix_total_produit = quantite * prix_produit ; | ||||
if(prix_total_produit) | if(prix_total_produit) | ||||
prix += prix_total_produit ; | prix += prix_total_produit ; | ||||
}) ; | }) ; | ||||
$('#total-commande strong').html(formate_prix(prix)+' €') ; | |||||
$('#total-order strong').html(formate_prix(prix)+' €') ; | |||||
var prix_global = prix ; | var prix_global = prix ; | ||||
// produits vrac | // produits vrac | ||||
var prix = 0 ; | var prix = 0 ; | ||||
$('.commande-form #table-produits-vrac tbody tr').each(function() { | |||||
$('.order-form #table-products-vrac tbody tr').each(function() { | |||||
var quantite = parseInt($(this).find('.quantity').val()) ; | var quantite = parseInt($(this).find('.quantity').val()) ; | ||||
var prix_produit = parseFloat($(this).find('.prix').html()) ; | |||||
var prix_produit = parseFloat($(this).find('.price').html()) ; | |||||
var prix_total_produit = quantite/1000 * prix_produit ; | var prix_total_produit = quantite/1000 * prix_produit ; | ||||
if(prix_total_produit) | if(prix_total_produit) | ||||
prix += prix_total_produit ; | prix += prix_total_produit ; | ||||
}) ; | }) ; | ||||
$('#total-commande-vrac strong').html(formate_prix(prix)+' €') ; | |||||
$('#total-order-vrac strong').html(formate_prix(prix)+' €') ; | |||||
prix_global += prix ; | prix_global += prix ; | ||||
$('#total-commande-bottom span').html(formate_prix(prix_global)) ; | |||||
$('#total-order-bottom span').html(formate_prix(prix_global)) ; | |||||
if(prix_global) | if(prix_global) | ||||
$('#total-commande-bottom').fadeIn() ; | |||||
$('#total-order-bottom').fadeIn() ; | |||||
else | else | ||||
$('#total-commande-bottom').hide() ; | |||||
$('#total-order-bottom').hide() ; | |||||
// maj credit pain | // maj credit pain | ||||
chat_systeme_commande_credit_pain_event(prix_global) ; | chat_systeme_commande_credit_pain_event(prix_global) ; | ||||
} | } | ||||
function chat_systeme_commande_credit_pain() { | function chat_systeme_commande_credit_pain() { | ||||
$('input[name=credit_pain]').change(function() { | |||||
$('input[name=credit]').change(function() { | |||||
var prix_global = chat_systeme_commande_maj_table_prix() ; | var prix_global = chat_systeme_commande_maj_table_prix() ; | ||||
chat_systeme_commande_credit_pain_event(prix_global) ; | chat_systeme_commande_credit_pain_event(prix_global) ; | ||||
}) ; | }) ; | ||||
function chat_systeme_commande_credit_pain_event(prix_global) { | function chat_systeme_commande_credit_pain_event(prix_global) { | ||||
var html = '' ; | var html = '' ; | ||||
var use_credit_pain = $('input[name=credit_pain]').prop('checked') ; | |||||
var use_credit_pain = $('input[name=credit]').prop('checked') ; | |||||
var credit_pain = parseFloat($('#montant-credit-pain').val()) ; | |||||
var credit_pain = parseFloat($('#montant-credit').val()) ; | |||||
var credit_pain_dispo = credit_pain ; | var credit_pain_dispo = credit_pain ; | ||||
var montant_paye = 0 | var montant_paye = 0 | ||||
if($('#montant-paye').size() && $('#montant-paye').val()) | |||||
montant_paye = parseFloat($('#montant-paye').val()) ; | |||||
if($('#amount-paid').size() && $('#amount-paid').val()) | |||||
montant_paye = parseFloat($('#amount-paid').val()) ; | |||||
if($('#id-commande').size() && $('#id-commande').val()) { | |||||
if($('#id-order').size() && $('#id-order').val()) { | |||||
credit_pain_dispo = credit_pain + montant_paye ; | credit_pain_dispo = credit_pain + montant_paye ; | ||||
} | } | ||||
var credit_pain_active = $('.point-vente.selected').data('credit-pain') ; | |||||
var credit_pain_active = $('.point-sale.selected').data('credit') ; | |||||
if(credit_pain_active || montant_paye) { | if(credit_pain_active || montant_paye) { | ||||
$('#checkbox-credit-pain #info-credit-vide').show() ; | |||||
$('#checkbox-credit-pain label').show() ; | |||||
$('#checkbox-credit-pain #credit-pain-disabled').hide() ; | |||||
$('#checkbox-credit #info-credit-empty').show() ; | |||||
$('#checkbox-credit label').show() ; | |||||
$('#checkbox-credit #credit-disabled').hide() ; | |||||
if(prix_global > credit_pain_dispo) { | if(prix_global > credit_pain_dispo) { | ||||
var reste_payer = prix_global - credit_pain_dispo ; | var reste_payer = prix_global - credit_pain_dispo ; | ||||
if(use_credit_pain) { | if(use_credit_pain) { | ||||
if(montant_paye) { | if(montant_paye) { | ||||
html += '<span class="montant-paye">'+montant_paye+' € déjà payé</span><br />' ; | |||||
html += '<span class="amount-paid">'+montant_paye+' € déjà payé</span><br />' ; | |||||
} | } | ||||
html += '<strong>'+credit_pain+' €</strong> seront débités<br />' ; | html += '<strong>'+credit_pain+' €</strong> seront débités<br />' ; | ||||
html += 'Restera <strong>'+reste_payer+' €</strong> à payer à la boulangerie' ; | html += 'Restera <strong>'+reste_payer+' €</strong> à payer à la boulangerie' ; | ||||
$('#checkbox-credit-pain .info').html(html) ; | |||||
$('#checkbox-credit .info').html(html) ; | |||||
} | } | ||||
else { | else { | ||||
$('#checkbox-credit-pain .info').html('') ; | |||||
$('#checkbox-credit .info').html('') ; | |||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$('#checkbox-credit-pain').removeClass('paiement-impossible') ; | |||||
$('input[name=credit_pain]').removeAttr('disabled') ; | |||||
$('#checkbox-credit').removeClass('payment-impossible') ; | |||||
$('input[name=credit]').removeAttr('disabled') ; | |||||
if(use_credit_pain) { | if(use_credit_pain) { | ||||
var html = '' ; | var html = '' ; | ||||
// à payer | // à payer | ||||
{ | { | ||||
montant = prix_global - montant_paye ; | montant = prix_global - montant_paye ; | ||||
if(montant_paye) { | if(montant_paye) { | ||||
html += '<span class="montant-paye">'+montant_paye+' € déjà payé</span><br />' ; | |||||
html += '<span class="amount-paid">'+montant_paye+' € déjà payé</span><br />' ; | |||||
} | } | ||||
html += '<strong>'+montant+' €</strong> seront débités' ; | html += '<strong>'+montant+' €</strong> seront débités' ; | ||||
$('#checkbox-credit-pain .info').html(html) ; | |||||
$('#checkbox-credit .info').html(html) ; | |||||
} | } | ||||
// remboursé | // remboursé | ||||
else if(prix_global < montant_paye) { | else if(prix_global < montant_paye) { | ||||
montant = montant_paye - prix_global ; | montant = montant_paye - prix_global ; | ||||
if(montant_paye) { | if(montant_paye) { | ||||
html += '<span class="montant-paye">'+montant_paye+' € déjà payé</span><br />' ; | |||||
html += '<span class="amount-paid">'+montant_paye+' € déjà payé</span><br />' ; | |||||
} | } | ||||
html += '<strong>'+montant+' €</strong> seront remboursés' ; | html += '<strong>'+montant+' €</strong> seront remboursés' ; | ||||
$('#checkbox-credit-pain .info').html(html) ; | |||||
$('#checkbox-credit .info').html(html) ; | |||||
} | } | ||||
else { | else { | ||||
if(montant_paye > 0) | if(montant_paye > 0) | ||||
$('#checkbox-credit-pain .info').html('<span class="montant-paye">'+montant_paye+' € déjà payé</span>') ; | |||||
$('#checkbox-credit .info').html('<span class="amount-paid">'+montant_paye+' € déjà payé</span>') ; | |||||
else | else | ||||
$('#checkbox-credit-pain .info').html('') ; | |||||
$('#checkbox-credit .info').html('') ; | |||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$('#checkbox-credit-pain .info').html('') | |||||
$('#checkbox-credit .info').html('') | |||||
} | } | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$('#checkbox-credit-pain #info-credit-vide').hide() ; | |||||
$('#checkbox-credit-pain label').hide() ; | |||||
$('#checkbox-credit-pain #credit-pain-disabled').show() ; | |||||
$('#checkbox-credit #info-credit-empty').hide() ; | |||||
$('#checkbox-credit label').hide() ; | |||||
$('#checkbox-credit #credit-disabled').show() ; | |||||
} | } | ||||
} | } | ||||
}) ; | }) ; | ||||
} | } | ||||
function chat_tabs_gamme_saison() { | |||||
$('#tab-gamme-saison a').click(function (e) { | |||||
e.preventDefault(); | |||||
$(this).tab('show'); | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
.infos-point-sale { | |||||
.infos-points-sale { | |||||
display: none; | display: none; | ||||
margin-top: 15px ; | margin-top: 15px ; | ||||
#products { | #products { | ||||
margin-top: 15px ; | margin-top: 15px ; | ||||
.alert.unavailable { | |||||
display: none ; | |||||
} | |||||
#label-products { | #label-products { | ||||
display: block ; | display: block ; | ||||
margin-bottom: 5px ; | margin-bottom: 5px ; | ||||
text-align: center ; | text-align: center ; | ||||
} | } | ||||
.epuise { | |||||
.unavailable { | |||||
display: none ; | display: none ; | ||||
text-transform: uppercase ; | text-transform: uppercase ; | ||||
color: #B32815 ; | color: #B32815 ; |