database for seed
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
-- Expand allowed values for user_products.custom_product_type to include seed and powder
|
||||
DO $$
|
||||
DECLARE cname text;
|
||||
BEGIN
|
||||
SELECT conname INTO cname
|
||||
FROM pg_constraint
|
||||
WHERE conrelid = 'user_products'::regclass AND contype='c' AND conname LIKE '%custom_product_type%';
|
||||
IF cname IS NOT NULL THEN
|
||||
EXECUTE format('ALTER TABLE user_products DROP CONSTRAINT %I', cname);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
ALTER TABLE user_products
|
||||
ADD CONSTRAINT user_products_custom_product_type_check CHECK (custom_product_type IN ('granular','liquid','seed','powder'));
|
||||
|
||||
@@ -543,7 +543,7 @@ const AdminProducts = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
{loading && !showCreateModal && !showEditModal && !showDetailsModal && !showDeleteModal ? (
|
||||
<div className="flex justify-center items-center h-64">
|
||||
<LoadingSpinner size="lg" />
|
||||
</div>
|
||||
@@ -596,10 +596,14 @@ const AdminProducts = () => {
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<span className={`px-2 py-1 text-xs font-medium rounded-full ${
|
||||
(product.productType || product.productType) === 'granular'
|
||||
? 'bg-blue-100 text-blue-800'
|
||||
: (product.productType || product.productType) === 'liquid'
|
||||
product.productType === 'granular'
|
||||
? 'bg-green-100 text-green-800'
|
||||
: product.productType === 'liquid'
|
||||
? 'bg-blue-100 text-blue-800'
|
||||
: product.productType === 'seed'
|
||||
? 'bg-yellow-100 text-yellow-800'
|
||||
: product.productType === 'powder'
|
||||
? 'bg-purple-100 text-purple-800'
|
||||
: 'bg-gray-100 text-gray-800'
|
||||
}`}>
|
||||
{product.productType}
|
||||
|
||||
Reference in New Issue
Block a user