1.2
This commit is contained in:
parent
1cff3c750d
commit
91d94f28e2
12
index.php
12
index.php
@ -37,6 +37,7 @@ $current_role = current_user_role();
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-white mb-4">
|
||||
@ -221,5 +222,16 @@ $current_role = current_user_role();
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js').then(registration => {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
}, err => {
|
||||
console.log('ServiceWorker registration failed: ', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
20
manifest.json
Normal file
20
manifest.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"short_name": "Clinic",
|
||||
"name": "Clinic Management",
|
||||
"icons": [
|
||||
{
|
||||
"src": "assets/icons/icon-192x192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "assets/icons/icon-512x512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": "/index.php",
|
||||
"display": "standalone",
|
||||
"theme_color": "#3367D6",
|
||||
"background_color": "#3367D6"
|
||||
}
|
||||
36
sw.js
Normal file
36
sw.js
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
const CACHE_NAME = 'clinic-app-cache-v1';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/index.php',
|
||||
'/dashboard.php',
|
||||
'/login.php',
|
||||
'/register.php',
|
||||
'/view_visits.php',
|
||||
'/add_visit.php',
|
||||
'/auth.php',
|
||||
'/logout.php',
|
||||
'/update_visit_status.php'
|
||||
];
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then(cache => {
|
||||
console.log('Opened cache');
|
||||
return cache.addAll(urlsToCache);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
event.respondWith(
|
||||
caches.match(event.request)
|
||||
.then(response => {
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
return fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user