# Creating The Directory and Necessary Files For The Svelte Project Structuren
# Creating The Directory and Necessary Files For The Svelte Project Structuren
import os
files = {
f"{project_name}/src/App.svelte": """<script>
import { onMount } from "svelte";
let services = [];
let newService = { name: "", description: "", price: "" };
let selectedService = null;
onMount(() => {
// Sample services to populate the list initially
services = [
{ name: "General Checkup", description: "Basic health checkup", price: "50" },
{ name: "Blood Test", description: "Complete blood count test", price: "30" },
];
});
</script>
<style>
.service-list, .form {
max-width: 600px;
margin: 20px auto;
}
.form input {
display: block;
margin-bottom: 10px;
padding: 8px;
width: 100%;
}
.service-list table {
width: 100%;
border-collapse: collapse;
}
.service-list th, td {
padding: 10px;
border: 1px solid #ddd;
}
button {
margin-right: 5px;
}
</style>
<main>
<div class="form">
<h2>{selectedService ? "Update Service" : "Add New Service"}</h2>
<input type="text" bind:value={selectedService ? selectedService.name :
newService.name} placeholder="Service Name" />
<input type="text" bind:value={selectedService ? selectedService.description :
newService.description} placeholder="Description" />
<input type="number" bind:value={selectedService ? selectedService.price :
newService.price} placeholder="Price" />
{#if selectedService}
<button on:click={updateService}>Update Service</button>
<button on:click={() => (selectedService = null)}>Cancel</button>
{:else}
<button on:click={addService}>Add Service</button>
{/if}
</div>
<div class="service-list">
<h2>Service List</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Price</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{#each services as service (service.name)}
<tr>
<td>{service.name}</td>
<td>{service.description}</td>
<td>{service.price}</td>
<td>
<button on:click={() => (selectedService = service)}>Edit</button>
<button on:click={() => deleteService(service)}>Delete</button>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
</main>
""",
f"{project_name}/public/index.html": """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jarurat Care</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/build/bundle.js"></script>
</body>
</html>
""",
f"{project_name}/README.md": """# Jarurat Care - Svelte Healthcare Service Management
## Overview
This Svelte application allows users to manage healthcare services (add, update, and delete
services). The state is handled using Svelte's built-in reactivity.
### Features
### Prerequisites
```bash
npm install