Browse Source

Correction bug base url ajax

dev
keun 6 years ago
parent
commit
d7a024d69e
2 changed files with 14 additions and 19 deletions
  1. +3
    -1
      backend/views/layouts/main.php
  2. +11
    -18
      backend/web/js/lechatdesnoisettes.js

+ 3
- 1
backend/views/layouts/main.php View File

@@ -16,7 +16,9 @@ use common\helpers\Url;
\common\assets\CommonAsset::register($this);
\backend\assets\AppAsset::register($this);

$producer = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
$producer = null ;
if(!Yii::$app->user->isGuest)
$producer = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;

?>
<?php $this->beginPage() ?>

+ 11
- 18
backend/web/js/lechatdesnoisettes.js View File

@@ -20,7 +20,8 @@ $(document).ready(function() {

var UrlManager = {
getBaseUrl: function() {
return $('meta[name=baseurl]').attr('content') ;
var base_url = $('meta[name=baseurl]').attr('content')+'/' ;
return base_url ;
}
};

@@ -51,8 +52,7 @@ function chat_index_commandes_points_vente_livraison() {
if($(this).prop('checked'))
livraison = 1 ;

$.get('index.php',{
r: 'commande/ajax-point-vente-livraison',
$.get(UrlManager.getBaseUrl()+'commande/ajax-point-vente-livraison',{
id_production: arr_val[0],
id_point_vente: arr_val[1],
bool_livraison: livraison
@@ -196,8 +196,7 @@ function chat_index_commandes_points_vente() {
var id_commande = $(this).data('id-commande') ;
$(this).attr('disabled', 'disabled') ;

$.get('index.php',{
r: 'commande/ajax-delete',
$.get(UrlManager.getBaseUrl()+'commande/ajax-delete',{
date: $('#date-production').val(),
id_commande: id_commande
}, function(data) {
@@ -255,8 +254,7 @@ function chat_index_commandes_points_vente() {

$(this).attr('disabled', 'disabled') ;

$.get('index.php',{
r: 'commande/ajax-create',
$.get(UrlManager.getBaseUrl()+'commande/ajax-create',{
date: $('#date-production').val(),
id_pv: id_pv,
id_user: $('#point-vente-'+id_pv+' .user-id').val(),
@@ -292,8 +290,7 @@ function chat_index_commandes_points_vente() {
var id_commande = $(this).data('id-commande') ;

$(this).attr('disabled', 'disabled') ;
$.get('index.php',{
r: 'commande/ajax-update',
$.get(UrlManager.getBaseUrl()+'commande/ajax-update',{
id_commande: id_commande,
produits: JSON.stringify(tab_produits),
date: $('#date-production').val(),
@@ -359,8 +356,7 @@ function chat_index_commandes_points_vente() {
}

function chat_index_commandes_maj_total_commandes() {
$.get('index.php',{
r: 'commande/ajax-total-commandes',
$.get(UrlManager.getBaseUrl()+'commande/ajax-total-commandes',{
date: $('#date-production').val()
}, function(data) {
$('#bloc-totaux').html(data.html_totaux) ;
@@ -545,8 +541,7 @@ function chat_index_commandes_affiche_commande(id_pv, id_commande) {
$('#point-vente-'+id_pv+' .tr-total').show() ;

// paiement
$.get('index.php',{
r: 'commande/statut-paiement',
$.get(UrlManager.getBaseUrl()+'commande/statut-paiement',{
id_commande: id_commande
}, function(data) {
$('#point-vente-'+id_pv+' .bloc-commande .td-paiement').html(data.html_statut_paiement) ;
@@ -562,8 +557,7 @@ function chat_index_commandes_affiche_commande(id_pv, id_commande) {
function chat_index_commandes_boutons_paiement(id_pv, id_commande) {
// boutons paiement/remboursement
$('#point-vente-'+id_pv+' .payer, #point-vente-'+id_pv+' .rembourser').click(function() {
$.get('index.php',{
r: 'commande/paiement',
$.get(UrlManager.getBaseUrl()+'commande/paiement',{
id_commande: id_commande,
type: $(this).data('type'),
montant: $(this).data('montant')
@@ -625,8 +619,7 @@ function chat_ordre_produits() {
}) ;
console.log(tab_ordre) ;
$.get('index.php',{
r: 'produit/ordre',
$.get(UrlManager.getBaseUrl()+'produit/ordre',{
tab: JSON.stringify(tab_ordre)
}) ;
}
@@ -662,7 +655,7 @@ function chat_email_masse_send() {
$('input[name=id_user]').val(user.data('id')) ;
$.post('index.php?r=user/mail',$('#email-masse-form').serialize(), function(retour) {
$.post(UrlManager.getBaseUrl()+'user/mail',$('#email-masse-form').serialize(), function(retour) {
user.removeClass('label-default').addClass('label-success') ;
setTimeout("chat_email_masse_send()",30000) ;
}) ;

Loading…
Cancel
Save