[ | [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['?'], | 'roles' => ['?'], | ||||
] | |||||
], | |||||
[ | |||||
'actions' => ['pay-orders'], | |||||
'allow' => true, | |||||
'roles' => ['@'] | |||||
], | |||||
], | ], | ||||
], | ], | ||||
]; | ]; | ||||
} | } | ||||
public function actionPayOrders($date) | |||||
{ | |||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||||
if(strlen($date)) { | |||||
$this->actionProcessOrders('64ac0bdab7e9f5e48c4d991ec5201d57', $date) ; | |||||
} | |||||
return [ | |||||
'return' => 'success', | |||||
'alert' => [ | |||||
'type' => 'success', | |||||
'message' => 'Commandes payées.' | |||||
] | |||||
] ; | |||||
} | |||||
/** | /** | ||||
* Routine quotidienne concernant les commandes : paiement et envoi d'un | * Routine quotidienne concernant les commandes : paiement et envoi d'un | ||||
* récap aux producteurs. | * récap aux producteurs. |
throw new NotFoundHttpException('Le document n\'a pas été trouvé.'); | throw new NotFoundHttpException('Le document n\'a pas été trouvé.'); | ||||
} | } | ||||
if ($model->isStatusValid()) { | |||||
return $this->redirect(['download', 'id' => $id]) ; | |||||
} | |||||
if ($model && $model->load(Yii::$app->request->post()) && $model->save()) { | if ($model && $model->load(Yii::$app->request->post()) && $model->save()) { | ||||
Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('update', $model)); | Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('update', $model)); | ||||
} | } |
<button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button> | <button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button> | ||||
<button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller"><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button> | <button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller"><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button> | ||||
</template> | </template> | ||||
<button v-if="producer.credit" id="btn-pay-orders" class="btn btn-default btn-xs" @click="payOrders"><span class="glyphicon glyphicon-euro"></span> Payer les commandes</button> | |||||
<button id="btn-add-order" @click="openModalFormOrderCreate" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button> | <button id="btn-add-order" @click="openModalFormOrderCreate" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button> | ||||
</div> | </div> | ||||
<div class="left"> | <div class="left"> |
}, | }, | ||||
deliveryNoteExist: function(idPointSale) { | deliveryNoteExist: function(idPointSale) { | ||||
return typeof this.deliveryNotes[this.idActivePointSale] != 'undefined' ; | return typeof this.deliveryNotes[this.idActivePointSale] != 'undefined' ; | ||||
}, | |||||
payOrders: function() { | |||||
var app = this ; | |||||
axios.get(UrlManager.getBaseUrlAbsolute()+"cron/pay-orders",{params: { | |||||
date: app.getDate() | |||||
}}) | |||||
.then(function(response) { | |||||
appAlerts.alertResponse(response) ; | |||||
app.init(app.idActivePointSale) ; | |||||
}) ; | |||||
} | } | ||||
}, | }, | ||||
}); | }); |