PWA manager is now visible to all users

This commit is contained in:
Dobromir Popov
2024-05-07 14:00:29 +03:00
parent 885f98e83e
commit c30928547c
6 changed files with 173 additions and 107 deletions

View File

@ -250,49 +250,60 @@ export default function PublisherForm({ item, me }) {
{/* notifications */}
<div className="mb-6 p-4 border border-gray-300 rounded-lg">
<fieldset>
<legend className="text-lg font-medium mb-2">Известия по имейл</legend>
<div className="space-y-4">
<div className="form-check">
<input
className="checkbox cursor-not-allowed opacity-50"
type="checkbox"
id="isSubscribedToCoverMeMandatory"
name="isSubscribedToCoverMeMandatory"
onChange={handleChange} // This will not fire due to being disabled, but kept for consistency
checked={true} // Always checked
disabled={true} // User cannot change this field
autoComplete="off" />
<label className="label cursor-not-allowed opacity-50" htmlFor="isSubscribedToCoverMeMandatory">
Имейли за заместване които отговарят на моите предпочитания
</label>
</div>
<div className="form-check">
<input
className="checkbox"
type="checkbox"
id="isSubscribedToCoverMe"
name="isSubscribedToCoverMe"
onChange={handleChange}
checked={publisher.isSubscribedToCoverMe}
autoComplete="off" />
<label className="label" htmlFor="isSubscribedToCoverMe">
Всички заявки за заместване
</label>
</div>
<div className="form-check">
<input
className="checkbox"
type="checkbox"
id="isSubscribedToReminders"
name="isSubscribedToReminders"
onChange={handleChange}
checked={publisher.isSubscribedToReminders}
autoComplete="off" />
<label className="label" htmlFor="isSubscribedToReminders">
Други напомняния
</label>
<legend className="text-lg font-medium mb-2">Известия</legend>
{/* Email notifications group */}
<div className="mb-4">
<h3 className="text-md font-semibold mb-2">Известия по имейл</h3>
<div className="space-y-4">
<div className="form-check">
<input
className="checkbox cursor-not-allowed opacity-50"
type="checkbox"
id="isSubscribedToCoverMeMandatory"
name="isSubscribedToCoverMeMandatory"
onChange={handleChange} // This will not fire due to being disabled, but kept for consistency
checked={true} // Always checked
disabled={true} // User cannot change this field
autoComplete="off" />
<label className="label cursor-not-allowed opacity-50" htmlFor="isSubscribedToCoverMeMandatory">
Имейли за заместване които отговарят на моите предпочитания
</label>
</div>
<div className="form-check">
<input
className="checkbox"
type="checkbox"
id="isSubscribedToCoverMe"
name="isSubscribedToCoverMe"
onChange={handleChange}
checked={publisher.isSubscribedToCoverMe}
autoComplete="off" />
<label className="label" htmlFor="isSubscribedToCoverMe">
Всички заявки за заместване
</label>
</div>
<div className="form-check">
<input
className="checkbox"
type="checkbox"
id="isSubscribedToReminders"
name="isSubscribedToReminders"
onChange={handleChange}
checked={publisher.isSubscribedToReminders}
autoComplete="off" />
<label className="label" htmlFor="isSubscribedToReminders">
Други напомняния
</label>
</div>
</div>
</div>
{/* In-App notifications group */}
<div className="mb-4">
<h3 className="text-md font-semibold mb-2">Известия в приложението</h3>
<PwaManager />
</div>
</fieldset>
</div>
@ -307,7 +318,6 @@ export default function PublisherForm({ item, me }) {
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage=" " className="">
<div className="border border-blue-500 border-solid p-2">
{/* prompt to install PWA */}
<PwaManager />
<div className="mb-4">
<label className="label" htmlFor="type">Тип</label>
<select id="type" name="type" value={publisher.type} onChange={handleChange} className="textbox" placeholder="Type" autoFocus >
@ -366,7 +376,7 @@ export default function PublisherForm({ item, me }) {
{/* save */}
<button className="button bg-blue-500 hover:bg-blue-700 focus:outline-none focus:shadow-outline" type="submit">
{router.query?.id ? "Update" : "Create"}
{router.query?.id ? "Запази" : "Създай"}
</button>
</div>
</form>