Browse Source

[Administration et Espace producteur] Calendrier pour le choix du jour de distribution : lundi en premier #166

feature/souke
Guillaume 1 year ago
parent
commit
ee78b907b0
7 changed files with 30 additions and 26 deletions
  1. +3
    -3
      backend/views/distribution/index.php
  2. +1
    -6
      backend/web/js/vuejs/distribution-index.js
  3. +4
    -1
      common/assets/CommonAsset.php
  4. +2
    -0
      common/web/js/vuejs/vcalendar/v-calendar.umd.min.js
  5. +5
    -0
      producer/controllers/OrderController.php
  6. +3
    -7
      producer/views/order/order.php
  7. +12
    -9
      producer/web/js/vuejs/order-order.js

+ 3
- 3
backend/views/distribution/index.php View File

<div id="wrapper-app-distribution-index" :class="'wrapper-app-vuejs '+(loading ? '' : 'loaded')"> <div id="wrapper-app-distribution-index" :class="'wrapper-app-vuejs '+(loading ? '' : 'loaded')">
<div class="col-md-4"> <div class="col-md-4">
<div id="calendar"> <div id="calendar">
<v-date-picker
<v-calendar
is-inline is-inline
is-expanded is-expanded
v-model="date" v-model="date"
popover-visibility="hidden" popover-visibility="hidden"
firstDayOfWeek="1"
color="green"
:mode="calendar.mode" :mode="calendar.mode"
:formats="calendar.formats" :formats="calendar.formats"
:theme-styles="calendar.themeStyles" :theme-styles="calendar.themeStyles"
:attributes="calendar.attrs" :attributes="calendar.attrs"
@dayclick='dayClicked'> @dayclick='dayClicked'>
></v-date-picker>
></v-calendar>
</div> </div>
<div class="clr"></div> <div class="clr"></div>
</div> </div>

+ 1
- 6
backend/web/js/vuejs/distribution-index.js View File

if(distributions.length) { if(distributions.length) {
for(var i= 0; i < distributions.length; i++) { for(var i= 0; i < distributions.length; i++) {
app.calendar.attrs.push({ app.calendar.attrs.push({
highlight: {
backgroundColor: '#5cb85c',
},
contentStyle: {
color: 'white',
},
highlight: true,
dates: distributions[i].date dates: distributions[i].date
}) ; }) ;
} }

+ 4
- 1
common/assets/CommonAsset.php View File

$this->addAsset('js','js/promise-polyfill/promise.min.js'); $this->addAsset('js','js/promise-polyfill/promise.min.js');
$this->addAsset('js','js/axios/axios.min.js'); $this->addAsset('js','js/axios/axios.min.js');
$this->addAsset('js','js/vuejs/vue.js'); $this->addAsset('js','js/vuejs/vue.js');
$this->addAsset('js','js/vuejs/vcalendar/vcalendar.min.js') ;

// Documentation : https://vcalendar.io/
$this->addAsset('js','js/vuejs/vcalendar/v-calendar.umd.min.js') ;

$this->addAsset('js','js/utils.js') ; $this->addAsset('js','js/utils.js') ;
} }
} }

+ 2
- 0
common/web/js/vuejs/vcalendar/v-calendar.umd.min.js
File diff suppressed because it is too large
View File


+ 5
- 0
producer/controllers/OrderController.php View File



if (is_array($ordersUserArray) && count($ordersUserArray)) { if (is_array($ordersUserArray) && count($ordersUserArray)) {
foreach ($ordersUserArray as &$order) { foreach ($ordersUserArray as &$order) {
$orderManager->initOrder($order);
$order = array_merge($order->getAttributes(), [ $order = array_merge($order->getAttributes(), [
'amount_total' => $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL), 'amount_total' => $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL),
'date_distribution' => $order->distribution->date, 'date_distribution' => $order->distribution->date,
} }
} }


if($orderUser) {
$orderManager->initOrder($orderUser);
}

return $orderUser; return $orderUser;
} }
} }

+ 3
- 7
producer/views/order/order.php View File

<div id="calendar"> <div id="calendar">
<v-calendar <v-calendar
is-inline is-inline
is-double-paned
is-expanded is-expanded
v-model="date" v-model="date"
mode="single" mode="single"
locale="fr"
:locale="{ id: 'fr', firstDayOfWeek: 1, masks: { weekdays: 'WW' } }"
:first-day-of-week="1"
columns="2"
color="green"
:formats="calendar.formats" :formats="calendar.formats"
:theme-styles="calendar.themeStyles" :theme-styles="calendar.themeStyles"
:attributes="calendar.attrs" :attributes="calendar.attrs"
<div class="comment" v-if="pointSale.userPointSale"> <div class="comment" v-if="pointSale.userPointSale">
{{ pointSale.userPointSale.comment }} {{ pointSale.userPointSale.comment }}
</div> </div>
<div class="comment" v-if="pointSale.infos && pointSale.infos.length > 0">
{{ pointSale.infos }}
</div>
<div class="comment" v-if="pointSale.infos && pointSale.infos.length > 0" v-html="pointSale.infos"></div>
</td> </td>
<td class="locality">{{ pointSale.locality }}</td> <td class="locality">{{ pointSale.locality }}</td>
<td class="actions"> <td class="actions">

+ 12
- 9
producer/web/js/vuejs/order-order.js View File

var arrayDate; var arrayDate;
for (var i = 0; i < distributions.length; i++) { for (var i = 0; i < distributions.length; i++) {
app.calendar.attrs.push({ app.calendar.attrs.push({
highlight: {
backgroundColor: '#5cb85c',
},
contentStyle: {
color: 'white',
},
dates: distributions[i].date,
highlight: true,
dates: distributions[i].date
}); });


arrayDate = distributions[i].date.split('-'); arrayDate = distributions[i].date.split('-');
if (app.isAvailableDate(dateOrder)) { if (app.isAvailableDate(dateOrder)) {


app.calendar.attrs.push({ app.calendar.attrs.push({
highlight: {
highlight: true,
popover: {
label: orders[i].pointSale.name + ' / ' + app.formatPrice(orders[i].amount_total),
hideIndicator: true
},
dates: orders[i].date_distribution


/*highlight: {
backgroundColor: '#FF7F00' backgroundColor: '#FF7F00'
}, },
contentStyle: { contentStyle: {
label: orders[i].pointSale.name + ' / ' + app.formatPrice(orders[i].amount_total), label: orders[i].pointSale.name + ' / ' + app.formatPrice(orders[i].amount_total),
hideIndicator: true hideIndicator: true
}, },
dates: orders[i].date_distribution,
dates: orders[i].date_distribution,*/
}); });
} }
} }

Loading…
Cancel
Save