98 lines
3.9 KiB
JavaScript
98 lines
3.9 KiB
JavaScript
/// <reference types="../../node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts" />
|
|
import { onMounted, ref } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { api } from '../api/client';
|
|
import { useSessionStore } from '../stores/session';
|
|
const customers = ref([]);
|
|
const loading = ref(true);
|
|
const error = ref(null);
|
|
const router = useRouter();
|
|
const session = useSessionStore();
|
|
onMounted(async () => {
|
|
try {
|
|
customers.value = await api.listCustomers();
|
|
}
|
|
catch (e) {
|
|
error.value = e.message;
|
|
}
|
|
finally {
|
|
loading.value = false;
|
|
}
|
|
});
|
|
function goToNewOrder(customerId) {
|
|
session.selectCustomer(customerId);
|
|
router.push({ name: 'order-new' });
|
|
}
|
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
const __VLS_ctx = {};
|
|
let __VLS_components;
|
|
let __VLS_directives;
|
|
// CSS variable injection
|
|
// CSS variable injection end
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.section, __VLS_intrinsicElements.section)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.h1, __VLS_intrinsicElements.h1)({});
|
|
if (__VLS_ctx.loading) {
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({});
|
|
}
|
|
else if (__VLS_ctx.error) {
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({
|
|
...{ class: "error" },
|
|
});
|
|
(__VLS_ctx.error);
|
|
}
|
|
else {
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.table, __VLS_intrinsicElements.table)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.thead, __VLS_intrinsicElements.thead)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.tr, __VLS_intrinsicElements.tr)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.th, __VLS_intrinsicElements.th)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.tbody, __VLS_intrinsicElements.tbody)({});
|
|
for (const [c] of __VLS_getVForSourceType((__VLS_ctx.customers))) {
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.tr, __VLS_intrinsicElements.tr)({
|
|
key: (c.id),
|
|
});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
(c.fullName);
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
(c.mobile);
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
(c.goldDebtGrams);
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
(c.fiatDebtRial);
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
(c.goldCreditLimitGrams);
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.td, __VLS_intrinsicElements.td)({});
|
|
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
|
|
...{ onClick: (...[$event]) => {
|
|
if (!!(__VLS_ctx.loading))
|
|
return;
|
|
if (!!(__VLS_ctx.error))
|
|
return;
|
|
__VLS_ctx.goToNewOrder(c.id);
|
|
} },
|
|
});
|
|
}
|
|
}
|
|
/** @type {__VLS_StyleScopedClasses['error']} */ ;
|
|
var __VLS_dollars;
|
|
const __VLS_self = (await import('vue')).defineComponent({
|
|
setup() {
|
|
return {
|
|
customers: customers,
|
|
loading: loading,
|
|
error: error,
|
|
goToNewOrder: goToNewOrder,
|
|
};
|
|
},
|
|
});
|
|
export default (await import('vue')).defineComponent({
|
|
setup() {
|
|
return {};
|
|
},
|
|
});
|
|
; /* PartiallyEnd: #4569/main.vue */
|