Trying to make a storage manager app. As a beginner

Im trying to make the app goes like this .

SCREEN1 - for sign in/sign up

SCEEN2 - USER PROFILE

SCREEN3 - SCAN ITEM with details

footnote

-using GOOGLESHEETS as database
-Every item got their own ID
-A user logged in to the app
-User scan for the item using QR
-Result scan of item the data goes out to google sheet with item id/name, Out and In time 
-GOOGLESHEETS column goes by NAME / COURSE / ITEM TOOK / IN TIME / OUT TIME
-And a reminder to return the item after 24 hour of using it

Ok, what have you done so far? Show your relevant blocks and other screen shots.

i only got to make the qr for scanning in and out for the item with this script

var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1S1f4xPr4xUSRuZMcs4RRXqRu6UjbkgEAwQ5i0j_mjEc/edit#gid=0");
var sheet = ss.getSheetByName("MANAGE");
function doGet(e){
  var action  = e.parameter.action;

  if(action == "in")
    return inTime(e);
  if(action == "out")
    return outTime(e);
}

function doPost(e){
  var action  = e.parameter.action;
  if(action == "in")
    return inTime(e);
  if(action == "out")
    return outTime(e);
}

function inTime(e){
  var id = e.parameter.id;
  var values = sheet.getRange(2,1,sheet.getLastRow(),1).getValues();
  for(var i = 0 ; i<values.length ; i++){
    if(values[i][0] == id){
      i=i+2;
      var in_time = Utilities.formatDate(new Date(), "GMT+8", "d/M/yy , HH:mm:ss");
      sheet.getRange(i,3).setValue(in_time);
      return ContentService.createTextOutput("Thank You ! Your In Time is "+in_time).setMimeType(ContentService.MimeType.TEXT);
    }
  }
  return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);
}

function outTime(e){
  var id = e.parameter.id;
  var values = sheet.getRange(2,1,sheet.getLastRow(),1).getValues();
  for(var i = 0 ; i<values.length ; i++){
    if(values[i][0] == id){
      i=i+2;
      var out_time = Utilities.formatDate(new Date(), "GMT+8", "d/M/yy , HH:mm:ss");
      sheet.getRange(i,4).setValue(out_time);
      return ContentService.createTextOutput("Thank You ! Your Out Time is "+out_time).setMimeType(ContentService.MimeType.TEXT);
    }

  }

  return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);

}

right now im trying to get the USER login stuff going in but i cant seems to find a way to make it done

as you can see for USER column i want to make like whoever scan for item qr free text for ID TLX1 their name always appear in the user column. or do you have somekind of new idea?


This is the same as a Marathon race track app, with the runners reaching locations corresponding to your tools changing hands.

Search this board for Marathon.

i have a update on this project. im not using it like a marathon app but just need a small help cause im stuck at here

function addUser(e, sheet) {
  var id = e.parameter.id;
  var name = e.parameter.name;
  var values = sheet.getRange(2, 1, sheet.getLastRow() - 1, 2).getValues();

  for (var i = 0; i < values.length; i++) {
    if (values[i][0] == id) {
      // ID already exists, update the corresponding name
      var rowIndex = i + 2;
      sheet.getRange(rowIndex, 2).setValue(name);
      return;
    }
  }

  // ID doesn't exist, add a new user
  sheet.appendRow([id, name]);
}

this is the code and here is the spreadsheet

Screenshot 2023-07-07 131940

already had a test run with this url

Blockquote
https://script.google.com/macros/s/AKfycbzn8MLVYqnB89KlIRxaqCvlDHZIuuXKkAKxIDKywoXA4o9s20zQnGWVspaszAXgGg/exec?id=AIR%20GUN&name=John

it does output john in airgun ID in name column.

now it all left with how to make it in app with different id and name,

it'll be better if the id had already registered when i scan it in screen 1 means to just enter a name

I guess John would need to book out the Compressor as well as the air gun ?

In which case, you probably need a list of users (maybe with unique IDs) somewhere to simplify things. You also need a unique ID for each item, as in your first spreadsheet screenshot, in case you have three air guns or three compressors.

I see, its fine for now its just a single item.
Would you mind show me an example how to make a unique id

You could just setup your user sheet with IDs, e.g. U001,U002,U003.....

I read again on your reply. Basically it does links up on every item. And anyone would just type in a name just like in the url for name= it can be just a free text

And from the url it had to start from id=MULTIMETER&name=john

My point is how to make the app for a second screen so anyone can type in free text for their name after they scanned for in or out for a item and still outputs a id=>anything<&name=>freetext< so they jusy need to type in a name

Sorry for my bad english

How many people / devices will use this app ?

It might be 100 person but not at one time

What happens if a scanned item is already "out" ?

What happens if an item is not returned ?

How will you handle the return of an item, and make it available again?

Do you want a history log of all items borrowed, and by whom ?

Where are the bar codes / qr codes ? Why have these if you have the item list in your spreadsheet / app ?

So i see what you trying to tell me yes it does looks like it still incomplete and yes indeed i am a beginner so i dont really know much and still learning

To answer your first question
The item would phisically dont have in the store

Your second is
What would happpend is i would look back at the name whose name and i would really like to have a history log just like ur question 4

Num. 3 is column for name can just be overwritten by anyone who scanned for the item

4 is on 2

The qr is taped onto the item and there are 2 kinds of qr one for in and vice versa

new update here i already make the history and added a new function for quantity and sooner or later, im going to make so app can read a data for quantity item. But here im stuck again cuz i want to make a list view and every listed item in the list view can have an individual barcode scanner function there is about 77 more item i want to list in and a search for the listed item in the search bar is it possible?

here is my progress so far

and as i did for the list view code block its does call for both at one time

var sheet1Url = "https://docs.google.com/spreadsheets/d/1v7ApBU-FHyuDY1J-56dJ8SfFH6UCx5ne8S5dxU4KmAY/edit#gid=0";
var sheet2Url = "https://docs.google.com/spreadsheets/d/1v7ApBU-FHyuDY1J-56dJ8SfFH6UCx5ne8S5dxU4KmAY/edit#gid=906968515";
var sheet3Url = "https://docs.google.com/spreadsheets/d/1v7ApBU-FHyuDY1J-56dJ8SfFH6UCx5ne8S5dxU4KmAY/edit#gid=1439910358";

var sheet1 = SpreadsheetApp.openByUrl(sheet1Url);
var sheet2 = SpreadsheetApp.openByUrl(sheet2Url);
var sheet3 = SpreadsheetApp.openByUrl(sheet3Url);

var sheet = sheet1.getSheetByName("ItemID");
var historySheet = sheet2.getSheetByName("History");
var itemQuantitiesSheet = sheet3.getSheetByName("ItemQuantities");

function doGet(e) {
  var actions = e.parameter.action.split(',');
  var response = '';

  for (var i = 0; i < actions.length; i++) {
    var action = actions[i].trim();
    var name = e.parameter.name;
    var item = e.parameter.item;
    var quantity = parseInt(e.parameter.quantity);
    var id = e.parameter.id;

    if (action == "in") {
      response += inTime(e, id, name, item);
    } else if (action == "out") {
      response += outTime(e, id, name, item);
    } else if (action == "add" || action == "remove") {
      updateItemQuantity(action, item, quantity);
      response += "Item quantity updated successfully for action: " + action + "\n";
    } else {
      response += "Invalid action parameter: " + action + "\n";
    }
  }

  return ContentService.createTextOutput(response).setMimeType(ContentService.MimeType.TEXT);
}

function doPost(e) {
  return doGet(e);
}

function inTime(e, id, name, item) {
  var values = sheet.getRange(2, 1, sheet.getLastRow(), 1).getValues();

  for (var i = 0; i < values.length; i++) {
    if (values[i][0] == id) {
      i = i + 2;
      var in_time = Utilities.formatDate(new Date(), "GMT+8", "d/M/yy , HH:mm:ss");
      sheet.getRange(i, 3).setValue(in_time);
      sheet.getRange(i, 4).setValue("in");
      historySheet.appendRow([id, name, item, in_time, "in"]);
      return "Thank You! Your In Time is " + in_time + "\n";
    }
  }
  return "ID Not Found\n";
}

function outTime(e, id, name, item) {
  var values = sheet.getRange(2, 1, sheet.getLastRow(), 1).getValues();

  for (var i = 0; i < values.length; i++) {
    if (values[i][0] == id) {
      i = i + 2;
      var out_time = Utilities.formatDate(new Date(), "GMT+8", "d/M/yy , HH:mm:ss");
      sheet.getRange(i, 3).setValue(out_time);
      sheet.getRange(i, 4).setValue("out");
      historySheet.appendRow([id, name, item, out_time, "out"]);
      return "Thank You! Your Out Time is " + out_time + "\n";
    }
  }
  return "ID Not Found\n";
}

function updateItemQuantity(action, item, quantity) {
  var itemRow = findItemRow(item, itemQuantitiesSheet);

  if (itemRow !== -1) {
    var currentQuantity = parseInt(itemQuantitiesSheet.getRange(itemRow, 2).getValue());

    if (action === "add") {
      itemQuantitiesSheet.getRange(itemRow, 2).setValue(currentQuantity + quantity);
    } else if (action === "remove") {
      itemQuantitiesSheet.getRange(itemRow, 2).setValue(currentQuantity - quantity);
    }
  } else {
    itemQuantitiesSheet.appendRow([item, quantity]);
  }
}

function findItemRow(item, sheet) {
  var data = sheet.getDataRange().getValues();
  for (var i = 0; i < data.length; i++) {
    if (data[i][0] == item) {
      return i + 1;
    }
  }
  return -1;
}

thank you TIMAI2 for having me, sorry

If it were me, I would look to categorise these 77 items, e.g. handtools, powertools, saws etc, to hopefully get each category to @ 10 items, then offer a category selection, which then offers just those items.

Alternatively, you could create a dynamic scrolling listing with thumbnail images and descriptions (clickable), perhaps 3 across (25 down)

I see but how do i make a listview so i can have the picture (clickable) for those 77 of different functional barcode reader. Also for the name it change for 9 teachers and so i already reserve for 9 screen to have each screen listview for the same item but different function in the "& name=" code block

Just use the native listview, set to provide Image/MainText/Subtext and build this from your images and content. (Read the documentation, and see the video)

Probably not a good idea. Why not simply use one screen, and have a selector for the teacher?

now i understand what you meant by using the code block to visible true and stuff.
now its the next step of how could i use the name for the teacher by using this type of screen and outputs the name of the button by using button.text but im trying to use 10 of different teacher button.text

image
as you can see this is just for button 1 but i want to make it as its a placeholder for button 1-10

also about search how do i make it like even if its not capitalise its still showing the closest to the what the user typed
image

this is my progress so far

please help on these i felt it so close to finished

You probably only need one barcodescanner component, and one button to initiate the scan, saving @ 80 components in your app. You should be using lists and logic to populate your web post.

If I get time today, I will have a go at working up an example for you.

Okay thank you so much bless you