Assignment 2 Book Back Assignment 2 Sr Assignment 2 Drd

Assigment 2book Backjpgassigment 2sr Assigment2 Drdhtmlthe Story K

Assigment 2book Backjpgassigment 2sr Assigment2 Drdhtmlthe Story K Assigment 2/Book_Back.jpg Assigment 2/SR_Assigment2_DRD.html The Story Keeper Book Store Book Seller's First Name: Book Seller's Last Name: Book Seller's Email: Book Seller's Contact Number: Book Seller's Password: Book Seller's ID: Check If You Wish Getting a Email Conformation Transaction Type Book Purchase Book Return Modify a Order Cancel a Order Rent a Book Singer/Baer/Long/Pavlotski Chapter 7 People, Places, Concepts and Questions People, Places & Concepts Dominative medical system Medical pluralism Libbet Crandon-Malamud Kachitu Aymara Indians Medical dialogue Steve Ferzacca Yogyakarta Complementary and alternative medicine Naturopathy Popular sector Therapeutic management group Folk sector Professional sector Aztecs Biomedicine Biological reductionism Exclusive systems Tolerant systems Integrated systems Syncretism Hybridization Mangle of practice Medical diversity Mediocscapes Questions 1. According to the case study presented at the beginning of Singer/Baer/Long/Pavlotski Chapter 7, how does medical pluralism function among the Aymara in Bolivia? Do you agree their assessment that this “medical dialogue” is more about coping than empowerment? Can you think of similar examples of medical pluralism in your own lives? How would you situate these experiences within US political economy and the global economy? 2. How did biomedicine come to dominate other forms of healing in the 19th and 20th centuries in Australia and the US? 3. What is complementary and alternative medicine, and how does it relate to biomedicine? 4. What are the similarities and differences of medical pluralism in early state and modern societies? 5. How do dominant medical systems vary in different societies, such as China, India, Indonesia, and Morocco. Assignment 2 Why are we doing this? JavaScript is one of the most useful tools available to the web developer. It is indispensable for creating user interfaces, which minimize the number of mistakes a user can make and thus making it easier to store and retrieve data. It's very important for you to understand when and how to implement JavaScript in your web pages. The lectures will cover the "when" and this assignment will cover the "how" of implementing JavaScript. Bootstrap MAY NOT be used for any projects in this course The Assignment Overview: Using the user login form you created for a local Bookstore called The Story Keeper Bookstore (TSKB) you will enhance it so that validates a salesperson’s data and verifies the salesperson’s name, the salesperson’s password and the salesperson’s ID. Task Description: Scenario In order to access TSKB’s site, a salesperson must login with a valid username, user password, user ID, and user phone number. A user’s email address is also required only if the user wants an email confirmation of any transaction (The user will indicate this by checking a box signifying the user wants email confirmation). Develop the login script using JavaScript that first validates and then verifies the user input. Validation ensure that the salesperson has entered all the required data: username, user password, user ID, user phone number and user email address (if requested). The user password should contain a max of 10 characters and have at least 1 uppercase letter, one special character, and one numeric character, the user ID field should contain an 8-digit number, the user phone number should consist of 10 digits which can be delineated either by spaces or dashes, and the email address must contain an @ followed by a period and an email domain that consists of 2 to 5 characters. If the input is invalid, an alert should be issued to the user to correct the particular error in the appropriate box. The alert should be specific regarding what the error is and how it can be corrected. Alerts must be issued one at a time (meaning only a single error appears in the alert). No new alert should be displayed before the previous issue is rectified. After the alert is issued the user should be brought back to the field that had invalid data entered so it can be re- entered. Verification checks that the salesperson has an account, i.e., that the username, user password, and user ID match the name, password, and ID for one of TSKB’s salespersons. If the input is not verified, alert the user that an account for them cannot be found. The alert should contain a message indicating the name of the salesperson and that they cannot be found. Once the input is both validated and verified, alert the user with a simple welcome message that they have entered the system indicating the salesperson’s name (first and last) and the transaction chosen (Search the Books Seller’s Account, Customer’s Book Purchase, Customer’s Book Return, Update a Customer’s Book Order, Cancel a Customer’s Book Order, Search for a Book or Create a New Customer’s Account). Program Design and Implementation The design for the HTML interface was developed in Assignment 1. It consisted of the following fields: salesperson’s name, salesperson’s phone number and salesperson’s email address, salesperson’s password, salesperson’s ID, a checkbox for indicating an email confirmation is requested, a drop-down list allowing the salesperson to indicate what type of transaction they wish to perform, and buttons as input elements. In this assignment you will need to implement the functionality for email checkbox which consists of requiring an email address is entered when the checkbox is checked. The figures below illustrate some of the various concepts discussed for implementation of this assignment. Email confirmation wanted Email Confirmation not wanted Sample Error Message Sample Cursor Brought Back to Field Modularize your JavaScript using two functions: validate and verify described below. Your event-driven program should call the validate function when the “Submit” button on your form is clicked. If all the data has been entered correctly, the validate function then calls the verify function. The “Reset” button will clear all data from the form. Validate Function: INPUT: HTML Form that needs to be validated PROCESS: Validates that all required information exists and conforms to requirements: Salesperson Name (First and Last), Salesperson Password, Salesperson Phone Number, Saleperson ID and Salesperson Email Address (ONLY if required). Validation MUST take place in your JavaScript via REGEX for patterns. No validation should be done via your element/tag attribute(s) (i.e., patterns, length, number, email, etc.). OUPUT: Alert the user to correct any particular error in the appropriate box if necessary Verification Function: INPUT: HTML Form with Salesperson Name (First and Last), Salesperson Password and Salesperson ID PROCESS: Compares the form's Salesperson Name (First and Last), Salesperson Password and Salesperson ID with the properties of a salesperson object stored in a global array of salespersons (for this exercise create an array of 8 salespersons). Returns true if it finds the salesperson object matches the inputted data. OUPUT: Simple welcome message consisting of the Salesperson’s name (first and last) and the Transaction chosen from the dropdown menu or message indicating that the specific salesperson cannot be found. Make sure to test your program with a variety of valid and invalid input to ensure that your program is properly validating the data, properly verifying the salesperson and that all alerts are working as described. Debugging: Please read over my posting under Week 0 called Web Development Tools. This posting will give you information on how to activate your browser’s DevTools that will aid in the debugging process. ALSO please upload your files and a URL where the files are contained in "Canvas". Points will be deducted for any missing files or missing url. URL format for your webpage: web.njit.edu/~YOUR UCID/YOUR FILE NAME YOUR UCID is replaced with your UCID YOUR FILE NAME is replaced with the name of the file you wish to execute The following URL will give you step-by-step instructions on how to submit your assignment files. Good luck. Maura Overview: Using the user login form you created for a local Bookstore called The Story Keeper Bookstore (TSKB) you will enhance it so that validates a salesperson’s data and verifies the salesperson’s name, the salesperson’s password and the salespers...

Paper For Above instruction

Assigment 2book Backjpgassigment 2sr Assigment2 Drdhtmlthe Story K

// Sample data: array of salesperson objects

const salespersons = [

{ firstName: "Alice", lastName: "Johnson", password: "A!c123456", id: "12345678" },

{ firstName: "Bob", lastName: "Smith", password: "B#Smith1", id: "87654321" },

{ firstName: "Carol", lastName: "Davis", password: "C$davis2", id: "11223344" },

{ firstName: "David", lastName: "Brown", password: "D*brown3", id: "44332211" },

{ firstName: "Eve", lastName: "Wilson", password: "E!Wilson4", id: "56789012" },

{ firstName: "Frank", lastName: "Moore", password: "F$moore5", id: "23456789" },

{ firstName: "Grace", lastName: "Lee", password: "G&lee6", id: "99887766" },

{ firstName: "Hank", lastName: "Taylor", password: "H.taylor7", id: "66778899" }

];

function validate() {

const form = document.forms["loginForm"];

// Validate salesperson's name

const name = form["salespersonName"].value.trim();

if (!name || !name.includes(" ")) {

alert("Please enter your first and last name.");

form["salespersonName"].focus();

return false;

}

// Validate password: max 10 chars, at least 1 uppercase, 1 special, 1 digit

const password = form["password"].value;

const passwordPattern = /^(?=.[A-Z])(?=.[\W_])(?=.*\d).{1,10}$/;

if (!passwordPattern.test(password)) {

alert("Password must be 1-10 characters, contain at least one uppercase letter, one special character, and one digit.");

form["password"].focus();

return false;

}

// Validate ID: exactly 8 digits

const id = form["userID"].value.trim();

const idPattern = /^\d{8}$/;

if (!idPattern.test(id)) {

alert("ID must be an 8-digit number.");

form["userID"].focus();

return false;

}

// Validate phone number: 10 digits, spaces or dashes allowed

const phone = form["phone"].value.trim();

const phonePattern = /^(\d{3}[- ]?\d{3}[- ]?\d{4})$/;

if (!phonePattern.test(phone)) {

alert("Phone number must be 10 digits, separated by spaces or dashes if needed.");

form["phone"].focus();

return false;

}

// If email confirmation is requested, validate email

const emailCheckbox = form["emailConfirm"].checked;

const email = form["email"].value.trim();

if (emailCheckbox) {

const emailPattern = /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,5}$/;

if (!emailPattern.test(email)) {

alert("Please enter a valid email address with '@' and a domain of 2-5 characters.");

form["email"].focus();

return false;

}

}

// All validation passed

return true;

}

function verify() {

const form = document.forms["loginForm"];

const name = form["salespersonName"].value.trim();

const password = form["password"].value;

const id = form["userID"].value.trim();

// Extract first and last name

const nameParts = name.split(" ");

const firstName = nameParts[0];

const lastName = nameParts.slice(1).join(" ");

// Find salesperson matching the input

const salesperson = salespersons.find(sp =>

sp.firstName.toLowerCase() === firstName.toLowerCase() &&

sp.lastName.toLowerCase() === lastName.toLowerCase() &&

sp.password === password &&

sp.id === id

);

if (salesperson) {

const transaction = form["transaction"].value;

alert(`Welcome ${salesperson.firstName} ${salesperson.lastName}. You have selected the transaction: ${transaction}.`);

return true;

} else {

alert(`Account for ${name} cannot be found.`);

form["salespersonName"].focus();

return false;

}

}

function submitForm() {

if (validate()) {

if (verify()) {

// Successful login

}

}

}

function resetForm() {

document.forms["loginForm"].reset();

}

JavaScript Validation for The Story Keeper Bookstore Login