Merge branch 'staging' into 'main'

Staging

See merge request PhilippHofer/rot!17
This commit is contained in:
PhilippHofer 2023-07-31 05:51:51 +00:00
commit b5962dcb84
16 changed files with 802 additions and 88 deletions

View File

@ -5,15 +5,19 @@ variables:
before_script:
- rustup target add $CARGO_TARGET
- apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 && ./test_db.sh
- apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
- ./test_db.sh
build:
stage: build
script:
- cargo build --release --target $CARGO_TARGET
- cd frontend && npm install && npm run build
# - strip target/$CARGO_TARGET/release/rot
artifacts:
paths:
- target/$CARGO_TARGET/release/rot
- static
expire_in: 1 week
test:
@ -38,7 +42,7 @@ deploy-staging:
- scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging'
- ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build'
- mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot
- ssh $SSH_USER@$SSH_HOST 'mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot'
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging'
only:
- staging
@ -58,8 +62,8 @@ deploy-main:
- scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/
- scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/
- ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing/svelte/build'
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging'
- mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot'
- ssh $SSH_USER@$SSH_HOST 'mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot'
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot'
only:
- main

View File

@ -8,3 +8,4 @@
@import 'components/links';
@import 'components/input';
@import 'components/alert';
@import 'components/status';

View File

@ -1,3 +1,13 @@
.input {
@apply relative block w-full border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6;
}
select {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right .75rem center;
background-size: 16px 12px;
background-color: white;
-webkit-appearance: none;
appearance: none;
}

View File

@ -0,0 +1,15 @@
.status-damage {
@apply inline-block w-[12px] h-[12px] rounded-full mr-2 bg-gray-200;
&-none {
@apply bg-[#15803d];
}
&-light {
@apply bg-[#ffae42];
}
&-locked {
@apply bg-[#f43f5e];
}
}

View File

@ -0,0 +1,225 @@
var style = document.createElement('style');
style.setAttribute("id","multiselect_dropdown_styles");
style.innerHTML = `
.multiselect-dropdown{
display: inline-block;
border-radius: 4px;
border: solid 1px #ced4da;
background-color: white;
position: relative;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right .75rem center;
background-size: 16px 12px;
padding: 0.375rem 0.5rem;
line-height: 1.5rem;
}
.multiselect-dropdown span.optext, .multiselect-dropdown span.placeholder{
margin-right:0.5em;
margin-bottom:2px;
padding:1px 0;
border-radius: 4px;
display:inline-block;
}
.multiselect-dropdown span.optext{
background-color: rgba(226, 232, 240, 0.8);
padding:1px 0.75em;
}
.multiselect-dropdown span.optext .optdel {
float: right;
margin: 0 -6px 1px 5px;
font-size: 1em;
cursor: pointer;
}
.multiselect-dropdown span.optext .optdel:hover { color:#f43f5e;}
.multiselect-dropdown span.placeholder{
color:#ced4da;
}
.multiselect-dropdown-list-wrapper{
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px;
z-index: 100;
padding:2px;
border-radius: .375rem;
border: solid 1px #ced4da;
display: none;
margin: -1px;
position: absolute;
top:0;
left: 0;
right: 0;
background: white;
}
.multiselect-dropdown-list-wrapper .multiselect-dropdown-search{
margin-bottom:5px;
padding: 0.375rem 0.5rem;
line-height: 1.5rem;
}
.multiselect-dropdown-list{
padding:2px;
height: 15rem;
overflow-y:auto;
overflow-x: hidden;
}
.multiselect-dropdown-list::-webkit-scrollbar {
width: 6px;
}
.multiselect-dropdown-list::-webkit-scrollbar-thumb {
background-color: rgba(226, 232, 240, 0.8);
border-radius: .375rem;
}
.multiselect-dropdown-list div{
padding: 5px;
}
.multiselect-dropdown-list input{
height: 1.15em;
width: 1.15em;
margin-right: 0.35em;
}
.multiselect-dropdown-list div.checked{
}
.multiselect-dropdown-list div:hover{
background-color: rgba(226, 232, 240, 0.8);
}
.multiselect-dropdown span.maxselected {width:100%;}
.multiselect-dropdown-all-selector {border-bottom:solid 1px #999;}
`;
document.head.appendChild(style);
function MultiselectDropdown(options){
var config={
search:true,
height:'15rem',
placeholder:'Auswählen',
txtSelected:'ausgewählt',
txtAll:'Alle',
txtRemove: 'Entfernen',
txtSearch:'Suchen',
...options
};
function newEl(tag,attrs){
var e=document.createElement(tag);
if(attrs!==undefined) Object.keys(attrs).forEach(k=>{
if(k==='class') { Array.isArray(attrs[k]) ? attrs[k].forEach(o=>o!==''?e.classList.add(o):0) : (attrs[k]!==''?e.classList.add(attrs[k]):0)}
else if(k==='style'){
Object.keys(attrs[k]).forEach(ks=>{
e.style[ks]=attrs[k][ks];
});
}
else if(k==='text'){attrs[k]===''?e.innerHTML=' ':e.innerText=attrs[k]}
else e[k]=attrs[k];
});
return e;
}
document.querySelectorAll("select[multiple]").forEach((el,k)=>{
var div=newEl('div',{class:'multiselect-dropdown',style:{width:config.style?.width??el.clientWidth+'px',padding:config.style?.padding??''}});
el.style.display='none';
el.parentNode.insertBefore(div,el.nextSibling);
var listWrap=newEl('div',{class:'multiselect-dropdown-list-wrapper'});
var list=newEl('div',{class:'multiselect-dropdown-list',style:{height:config.height}});
var search=newEl('input',{class:['multiselect-dropdown-search'].concat([config.searchInput?.class??'form-control']),style:{width:'100%',display:el.attributes['multiselect-search']?.value==='true'?'block':'none'},placeholder:config.txtSearch});
listWrap.appendChild(search);
div.appendChild(listWrap);
listWrap.appendChild(list);
el.loadOptions=()=>{
list.innerHTML='';
if(el.attributes['multiselect-select-all']?.value=='true'){
var op=newEl('div',{class:'multiselect-dropdown-all-selector'})
var ic=newEl('input',{type:'checkbox'});
op.appendChild(ic);
op.appendChild(newEl('label',{text:config.txtAll}));
op.addEventListener('click',()=>{
op.classList.toggle('checked');
op.querySelector("input").checked=!op.querySelector("input").checked;
var ch=op.querySelector("input").checked;
list.querySelectorAll(":scope > div:not(.multiselect-dropdown-all-selector)")
.forEach(i=>{if(i.style.display!=='none'){i.querySelector("input").checked=ch; i.optEl.selected=ch}});
el.dispatchEvent(new Event('change'));
});
ic.addEventListener('click',(ev)=>{
ic.checked=!ic.checked;
});
el.addEventListener('change', (ev)=>{
let itms=Array.from(list.querySelectorAll(":scope > div:not(.multiselect-dropdown-all-selector)")).filter(e=>e.style.display!=='none')
let existsNotSelected=itms.find(i=>!i.querySelector("input").checked);
if(ic.checked && existsNotSelected) ic.checked=false;
else if(ic.checked==false && existsNotSelected===undefined) ic.checked=true;
});
list.appendChild(op);
}
Array.from(el.options).map(o=>{
var op=newEl('div',{class:o.selected?'checked':'',optEl:o})
var ic=newEl('input',{type:'checkbox',checked:o.selected});
op.appendChild(ic);
op.appendChild(newEl('label',{text:o.text}));
op.addEventListener('click',()=>{
op.classList.toggle('checked');
op.querySelector("input").checked=!op.querySelector("input").checked;
op.optEl.selected=!!!op.optEl.selected;
el.dispatchEvent(new Event('change'));
});
ic.addEventListener('click',(ev)=>{
ic.checked=!ic.checked;
});
o.listitemEl=op;
list.appendChild(op);
});
div.listEl=listWrap;
div.refresh=()=>{
div.querySelectorAll('span.optext, span.placeholder').forEach(t=>div.removeChild(t));
var sels=Array.from(el.selectedOptions);
if(sels.length>(el.attributes['multiselect-max-items']?.value??5)){
div.appendChild(newEl('span',{class:['optext','maxselected'],text:sels.length+' '+config.txtSelected}));
}
else{
sels.map(x=>{
var c=newEl('span',{class:'optext',text:x.text, srcOption: x});
if((el.attributes['multiselect-hide-x']?.value !== 'true'))
c.appendChild(newEl('span',{class:'optdel',text:'x',title:config.txtRemove, onclick:(ev)=>{c.srcOption.listitemEl.dispatchEvent(new Event('click'));div.refresh();ev.stopPropagation();}}));
div.appendChild(c);
});
}
if(0==el.selectedOptions.length) div.appendChild(newEl('span',{class:'placeholder',text:el.attributes['placeholder']?.value??config.placeholder}));
};
div.refresh();
}
el.loadOptions();
search.addEventListener('input',()=>{
list.querySelectorAll(":scope div:not(.multiselect-dropdown-all-selector)").forEach(d=>{
var txt=d.querySelector("label").innerText.toUpperCase();
d.style.display=txt.includes(search.value.toUpperCase())?'block':'none';
});
});
div.addEventListener('click',()=>{
div.listEl.style.display='block';
search.focus();
search.select();
});
document.addEventListener('click', function(event) {
if (!div.contains(event.target)) {
listWrap.style.display='none';
div.refresh();
}
});
});
}
window.addEventListener('load',()=>{
MultiselectDropdown(window.MultiselectDropdownOptions);
});

View File

@ -0,0 +1,41 @@
// vite.config.js
import { defineConfig } from "file:///Users/mariebirner/PrivateDev/rot/frontend/node_modules/vite/dist/node/index.js";
import { viteStaticCopy } from "file:///Users/mariebirner/PrivateDev/rot/frontend/node_modules/vite-plugin-static-copy/dist/index.js";
var vite_config_default = defineConfig({
plugins: [
viteStaticCopy({
targets: [
{
src: "./static/[!.]*",
dest: "./"
}
]
})
],
publicDir: false,
// disable copy `public/` to outDir
build: {
rollupOptions: {
input: {
main: "./main.ts"
// Example for more entry points
// test: './src/test.ts',
},
output: {
entryFileNames: "[name].js",
assetFileNames: "[name].css"
}
},
manifest: true,
// generate manifest.json in outDir
outDir: "../static/"
},
css: {
devSourcemap: true
// disabled by default because of performance reasons
}
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvbWFyaWViaXJuZXIvUHJpdmF0ZURldi9yb3QvZnJvbnRlbmRcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy9tYXJpZWJpcm5lci9Qcml2YXRlRGV2L3JvdC9mcm9udGVuZC92aXRlLmNvbmZpZy5qc1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vVXNlcnMvbWFyaWViaXJuZXIvUHJpdmF0ZURldi9yb3QvZnJvbnRlbmQvdml0ZS5jb25maWcuanNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJztcbmltcG9ydCB7IHZpdGVTdGF0aWNDb3B5IH0gZnJvbSAndml0ZS1wbHVnaW4tc3RhdGljLWNvcHknXG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gIHBsdWdpbnM6IFtcbiAgICB2aXRlU3RhdGljQ29weSh7XG4gICAgICB0YXJnZXRzOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBzcmM6ICcuL3N0YXRpYy9bIS5dKicsXG4gICAgICAgICAgZGVzdDogJy4vJyxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSlcbiAgXSxcbiAgcHVibGljRGlyOiBmYWxzZSwgLy8gZGlzYWJsZSBjb3B5IGBwdWJsaWMvYCB0byBvdXREaXJcbiAgYnVpbGQ6IHtcbiAgICByb2xsdXBPcHRpb25zOiB7XG4gICAgICBpbnB1dDoge1xuICAgICAgICBtYWluOiAnLi9tYWluLnRzJyxcbiAgICAgICAgLy8gRXhhbXBsZSBmb3IgbW9yZSBlbnRyeSBwb2ludHNcbiAgICAgICAgLy8gdGVzdDogJy4vc3JjL3Rlc3QudHMnLFxuICAgICAgfSxcbiAgICAgIG91dHB1dDoge1xuICAgICAgICBlbnRyeUZpbGVOYW1lczogJ1tuYW1lXS5qcycsXG4gICAgICAgIGFzc2V0RmlsZU5hbWVzOiAnW25hbWVdLmNzcycsXG4gICAgICB9LFxuICAgIH0sXG4gICAgbWFuaWZlc3Q6IHRydWUsIC8vIGdlbmVyYXRlIG1hbmlmZXN0Lmpzb24gaW4gb3V0RGlyXG4gICAgb3V0RGlyOiAnLi4vc3RhdGljLycsXG4gIH0sXG4gIGNzczoge1xuICAgIGRldlNvdXJjZW1hcDogdHJ1ZSwgLy8gZGlzYWJsZWQgYnkgZGVmYXVsdCBiZWNhdXNlIG9mIHBlcmZvcm1hbmNlIHJlYXNvbnNcbiAgfSxcbn0pIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFnVCxTQUFTLG9CQUFvQjtBQUM3VSxTQUFTLHNCQUFzQjtBQUUvQixJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUMxQixTQUFTO0FBQUEsSUFDUCxlQUFlO0FBQUEsTUFDYixTQUFTO0FBQUEsUUFDUDtBQUFBLFVBQ0UsS0FBSztBQUFBLFVBQ0wsTUFBTTtBQUFBLFFBQ1I7QUFBQSxNQUNGO0FBQUEsSUFDRixDQUFDO0FBQUEsRUFDSDtBQUFBLEVBQ0EsV0FBVztBQUFBO0FBQUEsRUFDWCxPQUFPO0FBQUEsSUFDTCxlQUFlO0FBQUEsTUFDYixPQUFPO0FBQUEsUUFDTCxNQUFNO0FBQUE7QUFBQTtBQUFBLE1BR1I7QUFBQSxNQUNBLFFBQVE7QUFBQSxRQUNOLGdCQUFnQjtBQUFBLFFBQ2hCLGdCQUFnQjtBQUFBLE1BQ2xCO0FBQUEsSUFDRjtBQUFBLElBQ0EsVUFBVTtBQUFBO0FBQUEsSUFDVixRQUFRO0FBQUEsRUFDVjtBQUFBLEVBQ0EsS0FBSztBQUFBLElBQ0gsY0FBYztBQUFBO0FBQUEsRUFDaEI7QUFDRixDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo=

View File

@ -21,6 +21,7 @@ INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Haichenbach', 1, 1
INSERT INTO "boat" (name, amount_seats, location_id, owner) VALUES ('private_boat_from_rower', 1, 1, 2);
INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Joe', 2, 1);
INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Kaputtes Boot :-(', 7, 1);
INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Sehr kaputtes Boot :-((', 7, 1);
INSERT INTO "logbook_type" (name) VALUES ('Wanderfahrt');
INSERT INTO "logbook_type" (name) VALUES ('Regatta');
INSERT INTO "logbook" (boat_id, shipmaster, shipmaster_only_steering, departure) VALUES (2, 2, false, '2142-12-24 10:00');
@ -28,3 +29,4 @@ INSERT INTO "logbook" (boat_id, shipmaster, shipmaster_only_steering, departure,
INSERT INTO "logbook" (boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km) VALUES (3, 4, false, '2142-12-24 10:00', '2142-12-24 11:30', 'Ottensheim + Regattastrecke', 29);
INSERT INTO "rower" (logbook_id, rower_id) VALUES(3,3);
INSERT INTO "boat_damage" (boat_id, desc, user_id_created, created_at) VALUES(4,'Dolle bei Position 2 fehlt', 5, '2142-12-24 15:02');
INSERT INTO "boat_damage" (boat_id, desc, user_id_created, created_at, lock_boat) VALUES(5, 'TOHT', 5, '2142-12-24 15:02', 1);

View File

@ -1,5 +1,5 @@
use rocket::serde::{Deserialize, Serialize};
use rocket::FromForm;
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};
#[derive(FromRow, Debug, Serialize, Deserialize)]
@ -19,6 +19,22 @@ pub struct Boat {
external: bool,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum BoatDamage {
None,
Light,
Locked,
}
#[derive(Serialize, Deserialize)]
pub struct BoatWithDetails {
#[serde(flatten)]
boat: Boat,
damage: BoatDamage,
on_water: bool,
}
#[derive(FromForm)]
pub struct BoatToAdd<'r> {
pub name: &'r str,
@ -64,6 +80,10 @@ impl Boat {
sqlx::query!("SELECT * FROM boat_damage WHERE boat_id=? AND lock_boat=true AND user_id_verified is null", self.id).fetch_optional(db).await.unwrap().is_some()
}
pub async fn has_minor_damage(&self, db: &SqlitePool) -> bool {
sqlx::query!("SELECT * FROM boat_damage WHERE boat_id=? AND lock_boat=false AND user_id_verified is null", self.id).fetch_optional(db).await.unwrap().is_some()
}
pub async fn on_water(&self, db: &SqlitePool) -> bool {
sqlx::query!(
"SELECT * FROM logbook WHERE boat_id=? AND arrival is null",
@ -75,8 +95,8 @@ impl Boat {
.is_some()
}
pub async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as!(
pub async fn all(db: &SqlitePool) -> Vec<BoatWithDetails> {
let boats = sqlx::query_as!(
Boat,
"
SELECT id, name, amount_seats, location_id, owner, year_built, boatbuilder, default_shipmaster_only_steering, skull, external
@ -86,7 +106,24 @@ ORDER BY amount_seats DESC
)
.fetch_all(db)
.await
.unwrap() //TODO: fixme
.unwrap(); //TODO: fixme
let mut res = Vec::new();
for boat in boats {
let mut damage = BoatDamage::None;
if boat.has_minor_damage(db).await {
damage = BoatDamage::Light;
}
if boat.is_locked(db).await {
damage = BoatDamage::Locked;
}
res.push(BoatWithDetails {
damage,
on_water: boat.on_water(db).await,
boat,
})
}
res
}
pub async fn create(db: &SqlitePool, boat: BoatToAdd<'_>) -> bool {

View File

@ -1,4 +1,4 @@
use chrono::NaiveDateTime;
use chrono::{Local, NaiveDateTime, TimeZone};
use rocket::FromForm;
use serde::Serialize;
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
@ -50,6 +50,8 @@ pub struct LogbookWithBoatAndRowers {
pub boat: Boat,
pub shipmaster_user: User,
pub rowers: Vec<User>,
pub departure_timestamp: i64,
pub arrival_timestamp: Option<i64>,
}
pub enum LogbookUpdateError {
@ -83,26 +85,50 @@ impl Logbook {
}
pub async fn on_water(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
let logs = sqlx::query_as!(
Logbook,
"
SELECT id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
FROM logbook
WHERE arrival is null
ORDER BY departure DESC
"
)
.fetch_all(db)
.await
.unwrap(); //TODO: fixme
let rows = sqlx::query!(
"
SELECT id, boat_id, shipmaster, shipmaster_only_steering, strftime('%Y-%m-%d %H:%M', departure) as departure, arrival, destination, distance_in_km, comments, logtype
FROM logbook
WHERE arrival is null
ORDER BY departure DESC
"
)
.fetch_all(db)
.await
.unwrap(); //TODO: fixme
let logs: Vec<Logbook> = rows
.into_iter()
.map(|row| Logbook {
id: row.id,
boat_id: row.boat_id,
shipmaster: row.shipmaster,
shipmaster_only_steering: row.shipmaster_only_steering,
departure: row.departure.unwrap(),
arrival: row.arrival,
destination: row.destination,
distance_in_km: row.distance_in_km,
comments: row.comments,
logtype: row.logtype,
})
.collect();
let mut ret = Vec::new();
for log in logs {
let date_time_naive =
NaiveDateTime::parse_from_str(&log.departure, "%Y-%m-%d %H:%M").unwrap();
let date_time = Local
.from_local_datetime(&date_time_naive)
.single()
.unwrap();
ret.push(LogbookWithBoatAndRowers {
rowers: Rower::for_log(db, &log).await,
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
logbook: log,
arrival_timestamp: None, //TODO: send arrival timestmap
departure_timestamp: date_time.timestamp(),
});
}
ret
@ -129,6 +155,8 @@ impl Logbook {
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
logbook: log,
arrival_timestamp: None,
departure_timestamp: 0,
});
}
ret
@ -146,10 +174,13 @@ impl Logbook {
if boat.on_water(db).await {
return Err(LogbookCreateError::BoatAlreadyOnWater);
}
if (User::find_by_id(db, log.shipmaster as i32).await.unwrap()).on_water(db).await {
if (User::find_by_id(db, log.shipmaster as i32).await.unwrap())
.on_water(db)
.await
{
return Err(LogbookCreateError::ShipmasterAlreadyOnWater);
}
if log.rower.len() > boat.amount_seats as usize - 1 {
return Err(LogbookCreateError::TooManyRowers(
boat.amount_seats as usize,
@ -194,19 +225,23 @@ impl Logbook {
Ok(())
}
pub async fn distances(db: &SqlitePool) -> Vec<(String, i64)>{
pub async fn distances(db: &SqlitePool) -> Vec<(String, i64)> {
let result = sqlx::query!("SELECT destination, distance_in_km FROM logbook WHERE id IN (SELECT MIN(id) FROM logbook GROUP BY destination) AND destination IS NOT NULL AND distance_in_km IS NOT NULL;")
.fetch_all(db)
.await
.unwrap();
result.into_iter().filter_map(|r| {
if let (Some(destination), Some(distance_in_km)) = (r.destination, r.distance_in_km) {
Some((destination, distance_in_km))
} else {
None
}
}).collect()
result
.into_iter()
.filter_map(|r| {
if let (Some(destination), Some(distance_in_km)) = (r.destination, r.distance_in_km)
{
Some((destination, distance_in_km))
} else {
None
}
})
.collect()
}
async fn remove_rowers(&self, db: &mut Transaction<'_, Sqlite>) {

View File

@ -95,7 +95,7 @@ WHERE name like ?
}
pub async fn on_water(&self, db: &SqlitePool) -> bool {
sqlx::query!(
if sqlx::query!(
"SELECT * FROM logbook WHERE shipmaster=? AND arrival is null",
self.id
)
@ -103,6 +103,22 @@ WHERE name like ?
.await
.unwrap()
.is_some()
{
return true;
}
if sqlx::query!(
"SELECT * FROM logbook JOIN rower ON rower.logbook_id=logbook.id WHERE rower_id=? AND arrival is null",
self.id
)
.fetch_optional(db)
.await
.unwrap()
.is_some()
{
return true;
}
false
}
pub async fn all(db: &SqlitePool) -> Vec<Self> {

View File

@ -0,0 +1,225 @@
var style = document.createElement('style');
style.setAttribute("id","multiselect_dropdown_styles");
style.innerHTML = `
.multiselect-dropdown{
display: inline-block;
border-radius: 4px;
border: solid 1px #ced4da;
background-color: white;
position: relative;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right .75rem center;
background-size: 16px 12px;
padding: 0.375rem 0.5rem;
line-height: 1.5rem;
}
.multiselect-dropdown span.optext, .multiselect-dropdown span.placeholder{
margin-right:0.5em;
margin-bottom:2px;
padding:1px 0;
border-radius: 4px;
display:inline-block;
}
.multiselect-dropdown span.optext{
background-color: rgba(226, 232, 240, 0.8);
padding:1px 0.75em;
}
.multiselect-dropdown span.optext .optdel {
float: right;
margin: 0 -6px 1px 5px;
font-size: 1em;
cursor: pointer;
}
.multiselect-dropdown span.optext .optdel:hover { color:#f43f5e;}
.multiselect-dropdown span.placeholder{
color:#ced4da;
}
.multiselect-dropdown-list-wrapper{
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px;
z-index: 100;
padding:2px;
border-radius: .375rem;
border: solid 1px #ced4da;
display: none;
margin: -1px;
position: absolute;
top:0;
left: 0;
right: 0;
background: white;
}
.multiselect-dropdown-list-wrapper .multiselect-dropdown-search{
margin-bottom:5px;
padding: 0.375rem 0.5rem;
line-height: 1.5rem;
}
.multiselect-dropdown-list{
padding:2px;
height: 15rem;
overflow-y:auto;
overflow-x: hidden;
}
.multiselect-dropdown-list::-webkit-scrollbar {
width: 6px;
}
.multiselect-dropdown-list::-webkit-scrollbar-thumb {
background-color: rgba(226, 232, 240, 0.8);
border-radius: .375rem;
}
.multiselect-dropdown-list div{
padding: 5px;
}
.multiselect-dropdown-list input{
height: 1.15em;
width: 1.15em;
margin-right: 0.35em;
}
.multiselect-dropdown-list div.checked{
}
.multiselect-dropdown-list div:hover{
background-color: rgba(226, 232, 240, 0.8);
}
.multiselect-dropdown span.maxselected {width:100%;}
.multiselect-dropdown-all-selector {border-bottom:solid 1px #999;}
`;
document.head.appendChild(style);
function MultiselectDropdown(options){
var config={
search:true,
height:'15rem',
placeholder:'Auswählen',
txtSelected:'ausgewählt',
txtAll:'Alle',
txtRemove: 'Entfernen',
txtSearch:'Suchen',
...options
};
function newEl(tag,attrs){
var e=document.createElement(tag);
if(attrs!==undefined) Object.keys(attrs).forEach(k=>{
if(k==='class') { Array.isArray(attrs[k]) ? attrs[k].forEach(o=>o!==''?e.classList.add(o):0) : (attrs[k]!==''?e.classList.add(attrs[k]):0)}
else if(k==='style'){
Object.keys(attrs[k]).forEach(ks=>{
e.style[ks]=attrs[k][ks];
});
}
else if(k==='text'){attrs[k]===''?e.innerHTML='&nbsp;':e.innerText=attrs[k]}
else e[k]=attrs[k];
});
return e;
}
document.querySelectorAll("select[multiple]").forEach((el,k)=>{
var div=newEl('div',{class:'multiselect-dropdown',style:{width:config.style?.width??el.clientWidth+'px',padding:config.style?.padding??''}});
el.style.display='none';
el.parentNode.insertBefore(div,el.nextSibling);
var listWrap=newEl('div',{class:'multiselect-dropdown-list-wrapper'});
var list=newEl('div',{class:'multiselect-dropdown-list',style:{height:config.height}});
var search=newEl('input',{class:['multiselect-dropdown-search'].concat([config.searchInput?.class??'form-control']),style:{width:'100%',display:el.attributes['multiselect-search']?.value==='true'?'block':'none'},placeholder:config.txtSearch});
listWrap.appendChild(search);
div.appendChild(listWrap);
listWrap.appendChild(list);
el.loadOptions=()=>{
list.innerHTML='';
if(el.attributes['multiselect-select-all']?.value=='true'){
var op=newEl('div',{class:'multiselect-dropdown-all-selector'})
var ic=newEl('input',{type:'checkbox'});
op.appendChild(ic);
op.appendChild(newEl('label',{text:config.txtAll}));
op.addEventListener('click',()=>{
op.classList.toggle('checked');
op.querySelector("input").checked=!op.querySelector("input").checked;
var ch=op.querySelector("input").checked;
list.querySelectorAll(":scope > div:not(.multiselect-dropdown-all-selector)")
.forEach(i=>{if(i.style.display!=='none'){i.querySelector("input").checked=ch; i.optEl.selected=ch}});
el.dispatchEvent(new Event('change'));
});
ic.addEventListener('click',(ev)=>{
ic.checked=!ic.checked;
});
el.addEventListener('change', (ev)=>{
let itms=Array.from(list.querySelectorAll(":scope > div:not(.multiselect-dropdown-all-selector)")).filter(e=>e.style.display!=='none')
let existsNotSelected=itms.find(i=>!i.querySelector("input").checked);
if(ic.checked && existsNotSelected) ic.checked=false;
else if(ic.checked==false && existsNotSelected===undefined) ic.checked=true;
});
list.appendChild(op);
}
Array.from(el.options).map(o=>{
var op=newEl('div',{class:o.selected?'checked':'',optEl:o})
var ic=newEl('input',{type:'checkbox',checked:o.selected});
op.appendChild(ic);
op.appendChild(newEl('label',{text:o.text}));
op.addEventListener('click',()=>{
op.classList.toggle('checked');
op.querySelector("input").checked=!op.querySelector("input").checked;
op.optEl.selected=!!!op.optEl.selected;
el.dispatchEvent(new Event('change'));
});
ic.addEventListener('click',(ev)=>{
ic.checked=!ic.checked;
});
o.listitemEl=op;
list.appendChild(op);
});
div.listEl=listWrap;
div.refresh=()=>{
div.querySelectorAll('span.optext, span.placeholder').forEach(t=>div.removeChild(t));
var sels=Array.from(el.selectedOptions);
if(sels.length>(el.attributes['multiselect-max-items']?.value??5)){
div.appendChild(newEl('span',{class:['optext','maxselected'],text:sels.length+' '+config.txtSelected}));
}
else{
sels.map(x=>{
var c=newEl('span',{class:'optext',text:x.text, srcOption: x});
if((el.attributes['multiselect-hide-x']?.value !== 'true'))
c.appendChild(newEl('span',{class:'optdel',text:'x',title:config.txtRemove, onclick:(ev)=>{c.srcOption.listitemEl.dispatchEvent(new Event('click'));div.refresh();ev.stopPropagation();}}));
div.appendChild(c);
});
}
if(0==el.selectedOptions.length) div.appendChild(newEl('span',{class:'placeholder',text:el.attributes['placeholder']?.value??config.placeholder}));
};
div.refresh();
}
el.loadOptions();
search.addEventListener('input',()=>{
list.querySelectorAll(":scope div:not(.multiselect-dropdown-all-selector)").forEach(d=>{
var txt=d.querySelector("label").innerText.toUpperCase();
d.style.display=txt.includes(search.value.toUpperCase())?'block':'none';
});
});
div.addEventListener('click',()=>{
div.listEl.style.display='block';
search.focus();
search.select();
});
document.addEventListener('click', function(event) {
if (!div.contains(event.target)) {
listWrap.style.display='none';
div.refresh();
}
});
});
}
window.addEventListener('load',()=>{
MultiselectDropdown(window.MultiselectDropdownOptions);
});

View File

@ -1 +1 @@
*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e2e8f0}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#94a3b8}input::placeholder,textarea::placeholder{opacity:1;color:#94a3b8}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-y-0{top:0px;bottom:0px}.bottom-0{bottom:0px}.left-0{left:0px}.right-0{right:0px}.z-10{z-index:10}.col-span-2{grid-column:span 2 / span 2}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-4{margin-left:1rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-16{height:4rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.min-h-screen{min-height:100vh}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-auto{width:auto}.w-full{width:100%}.max-w-md{max-width:28rem}.max-w-screen-lg{max-width:1024px}.max-w-screen-xl{max-width:1280px}.flex-shrink-0{flex-shrink:0}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.-space-y-px>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(-1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(-1px * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.rounded-md{border-radius:.375rem}.rounded-b-md{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.rounded-bl-md{border-bottom-left-radius:.375rem}.rounded-br-md{border-bottom-right-radius:.375rem}.rounded-tr-md{border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-t{border-top-width:1px}.border-t-0{border-top-width:0px}.border-\[\#f43f5e\]{--tw-border-opacity: 1;border-color:rgb(244 63 94 / var(--tw-border-opacity))}.bg-\[\#f43f5e\]{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-primary-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-primary-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-primary-900{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.bg-primary-950{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-80{--tw-bg-opacity: .8}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-3{padding-bottom:.75rem}.pl-3{padding-left:.75rem}.ps-1{-webkit-padding-start:.25rem;padding-inline-start:.25rem}.pt-2{padding-top:.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-\[\#f43f5e\]{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity))}.text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-primary-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity))}.text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-primary-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.text-primary-950{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.accent-gray-200{accent-color:#e2e8f0}.accent-primary-600{accent-color:#2563eb}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-gray-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(203 213 225 / var(--tw-ring-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.h1{text-align:center;font-size:1.875rem;line-height:2.25rem;font-weight:700;text-transform:uppercase;letter-spacing:.025em;--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.h2{border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:rgb(226 232 240 / var(--tw-bg-opacity));--tw-bg-opacity: .8;padding:.75rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.025em;--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.sidebar{position:fixed;overflow-y:scroll;top:0;background:white;z-index:2000;width:0;max-width:0;box-shadow:0 1rem 3rem #0000002d}.sidebar.open{background-color:#fff;display:block;height:100vh;right:0;top:0;width:100%;max-width:375px;z-index:40000}.sidebar.slide-in{transition-duration:75ms;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.sidebar.from-right{right:-24rem}.sidebar.from-right.open{right:0}.sidebar.from-left{left:-24rem}.sidebar.from-left.open{left:0}.sidebar-overlay{display:none}.sidebar-overlay.show{background-color:#0003;content:"";display:block;height:100%;left:0;position:fixed;top:0;width:100%;z-index:1025}.sidebar-close{border-radius:100%;flex:0 0 auto;height:1.5rem;width:1.5rem}.sidebar-footer{position:fixed;margin:0 -8px -4px;width:374px;bottom:0}.overlay{overflow:hidden}.btn{display:inline-block;cursor:pointer;border-radius:.375rem;padding:.5rem .75rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.btn:focus-visible{outline-style:solid;outline-width:2px;outline-offset:2px}.btn-primary{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.btn-primary:focus-visible{outline-color:#2563eb}.btn-dark{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.btn-dark:hover{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.btn-dark:focus-visible{outline-color:#172554}.btn-gray{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.btn-gray:hover{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity))}.btn-gray:focus-visible{outline-color:#3b82f6}.btn-attention{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.btn-attention:hover{--tw-bg-opacity: 1;background-color:rgb(255 0 0 / var(--tw-bg-opacity))}.btn-attention:focus-visible{outline-color:red}.btn-alert,.btn-alert:hover{--tw-bg-opacity: 1;background-color:rgb(255 0 0 / var(--tw-bg-opacity))}.btn-alert:focus-visible{outline-color:red}.btn-fw{width:7rem}.btn[aria-pressed=true]{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity));outline-style:solid;outline-width:2px;outline-offset:2px;outline-color:#2563eb}.link-primary{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity));text-decoration-line:underline}.link-primary:hover{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.link-dark{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity));text-decoration-line:underline}.link-dark:hover{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.link-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));text-decoration-line:underline}.link-white:hover{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity))}.input{position:relative;display:block;width:100%;border-width:0px;padding:.375rem .5rem;--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-inset: inset;--tw-ring-opacity: 1;--tw-ring-color: rgb(203 213 225 / var(--tw-ring-opacity))}.input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.input::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.input:focus{z-index:10;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-inset: inset;--tw-ring-opacity: 1;--tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity))}@media (min-width: 640px){.input{font-size:.875rem;line-height:1.5rem}}.alert-success{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.alert-error{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.placeholder\:text-gray-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-gray-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:bg-primary-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:bg-primary-950:hover{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.hover\:text-gray-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.hover\:text-primary-900:hover{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.hover\:text-primary-950:hover{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.focus\:z-10:focus{z-index:10}.focus\:bg-gray-200:focus{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.focus\:bg-primary-50:focus{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.focus\:bg-primary-950:focus{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.focus\:text-primary-950:focus{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-inset:focus{--tw-ring-inset: inset}.focus\:ring-primary-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity))}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-primary-600:focus-visible{outline-color:#2563eb}.group:hover .group-hover\:text-primary-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width: 768px){.md\:col-span-3{grid-column:span 3 / span 3}.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:items-center{align-items:center}}@media (min-width: 1024px){.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}
*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e2e8f0}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#94a3b8}input::placeholder,textarea::placeholder{opacity:1;color:#94a3b8}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-y-0{top:0px;bottom:0px}.bottom-0{bottom:0px}.left-0{left:0px}.right-0{right:0px}.z-10{z-index:10}.col-span-2{grid-column:span 2 / span 2}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-4{margin-left:1rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-3{margin-top:.75rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-16{height:4rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.min-h-screen{min-height:100vh}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-auto{width:auto}.w-full{width:100%}.max-w-md{max-width:28rem}.max-w-screen-lg{max-width:1024px}.max-w-screen-xl{max-width:1280px}.flex-shrink-0{flex-shrink:0}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.-space-y-px>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(-1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(-1px * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.rounded-md{border-radius:.375rem}.rounded-b-md{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.rounded-bl-md{border-bottom-left-radius:.375rem}.rounded-br-md{border-bottom-right-radius:.375rem}.rounded-tr-md{border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-t{border-top-width:1px}.border-t-0{border-top-width:0px}.border-\[\#f43f5e\]{--tw-border-opacity: 1;border-color:rgb(244 63 94 / var(--tw-border-opacity))}.bg-\[\#f43f5e\]{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-primary-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-primary-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-primary-900{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.bg-primary-950{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-80{--tw-bg-opacity: .8}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-3{padding-bottom:.75rem}.pl-3{padding-left:.75rem}.ps-1{-webkit-padding-start:.25rem;padding-inline-start:.25rem}.pt-2{padding-top:.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-\[\#f43f5e\]{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity))}.text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-primary-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity))}.text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-primary-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.text-primary-950{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.accent-gray-200{accent-color:#e2e8f0}.accent-primary-600{accent-color:#2563eb}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-gray-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(203 213 225 / var(--tw-ring-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.h1{text-align:center;font-size:1.875rem;line-height:2.25rem;font-weight:700;text-transform:uppercase;letter-spacing:.025em;--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.h2{border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:rgb(226 232 240 / var(--tw-bg-opacity));--tw-bg-opacity: .8;padding:.75rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.025em;--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.sidebar{position:fixed;overflow-y:scroll;top:0;background:white;z-index:2000;width:0;max-width:0;box-shadow:0 1rem 3rem #0000002d}.sidebar.open{background-color:#fff;display:block;height:100vh;right:0;top:0;width:100%;max-width:375px;z-index:40000}.sidebar.slide-in{transition-duration:75ms;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.sidebar.from-right{right:-24rem}.sidebar.from-right.open{right:0}.sidebar.from-left{left:-24rem}.sidebar.from-left.open{left:0}.sidebar-overlay{display:none}.sidebar-overlay.show{background-color:#0003;content:"";display:block;height:100%;left:0;position:fixed;top:0;width:100%;z-index:1025}.sidebar-close{border-radius:100%;flex:0 0 auto;height:1.5rem;width:1.5rem}.sidebar-footer{position:fixed;margin:0 -8px -4px;width:374px;bottom:0}.overlay{overflow:hidden}.btn{display:inline-block;cursor:pointer;border-radius:.375rem;padding:.5rem .75rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.btn:focus-visible{outline-style:solid;outline-width:2px;outline-offset:2px}.btn-primary{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.btn-primary:focus-visible{outline-color:#2563eb}.btn-dark{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.btn-dark:hover{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.btn-dark:focus-visible{outline-color:#172554}.btn-gray{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.btn-gray:hover{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity))}.btn-gray:focus-visible{outline-color:#3b82f6}.btn-attention{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.btn-attention:hover{--tw-bg-opacity: 1;background-color:rgb(255 0 0 / var(--tw-bg-opacity))}.btn-attention:focus-visible{outline-color:red}.btn-alert,.btn-alert:hover{--tw-bg-opacity: 1;background-color:rgb(255 0 0 / var(--tw-bg-opacity))}.btn-alert:focus-visible{outline-color:red}.btn-fw{width:7rem}.btn[aria-pressed=true]{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity));outline-style:solid;outline-width:2px;outline-offset:2px;outline-color:#2563eb}.link-primary{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity));text-decoration-line:underline}.link-primary:hover{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.link-dark{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity));text-decoration-line:underline}.link-dark:hover{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.link-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));text-decoration-line:underline}.link-white:hover{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity))}.input{position:relative;display:block;width:100%;border-width:0px;padding:.375rem .5rem;--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-inset: inset;--tw-ring-opacity: 1;--tw-ring-color: rgb(203 213 225 / var(--tw-ring-opacity))}.input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.input::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.input:focus{z-index:10;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-inset: inset;--tw-ring-opacity: 1;--tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity))}@media (min-width: 640px){.input{font-size:.875rem;line-height:1.5rem}}.alert-success{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.alert-error{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.placeholder\:text-gray-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-gray-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:bg-primary-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:bg-primary-950:hover{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.hover\:text-gray-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.hover\:text-primary-900:hover{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity))}.hover\:text-primary-950:hover{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.focus\:z-10:focus{z-index:10}.focus\:bg-gray-200:focus{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.focus\:bg-primary-50:focus{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.focus\:bg-primary-950:focus{--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity))}.focus\:text-primary-950:focus{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity))}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-inset:focus{--tw-ring-inset: inset}.focus\:ring-primary-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity))}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-primary-600:focus-visible{outline-color:#2563eb}.group:hover .group-hover\:text-primary-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width: 768px){.md\:col-span-3{grid-column:span 3 / span 3}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:items-center{align-items:center}}@media (min-width: 1024px){.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}

View File

@ -4,12 +4,12 @@
{% if allow_any_shipmaster %}
<select name="shipmaster" id="shipmaster" class="input rounded-md h-10">
<optgroup label="Steuerpersonen">
<optgroup label="Steuerleute">
{% for cox in coxes %}
<option value="{{ cox.id }}" {% if cox.id == shipmaster%} selected {% endif %}>{{ cox.name }}</option>
{% endfor %}
</optgroup>
<optgroup label="Restliche Mitglieder">
<optgroup label="Mitglieder">
{% for user in users | filter(attribute="is_cox", value=false) %}
<option value="{{ user.id }}" {% if user.id == shipmaster%} selected {% endif %}>{{ user.name }}</option>
{% endfor %}
@ -26,6 +26,8 @@
{{ log::rower_select(id="newrower", selected=[], class="col-span-2") }}
{% endif %}
<div></div>
{{ macros::input(label='Abfahrtszeit', name='departure', type='datetime-local', required=true) }}
{{ macros::input(label='Ankunftszeit', name='arrival', type='datetime-local') }}
@ -69,6 +71,8 @@
document.getElementById("departure").value = formattedDate;
</script>
</form>
<script src="/public/js/multiselect-dropdown.js" ></script>
<script>
document.getElementById('form').addEventListener('submit', function(e) {
e.preventDefault();
@ -87,9 +91,20 @@
{% if only_ones %}
{% set_global boats = boats | filter(attribute="amount_seats", value=1) %}
{% endif %}
{% for boat in boats %}
<div onclick="document.getElementById('boat_id').value='{{ boat.id }}';updateElementsBasedOnSelectedOption()">{{ boat.name }}</div>
{% endfor %}
{% for amount_seats, grouped_boats in boats | group_by(attribute="amount_seats") %}
<div class="pb-2">
<div class="bg-gray-100 text-primary-950 text-center text-sm mb-2">
<strong>{{ amount_seats }}x</strong>
</div>
{% for boat in grouped_boats %}
<div id="boat-{{ boat.id }}" {% if boat.damage != 'locked' %} onclick="document.getElementById('boat_id').value='{{ boat.id }}';updateElementsBasedOnSelectedOption()"{% endif %} class="px-3">
<span class="status-damage status-damage-{{ boat.damage }}"></span>
<span {% if boat.damage == 'locked' or boat.on_water %} class="opacity-50" {% endif %}>{{ boat.name }}</span>
</div>
{% endfor %}
</div>
{% endfor %}
<script>
function updateElementsBasedOnSelectedOption() {
var selectElement = document.getElementById('boat_id');
@ -97,6 +112,8 @@
var shipmaster_only_steering = selectedOption.getAttribute("extra-default_shipmaster_only_steering") === 'true';
document.getElementById('shipmaster_only_steering').checked = shipmaster_only_steering;
document.getElementById('newrower-max_rower_allowed').innerHTML = selectedOption.getAttribute("extra-amount_seats");
console.log(selectElement.selectedOptions[0]);
}
document.addEventListener('DOMContentLoaded', function() {
@ -108,10 +125,10 @@
{% macro boat_select(only_ones) %}
{% if not only_ones %}
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="col-span-2 md:hidden") }}
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="col-span-2") }}
{% else %}
{% set ones = boats | filter(attribute="amount_seats", value=1) %}
{{ macros::select(data=ones, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="md:hidden") }}
{{ macros::select(data=ones, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="col-span-2") }}
{% endif %}
<script>
function updateElementsBasedOnSelectedOption() {
@ -128,6 +145,60 @@
{% endmacro boat_select %}
{% macro show(log, state, allowed_to_close=false, only_ones) %}
<div class="grid grid-cols-1 gap-3 mb-3 w-full">
<div class="pt-2 px-3 {% if not loop.first %} border-t {% endif %}">
<div class="w-full">
<div class="flex justify-between">
<div>
<strong class="text-primary-900">
{{ log.departure_timestamp | date(format="%H:%M") }} Uhr
</strong>
<small class="text-gray-600">({{ log.boat.name }})</small>
</div>
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ log.departure_timestamp | date(format="%H:%M") }} Uhr</strong> ({{ log.boat.name }})" data-body="#log{{ log.id }}" class="inline-block link-primary mr-3">
Details
</a>
</div>
<div>
{% if allowed_to_close and state == "on_water" %}
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ log.departure_timestamp | date(format="%H:%M") }} Uhr</strong> ({{ log.boat.name }})" data-body="#close{{ log.id }}" class="btn btn-dark w-full mt-3">
Beenden
</a>
{% endif %}
</div>
<div class="hidden">
{% if allowed_to_close and state == "on_water" %}
<div id="close{{ log.id }}">
{{ log::home(log=log, only_ones=only_ones) }}
</div>
{% endif %}
<div id="log{{ log.id }}">
{% if log.destination %}
{{ log.destination }}
{% endif %}
{% for cox in coxes %}
{% if cox.id == log.shipmaster %}
<p>
<strong>{{ cox.name }}</strong>
</p>
{% endif %}
{% endfor %}
{% for rower in log.rowers %}
<p>{{ rower.name }}</p>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% endmacro show %}
{% macro show_old(log, state, allowed_to_close=false, only_ones) %}
Bootsname: {{ log.boat.name }}<br />
Schiffsführer: {{ log.shipmaster_user.name }}<br />
{% if log.shipmaster_only_steering %}
@ -162,11 +233,16 @@
{{ rower.name }}
{% endfor %}
{% endif %}
{% endmacro show %}
{% endmacro show_old %}
{% macro home(log, only_ones) %}
<form action="/log/{{log.id}}" method="post">
Destination: <input type="search" list="destinations" placeholder="Destination" required="required", id="destination-home" name="destination" value="{{log.destination}}" oninput="var inputElement = document.getElementById('destination-home');
<form class="grid grid-cols-1 gap-3" action="/log/{{log.id}}" method="post">
{% if not only_ones %}
{% endif %}
<div class="relative">
<label for="destination" class="small text-gray-600">Ziel</label>
<input class="input rounded-md" type="search" list="destinations" placeholder="Destination" required="required", id="destination-home" name="destination" value="{{log.destination}}" oninput="var inputElement = document.getElementById('destination-home');
var dataList = document.getElementById('destinations');
var selectedValue = inputElement.value;
for (var i = 0; i < dataList.options.length; i++) {
@ -176,36 +252,46 @@
break;
}
}">
{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km_home", type="number", min=0, value=log.distance_in_km, required=true) }}
{{ macros::input(label="Kommentar", name="comments", type="text", value=log.comments) }}
{{ macros::select(data=logtypes, select_name='logtype', default="Normal", selected_id=log.logtype) }}
{% if not only_ones %}
{{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }}
{% endif %}
<input type="submit" value="AUSFAHRT BEENDEN"/>
</div>
<div class="relative">
{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km_home", type="number", min=0, value=log.distance_in_km, required=true) }}
<span class="absolute right-0 bottom-0 py-1.5 px-2 bg-white border-0 text-gray-600 ring-1 ring-inset ring-gray-300 rounded-br-md rounded-tr-md">km</span>
</div>
{{ macros::input(label="Kommentar", name="comments", type="text", value=log.comments) }}
<div>
<label for="logtype" class=" small text-gray-600 ">Typ</label>
{{ macros::select(data=logtypes, select_name='logtype', default="Normal", selected_id=log.logtype) }}
</div>
<input class="btn btn-primary" type="submit" value="Ausfahrt beenden"/>
</form>
{% endmacro home %}
{% macro rower_select(id, selected, amount_seats='', class='') %}
<select multiple="multiple" name="rower[]" id="{{id}}" onclick="updateSelectedRowersCount{{id}}()" onblur="updateSelectedRowersCount{{id}}()" class="{{ class }}">
{% for user in users %}
{% set_global sel = false %}
{% for rower in selected %}
{% if rower.id == user.id %}
{% set_global sel = true %}
{% endif %}
<div class="{{ class }}">
<select multiple="multiple" name="rower[]" multiselect-search="true" multiselect-max-items="8" id="{{id}}" onclick="updateSelectedRowersCount{{id}}()" onblur="updateSelectedRowersCount{{id}}()" class="w-full">
{% for user in users %}
{% set_global sel = false %}
{% for rower in selected %}
{% if rower.id == user.id %}
{% set_global sel = true %}
{% endif %}
{% endfor %}
<option value="{{ user.id }}" {% if sel %}selected{% endif %} onmousedown="event.preventDefault();this.selected = !this.selected; return false;">{{user.name}}</option>
{% endfor %}
<option value="{{ user.id }}" {% if sel %}selected{% endif %} onmousedown="event.preventDefault();this.selected = !this.selected; return false;">{{user.name}}</option>
{% endfor %}
</select>
<script>
function updateSelectedRowersCount{{id}}() {
document.getElementById('{{id}}-amount_rower_selected').textContent = document.getElementById('{{id}}').selectedOptions.length+1;
}
document.addEventListener('DOMContentLoaded', updateSelectedRowersCount{{id}});
</script>
<div class="col-span-2">
</select>
<script>
function updateSelectedRowersCount{{id}}() {
document.getElementById('{{id}}-amount_rower_selected').textContent = document.getElementById('{{id}}').selectedOptions.length+1;
}
document.addEventListener('DOMContentLoaded', updateSelectedRowersCount{{id}});
</script>
</div>
<div>
<span id="{{id}}-amount_rower_selected"></span>/<span id="{{id}}-max_rower_allowed">{{amount_seats}}</span> Ruderer ausgewählt
</div>
{% endmacro rower_select %}

View File

@ -13,29 +13,30 @@
{% endif %}
<div class="w-full grid md:grid-cols-5 gap-3 mt-5">
<div class="bg-white rounded-md hidden md:block">
<div class="bg-white rounded-md hidden md:block shadow">
<h2 class="h2">Boote</h2>
<div class="p-3">
<div>
{{ log::show_boats(only_ones=false) }}
</div>
</div>
<div class="md:col-span-3 bg-white rounded-md">
<div class="md:col-span-3 bg-white rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3">
{{ log::new(only_ones=false, allow_any_shipmaster=true, shipmaster=-1) }}
</div>
</div>
<div class="bg-white rounded-md">
<div class="bg-white rounded-md shadow">
<h2 class="h2">Am Wasser</h2>
<div class="p-3">
<div>
{% for log in on_water %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=false) }}
<hr />
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=false) }}
{% endfor %}
</div>
</div>
</div>
</div>
{% include "dynamics/sidebar" %}
{% endblock content%}

View File

@ -8,7 +8,7 @@
<div class="max-w-screen-lg w-full">
<h1 class="h1">Logbuch</h1>
{% for log in logs %}
{{ log::show(log=log, state="completed", only_ones=false) }}
{{ log::show_old(log=log, state="completed", only_ones=false) }}
<hr/>
{% endfor %}
</div>

View File

@ -8,20 +8,36 @@
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
{% endif %}
<div class="max-w-screen-lg w-full">
<div class="w-full">
<h1 class="h1">Logbuch</h1>
<h2>Neue Ausfahrt starten</h2>
{{ log::new(only_ones=loggedin_user.is_cox==false, allow_any_shipmaster=loggedin_user.is_cox, shipmaster=loggedin_user.id) }}
<h2 style="font-size: 100px">Am Wasser</h2>
{% for log in on_water %}
{% if log.shipmaster == loggedin_user.id %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=loggedin_user.is_cox==false) }}
{% else %}
{{ log::show(log=log, state="on_water", only_ones=true) }}
{% endif %}
<hr/>
{% endfor %}
</div>
<div class="w-full grid md:grid-cols-5 gap-3 mt-5">
<div class="bg-white rounded-md hidden md:block shadow">
<h2 class="h2">Boote</h2>
<div>
{{ log::show_boats(only_ones=false) }}
</div>
</div>
<div class="md:col-span-3 bg-white rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3">
{{ log::new(only_ones=loggedin_user.is_cox==false, allow_any_shipmaster=loggedin_user.is_cox, shipmaster=loggedin_user.id) }}
</div>
</div>
<div class="bg-white rounded-md shadow">
<h2 class="h2">Am Wasser</h2>
{% for log in on_water %}
{% if log.shipmaster == loggedin_user.id %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=loggedin_user.is_cox==false) }}
{% else %}
{{ log::show(log=log, state="on_water", only_ones=true) }}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% include "dynamics/sidebar" %}
{% endblock content%}