warehouse locations
This commit is contained in:
@ -9,6 +9,7 @@ import FileUploadWithPreview from 'components/FileUploadWithPreview ';
|
||||
|
||||
import ProtectedRoute, { serverSideAuth } from "../../components/protectedRoute";
|
||||
import { UserRole } from "@prisma/client";
|
||||
import { Input } from '@mui/base';
|
||||
|
||||
const common = require('src/helpers/common');
|
||||
|
||||
@ -67,6 +68,7 @@ export default function LocationForm() {
|
||||
address: "",
|
||||
isActive: true,
|
||||
});
|
||||
const [isRawHtml, setIsRawHtml] = useState(false);
|
||||
|
||||
// const [isEdit, setIsEdit] = useState(false);
|
||||
|
||||
@ -178,6 +180,13 @@ export default function LocationForm() {
|
||||
<label className="label" htmlFor="isActive">Активна</label>
|
||||
</div>
|
||||
</div>
|
||||
{/* is on main menu */}
|
||||
<div className="mb-4">
|
||||
<div className="form-check">
|
||||
<input className="checkbox form-input" type="checkbox" id="isOnMainMenu" name="isOnMainMenu" onChange={handleChange} checked={location.isOnMainMenu} autoComplete="off" />
|
||||
<label className="label" htmlFor="isOnMainMenu">Покажи в главното меню</label>
|
||||
</div>
|
||||
</div>
|
||||
{/* backupLocation */}
|
||||
<div className="mb-4">
|
||||
<label className="label" htmlFor="backupLocation">При дъжд и лошо време</label>
|
||||
@ -238,12 +247,50 @@ export default function LocationForm() {
|
||||
|
||||
<label className="label" htmlFor="content">Content</label>
|
||||
|
||||
<TextEditor
|
||||
ref={quillRef}
|
||||
value={content}
|
||||
onChange={setContent}
|
||||
placeholder="Описание на локацията. Снимки"
|
||||
prefix={`location-${router.query.id}`} />
|
||||
|
||||
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage=" ">
|
||||
<label className="label" htmlFor="backupLocation">Admin Edit Location HTML</label>
|
||||
<div className="field mb-4">
|
||||
<label className="switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={isRawHtml}
|
||||
onChange={(e) => {
|
||||
setIsRawHtml(e.target.checked);
|
||||
}}
|
||||
/>
|
||||
<span className="slider round"></span>
|
||||
<span className="ml-2">Edit Raw HTML</span>
|
||||
|
||||
</label>
|
||||
{isRawHtml && <>
|
||||
<label className="label" htmlFor="backupLocation">Admin Edit Location HTML</label>
|
||||
<textarea
|
||||
className="w-full min-h-[200px] p-3 border rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 dark:border-gray-700 dark:text-gray-200 font-mono resize-y"
|
||||
placeholder="HTML Content"
|
||||
id="contentHTML_Raw"
|
||||
name="backupLocation"
|
||||
// onChange={handleChange}
|
||||
value={content}
|
||||
autoComplete="off"
|
||||
spellCheck="false"
|
||||
/>
|
||||
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</ProtectedRoute>
|
||||
{!isRawHtml && <>
|
||||
<TextEditor
|
||||
ref={quillRef}
|
||||
value={content}
|
||||
onChange={setContent}
|
||||
placeholder="Описание на локацията. Снимки"
|
||||
prefix={`location-${router.query.id}`} />
|
||||
|
||||
</>}
|
||||
|
||||
|
||||
</>)}
|
||||
</div>
|
||||
<div className="panel-actions pt-12">
|
||||
@ -270,3 +317,4 @@ export default function LocationForm() {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user