move date selection to workflow

This commit is contained in:
Bilal Catic
2018-11-03 05:15:38 +01:00
parent 2a3f2f8245
commit 93e17817dc
7 changed files with 95 additions and 174 deletions

View File

@@ -4,8 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<div>
<div style="background:white;padding:8px 10px;">
<table style="width:100%">
<tr>
<th align="left">Suppliers</th>
@@ -67,7 +66,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<tr>
<td><h3>Final dates : </h3></td>
<td><h4>Final dates : </h4></td>
<td><h4><?php echo $final_estimated_date ? date('Y-m-d', $final_estimated_date) : '-' ?></h4></td>
<td><h4><?php echo $final_confirmed_date ? date('Y-m-d', $final_confirmed_date) : '-' ?></h4></td>
</tr>
@@ -75,7 +74,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<td colspan="5"><hr></td>
</tr>
<tr>
<td><h3>Earliest installation date : </h3></td>
<td><h4>Earliest installation date : </h4></td>
<td><h4><?php echo $earliest_installation_date ? date('Y-m-d', $earliest_installation_date) : '-' ?></h4></td>
</tr>
@@ -100,7 +99,7 @@ function onEstimatedDeliveryDateChange(supplierID, date) {
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
@@ -125,7 +124,7 @@ function onConfirmedDeliveryDateChange(supplierID, date) {
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
@@ -145,7 +144,7 @@ function addAdditionalTrackingInfo(e){
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
@@ -170,7 +169,7 @@ function saveTrackingInfo(e, supplierID, index){
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
@@ -190,7 +189,7 @@ function deleteTrackingInfo(e, supplierID, index){
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{

View File

@@ -1,65 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
.collapsible {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.collapsible-active, .collapsible:hover {
background-color: #555;
}
.collapsible-content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
background-color: #f1f1f1;
}
</style>
<div>
<h3><?php echo $title ?></h3>
<br/>
<?php
foreach($steps as $index => $step){
$count = $index + 1;
echo '<button class="collapsible">' . $count . '. ' . $step['short_desc'] . '</button>';
echo '<div class="collapsible-content">';
echo $step['full_desc'];
echo '</div>';
}
?>
</div>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function(event) {
event.preventDefault();
this.classList.toggle("collapsible-active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>

View File

@@ -1,65 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
.delivery-process {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.delivery-process:hover {
background-color: #555;
}
</style>
<div>
<h1>Please select a process for the order:</h1>
<br/>
<select id="delivery-process-selector">
<option value="" disabled selected>Select ... </option>
<?php
foreach($list_of_delivery_processes as $index => $process){
echo '<option value=' . $process['id'] . '>' . $process['title'] . '</option>';
}
?>
</select>
</div>
<script type="text/javascript" >
jQuery(document).ready(function($) {
$('#delivery-process-selector').change(function(e){
e.preventDefault();
var data = {
action: 'wiaas_create_order_delivery_process',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_create_order_delivery_process" ) ?>',
order: '<?php echo $order_id ?>',
form: e.target.value
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
});
});
</script>