import { rents_screen } from "./rents_screen.js"; import { reservation } from "./reservation.js"; import { reservation_factory } from "./reservation_factory.js"; import { product_give_back_request } from "./product_give_back_request.js"; import { searcher } from "./searcher.js"; export class product_give_back extends rents_screen { get _name() { return _("product-give-back"); } async _process() { try { this._info = _("processing"); const target = new reservation_factory() .email(this._email) .phone_number(this._phone) .product(this._target) .result(); const request = new product_give_back_request(target); const response = await request.connect(); if (!response.result) { throw new Error(response.cause); } this._success = _("give-back-successfull"); searcher.reload(); setTimeout(() => { this.hide(); }, 500); } catch (error) { this._error = String(error); } } }