Show contacts in create offer
This commit is contained in:
parent
1efb7df848
commit
d02deeb732
@ -2,4 +2,22 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Tworzenie oferty</h2>
|
<h2>Tworzenie oferty</h2>
|
||||||
<offer-form {{h.account_id_tag(account)}}></offer-form>
|
<offer-form {{h.account_id_tag(account)}}></offer-form>
|
||||||
|
|
||||||
|
<h3>Lista danych kontaktowych</h3>
|
||||||
|
<contact-info-editor {{h.account_id_tag(account)}}>
|
||||||
|
{% for contact in contacts -%}
|
||||||
|
<edit-contact-info
|
||||||
|
contact-id="{{contact.id}}"
|
||||||
|
type="{{contact.contact_type}}"
|
||||||
|
content="{{contact.content}}"
|
||||||
|
mode="view"
|
||||||
|
>
|
||||||
|
<contact-info
|
||||||
|
contact-id="{{contact.id}}"
|
||||||
|
type="{{contact.contact_type}}"
|
||||||
|
content="{{contact.content}}"
|
||||||
|
></contact-info>
|
||||||
|
</edit-contact-info>
|
||||||
|
{%- endfor %}
|
||||||
|
</contact-info-editor>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -5,7 +5,7 @@ use askama::*;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
|
|
||||||
use crate::model::db::{self, OfferState};
|
use crate::model::db::{self, ContactInfo, OfferState};
|
||||||
use crate::model::view;
|
use crate::model::view;
|
||||||
use crate::model::view::Page;
|
use crate::model::view::Page;
|
||||||
use crate::routes::{HttpResult, Identity};
|
use crate::routes::{HttpResult, Identity};
|
||||||
@ -20,6 +20,7 @@ struct NewOfferTemplate {
|
|||||||
page: Page,
|
page: Page,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
h: Helper,
|
h: Helper,
|
||||||
|
contacts: Vec<ContactInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/new")]
|
#[get("/new")]
|
||||||
@ -46,6 +47,10 @@ async fn new_offer(req: HttpRequest, db: Data<PgPool>, id: Identity) -> HttpResu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let contacts = queries::account_contacts(&mut t, account.id)
|
||||||
|
.await
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
t.commit().await.ok();
|
t.commit().await.ok();
|
||||||
|
|
||||||
HttpResult::res(
|
HttpResult::res(
|
||||||
@ -54,6 +59,7 @@ async fn new_offer(req: HttpRequest, db: Data<PgPool>, id: Identity) -> HttpResu
|
|||||||
NewOfferTemplate {
|
NewOfferTemplate {
|
||||||
page: Page::Marketplace,
|
page: Page::Marketplace,
|
||||||
account: Some(account),
|
account: Some(account),
|
||||||
|
contacts,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user