import { rents_screen } from "./rents_screen.js"; import { product_rent_request } from "./product_rent_request.js"; import { reservation } from "./reservation.js"; import { reservation_factory } from "./reservation_factory.js"; import { searcher } from "./searcher.js"; export class product_rent extends rents_screen { get _name() { return _("product-rent"); } 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_rent_request(target); const response = await request.connect(); if (!response.result) { throw new Error(response.cause); } this._success = _("new-rent-added"); searcher.reload(); setTimeout(() => { this.hide(); }, 500); } catch (error) { this._error = String(error); } } }