feat: add FormKit framework support and update dependencies
- Add `telecart_forms` table migration and default checkout form seeder - Implement `FormsHandler` to fetch form schemas - Update `OrderCreateService` to handle custom fields in order comments - Add `update` method to QueryBuilder and Grammar - Add `Arr::except` helper - Update composer dependencies (Carbon, Symfony, PHPUnit, etc.) - Improve `MigratorService` error handling - Add unit tests for new functionality
This commit is contained in:
@@ -8,20 +8,11 @@ import {useSettingsStore} from "@/stores/SettingsStore.js";
|
||||
|
||||
export const useCheckoutStore = defineStore('checkout', {
|
||||
state: () => ({
|
||||
customer: {
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
comment: "",
|
||||
tgData: null,
|
||||
},
|
||||
|
||||
form: {},
|
||||
order: null,
|
||||
|
||||
isLoading: false,
|
||||
validationErrors: {},
|
||||
errorMessage: '',
|
||||
}),
|
||||
|
||||
getters: {
|
||||
@@ -33,6 +24,7 @@ export const useCheckoutStore = defineStore('checkout', {
|
||||
actions: {
|
||||
async makeOrder() {
|
||||
try {
|
||||
this.errorMessage = '';
|
||||
this.isLoading = true;
|
||||
const data = window.Telegram.WebApp.initDataUnsafe;
|
||||
|
||||
@@ -54,9 +46,10 @@ export const useCheckoutStore = defineStore('checkout', {
|
||||
}
|
||||
}
|
||||
|
||||
this.customer.tgData = data;
|
||||
|
||||
const response = await storeOrder(this.customer);
|
||||
const response = await storeOrder({
|
||||
...this.form,
|
||||
tgData: data,
|
||||
});
|
||||
this.order = response.data;
|
||||
|
||||
if (! this.order.id) {
|
||||
@@ -101,6 +94,8 @@ export const useCheckoutStore = defineStore('checkout', {
|
||||
|
||||
window.Telegram.WebApp.HapticFeedback.notificationOccurred('error');
|
||||
|
||||
this.errorMessage = 'Возникла ошибка при создании заказа.';
|
||||
|
||||
throw error;
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
|
||||
Reference in New Issue
Block a user