The sheet accepts up to fifty unique SKUs, with an explicit ASCII case-insensitive identifier policy. Quantities are whole units from zero to 100000. Once counting starts, the baseline cannot be edited through this workflow. A real service integration should load and version the authoritative sheet rather than trust user input as server stock.
Scanning and manual entry use the same selection rule. Neither changes quantities. A selected product gets its own keyed count panel, so another product does not inherit the previous product's unsubmitted draft. The proposed count belongs to the record and survives closing that panel.
The photo request snapshots the selected SKU. Its job consumes actual image bytes before attaching them to that product. Replacements preserve the previous image on failure, and the whole sheet has a sixteen-MiB photo budget in addition to the job's per-image bound.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/app/jobs.rs","value":"src-app-jobs-rs"},{"index":2,"label":"src/app/state.rs","value":"src-app-state-rs"},{"index":3,"label":"src/app/setup.rs","value":"src-app-setup-rs"},{"index":4,"label":"src/app/product.rs","value":"src-app-product-rs"},{"index":5,"label":"src/app/screen.rs","value":"src-app-screen-rs"},{"index":6,"label":"src/i18n.rs","value":"src-i18n-rs"},{"index":7,"label":"src/lib.rs","value":"src-lib-rs"},{"index":8,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":9,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":10,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
pub mod jobs;
mod product;
mod screen;
mod setup;
pub mod state;
pub use screen::InventoryScreen;
pub use state::InventoryState;
{"id":"fission-tabs-1","index":1,"label":"src/app/jobs.rs","value":"src-app-jobs-rs"}
use fission::core::{CameraCapture, JobCtx, JobRef, JobSpec};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PhotoRequest {
pub reference: String,
pub capture: CameraCapture,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ShelfPhoto {
pub reference: String,
pub bytes: Vec<u8>,
pub content_type: String,
}
pub struct CollectPhoto;
impl JobSpec for CollectPhoto {
type Request = PhotoRequest;
type Ok = ShelfPhoto;
type Err = String;
const NAME: &'static str = "inventory.collect-photo";
}
pub const COLLECT_PHOTO: JobRef<CollectPhoto> = JobRef::new(CollectPhoto::NAME);
pub async fn collect_photo(request: PhotoRequest, cx: JobCtx) -> Result<ShelfPhoto, String> {
let mut stream = cx
.open_data_stream(request.capture.stream)
.map_err(|error| error.to_string())?;
// Consume the one-shot handle even when its metadata fails these bounds.
let pixels = u64::from(request.capture.width) * u64::from(request.capture.height);
if pixels == 0 || pixels > 16_000_000 {
return Err("Unsupported image dimensions".into());
}
if !matches!(
request.capture.content_type.as_str(),
"image/jpeg" | "image/png"
) {
return Err("Only JPEG and PNG arrival photos are accepted".into());
}
let mut bytes = Vec::new();
while let Some(chunk) = std::future::poll_fn(|cx| stream.as_mut().poll_next(cx)).await {
let chunk = chunk.map_err(|error| error.to_string())?;
let length = bytes
.len()
.checked_add(chunk.len())
.ok_or("Image is too large")?;
if length > 8 * 1024 * 1024 {
return Err("Image exceeds the eight-MiB limit".into());
}
bytes.extend_from_slice(&chunk);
}
if bytes.is_empty() {
return Err("The camera returned an empty image".into());
}
Ok(ShelfPhoto {
reference: request.reference,
bytes,
content_type: request.capture.content_type,
})
}
{"id":"fission-tabs-1","index":2,"label":"src/app/state.rs","value":"src-app-state-rs"}
use super::jobs::{PhotoRequest, ShelfPhoto, COLLECT_PHOTO};
use fission::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Product {
pub sku: String,
pub name: String,
pub bin: String,
pub baseline: u32,
pub proposed: Option<u32>,
pub photo: Option<ShelfPhoto>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct InventoryState {
pub locale: Locale,
pub products: Vec<Product>,
pub locked: bool,
pub selected: Option<String>,
pub busy: bool,
pub capture_sku: Option<String>,
pub status_key: String,
pub diagnostic: Option<String>,
}
impl Default for InventoryState {
fn default() -> Self {
Self {
locale: Locale::from("en-US"),
products: Vec::new(),
locked: false,
selected: None,
busy: false,
capture_sku: None,
status_key: "inventory.ready".into(),
diagnostic: None,
}
}
}
impl GlobalState for InventoryState {}
pub fn units(input: &str) -> Option<u32> {
let input = input.trim();
if input.is_empty() || !input.bytes().all(|byte| byte.is_ascii_digit()) {
return None;
}
input.parse::<u32>().ok().filter(|value| *value <= 100_000)
}
pub fn normalized_sku(input: &str) -> Option<String> {
let input = input.trim();
if input.is_empty()
|| input.len() > 48
|| !input
.bytes()
.all(|byte| byte.is_ascii_alphanumeric() || b"-_.".contains(&byte))
{
return None;
}
Some(input.to_ascii_uppercase())
}
pub fn add_product(
state: &mut InventoryState,
sku: &str,
name: &str,
bin: &str,
quantity: &str,
) -> bool {
if state.locked || state.products.len() >= 50 {
return false;
}
let (Some(sku), Some(baseline)) = (normalized_sku(sku), units(quantity)) else {
return false;
};
if name.trim().is_empty()
|| bin.trim().is_empty()
|| state.products.iter().any(|product| product.sku == sku)
{
return false;
}
state.products.push(Product {
sku,
name: name.trim().to_owned(),
bin: bin.trim().to_owned(),
baseline,
proposed: None,
photo: None,
});
true
}
pub fn select_product(state: &mut InventoryState, input: &str) {
if state.busy || !state.locked {
return;
}
state.diagnostic = None;
let sku = normalized_sku(input);
if let Some(product) = state
.products
.iter()
.find(|product| Some(&product.sku) == sku.as_ref())
{
state.selected = Some(product.sku.clone());
state.status_key = "inventory.selected".into();
} else {
state.status_key = "inventory.unknown_sku".into();
}
}
pub fn stage_count(state: &mut InventoryState, sku: &str, input: &str) -> bool {
if state.busy || !state.locked {
return false;
}
let Some(count) = units(input) else {
return false;
};
let Some(product) = state.products.iter_mut().find(|product| product.sku == sku) else {
return false;
};
product.proposed = Some(count);
state.status_key = "inventory.staged".into();
true
}
pub fn scan(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
if state.busy || !state.locked {
return;
}
state.busy = true;
state.diagnostic = None;
state.status_key = "inventory.scan_pending".into();
let ok = cx.effects.bind(SkuScanned, reduce_with!(sku_scanned));
let err = cx.effects.bind(ScanFailed, reduce_with!(scan_failed));
cx.effects
.barcode_scanner()
.scan(BarcodeScanRequest {
formats: vec![BarcodeFormat::Code128, BarcodeFormat::QrCode],
allow_multiple: false,
prompt: None,
timeout_ms: Some(20_000),
..Default::default()
})
.on_ok(ok)
.on_err(err);
}
#[fission_reducer(SkuScanned)]
fn sku_scanned(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
state.busy = false;
let Some(results) = cx.input.capability_ok(SCAN_BARCODE) else {
state.status_key = "inventory.unexpected".into();
return;
};
match results.items.first() {
Some(result) => select_product(state, &result.value),
None => state.status_key = "inventory.no_code".into(),
}
}
#[fission_reducer(ScanFailed)]
fn scan_failed(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
state.busy = false;
match cx.input.capability_error(SCAN_BARCODE) {
Some(error) => {
state.status_key = "inventory.scan_failed".into();
state.diagnostic = Some(format!("{}: {}", error.code, error.message));
}
None => state.status_key = "inventory.unexpected".into(),
}
}
pub fn capture_photo(
state: &mut InventoryState,
sku: &str,
cx: &mut ReducerContext<InventoryState>,
) {
if state.busy {
return;
}
if !state.products.iter().any(|product| product.sku == sku) {
return;
}
state.capture_sku = Some(sku.to_owned());
state.busy = true;
state.diagnostic = None;
state.status_key = "inventory.permission_pending".into();
let ok = cx
.effects
.bind(PermissionReturned, reduce_with!(permission_returned));
let err = cx.effects.bind(CameraFailed, reduce_with!(camera_failed));
cx.effects
.camera()
.request_permission(CameraPermissionRequest { reason: None })
.on_ok(ok)
.on_err(err);
}
#[fission_reducer(PermissionReturned)]
fn permission_returned(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
match cx.input.capability_ok(REQUEST_CAMERA_PERMISSION) {
Some(CameraPermission::Granted) => {
state.status_key = "inventory.photo_pending".into();
let ok = cx.effects.bind(PhotoCaptured, reduce_with!(photo_captured));
let err = cx.effects.bind(CameraFailed, reduce_with!(camera_failed));
cx.effects
.camera()
.capture_photo(CameraCaptureRequest {
camera_id: None,
facing: CameraFacing::Back,
resolution: Some(CameraResolution {
width: 1600,
height: 1200,
}),
format: CameraImageFormat::Jpeg,
flash: CameraFlashMode::Off,
quality: Some(85),
})
.on_ok(ok)
.on_err(err);
}
Some(
CameraPermission::Denied | CameraPermission::Restricted | CameraPermission::Unknown,
) => {
state.busy = false;
state.capture_sku = None;
state.status_key = "inventory.denied".into();
}
None => {
state.busy = false;
state.capture_sku = None;
state.status_key = "inventory.unexpected".into();
}
}
}
#[fission_reducer(PhotoCaptured)]
fn photo_captured(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
let capture = cx.input.capability_ok(CAPTURE_PHOTO);
let sku = state.capture_sku.take();
let (Some(capture), Some(reference)) = (capture, sku) else {
state.busy = false;
state.status_key = "inventory.unexpected".into();
return;
};
state.status_key = "inventory.image_pending".into();
let ok = cx
.effects
.bind(PhotoCollected, reduce_with!(photo_collected));
let err = cx.effects.bind(PhotoFailed, reduce_with!(photo_failed));
cx.effects
.app(COLLECT_PHOTO, PhotoRequest { reference, capture })
.on_ok(ok)
.on_err(err);
}
#[fission_reducer(PhotoCollected)]
fn photo_collected(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
state.busy = false;
let Some(photo) = cx.input.job_ok(COLLECT_PHOTO) else {
state.status_key = "inventory.unexpected".into();
return;
};
let existing_bytes: usize = state
.products
.iter()
.filter(|product| product.sku != photo.reference)
.filter_map(|product| product.photo.as_ref())
.map(|photo| photo.bytes.len())
.sum();
if existing_bytes + photo.bytes.len() > 16 * 1024 * 1024 {
state.status_key = "inventory.photo_budget".into();
return;
}
let Some(product) = state
.products
.iter_mut()
.find(|product| product.sku == photo.reference)
else {
state.status_key = "inventory.unexpected".into();
return;
};
product.photo = Some(photo);
state.status_key = "inventory.photo_attached".into();
}
#[fission_reducer(PhotoFailed)]
fn photo_failed(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
state.busy = false;
state.status_key = "inventory.photo_failed".into();
state.diagnostic = cx.input.job_err(COLLECT_PHOTO);
if state.diagnostic.is_none() {
state.status_key = "inventory.unexpected".into();
}
}
#[fission_reducer(CameraFailed)]
fn camera_failed(state: &mut InventoryState, cx: &mut ReducerContext<InventoryState>) {
state.busy = false;
state.capture_sku = None;
let error = cx
.input
.capability_error(REQUEST_CAMERA_PERMISSION)
.or_else(|| cx.input.capability_error(CAPTURE_PHOTO));
match error {
Some(error) => {
state.status_key = "inventory.photo_failed".into();
state.diagnostic = Some(format!("{}: {}", error.code, error.message));
}
None => state.status_key = "inventory.unexpected".into(),
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn stage_changes_proposal_but_not_baseline() {
let mut state = InventoryState::default();
assert!(add_product(
&mut state,
"tnt-041",
"Trail tarp",
"C-12",
"18"
));
state.locked = true;
assert!(stage_count(&mut state, "TNT-041", "17"));
assert_eq!(state.products[0].baseline, 18);
assert_eq!(state.products[0].proposed, Some(17));
assert!(stage_count(&mut state, "TNT-041", "0"));
assert_eq!(state.products[0].baseline, 18);
}
#[test]
fn unknown_sku_and_invalid_count_preserve_record() {
let mut state = InventoryState::default();
add_product(&mut state, "tnt-041", "Trail tarp", "C-12", "18");
assert!(!add_product(
&mut state,
"TNT-041",
"Duplicate",
"C-13",
"4"
));
state.locked = true;
assert!(!stage_count(&mut state, "TNT-041", "17.5"));
select_product(&mut state, "UNKNOWN");
assert_eq!(state.selected, None);
assert_eq!(state.products[0].baseline, 18);
assert_eq!(state.products[0].proposed, None);
}
}
{"id":"fission-tabs-1","index":3,"label":"src/app/setup.rs","value":"src-app-setup-rs"}
use super::state::{add_product, normalized_sku, units, InventoryState};
use fission::prelude::*;
fission_component! {
pub SheetSetup<InventoryState> {
state {
sku: String = String::new(),
name: String = String::new(),
bin: String = String::new(),
baseline: String = String::new(),
attempted: bool = false,
}
}
view(form, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let sku_error = (form.attempted && (normalized_sku(&form.sku).is_none()
|| state.products.iter().any(|product| Some(product.sku.clone()) == normalized_sku(&form.sku))))
.then(|| cx.tr("inventory.sku_error"));
let name_error = (form.attempted && form.name.trim().is_empty()).then(|| cx.tr("inventory.required"));
let bin_error = (form.attempted && form.bin.trim().is_empty()).then(|| cx.tr("inventory.required"));
let count_error = (form.attempted && units(&form.baseline).is_none()).then(|| cx.tr("inventory.units_error"));
} => Column(gap: tokens.spacing.s, children: [
Text(cx.tr("inventory.setup")),
FormControl(label: Some(cx.tr("inventory.sku")), required: true, error: sku_error,
child: TextInput(value: form.sku.clone(), bind(on_input): to(form.sku))),
FormControl(label: Some(cx.tr("inventory.name")), required: true, error: name_error,
child: TextInput(value: form.name.clone(), bind(on_input): to(form.name))),
FormControl(label: Some(cx.tr("inventory.bin")), required: true, error: bin_error,
child: TextInput(value: form.bin.clone(), bind(on_input): to(form.bin))),
FormControl(label: Some(cx.tr("inventory.baseline")), required: true, error: count_error,
child: TextInput(value: form.baseline.clone(), bind(on_input): to(form.baseline),
keyboard_type: TextInputType::Number)),
Button(child: Text(cx.tr("inventory.add")), key: "add-product", disabled: state.products.len() >= 50,
on_press: reduce {
form.attempted = true;
if add_product(state, &form.sku, &form.name, &form.bin, &form.baseline) {
form.sku.clear(); form.name.clear(); form.bin.clear(); form.baseline.clear();
form.attempted = false;
}
}),
Button(child: Text(cx.tr("inventory.lock")), key: "lock-sheet", disabled: state.products.is_empty(),
on_press: reduce { state.locked = true; }),
])
}
{"id":"fission-tabs-1","index":4,"label":"src/app/product.rs","value":"src-app-product-rs"}
use super::state::{capture_photo, select_product, stage_count, units, InventoryState};
use fission::prelude::*;
fission_component! {
pub ProductRow<InventoryState> { props { sku: String } }
view(row, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let product = state.products.iter().find(|product| product.sku == row.sku);
} => if let Some(product) = product {
Container(Column(gap: tokens.spacing.s, children: [
Text(format!("{} · {} · {}", product.sku, product.name, product.bin))
.weight(tokens.typography.font_weight_semibold),
Text(cx.tr("inventory.baseline_value").replace("{count}", &product.baseline.to_string())),
if let Some(count) = product.proposed {
Text(cx.tr("inventory.proposal")
.replace("{count}", &count.to_string())
.replace("{difference}", &format!("{:+}", i64::from(count) - i64::from(product.baseline))))
},
if state.locked {
Button(child: Text(cx.tr("inventory.select")), key: "select",
disabled: state.busy,
on_press: reduce { select_product(state, &row.sku); })
},
])).padding_all(tokens.spacing.m)
.border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium)
} else { Text(cx.tr("inventory.unknown_sku")) }
}
fission_component! {
pub CountPanel<InventoryState> {
props { sku: String }
state { count: String = String::new(), attempted: bool = false }
}
view(panel, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let product = state.products.iter().find(|product| product.sku == panel.sku);
let error = (panel.attempted && units(&panel.count).is_none()).then(|| cx.tr("inventory.units_error"));
let image_width = (cx.view.viewport_size().width - 2.0 * tokens.spacing.l).clamp(1.0, 560.0);
} => if let Some(product) = product {
Column(gap: tokens.spacing.s, children: [
Text(cx.tr("inventory.counting").replace("{sku}", &product.sku))
.weight(tokens.typography.font_weight_semibold),
FormControl(label: Some(cx.tr("inventory.physical")), required: true, error: error,
child: TextInput(value: panel.count.clone(), bind(on_input): to(panel.count),
keyboard_type: TextInputType::Number)),
Button(child: Text(cx.tr("inventory.stage")), key: "stage", disabled: state.busy,
on_press: reduce {
panel.attempted = true;
if stage_count(state, &panel.sku, &panel.count) {
panel.count.clear(); panel.attempted = false;
}
}),
Button(child: Text(cx.tr("inventory.photo")), key: "photo", disabled: state.busy,
on_press: reduce { capture_photo(state, &panel.sku, cx); }),
if let Some(photo) = &product.photo {
Image::memory(photo.bytes.clone()).size(image_width, image_width * 0.75)
.fit(ir_op::ImageFit::Contain).semantic_label(cx.tr("inventory.photo_label"))
},
Button(child: Text(cx.tr("inventory.close")), key: "close", disabled: state.busy,
on_press: reduce { state.selected = None; }),
])
} else { Text(cx.tr("inventory.unknown_sku")) }
}
{"id":"fission-tabs-1","index":5,"label":"src/app/screen.rs","value":"src-app-screen-rs"}
use super::product::{CountPanel, ProductRow};
use super::setup::SheetSetup;
use super::state::{scan, select_product, InventoryState};
use fission::prelude::*;
fission_component! {
pub InventoryScreen<InventoryState> {
state { manual_sku: String = String::new() }
}
view(form, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let proposed = state.products.iter().filter(|product| product.proposed.is_some()).count();
} => SafeArea(child: Scroll(child: Container(Column(gap: tokens.spacing.m, children: [
Text(cx.tr("inventory.title")).size(tokens.typography.heading2_size),
Text(cx.tr("inventory.explanation")),
Row(gap: tokens.spacing.s, children: [
Button(child: Text(cx.tr("language.english")), key: "english",
on_press: reduce { state.locale = Locale::from("en-US"); }),
Button(child: Text(cx.tr("language.spanish")), key: "spanish",
on_press: reduce { state.locale = Locale::from("es-ES"); }),
]),
if !state.locked { SheetSetup() },
Text(cx.tr("inventory.progress")
.replace("{proposed}", &proposed.to_string()).replace("{total}", &state.products.len().to_string())),
if state.locked {
Column(gap: tokens.spacing.s, children: [
TextInput(value: form.manual_sku.clone(), bind(on_input): to(form.manual_sku),
label: Some(TextContent::Key("inventory.manual".into()))),
Button(child: Text(cx.tr("inventory.open")), key: "manual", disabled: state.busy,
on_press: reduce { select_product(state, &form.manual_sku); }),
Button(child: Text(cx.tr("inventory.scan")), key: "scan", disabled: state.busy,
on_press: reduce { scan(state, cx); }),
])
},
if state.busy {
Spinner(motion: Some(SpinnerMotion::Default), label: Some(cx.tr(&state.status_key)))
},
Text(cx.tr(&state.status_key)),
if let Some(diagnostic) = &state.diagnostic { Code(text: diagnostic.clone()) },
if let Some(sku) = &state.selected { CountPanel(sku.clone(), key: sku.clone()) },
for product in &state.products {
ProductRow(product.sku.clone(), key: product.sku.clone())
},
Text(cx.tr("inventory.scope")).color(tokens.colors.text_secondary),
])).padding_all(tokens.spacing.l)))
}
{"id":"fission-tabs-1","index":6,"label":"src/i18n.rs","value":"src-i18n-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;
pub fn create_env() -> Env {
let mut env = Env::default();
env.locale = Locale::from("en-US");
for (locale, source) in [
("en-US", include_str!("../i18n/en-US.yaml")),
("es-ES", include_str!("../i18n/es-ES.yaml")),
] {
let messages: HashMap<String, String> =
serde_yaml::from_str(source).expect("valid voice note translations");
env.i18n.add_bundle(TranslationBundle {
locale: Locale::from(locale),
messages,
});
}
env
}
pub fn sync_env(state: &crate::app::InventoryState, env: &mut Env) {
env.locale = state.locale.clone();
}
{"id":"fission-tabs-1","index":7,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod i18n;
use app::{InventoryScreen, InventoryState};
use fission::prelude::*;
#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
DesktopApp::<InventoryState, _>::new(InventoryScreen)
.with_env(i18n::create_env())
.with_async(|asyncs| {
asyncs.register_job(app::jobs::COLLECT_PHOTO, |request, cx| async move {
app::jobs::collect_photo(request, cx).await
});
})
.with_sync_env(i18n::sync_env)
.run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
MobileApp::<InventoryState, _>::new(InventoryScreen)
.with_env(i18n::create_env())
.with_async(|asyncs| {
asyncs.register_job(app::jobs::COLLECT_PHOTO, |request, cx| async move {
app::jobs::collect_photo(request, cx).await
});
})
.with_sync_env(i18n::sync_env)
.run()
}
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
let _ = MobileApp::<InventoryState, _>::new(InventoryScreen)
.with_env(i18n::create_env())
.with_async(|asyncs| {
asyncs.register_job(app::jobs::COLLECT_PHOTO, |request, cx| async move {
app::jobs::collect_photo(request, cx).await
});
})
.with_sync_env(i18n::sync_env)
.run_with_android_app(app_handle);
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
console_error_panic_hook::set_once();
WebApp::<InventoryState, _>::new(InventoryScreen)
.with_env(i18n::create_env())
.with_async(|asyncs| {
asyncs.register_job(app::jobs::COLLECT_PHOTO, |request, cx| async move {
app::jobs::collect_photo(request, cx).await
});
})
.with_sync_env(i18n::sync_env)
.run()
.map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":8,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod i18n;
use fission::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();
WebApp::<app::InventoryState, _>::new(app::InventoryScreen)
.with_env(i18n::create_env())
.with_async(|asyncs| {
asyncs.register_job(app::jobs::COLLECT_PHOTO, |request, cx| async move {
app::jobs::collect_photo(request, cx).await
});
})
.with_sync_env(i18n::sync_env)
.mount("#fission-web-mount")
.run()
.map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":9,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
inventory.title: "Review a physical stock count"
inventory.explanation: "Enter the real count sheet, lock its baseline, then scan or select a product. Staging a count never changes that baseline."
inventory.setup: "Set up the count sheet from your inventory record. This example supports up to 50 products."
inventory.sku: "Product SKU"
inventory.name: "Product name"
inventory.bin: "Shelf or bin"
inventory.baseline: "Recorded system quantity"
inventory.sku_error: "Use a unique SKU of 1–48 ASCII letters, digits, dots, hyphens or underscores."
inventory.required: "Enter this value."
inventory.units_error: "Enter a whole-number quantity from 0 to 100000."
inventory.add: "Add product to sheet"
inventory.lock: "Lock baseline and start counting"
inventory.baseline_value: "Baseline system quantity: {count}"
inventory.proposal: "Proposed count: {count}; difference: {difference}"
inventory.select: "Count this product"
inventory.counting: "Counting {sku}"
inventory.physical: "Actual physical count"
inventory.stage: "Stage count for review"
inventory.photo: "Capture optional shelf photo"
inventory.photo_label: "Actual shelf photo for the selected product"
inventory.close: "Finish this product"
inventory.progress: "{proposed} of {total} products have a staged count"
inventory.manual: "Enter a shelf label manually"
inventory.open: "Select entered SKU"
inventory.scan: "Scan shelf label"
inventory.ready: "No count sheet has been locked yet."
inventory.selected: "Product selected. Scanning does not change its count."
inventory.unknown_sku: "That SKU is not on the locked count sheet. No product was changed."
inventory.staged: "Count staged for review. The baseline quantity is unchanged."
inventory.scan_pending: "Waiting for a barcode result…"
inventory.no_code: "No barcode was returned. Enter the label manually or choose a product."
inventory.scan_failed: "Scanning failed. Manual entry and product selection remain available."
inventory.permission_pending: "Waiting for camera permission…"
inventory.denied: "Photo access was not granted. You can continue counting without it."
inventory.photo_pending: "Capturing the shelf photograph…"
inventory.image_pending: "Reading the actual shelf image…"
inventory.photo_attached: "Actual image attached in memory. No upload has occurred."
inventory.photo_failed: "Photo capture or collection failed. The previous image and count are unchanged."
inventory.photo_budget: "The sheet's sixteen-MiB photo limit would be exceeded. The previous image is unchanged."
inventory.unexpected: "The host returned no usable typed result. Existing records are unchanged."
inventory.scope: "The baseline comes from your entered sheet. Counts and photos are session-local proposals, not saved stock adjustments or submitted reports."
language.english: "English"
language.spanish: "Español"
{"id":"fission-tabs-1","index":10,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
inventory.title: "Revisar un recuento físico"
inventory.explanation: "Introduce la hoja real, bloquea su base y escanea o selecciona un producto. Dejar un recuento pendiente nunca cambia esa base."
inventory.setup: "Configura la hoja con el registro de inventario. El ejemplo admite hasta 50 productos."
inventory.sku: "SKU del producto"
inventory.name: "Nombre del producto"
inventory.bin: "Estantería o ubicación"
inventory.baseline: "Cantidad registrada en el sistema"
inventory.sku_error: "Usa un SKU único de 1 a 48 letras ASCII, dígitos, puntos, guiones o guiones bajos."
inventory.required: "Introduce este valor."
inventory.units_error: "Introduce una cantidad entera entre 0 y 100000."
inventory.add: "Añadir producto a la hoja"
inventory.lock: "Bloquear la base e iniciar recuento"
inventory.baseline_value: "Cantidad base del sistema: {count}"
inventory.proposal: "Recuento propuesto: {count}; diferencia: {difference}"
inventory.select: "Contar este producto"
inventory.counting: "Contando {sku}"
inventory.physical: "Recuento físico real"
inventory.stage: "Dejar recuento para revisión"
inventory.photo: "Capturar foto opcional"
inventory.photo_label: "Foto real de estantería del producto seleccionado"
inventory.close: "Terminar este producto"
inventory.progress: "{proposed} de {total} productos tienen un recuento pendiente"
inventory.manual: "Introducir la etiqueta manualmente"
inventory.open: "Seleccionar el SKU introducido"
inventory.scan: "Escanear etiqueta"
inventory.ready: "Todavía no se ha bloqueado ninguna hoja."
inventory.selected: "Producto seleccionado. Escanear no cambia su recuento."
inventory.unknown_sku: "El SKU no está en la hoja bloqueada. No se ha cambiado ningún producto."
inventory.staged: "Recuento pendiente de revisión. La cantidad base no ha cambiado."
inventory.scan_pending: "Esperando el resultado del código…"
inventory.no_code: "No se devolvió ningún código. Introduce la etiqueta o elige un producto."
inventory.scan_failed: "El escaneo falló. La entrada manual y la selección siguen disponibles."
inventory.permission_pending: "Esperando el permiso de cámara…"
inventory.denied: "No se concedió acceso a fotos. Puedes continuar el recuento."
inventory.photo_pending: "Capturando la foto de estantería…"
inventory.image_pending: "Leyendo la imagen real…"
inventory.photo_attached: "Imagen real adjunta en memoria. No se ha subido."
inventory.photo_failed: "La captura o lectura falló. La imagen anterior y el recuento no han cambiado."
inventory.photo_budget: "Se superaría el límite de dieciséis MiB de fotos. La imagen anterior no ha cambiado."
inventory.unexpected: "El host no devolvió un resultado tipado utilizable. Los registros no han cambiado."
inventory.scope: "La base procede de tu hoja. Los recuentos y fotos son propuestas de esta sesión, no ajustes guardados ni informes enviados."
language.english: "Inglés"
language.spanish: "Español"
{"id":"fission-tabs-1"}