Skip to content

Commit

Permalink
feat: service page
Browse files Browse the repository at this point in the history
  • Loading branch information
tuturd committed Mar 18, 2024
1 parent fc2235f commit 722eac5
Show file tree
Hide file tree
Showing 6 changed files with 343 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/app/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ body {
flex-direction: column;
justify-content: center;
align-items: center;
row-gap: 5vh;
row-gap: 5%;
background-color: var(--primary);
margin: 0px 10px;
border-radius: .2em;
Expand Down
48 changes: 29 additions & 19 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const App = () => {
const dispatch = useDispatch();
const router = useRouter();
const login = useSelector((state: State) => state.login);
console.log(login)
return (
<>
<Navbar>
Expand Down Expand Up @@ -62,26 +63,35 @@ const App = () => {
</div>
</>
}
{ ['admin','tv','seller'].includes(login.key) &&
<div className='link_category'>
<p>Administration / Affichage :</p>
<div className='links_btns'>
{ ['admin','seller'].includes(login.key) &&
<div onClick={() => router.push('/sell')}>
<FontAwesome name="hamburger" /> Vente
</div>
}
{ login.key === 'admin' &&
<div onClick={() => router.push('/items')}>
<FontAwesome name="receipt" /> Gestion
</div>
}
<div onClick={() => router.push('/tv')}>
<FontAwesome name="tv" /> TV
<div className='link_category'>
{ ['admin','seller','preparator','tv'].includes(login.key) &&
<>
<p>Autres controles :</p>
<div className='links_btns'>
{ ['admin','seller'].includes(login.key) &&
<div onClick={() => router.push('/sell')}>
<FontAwesome name="money-bill" /> Vente
</div>
}
{ login.key === 'admin' &&
<div onClick={() => router.push('/items')}>
<FontAwesome name="receipt" /> Gestion
</div>
}
{ ['admin','preparator'].includes(login.key) &&
<div onClick={() => router.push('/service')}>
<FontAwesome name="hamburger" /> Service
</div>
}
{ ['admin','tv'].includes(login.key) &&
<div onClick={() => router.push('/tv')}>
<FontAwesome name="tv" /> TV
</div>
}
</div>
</div>
</div>
}
</>
}
</div>
</div>
</>
);
Expand Down
5 changes: 5 additions & 0 deletions src/app/preparation/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
transition: transform 0.5s ease-in, opacity 0.5s ease-in;
}

&.disabled {
visibility: hidden;
background-color: var(--warning-dark);
}

&.downgrade {
background-color: var(--warning-dark);

Expand Down
9 changes: 2 additions & 7 deletions src/app/preparation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const Page = () => {

const displayOrders = (orders: Array<Order>) => {

const tenMinutesAgo: moment.Moment = moment().subtract(10, 'minutes');
const tenMinutesAgo: moment.Moment = moment().subtract(1, 'minutes');
const twentyMinutesAgo: moment.Moment = moment().subtract(20, 'minutes');

type itemQuantity = {
Expand Down Expand Up @@ -122,7 +122,7 @@ const Page = () => {
<Loader />
</div>
) : (
<div className={`next ${downgradeMode ? "downgrade" : ""}`} onClick={() => editOrder(order)}>
<div className={`next ${downgradeMode ? "downgrade" : (order.status === Status.READY ? "disabled" : "")}`} onClick={() => editOrder(order)}>
<FontAwesome name="arrow-right" />
</div>
)}
Expand All @@ -131,14 +131,9 @@ const Page = () => {
{separate_by === 'item' && items.map((item) => (
<div className="order" key={item.id}>
<div className="titles">
{/* <span className="place">x {item.quantity}</span> */}
<span className="quantity">x {item.quantity}</span>
{/* <span>{moment(order.createdAt).fromNow(true)}</span> */}
</div>
<ul className="items">
{/* <li key={item.name}>
{item.name}
</li> */}
{item.name}
</ul>
</div>
Expand Down
161 changes: 161 additions & 0 deletions src/app/service/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
.preparation-mode-button {
padding: 0 10px;
width: 210px;
text-align: left;
height: 100%;
line-height: 50px;

&.downgrade {
background-color: var(--warning-dark);
}
}

#preparation {
display: flex;
height: calc(100% - 50px);
justify-content: space-between;
background-color: var(--primary);

.status.service {
margin: auto;
width: 100%;
height: calc(100% - 20px);
padding: 10px 14px 0;
overflow-x: hidden;
overflow-y: auto;
scrollbar-color: var(--primary-light) transparent;
scrollbar-width: auto;

.title {
font-size: 1.5em;
line-height: 60px;
}

// Removes the visuals clicks for pending (because you can't downgrade a pending order)
&.pending .orders .order .next.downgrade {
background-color: var(--danger-dark);
}
}

.status .orders.service {
width: calc(100% - 10px);
display: grid;
grid-template-columns: 50% 50%;
column-gap: 10px;
}

.status .orders .order {
background: var(--primary-light);
padding-left: 10px;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;

.titles {
display: flex;
flex-direction: column;
margin: 5px 0;
width: 20%;

.place,
.quantity {
font-size: 1.75em;
}

.place {
margin-bottom: 10px;
}
}

.items {
text-align: left;
margin-right: auto;

.options {
font-style: italic;
}
}

&.timewarning:before {
content: "";
position: absolute;
left: 0;
top: 0;
width: 10px;
height: 100%;
}

&.orange:before {
background-color: var(--toastify-color-warning);
}

&.red:before {
background-color: var(--toastify-color-error);
}

.next {
background-color: var(--success);
width: 20%;
font-size: 2em;
position: relative;
align-self: stretch;
display: flex;
flex-direction: column;
justify-content: center;
transition: background-color 0.5s ease-in;

.fa {
transition: transform 0.5s ease-in, opacity 0.5s ease-in;
}

&.downgrade {
background-color: var(--warning-dark);

.fa {
transform: rotateZ(180deg);
}
}

&:before {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

&:hover {
filter: brightness(0.9);
}
}
}
}

.preparation-modal {
.actions {
display: flex;
flex-flow: row nowrap;
justify-content: center;

.button {
display: inline-block;
padding: 40px 100px;
margin: 0 20px;

color: #fff;

&.cancel {
background: var(--danger);
}

&.confirm {
background: var(--success);
}

&:hover {
filter: brightness(0.9);
}
}
}
}
Loading

0 comments on commit 722eac5

Please sign in to comment.