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 cartItems = cartTariffs.map(tariff => createCartItem(tariff));
|
||||
|
||||
const loyaltyValue = parseInt(loyaltyField);
|
||||
let loyaltyValue = parseInt(loyaltyField);
|
||||
|
||||
if (!isFinite(loyaltyValue)) {
|
||||
setErrorMessage("Лояльность не число");
|
||||
return;
|
||||
}
|
||||
if (!isFinite(loyaltyValue)) loyaltyValue = 0;
|
||||
|
||||
const cartData = calcCartData({
|
||||
user: testUser,
|
||||
|
@ -62,25 +62,29 @@ export default function Chat() {
|
||||
}, [messageApiPage, messagesPerPage, ticketId]);
|
||||
|
||||
useEffect(function subscribeToMessages() {
|
||||
if (!ticketId || !token) return;
|
||||
==== BASE ====
|
||||
if (!ticketId) return;
|
||||
|
||||
const unsubscribe = subscribeToTicketMessages({
|
||||
ticketId,
|
||||
accessToken: token,
|
||||
onMessage(event) {
|
||||
try {
|
||||
const newMessage = JSON.parse(event.data) as TicketMessage;
|
||||
console.log("SSE: parsed newMessage:", newMessage);
|
||||
addOrUpdateMessages([newMessage]);
|
||||
} catch (error) {
|
||||
console.log("SSE: couldn't parse:", event.data);
|
||||
console.log("Error parsing message SSE", error);
|
||||
}
|
||||
},
|
||||
onError(event) {
|
||||
console.log("SSE Error:", event);
|
||||
},
|
||||
});
|
||||
if (!token) return;
|
||||
|
||||
const unsubscribe = subscribeToTicketMessages({
|
||||
ticketId,
|
||||
accessToken: token,
|
||||
onMessage(event) {
|
||||
try {
|
||||
const newMessage = JSON.parse(event.data) as TicketMessage;
|
||||
console.log("SSE: parsed newMessage:", newMessage);
|
||||
addOrUpdateMessages([newMessage]);
|
||||
} catch (error) {
|
||||
console.log("SSE: couldn't parse:", event.data);
|
||||
console.log("Error parsing message SSE", error);
|
||||
}
|
||||
},
|
||||
onError(event) {
|
||||
console.log("SSE Error:", event);
|
||||
},
|
||||
});
|
||||
==== BASE ====
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
|
@ -19,7 +19,7 @@ export default function CreateTariff() {
|
||||
|
||||
function handleCreateTariffClick() {
|
||||
const amount = Number(amountField);
|
||||
const customPricePerUnit = Number(customPriceField);
|
||||
const customPrice = Number(customPriceField);
|
||||
|
||||
if (isNaN(amount) || !privilege) return;
|
||||
|
||||
@ -28,7 +28,7 @@ export default function CreateTariff() {
|
||||
name: nameField,
|
||||
amount,
|
||||
privilege,
|
||||
customPricePerUnit: customPricePerUnit ? customPricePerUnit : undefined,
|
||||
customPricePerUnit: customPrice ? customPrice / amount : undefined,
|
||||
};
|
||||
|
||||
addTariffs([newTariff]);
|
||||
@ -117,7 +117,7 @@ export default function CreateTariff() {
|
||||
/>
|
||||
<CustomTextField
|
||||
id="tariff-custom-price"
|
||||
label="Кастомная цена за единицу (не обязательно)"
|
||||
label="Кастомная цена (не обязательно)"
|
||||
value={customPriceField}
|
||||
setValue={e => setCustomPriceField(e.target.value)}
|
||||
type="number"
|
||||
|
Loading…
Reference in New Issue
Block a user