Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 59 additions & 57 deletions app/(main)/administration/exports/components/DonationsExportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,67 +66,69 @@ export default function Donations() {
return (
<Card className="form-card">
<Card.Body>
<h2 className="form-title-1">Export Gift-in-Kind Records</h2>
<form onSubmit={handleSubmit(onSubmit)}>
<div className="form-body">
<Form.Group>
<div className="radio-row">
<Form.Check
type="radio"
label="All time"
value="all"
id="date-mode-all"
{...register('dateMode')}
/>
<Form.Check
type="radio"
label="Date range"
value="range"
id="date-mode-range"
{...register('dateMode')}
/>
</div>
</Form.Group>

{dateMode === 'range' && (
<div className="two-col-row">
<Form.Group controlId="startDate">
<Form.Label className="field-label">Start date</Form.Label>
<Form.Control
type="date"
{...register('startDate', {
required: 'Start date is required.',
})}
isInvalid={!!errors.startDate}
<div className="form-body">
<h2 className="form-title">Export Gift-in-Kind Records</h2>
<form onSubmit={handleSubmit(onSubmit)}>
<div className="form-body">
<Form.Group>
<div className="radio-row">
<Form.Check
type="radio"
label="All time"
value="all"
id="date-mode-all"
{...register('dateMode')}
/>
<Form.Control.Feedback type="invalid">
{errors.startDate?.message}
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="endDate">
<Form.Label className="field-label">End date</Form.Label>
<Form.Control
type="date"
{...register('endDate', {
required: 'End date is required.',
})}
isInvalid={!!errors.endDate}
<Form.Check
type="radio"
label="Date range"
value="range"
id="date-mode-range"
{...register('dateMode')}
/>
<Form.Control.Feedback type="invalid">
{errors.endDate?.message}
</Form.Control.Feedback>
</Form.Group>
</div>
)}
</div>
</Form.Group>

<div className="submit-button-row">
<button type="submit" className="btn-submit">
Export
</button>
{dateMode === 'range' && (
<div className="two-col-row">
<Form.Group controlId="startDate">
<Form.Label className="field-label">Start date</Form.Label>
<Form.Control
type="date"
{...register('startDate', {
required: 'Start date is required.',
})}
isInvalid={!!errors.startDate}
/>
<Form.Control.Feedback type="invalid">
{errors.startDate?.message}
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="endDate">
<Form.Label className="field-label">End date</Form.Label>
<Form.Control
type="date"
{...register('endDate', {
required: 'End date is required.',
})}
isInvalid={!!errors.endDate}
/>
<Form.Control.Feedback type="invalid">
{errors.endDate?.message}
</Form.Control.Feedback>
</Form.Group>
</div>
)}

<div>
<button type="submit" className="btn-submit">
Export
</button>
</div>
</div>
</div>
</form>
</form>
</div>
</Card.Body>
</Card>
);
Expand Down
52 changes: 28 additions & 24 deletions app/(main)/administration/exports/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,34 @@ export default async function ExportsPage() {
<div>
<Breadcrumbs />
<h1>Exports</h1>
<DonationsExportForm />
<h2>Recent Gift-in-Kind Records</h2>
<Table borderless>
<thead className="table-header">
<tr>
<th>Receiver</th>
<th>Store</th>
<th>Items Donated</th>
<th>Date Submitted</th>
</tr>
</thead>
<tbody>
{sortedDonations.map((item) => (
<tr key={item.donation_id}>
<td>
{item.receiver_first_name} {item.receiver_last_name}
</td>
<td>{item.store_name}</td>
<td>{item.items_donated}</td>
<td>{new Date(item.date_submitted).toLocaleString()}</td>
</tr>
))}
</tbody>
</Table>
<div className="content-body">
<DonationsExportForm />
<div>
<h2>Recent Gift-in-Kind Records</h2>
<Table borderless>
<thead className="table-header">
<tr>
<th>Receiver</th>
<th>Store</th>
<th>Items Donated</th>
<th>Date Submitted</th>
</tr>
</thead>
<tbody>
{sortedDonations.map((item) => (
<tr key={item.donation_id}>
<td>
{item.receiver_first_name} {item.receiver_last_name}
</td>
<td>{item.store_name}</td>
<td>{item.items_donated}</td>
<td>{new Date(item.date_submitted).toLocaleString()}</td>
</tr>
))}
</tbody>
</Table>
</div>
</div>
</div>
);
}
64 changes: 34 additions & 30 deletions app/(main)/administration/members/[userId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,42 +42,46 @@ export default async function TeamProfilePage({
[`/administration/members/${userId}`]: `${user.first_name || 'FirstName'} ${user.last_name || 'LastName'}`,
}}
/>
<h1>Profile</h1>
<h1>
{user.first_name} {user.last_name}
</h1>
{/* same styling as profile page */}
<div className={styles.card}>
<div className={`form-body ${styles.cardBody}`}>
<div className={styles.avatarCircle}>
<Image
src={user.profile_photo_url || imagePlaceholder}
alt={user.first_name + ' ' + user.last_name}
width={96}
height={96}
unoptimized
/>
</div>
<h2>User Information</h2>
<div>
<div className={`form-card ${styles.card}`}>
<div className={`form-body ${styles.cardBody}`}>
<div className={styles.avatarCircle}>
<Image
src={user.profile_photo_url || imagePlaceholder}
alt={user.first_name + ' ' + user.last_name}
width={96}
height={96}
unoptimized
/>
</div>
<p className="form-title">User Information</p>

<div>
<div className="two-col-row">
<div>
<label className={styles.profileLabel}>First name</label>
<p className="form-control-plaintext">{user.first_name}</p>
</div>
<div>
<label className={styles.profileLabel}>Last name</label>
<p className="form-control-plaintext">{user.last_name}</p>
<div>
<div className="two-col-row">
<div>
<label className={styles.profileLabel}>First name</label>
<p className="form-control-plaintext">{user.first_name}</p>
</div>
<div>
<label className={styles.profileLabel}>Last name</label>
<p className="form-control-plaintext">{user.last_name}</p>
</div>
</div>
</div>
</div>

<div>
<label className={styles.profileLabel}>Email</label>
<p className="form-control-plaintext">{user.email}</p>
</div>
<div>
<label className={styles.profileLabel}>Email</label>
<p className="form-control-plaintext">{user.email}</p>
</div>

<div>
<label className={styles.profileLabel}>Role</label>
<Dropdown userId={userId} roleId={role?.role_id} />
<div>
<label className={styles.profileLabel}>Role</label>
<Dropdown userId={userId} roleId={role?.role_id} />
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
import { createClient } from '@/app/lib/supabase/browser-client';
import { createStoreAdmin } from '@/app/actions/store';
import { User } from '@/app/types/user';
import { Form, ListGroup } from 'react-bootstrap';
import { Form, ListGroup, Card } from 'react-bootstrap';

const supabase = createClient();

Expand Down Expand Up @@ -50,32 +50,44 @@ export default function AddAdminSearch({
}, [search, existingAdminUserIds]);

return (
<div>
{/* searching */}
<div className="search-filter-wrapper">
<Form.Control
type="text"
placeholder="Search users..."
className="search-bar"
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
</div>
<Card className="form-card">
<Card.Body>
<div className="form-body">
<p className="form-title">Add New Admins</p>
{/* searching */}
<div>
<div className="search-filter-wrapper">
<Form.Control
type="text"
placeholder="Search users..."
className="search-bar"
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
</div>

{/* search results */}
<ListGroup>
{searchData.map((u) => (
<ListGroup.Item
key={u.user_id}
action
onClick={() =>
createStoreAdmin({ user_id: u.user_id, store_id: storeId })
}
>
{u.first_name}
</ListGroup.Item>
))}
</ListGroup>
</div>
{/* search results */}
{searchData.length > 0 && (
<ListGroup>
{searchData.map((u) => (
<ListGroup.Item
key={u.user_id}
action
onClick={() =>
createStoreAdmin({
user_id: u.user_id,
store_id: storeId,
})
}
>
{u.first_name}
</ListGroup.Item>
))}
</ListGroup>
)}
</div>
</div>
</Card.Body>
</Card>
);
}
Loading
Loading