fix date pickers

This commit is contained in:
Tyrel Souza 2023-10-11 10:22:12 -04:00
parent c22c7e2b06
commit dccfcd43d2
No known key found for this signature in database
GPG Key ID: F3614B02ACBE438E
4 changed files with 73 additions and 65 deletions

View File

@ -8,9 +8,8 @@
<h3>Calibration Date</h3>
<VueDatePicker
v-model="date"
inline
:enableTimePicker="false"
auto-apply
:enableTimePicker="false"
:flow="flow"
></VueDatePicker>
</td>
@ -20,9 +19,8 @@
<h3>Calibration Due Date</h3>
<VueDatePicker
v-model="due_date"
inline
:enableTimePicker="false"
auto-apply
:enableTimePicker="false"
:flow="flow"
></VueDatePicker>
</td>

View File

@ -9,9 +9,8 @@
<div class="date-picker">
<VueDatePicker
v-model="date"
inline
:enableTimePicker="false"
auto-apply
:enableTimePicker="false"
:flow="flow"
></VueDatePicker>
</div>
@ -24,7 +23,6 @@
<VueDatePicker
v-model="due_date"
:enableTimePicker="false"
inline
auto-apply
:flow="flow"
></VueDatePicker>

View File

@ -106,36 +106,36 @@
</thead>
<tbody>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>&nbsp;</td>
@ -204,36 +204,36 @@
</thead>
<tbody>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>-12.500</td>
<td>0.050%</td>
<td>-12.510</td>
<td>-12.490</td>
<td>-12.500</td>
<td>0</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>&nbsp;</td>
@ -333,11 +333,10 @@ const i_date = () => {
const year = d.getFullYear();
const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1
const day = d.getDate().toString().padStart(2, "0");
return `${year}/${month}/${day}`;
return `${year}-${month}-${day}`;
};
const i_due_date = () => {
if (props.instrument?.due_date === undefined) {
return;
@ -346,7 +345,7 @@ const i_due_date = () => {
const year = d.getFullYear();
const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1
const day = d.getDate().toString().padStart(2, "0");
return `${year}/${month}/${day}`;
return `${year}-${month}-${day}`;
};
const c_date = () => {
@ -357,7 +356,7 @@ const c_date = () => {
const year = d.getFullYear();
const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1
const day = d.getDate().toString().padStart(2, "0");
return `${year}/${month}/${day}`;
return `${year}-${month}-${day}`;
};
const c_due_date = () => {
if (props.calibration?.due_date === undefined) {
@ -367,14 +366,14 @@ const c_due_date = () => {
const year = d.getFullYear();
const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1
const day = d.getDate().toString().padStart(2, "0");
return `${year}/${month}/${day}`;
return `${year}-${month}-${day}`;
};
const exportToPDF = () => {
const element = document.getElementById("pdf");
var opt = {
margin: 0.4,
filename: "myfile.pdf",
filename: `${props.instrument.model}_${i_date()}.pdf`,
image: { type: "jpeg", quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: "in", format: "letter", orientation: "portrait" },

View File

@ -11,13 +11,13 @@
required
id="id_report_type"
>
<option value="" selected>---------</option>
<option value="-" selected>----Select-----</option>
<option value="TV">Transducer Verify</option>
<option value="HC">Hardware Calibration</option>
</select>
</td>
</tr>
<tr v-if="showUpload">
<tr v-if="report_type != '-' || showUpload">
<td>
<button class="custom-button" @click="openFileInput" v-if="showUpload">
Select First File
@ -76,19 +76,32 @@
</template>
<script setup>
/*
RADIO BUTTONS ARE FUCKED
*/
import { ref, computed, watchEffect } from "vue";
const report_type = ref(""),
const report_type = ref("-"),
files = ref([]),
current_file = ref(null),
doc = ref();
const showUpload = computed({
get() {
console.log(files.value.length)
/// default select
if (report_type.value === "-") {
return false
}
// no more more than 2 files
if (files.value.length >= 2) {
return false;
}
// if the first item is both, disable upload
if (files.value.length > 0 && files.value[0].kind == "both") {
return false;
}