Merge branch 'dev' into 'main'
Users: replacing table with dataGrid && See merge request frontend/admin!14
This commit is contained in:
commit
5f6ea741f4
@ -91,12 +91,9 @@ export default function Cart({ selectedTariffs }: Props) {
|
|||||||
const cartTariffs = tariffs.filter(tariff => selectedTariffs.includes(tariff.id));
|
const cartTariffs = tariffs.filter(tariff => selectedTariffs.includes(tariff.id));
|
||||||
const cartItems = cartTariffs.map(tariff => createCartItem(tariff));
|
const cartItems = cartTariffs.map(tariff => createCartItem(tariff));
|
||||||
|
|
||||||
const loyaltyValue = parseInt(loyaltyField);
|
let loyaltyValue = parseInt(loyaltyField);
|
||||||
|
|
||||||
if (!isFinite(loyaltyValue)) {
|
if (!isFinite(loyaltyValue)) loyaltyValue = 0;
|
||||||
setErrorMessage("Лояльность не число");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cartData = calcCartData({
|
const cartData = calcCartData({
|
||||||
user: testUser,
|
user: testUser,
|
||||||
|
@ -62,25 +62,29 @@ export default function Chat() {
|
|||||||
}, [messageApiPage, messagesPerPage, ticketId]);
|
}, [messageApiPage, messagesPerPage, ticketId]);
|
||||||
|
|
||||||
useEffect(function subscribeToMessages() {
|
useEffect(function subscribeToMessages() {
|
||||||
if (!ticketId || !token) return;
|
==== BASE ====
|
||||||
|
if (!ticketId) return;
|
||||||
|
|
||||||
const unsubscribe = subscribeToTicketMessages({
|
if (!token) return;
|
||||||
ticketId,
|
|
||||||
accessToken: token,
|
const unsubscribe = subscribeToTicketMessages({
|
||||||
onMessage(event) {
|
ticketId,
|
||||||
try {
|
accessToken: token,
|
||||||
const newMessage = JSON.parse(event.data) as TicketMessage;
|
onMessage(event) {
|
||||||
console.log("SSE: parsed newMessage:", newMessage);
|
try {
|
||||||
addOrUpdateMessages([newMessage]);
|
const newMessage = JSON.parse(event.data) as TicketMessage;
|
||||||
} catch (error) {
|
console.log("SSE: parsed newMessage:", newMessage);
|
||||||
console.log("SSE: couldn't parse:", event.data);
|
addOrUpdateMessages([newMessage]);
|
||||||
console.log("Error parsing message SSE", error);
|
} catch (error) {
|
||||||
}
|
console.log("SSE: couldn't parse:", event.data);
|
||||||
},
|
console.log("Error parsing message SSE", error);
|
||||||
onError(event) {
|
}
|
||||||
console.log("SSE Error:", event);
|
},
|
||||||
},
|
onError(event) {
|
||||||
});
|
console.log("SSE Error:", event);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
==== BASE ====
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
|
@ -19,7 +19,7 @@ export default function CreateTariff() {
|
|||||||
|
|
||||||
function handleCreateTariffClick() {
|
function handleCreateTariffClick() {
|
||||||
const amount = Number(amountField);
|
const amount = Number(amountField);
|
||||||
const customPricePerUnit = Number(customPriceField);
|
const customPrice = Number(customPriceField);
|
||||||
|
|
||||||
if (isNaN(amount) || !privilege) return;
|
if (isNaN(amount) || !privilege) return;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export default function CreateTariff() {
|
|||||||
name: nameField,
|
name: nameField,
|
||||||
amount,
|
amount,
|
||||||
privilege,
|
privilege,
|
||||||
customPricePerUnit: customPricePerUnit ? customPricePerUnit : undefined,
|
customPricePerUnit: customPrice ? customPrice / amount : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
addTariffs([newTariff]);
|
addTariffs([newTariff]);
|
||||||
@ -117,7 +117,7 @@ export default function CreateTariff() {
|
|||||||
/>
|
/>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
id="tariff-custom-price"
|
id="tariff-custom-price"
|
||||||
label="Кастомная цена за единицу (не обязательно)"
|
label="Кастомная цена (не обязательно)"
|
||||||
value={customPriceField}
|
value={customPriceField}
|
||||||
setValue={e => setCustomPriceField(e.target.value)}
|
setValue={e => setCustomPriceField(e.target.value)}
|
||||||
type="number"
|
type="number"
|
||||||
|
Loading…
Reference in New Issue
Block a user