WIP : recherche de fiches
This commit is contained in:
@@ -11,6 +11,7 @@ import Modal from '@/components/base/Modal.vue'
|
|||||||
import FormReply from "@/components/FormReply.vue";
|
import FormReply from "@/components/FormReply.vue";
|
||||||
import TicketApi from "@/services/TicketApi.js";
|
import TicketApi from "@/services/TicketApi.js";
|
||||||
import FetchIcon from "@/components/base/FetchIcon.vue";
|
import FetchIcon from "@/components/base/FetchIcon.vue";
|
||||||
|
import FormSearch from "@/components/FormSearch.vue";
|
||||||
|
|
||||||
const store = useGlobalStore()
|
const store = useGlobalStore()
|
||||||
const storeTicket = useTicketStore();
|
const storeTicket = useTicketStore();
|
||||||
@@ -18,6 +19,7 @@ const {
|
|||||||
newTickets,
|
newTickets,
|
||||||
pendingTickets,
|
pendingTickets,
|
||||||
myTickets,
|
myTickets,
|
||||||
|
searchTickets,
|
||||||
originFilter,
|
originFilter,
|
||||||
idTicket,
|
idTicket,
|
||||||
currentTicket,
|
currentTicket,
|
||||||
@@ -207,7 +209,8 @@ const refreshTicketList = async () => {
|
|||||||
<ticket-list :rows="mapListOfTickets(myTickets)" :key="'new_'+originFilter+'_'+apiCounter"></ticket-list>
|
<ticket-list :rows="mapListOfTickets(myTickets)" :key="'new_'+originFilter+'_'+apiCounter"></ticket-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="search" role="tabpanel" tabindex="0">
|
<div class="tab-pane" id="search" role="tabpanel" tabindex="0">
|
||||||
TO DO
|
<form-search></form-search>
|
||||||
|
<ticket-list :rows="mapListOfTickets(searchTickets)" :key="'new_'+originFilter+'_'+apiCounter"></ticket-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {nextTick, onMounted, ref, watch} from "vue";
|
import {ref} from "vue";
|
||||||
|
|
||||||
import {useShipmentStore} from '@/stores/shipment.js'
|
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
|
|
||||||
const store = useShipmentStore();
|
|
||||||
const {currentFocus} = storeToRefs(store);
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
label: {
|
label: {
|
||||||
@@ -20,10 +14,6 @@ const props = defineProps({
|
|||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
autoFocus: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
insideModal: {
|
insideModal: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -32,30 +22,10 @@ const props = defineProps({
|
|||||||
|
|
||||||
const inputRef = ref(null)
|
const inputRef = ref(null)
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
|
|
||||||
if (props.autoFocus) {
|
|
||||||
|
|
||||||
if (props.insideModal) {
|
|
||||||
setTimeout(function () {
|
|
||||||
inputRef.value.focus()
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
inputRef.value.focus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(currentFocus, async (to, from) => {
|
|
||||||
if (to === props.name && from !== props.name) {
|
|
||||||
await nextTick()
|
|
||||||
inputRef.value.focus()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<label :class="classLabel" :for="$attrs.hasOwnProperty('id') ? $attrs.id : null" v-if="label">{{ label }}</label>
|
||||||
<input
|
<input
|
||||||
ref="inputRef"
|
ref="inputRef"
|
||||||
:value="modelValue"
|
:value="modelValue"
|
||||||
@@ -65,7 +35,6 @@ watch(currentFocus, async (to, from) => {
|
|||||||
}"
|
}"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
>
|
>
|
||||||
<label :class="classLabel" :for="$attrs.hasOwnProperty('id') ? $attrs.id : null" v-if="label">{{ label }}</label>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
32
src/components/FormSearch.vue
Normal file
32
src/components/FormSearch.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup>
|
||||||
|
import BaseInput from "@/components/BaseElements/BaseInput.vue";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import TicketApi from "@/services/TicketApi.js";
|
||||||
|
|
||||||
|
const lastName = ref(null)
|
||||||
|
const firstName = ref(null)
|
||||||
|
const email = ref(null)
|
||||||
|
const id = ref(null)
|
||||||
|
const dateFrom = ref(null)
|
||||||
|
const dateTo = ref(null)
|
||||||
|
|
||||||
|
const search =async () => {
|
||||||
|
await TicketApi.searchTickets(lastName.value, firstName.value, email.value, id.value, null, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<base-input label="Nom" :model-value="lastName"></base-input>
|
||||||
|
<base-input label="Prenom" :model-value="firstName"></base-input>
|
||||||
|
<base-input label="Email" :model-value="email" type="email"></base-input>
|
||||||
|
<base-input label="Id Fiche" :model-value="id"></base-input>
|
||||||
|
<button class="btn btn-primary mt-4" @click="search()">Valider</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -176,5 +176,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async archiveTickets(archivePeriod) {
|
async archiveTickets(archivePeriod) {
|
||||||
return Api.get('TicketingController', 'archiveTickets', '&archivage_from='+archivePeriod)
|
return Api.get('TicketingController', 'archiveTickets', '&archivage_from='+archivePeriod)
|
||||||
|
},
|
||||||
|
async searchTickets(lastName, firstName, email, id, dateFrom, dateTo) {
|
||||||
|
return Api.get('TicketingController', 'searchTickets', '&lastName='+lastName+'&firstName='+firstName+'&email='+email+'&id='+id+'&dateFrom='+dateFrom+'&dateTo='+dateTo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ export const useTicketStore = defineStore('ticket', {
|
|||||||
ticketList: [],
|
ticketList: [],
|
||||||
originFilter: 'ALL',
|
originFilter: 'ALL',
|
||||||
idTicket: 0,
|
idTicket: 0,
|
||||||
codeTicket: 0
|
codeTicket: 0,
|
||||||
|
searchTickets: [],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
newTickets: (state) => splitTicketList(state.ticketList, 'new_tickets', state.originFilter),
|
newTickets: (state) => splitTicketList(state.ticketList, 'new_tickets', state.originFilter),
|
||||||
|
|||||||
Reference in New Issue
Block a user